77#include " source_pw/module_pwdft/VSep_in_pw.h"
88
99template <typename T, typename Device>
10- void pw::setup_pot (const int istep,
11- UnitCell& ucell, // unitcell
10+ void pw::setup_pot (const int istep,
11+ UnitCell& ucell, // unitcell
1212 const K_Vectors &kv, // kpoints
1313 Structure_Factor &sf, // structure factors
1414 elecstate::ElecState *pelec, // pointer of electrons
@@ -24,6 +24,16 @@ void pw::setup_pot(const int istep,
2424 const Input_para& inp) // input parameters
2525{
2626 ModuleBase::TITLE (" pw" , " setup_pot" );
27+
28+ // ----------------------------------------------------------
29+ // ! 0) DFT-1/2 calculations, sep potential need to generate
30+ // before effective potential calculation
31+ // ----------------------------------------------------------
32+ if (PARAM.inp .dfthalf_type > 0 )
33+ {
34+ vsep_cell->generate_vsep_r (pw_rhod[0 ], sf.strucFac , ucell.sep_cell );
35+ }
36+
2737 // ----------------------------------------------------------
2838 // ! 1) Renew local pseudopotential
2939 // ----------------------------------------------------------
@@ -110,21 +120,12 @@ void pw::setup_pot(const int istep,
110120 dftu->init (ucell, nullptr , kv.get_nks ());
111121 }
112122
113- // ----------------------------------------------------------
114- // ! 7) DFT-1/2 calculations, sep potential need to generate
115- // before effective potential calculation
116- // ----------------------------------------------------------
117- if (PARAM.inp .dfthalf_type > 0 )
118- {
119- vsep_cell->generate_vsep_r (pw_rhod[0 ], sf.strucFac , ucell.sep_cell );
120- }
121-
122123 return ;
123124}
124125
125126template void pw::setup_pot<std::complex <float >, base_device::DEVICE_CPU>(
126127 const int istep, // ionic step
127- UnitCell& ucell, // unitcell
128+ UnitCell& ucell, // unitcell
128129 const K_Vectors &kv, // kpoints
129130 Structure_Factor &sf, // structure factors
130131 elecstate::ElecState *pelec, // pointer of electrons
@@ -142,7 +143,7 @@ template void pw::setup_pot<std::complex<float>, base_device::DEVICE_CPU>(
142143
143144template void pw::setup_pot<std::complex <double >, base_device::DEVICE_CPU>(
144145 const int istep, // ionic step
145- UnitCell& ucell, // unitcell
146+ UnitCell& ucell, // unitcell
146147 const K_Vectors &kv, // kpoints
147148 Structure_Factor &sf, // structure factors
148149 elecstate::ElecState *pelec, // pointer of electrons
@@ -161,7 +162,7 @@ template void pw::setup_pot<std::complex<double>, base_device::DEVICE_CPU>(
161162
162163template void pw::setup_pot<std::complex <float >, base_device::DEVICE_GPU>(
163164 const int istep, // ionic step
164- UnitCell& ucell, // unitcell
165+ UnitCell& ucell, // unitcell
165166 const K_Vectors &kv, // kpoints
166167 Structure_Factor &sf, // structure factors
167168 elecstate::ElecState *pelec, // pointer of electrons
@@ -178,7 +179,7 @@ template void pw::setup_pot<std::complex<float>, base_device::DEVICE_GPU>(
178179
179180template void pw::setup_pot<std::complex <double >, base_device::DEVICE_GPU>(
180181 const int istep, // ionic step
181- UnitCell& ucell, // unitcell
182+ UnitCell& ucell, // unitcell
182183 const K_Vectors &kv, // kpoints
183184 Structure_Factor &sf, // structure factors
184185 elecstate::ElecState *pelec, // pointer of electrons
0 commit comments