@@ -45,7 +45,7 @@ class DFTU
4545 );
4646
4747 // calculate the energy correction
48- void cal_energy_correction (const int istep);
48+ void cal_energy_correction (const UnitCell& ucell, const int istep);
4949 double get_energy (){return EU;}
5050 void uramping_update (); // update U by uramping
5151 bool u_converged (); // check if U is converged
@@ -89,16 +89,25 @@ class DFTU
8989 // =============================================================
9090 public:
9191 // calculate the local occupation number matrix
92- void cal_occup_m_k (const int iter, const std::vector<std::vector<std::complex <double >>>& dm_k, const K_Vectors& kv, const double & mixing_beta, hamilt::Hamilt<std::complex <double >>* p_ham);
93- void cal_occup_m_gamma (const int iter, const std::vector<std::vector<double >>& dm_gamma, const double & mixing_beta, hamilt::Hamilt<double >* p_ham);
92+ void cal_occup_m_k (const int iter,
93+ const UnitCell& ucell,
94+ const std::vector<std::vector<std::complex <double >>>& dm_k,
95+ const K_Vectors& kv,
96+ const double & mixing_beta,
97+ hamilt::Hamilt<std::complex <double >>* p_ham);
98+ void cal_occup_m_gamma (const int iter,
99+ const UnitCell& ucell,
100+ const std::vector<std::vector<double >>& dm_gamma,
101+ const double & mixing_beta,
102+ hamilt::Hamilt<double >* p_ham);
94103
95104 // dftu can be calculated only after locale has been initialed
96105 bool initialed_locale = false ;
97106
98107 private:
99- void copy_locale ();
100- void zero_locale ();
101- void mix_locale (const double & mixing_beta);
108+ void copy_locale (const UnitCell& ucell );
109+ void zero_locale (const UnitCell& ucell );
110+ void mix_locale (const UnitCell& ucell, const double & mixing_beta);
102111
103112public:
104113 // local occupancy matrix of the correlated subspace
@@ -147,13 +156,14 @@ class DFTU
147156 // dim = 4-6 : dS * dR, for stress
148157
149158 void folding_matrix_k (
159+ const UnitCell &ucell,
150160 ForceStressArrays &fsr,
151161 const Parallel_Orbitals &pv,
152- const int ik,
153- const int dim1,
154- const int dim2,
155- std::complex <double >* mat_k,
156- const std::vector<ModuleBase::Vector3<double >> &kvec_d);
162+ const int ik,
163+ const int dim1,
164+ const int dim2,
165+ std::complex <double >* mat_k,
166+ const std::vector<ModuleBase::Vector3<double >> &kvec_d);
157167
158168
159169 /* *
@@ -169,38 +179,40 @@ class DFTU
169179 // =============================================================
170180 public:
171181
172- void force_stress (const elecstate::ElecState* pelec,
173- const Parallel_Orbitals& pv,
174- ForceStressArrays& fsr,
175- ModuleBase::matrix& force_dftu,
176- ModuleBase::matrix& stress_dftu,
177- const K_Vectors& kv);
182+ void force_stress (const UnitCell& ucell,
183+ const elecstate::ElecState* pelec,
184+ const Parallel_Orbitals& pv,
185+ ForceStressArrays& fsr,
186+ ModuleBase::matrix& force_dftu,
187+ ModuleBase::matrix& stress_dftu,
188+ const K_Vectors& kv);
178189
179190 private:
180191
181- void cal_force_k (
182- ForceStressArrays &fsr,
183- const Parallel_Orbitals &pv,
184- const int ik,
185- const std::complex <double >* rho_VU,
186- ModuleBase::matrix& force_dftu,
187- const std::vector<ModuleBase::Vector3<double >>& kvec_d);
192+ void cal_force_k (const UnitCell &ucell,
193+ ForceStressArrays &fsr,
194+ const Parallel_Orbitals &pv,
195+ const int ik,
196+ const std::complex <double >* rho_VU,
197+ ModuleBase::matrix& force_dftu,
198+ const std::vector<ModuleBase::Vector3<double >>& kvec_d);
188199
189200 void cal_stress_k (
201+ const UnitCell &ucell,
190202 ForceStressArrays &fsr,
191203 const Parallel_Orbitals &pv,
192204 const int ik,
193205 const std::complex <double >* rho_VU,
194206 ModuleBase::matrix& stress_dftu,
195207 const std::vector<ModuleBase::Vector3<double >>& kvec_d);
196208
197- void cal_force_gamma (
198- const double * rho_VU,
199- const Parallel_Orbitals &pv,
200- double * dsloc_x,
201- double * dsloc_y,
202- double * dsloc_z,
203- ModuleBase::matrix& force_dftu);
209+ void cal_force_gamma (const UnitCell &ucell,
210+ const double * rho_VU,
211+ const Parallel_Orbitals &pv,
212+ double * dsloc_x,
213+ double * dsloc_y,
214+ double * dsloc_z,
215+ ModuleBase::matrix& force_dftu);
204216
205217 void cal_stress_gamma (
206218 const UnitCell &ucell,
@@ -218,12 +230,15 @@ class DFTU
218230 // For reading/writing/broadcasting/copying relevant data structures
219231 // =============================================================
220232 public:
221- void output ();
233+ void output (const UnitCell& ucell );
222234
223235 private:
224- void write_occup_m (std::ofstream& ofs, bool diag=false );
225- void read_occup_m (const std::string& fn);
226- void local_occup_bcast ();
236+ void write_occup_m (const UnitCell& ucell,
237+ std::ofstream& ofs,
238+ bool diag=false );
239+ void read_occup_m (const UnitCell& ucell,
240+ const std::string& fn);
241+ void local_occup_bcast (const UnitCell& ucell);
227242
228243 // =============================================================
229244 // In dftu_yukawa.cpp
@@ -232,15 +247,15 @@ class DFTU
232247
233248 public:
234249 bool Yukawa; // 1:use Yukawa potential; 0: do not use Yukawa potential
235- void cal_slater_UJ (double ** rho, const int & nrxx);
250+ void cal_slater_UJ (const UnitCell& ucell, double ** rho, const int & nrxx);
236251
237252 private:
238253 double lambda; // the parameter in Yukawa potential
239254 std::vector<std::vector<std::vector<std::vector<double >>>> Fk; // slater integral:Fk[T][L][N][k]
240255 std::vector<std::vector<std::vector<double >>> U_Yukawa; // U_Yukawa[T][L][N]
241256 std::vector<std::vector<std::vector<double >>> J_Yukawa; // J_Yukawa[T][L][N]
242257
243- void cal_slater_Fk (const int L, const int T); // L:angular momnet, T:atom type
258+ void cal_slater_Fk (const UnitCell& ucell, const int L, const int T); // L:angular momnet, T:atom type
244259 void cal_yukawa_lambda (double ** rho, const int & nrxx);
245260
246261 double spherical_Bessel (const int k, const double r, const double lambda);
@@ -267,6 +282,7 @@ class DFTU
267282
268283template <typename T>
269284void dftu_cal_occup_m (const int iter,
285+ const UnitCell& ucell,
270286 const std::vector<std::vector<T>>& dm,
271287 const K_Vectors& kv,
272288 const double & mixing_beta,
0 commit comments