@@ -67,9 +67,10 @@ void Gint::cal_gint(Gint_inout* inout)
67
67
ModuleBase::TITLE (" Gint_interface" ," cal_gint_force_meta" );
68
68
ModuleBase::timer::tick (" Gint_interface" ," cal_gint_force_meta" );
69
69
}
70
-
70
+ const UnitCell& ucell = *this ->ucell ;
71
+ const LCAO_Orbitals& orb = *this ->orb ;
71
72
const int max_size = this ->gridt ->max_atom ;
72
- const int LD_pool = max_size * GlobalC:: ucell.nwmax ;
73
+ const int LD_pool = max_size * ucell.nwmax ;
73
74
const int lgd = this ->gridt ->lgd ;
74
75
const int nnrg = this ->gridt ->nnrg ;
75
76
@@ -86,21 +87,21 @@ void Gint::cal_gint(Gint_inout* inout)
86
87
ylmcoef[i] = ModuleBase::Ylm::ylmcoef[i];
87
88
}
88
89
89
- const int ntype = GlobalC::ORB .get_ntype ();
90
+ const int ntype = orb .get_ntype ();
90
91
double * rcut = new double [ntype];
91
92
for (int it = 0 ; it < ntype; it++)
92
93
{
93
- rcut[it] = GlobalC::ORB .Phi [it].getRcut ();
94
+ rcut[it] = orb .Phi [it].getRcut ();
94
95
}
95
96
96
- const double dr = GlobalC::ORB .dr_uniform ;
97
+ const double dr = orb .dr_uniform ;
97
98
98
99
if (inout->job == Gint_Tools::job_type::vlocal)
99
100
{
100
101
GintKernel::gint_gamma_vl_gpu (this ->hRGint ,
101
102
lgd,
102
103
max_size,
103
- GlobalC:: ucell.omega
104
+ ucell.omega
104
105
/ this ->ncxyz ,
105
106
inout->vl ,
106
107
ylmcoef,
@@ -109,7 +110,7 @@ void Gint::cal_gint(Gint_inout* inout)
109
110
dr,
110
111
rcut,
111
112
*this ->gridt ,
112
- GlobalC:: ucell);
113
+ ucell);
113
114
}
114
115
else if (inout->job == Gint_Tools::job_type::rho)
115
116
{
@@ -123,17 +124,17 @@ void Gint::cal_gint(Gint_inout* inout)
123
124
dr,
124
125
rcut,
125
126
*this ->gridt ,
126
- GlobalC:: ucell,
127
+ ucell,
127
128
inout->rho [is]);
128
129
}
129
130
}
130
131
else if (inout->job == Gint_Tools::job_type::force)
131
132
{
132
133
const int ncyz = this ->ny * this ->nplane ;
133
- int nat = GlobalC:: ucell.nat ;
134
+ int nat = ucell.nat ;
134
135
// for (int is = 0; is < GlobalV::NSPIN; ++is)
135
136
// {
136
- double *force = new double [GlobalC:: ucell.nat * 3 ];
137
+ double *force = new double [ucell.nat * 3 ];
137
138
for (int i = 0 ; i < nat * 3 ; i++)
138
139
{
139
140
force[i] = 0.0 ;
@@ -144,7 +145,7 @@ void Gint::cal_gint(Gint_inout* inout)
144
145
stress[i] = 0.0 ;
145
146
}
146
147
GintKernel::gint_gamma_force_gpu (this ->DMRGint [inout->ispin ],
147
- GlobalC:: ucell.omega
148
+ ucell.omega
148
149
/ this ->ncxyz ,
149
150
inout->vl ,
150
151
force,
@@ -153,7 +154,7 @@ void Gint::cal_gint(Gint_inout* inout)
153
154
dr,
154
155
rcut,
155
156
*this ->gridt ,
156
- GlobalC:: ucell);
157
+ ucell);
157
158
for (int iat = 0 ; iat < nat; iat++)
158
159
{
159
160
inout->fvl_dphi [0 ](iat, 0 ) += force[iat * 3 ];
@@ -187,11 +188,11 @@ void Gint::cal_gint(Gint_inout* inout)
187
188
// prepare some constants
188
189
const int ncyz
189
190
= this ->ny * this ->nplane ; // mohan add 2012-03-25
190
- const double dv = GlobalC:: ucell.omega / this ->ncxyz ;
191
+ const double dv = ucell.omega / this ->ncxyz ;
191
192
192
193
// it's a uniform grid to save orbital values, so the delta_r is
193
194
// a constant.
194
- const double delta_r = GlobalC::ORB .dr_uniform ;
195
+ const double delta_r = orb .dr_uniform ;
195
196
196
197
if ((inout->job ==Gint_Tools::job_type::vlocal
197
198
|| inout->job ==Gint_Tools::job_type::vlocal_meta)
@@ -293,14 +294,14 @@ void Gint::cal_gint(Gint_inout* inout)
293
294
// int* vindex = Gint_Tools::get_vindex(ncyz, ibx, jby, kbz);
294
295
int * vindex = Gint_Tools::get_vindex (this ->bxyz , this ->bx , this ->by , this ->bz ,
295
296
this ->nplane , this ->gridt ->start_ind [grid_index], ncyz);
296
- this ->gint_kernel_rho (na_grid, grid_index, delta_r, vindex, LD_pool, inout);
297
+ this ->gint_kernel_rho (na_grid, grid_index, delta_r, vindex, LD_pool, ucell, inout);
297
298
delete[] vindex;
298
299
}
299
300
else if (inout->job == Gint_Tools::job_type::tau)
300
301
{
301
302
int * vindex = Gint_Tools::get_vindex (this ->bxyz , this ->bx , this ->by , this ->bz ,
302
303
this ->nplane , this ->gridt ->start_ind [grid_index], ncyz);
303
- this ->gint_kernel_tau (na_grid, grid_index, delta_r, vindex, LD_pool, inout);
304
+ this ->gint_kernel_tau (na_grid, grid_index, delta_r, vindex, LD_pool, inout,ucell );
304
305
delete[] vindex;
305
306
}
306
307
else if (inout->job == Gint_Tools::job_type::force)
@@ -322,11 +323,11 @@ void Gint::cal_gint(Gint_inout* inout)
322
323
#ifdef _OPENMP
323
324
this ->gint_kernel_force (na_grid, grid_index, delta_r, vldr3, LD_pool,
324
325
DM_in, inout->ispin , inout->isforce , inout->isstress ,
325
- &fvl_dphi_thread, &svl_dphi_thread);
326
+ &fvl_dphi_thread, &svl_dphi_thread,ucell );
326
327
#else
327
328
this ->gint_kernel_force (na_grid, grid_index, delta_r, vldr3, LD_pool,
328
329
DM_in, inout->ispin , inout->isforce , inout->isstress ,
329
- inout->fvl_dphi , inout->svl_dphi );
330
+ inout->fvl_dphi , inout->svl_dphi ,ucell );
330
331
#endif
331
332
delete[] vldr3;
332
333
}
@@ -338,17 +339,17 @@ void Gint::cal_gint(Gint_inout* inout)
338
339
if ((GlobalV::GAMMA_ONLY_LOCAL && lgd>0 ) || !GlobalV::GAMMA_ONLY_LOCAL)
339
340
{
340
341
this ->gint_kernel_vlocal (na_grid, grid_index, delta_r, vldr3, LD_pool,
341
- pvpR_thread, hRGint_thread);
342
+ pvpR_thread,ucell, hRGint_thread);
342
343
}
343
344
#else
344
345
if (GlobalV::GAMMA_ONLY_LOCAL && lgd>0 )
345
346
{
346
- this ->gint_kernel_vlocal (na_grid, grid_index, delta_r, vldr3, LD_pool, nullptr );
347
+ this ->gint_kernel_vlocal (na_grid, grid_index, delta_r, vldr3, LD_pool,ucell, nullptr );
347
348
}
348
349
if (!GlobalV::GAMMA_ONLY_LOCAL)
349
350
{
350
351
this ->gint_kernel_vlocal (na_grid, grid_index, delta_r, vldr3, LD_pool,
351
- this ->pvpR_reduced [inout->ispin ]);
352
+ ucell, this ->pvpR_reduced [inout->ispin ]);
352
353
}
353
354
#endif
354
355
delete[] vldr3;
@@ -359,12 +360,13 @@ void Gint::cal_gint(Gint_inout* inout)
359
360
this ->nplane , this ->gridt ->start_ind [grid_index], ncyz, dv);
360
361
#ifdef _OPENMP
361
362
this ->gint_kernel_dvlocal (na_grid, grid_index, delta_r, vldr3, LD_pool,
362
- pvdpRx_thread, pvdpRy_thread, pvdpRz_thread);
363
+ pvdpRx_thread, pvdpRy_thread, pvdpRz_thread,ucell );
363
364
#else
364
365
this ->gint_kernel_dvlocal (na_grid, grid_index, delta_r, vldr3, LD_pool,
365
366
this ->pvdpRx_reduced [inout->ispin ],
366
367
this ->pvdpRy_reduced [inout->ispin ],
367
- this ->pvdpRz_reduced [inout->ispin ]);
368
+ this ->pvdpRz_reduced [inout->ispin ],
369
+ ucell);
368
370
#endif
369
371
delete[] vldr3;
370
372
}
@@ -378,16 +380,16 @@ void Gint::cal_gint(Gint_inout* inout)
378
380
if ((GlobalV::GAMMA_ONLY_LOCAL && lgd>0 ) || !GlobalV::GAMMA_ONLY_LOCAL)
379
381
{
380
382
this ->gint_kernel_vlocal_meta (na_grid, grid_index, delta_r, vldr3, vkdr3, LD_pool,
381
- pvpR_thread, hRGint_thread);
383
+ pvpR_thread, ucell, hRGint_thread);
382
384
}
383
385
#else
384
386
if (GlobalV::GAMMA_ONLY_LOCAL && lgd>0 )
385
387
{
386
- this ->gint_kernel_vlocal_meta (na_grid, grid_index, delta_r, vldr3, vkdr3, LD_pool, nullptr );
388
+ this ->gint_kernel_vlocal_meta (na_grid, grid_index, delta_r, vldr3, vkdr3, LD_pool, ucell, nullptr );
387
389
}
388
390
if (!GlobalV::GAMMA_ONLY_LOCAL)
389
391
{
390
- this ->gint_kernel_vlocal_meta (na_grid, grid_index, delta_r, vldr3, vkdr3, LD_pool,
392
+ this ->gint_kernel_vlocal_meta (na_grid, grid_index, delta_r, vldr3, vkdr3, LD_pool,ucell,
391
393
this ->pvpR_reduced [inout->ispin ]);
392
394
}
393
395
#endif
@@ -415,11 +417,11 @@ void Gint::cal_gint(Gint_inout* inout)
415
417
#ifdef _OPENMP
416
418
this ->gint_kernel_force_meta (na_grid, grid_index, delta_r, vldr3, vkdr3, LD_pool,
417
419
DM_in, inout->ispin , inout->isforce , inout->isstress ,
418
- &fvl_dphi_thread, &svl_dphi_thread);
420
+ &fvl_dphi_thread, &svl_dphi_thread,ucell );
419
421
#else
420
422
this ->gint_kernel_force_meta (na_grid, grid_index, delta_r, vldr3, vkdr3, LD_pool,
421
423
DM_in, inout->ispin , inout->isforce , inout->isstress ,
422
- inout->fvl_dphi , inout->svl_dphi );
424
+ inout->fvl_dphi , inout->svl_dphi ,ucell );
423
425
#endif
424
426
delete[] vldr3;
425
427
delete[] vkdr3;
@@ -504,7 +506,9 @@ void Gint::prep_grid(const Grid_Technique& gt,
504
506
const int & nbxx_in,
505
507
const int & ny_in,
506
508
const int & nplane_in,
507
- const int & startz_current_in)
509
+ const int & startz_current_in,
510
+ const UnitCell* ucell_in,
511
+ const LCAO_Orbitals* orb_in)
508
512
{
509
513
ModuleBase::TITLE (GlobalV::ofs_running, " Gint_k" , " prep_grid" );
510
514
@@ -522,6 +526,9 @@ void Gint::prep_grid(const Grid_Technique& gt,
522
526
this ->ny = ny_in;
523
527
this ->nplane = nplane_in;
524
528
this ->startz_current = startz_current_in;
529
+ this ->ucell = ucell_in;
530
+ this ->orb = orb_in;
531
+
525
532
assert (nbx > 0 );
526
533
assert (nby > 0 );
527
534
assert (nbz >= 0 );
@@ -534,8 +541,7 @@ void Gint::prep_grid(const Grid_Technique& gt,
534
541
assert (ny > 0 );
535
542
assert (nplane >= 0 );
536
543
assert (startz_current >= 0 );
537
-
538
- assert (GlobalC::ucell.omega > 0.0 );
544
+ assert (this ->ucell ->omega > 0.0 );
539
545
540
546
return ;
541
547
}
@@ -640,15 +646,15 @@ void Gint::initialize_pvpR(const UnitCell& ucell_in, Grid_Driver* gd)
640
646
{
641
647
ModuleBase::Vector3<double > dtau = gd->getAdjacentTau (ad) - tau1;
642
648
double distance = dtau.norm () * ucell_in.lat0 ;
643
- double rcut = GlobalC::ORB. Phi [T1].getRcut () + GlobalC::ORB. Phi [T2].getRcut ();
649
+ double rcut = this -> orb -> Phi [T1].getRcut () + this -> orb -> Phi [T2].getRcut ();
644
650
645
651
// if(distance < rcut)
646
652
// mohan reset this 2013-07-02 in Princeton
647
- // we should make absolutely sure that the distance is smaller than GlobalC::ORB .Phi[it].getRcut
653
+ // we should make absolutely sure that the distance is smaller than orb .Phi[it].getRcut
648
654
// this should be consistant with LCAO_nnr::cal_nnrg function
649
655
// typical example : 7 Bohr cutoff Si orbital in 14 Bohr length of cell.
650
656
// distance = 7.0000000000000000
651
- // GlobalC::ORB .Phi[it].getRcut = 7.0000000000000008
657
+ // orb .Phi[it].getRcut = 7.0000000000000008
652
658
if (distance < rcut - 1.0e-15 )
653
659
{
654
660
// calculate R index
0 commit comments