@@ -90,16 +90,19 @@ void populate_atom_pairs(hamilt::HContainer<TR>* container,
9090
9191} // anonymous namespace
9292
93+ namespace hamilt
94+ {
95+
9396template <typename TK , typename TR >
94- hamilt:: Overlap<hamilt:: OperatorLCAO<TK , TR >>::Overlap(HS_Matrix_K<TK >* hsk_in,
97+ Overlap<OperatorLCAO<TK , TR >>::Overlap(HS_Matrix_K<TK >* hsk_in,
9598 const std::vector<ModuleBase::Vector3<double >>& kvec_d_in,
96- hamilt:: HContainer<TR >* hR_in,
97- hamilt:: HContainer<TR >* SR_in,
99+ HContainer<TR >* hR_in,
100+ HContainer<TR >* SR_in,
98101 const UnitCell* ucell_in,
99102 const std::vector<double >& orb_cutoff,
100103 const Grid_Driver* GridD_in,
101104 const TwoCenterIntegrator* intor)
102- : hamilt:: OperatorLCAO<TK , TR >(hsk_in, kvec_d_in, hR_in), orb_cutoff_(orb_cutoff), intor_(intor), gridD(GridD_in)
105+ : OperatorLCAO<TK , TR >(hsk_in, kvec_d_in, hR_in), orb_cutoff_(orb_cutoff), intor_(intor), gridD(GridD_in)
103106{
104107 this ->cal_type = calculation_type::lcao_overlap;
105108 this ->ucell = ucell_in;
@@ -116,12 +119,12 @@ hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::Overlap(HS_Matrix_K<TK>* hsk_in,
116119}
117120
118121template <typename TK , typename TR >
119- hamilt:: Overlap<hamilt:: OperatorLCAO<TK , TR >>::~Overlap ()
122+ Overlap<OperatorLCAO<TK , TR >>::~Overlap ()
120123{
121124}
122125
123126template <typename TK , typename TR >
124- void hamilt:: Overlap<hamilt:: OperatorLCAO<TK , TR >>::initialize_SR(const Grid_Driver* GridD)
127+ void Overlap<OperatorLCAO<TK , TR >>::initialize_SR(const Grid_Driver* GridD)
125128{
126129 ModuleBase::TITLE (" OverlapNew" , " initialize_SR" );
127130 ModuleBase::timer::start (" OverlapNew" , " initialize_SR" );
@@ -132,7 +135,7 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::initialize_SR(const Grid_Dri
132135}
133136
134137template <typename TK , typename TR >
135- void hamilt:: Overlap<hamilt:: OperatorLCAO<TK , TR >>::calculate_SR()
138+ void Overlap<OperatorLCAO<TK , TR >>::calculate_SR()
136139{
137140 ModuleBase::TITLE (" Overlap" , " calculate_SR" );
138141 ModuleBase::timer::start (" Overlap" , " calculate_SR" );
@@ -141,7 +144,7 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::calculate_SR()
141144#endif
142145 for (int iap = 0 ; iap < this ->SR ->size_atom_pairs (); ++iap)
143146 {
144- hamilt:: AtomPair<TR >& tmp = this ->SR ->get_atom_pair (iap);
147+ AtomPair<TR >& tmp = this ->SR ->get_atom_pair (iap);
145148 const int iat1 = tmp.get_atom_i ();
146149 const int iat2 = tmp.get_atom_j ();
147150 const Parallel_Orbitals* paraV = tmp.get_paraV ();
@@ -165,7 +168,7 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::calculate_SR()
165168
166169// cal_SR_IJR()
167170template <typename TK , typename TR >
168- void hamilt:: Overlap<hamilt:: OperatorLCAO<TK , TR >>::cal_SR_IJR(const int & iat1,
171+ void Overlap<OperatorLCAO<TK , TR >>::cal_SR_IJR(const int & iat1,
169172 const int & iat2,
170173 const Parallel_Orbitals* paraV,
171174 const ModuleBase::Vector3<double >& dtau,
@@ -234,7 +237,7 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::cal_SR_IJR(const int& iat1,
234237
235238// contributeHR()
236239template <typename TK , typename TR >
237- void hamilt:: Overlap<hamilt:: OperatorLCAO<TK , TR >>::contributeHR()
240+ void Overlap<OperatorLCAO<TK , TR >>::contributeHR()
238241{
239242 if (this ->SR_fixed_done )
240243 {
@@ -246,7 +249,7 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::contributeHR()
246249
247250// contributeHk()
248251template <>
249- void hamilt:: Overlap<hamilt:: OperatorLCAO<double , double >>::contributeHk(int ik)
252+ void Overlap<OperatorLCAO<double , double >>::contributeHk(int ik)
250253{
251254 // ! if k vector is not changed, then do nothing and return, only for gamma_only case
252255 if (this ->kvec_d [ik] == this ->kvec_d_old )
@@ -261,12 +264,12 @@ void hamilt::Overlap<hamilt::OperatorLCAO<double, double>>::contributeHk(int ik)
261264 if (ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER (PARAM .inp .ks_solver ))
262265 {
263266 const int nrow = this ->SR ->get_atom_pair (0 ).get_paraV ()->get_row_size ();
264- hamilt:: folding_HR (*this ->SR , this ->hsk ->get_sk (), this ->kvec_d [ik], nrow, 1 );
267+ folding_HR (*this ->SR , this ->hsk ->get_sk (), this ->kvec_d [ik], nrow, 1 );
265268 }
266269 else
267270 {
268271 const int ncol = this ->SR ->get_atom_pair (0 ).get_paraV ()->get_col_size ();
269- hamilt:: folding_HR (*this ->SR , this ->hsk ->get_sk (), this ->kvec_d [ik], ncol, 0 );
272+ folding_HR (*this ->SR , this ->hsk ->get_sk (), this ->kvec_d [ik], ncol, 0 );
270273 }
271274
272275 // update kvec_d_old
@@ -275,7 +278,7 @@ void hamilt::Overlap<hamilt::OperatorLCAO<double, double>>::contributeHk(int ik)
275278 ModuleBase::timer::end (" Overlap" , " contributeHk" );
276279}
277280template <typename TK , typename TR >
278- void hamilt:: Overlap<hamilt:: OperatorLCAO<TK , TR >>::contributeHk(int ik)
281+ void Overlap<OperatorLCAO<TK , TR >>::contributeHk(int ik)
279282{
280283 ModuleBase::TITLE (" Overlap" , " contributeHk" );
281284 ModuleBase::timer::start (" Overlap" , " contributeHk" );
@@ -291,7 +294,7 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::contributeHk(int ik)
291294 }
292295 else
293296 {
294- hamilt:: folding_HR (*this ->SR , this ->hsk ->get_sk (), this ->kvec_d [ik], nrow, 1 );
297+ folding_HR (*this ->SR , this ->hsk ->get_sk (), this ->kvec_d [ik], nrow, 1 );
295298 }
296299 }
297300 else
@@ -303,7 +306,7 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::contributeHk(int ik)
303306 }
304307 else
305308 {
306- hamilt:: folding_HR (*this ->SR , this ->hsk ->get_sk (), this ->kvec_d [ik], ncol, 0 );
309+ folding_HR (*this ->SR , this ->hsk ->get_sk (), this ->kvec_d [ik], ncol, 0 );
307310 }
308311 }
309312
@@ -313,7 +316,7 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::contributeHk(int ik)
313316 ModuleBase::timer::end (" Overlap" , " contributeHk" );
314317}
315318template <typename TK , typename TR >
316- TK * hamilt:: Overlap<hamilt:: OperatorLCAO<TK , TR >>::getSk()
319+ TK * Overlap<OperatorLCAO<TK , TR >>::getSk()
317320{
318321 if (this ->hsk != nullptr )
319322 {
@@ -329,7 +332,7 @@ TK* hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::getSk()
329332// ==============================================================================
330333
331334template <typename TK , typename TR >
332- hamilt:: HContainer<TR >* hamilt:: Overlap<hamilt:: OperatorLCAO<TK , TR >>::calculate_SR_async(const UnitCell& ucell_in,
335+ HContainer<TR >* Overlap<OperatorLCAO<TK , TR >>::calculate_SR_async(const UnitCell& ucell_in,
333336 const double md_dt,
334337 const Parallel_Orbitals* paraV)
335338{
@@ -338,7 +341,7 @@ hamilt::HContainer<TR>* hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::calculate
338341
339342 // Initialize SR_async for Hefei-NAMD asynchronous overlap calculation
340343 // This is done here to use the exact dtau with velocity shifts
341- hamilt:: HContainer<TR >* SR_async = new hamilt:: HContainer<TR >(paraV);
344+ HContainer<TR >* SR_async = new HContainer<TR >(paraV);
342345
343346 // Define velocity shift modifier for dtau
344347 // This shifts atom1 backward to its position at (t - dt),
@@ -361,7 +364,7 @@ hamilt::HContainer<TR>* hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::calculate
361364#endif
362365 for (int iap = 0 ; iap < SR_async->size_atom_pairs (); ++iap)
363366 {
364- hamilt:: AtomPair<TR >& atom_pair = SR_async->get_atom_pair (iap);
367+ AtomPair<TR >& atom_pair = SR_async->get_atom_pair (iap);
365368 const int iat1 = atom_pair.get_atom_i ();
366369 const int iat2 = atom_pair.get_atom_j ();
367370 const Parallel_Orbitals* paraV_local = atom_pair.get_paraV ();
@@ -399,8 +402,8 @@ hamilt::HContainer<TR>* hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::calculate
399402}
400403
401404template <typename TK , typename TR >
402- void hamilt:: Overlap<hamilt:: OperatorLCAO<TK , TR >>::output_SR_async_csr(const int istep,
403- hamilt:: HContainer<TR >* SR_async,
405+ void Overlap<OperatorLCAO<TK , TR >>::output_SR_async_csr(const int istep,
406+ HContainer<TR >* SR_async,
404407 const int precision)
405408{
406409 if (SR_async == nullptr )
@@ -419,10 +422,10 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::output_SR_async_csr(const in
419422 serial_paraV.set_serial (nbasis, nbasis);
420423 serial_paraV.set_atomic_trace (this ->ucell ->get_iat2iwt (), this ->ucell ->nat , nbasis);
421424
422- hamilt:: HContainer<TR > SR_async_serial (&serial_paraV);
423- hamilt:: gatherParallels (*SR_async, &SR_async_serial, 0 );
425+ HContainer<TR > SR_async_serial (&serial_paraV);
426+ gatherParallels (*SR_async, &SR_async_serial, 0 );
424427#else
425- hamilt:: HContainer<TR >& SR_async_serial = *SR_async;
428+ HContainer<TR >& SR_async_serial = *SR_async;
426429#endif
427430
428431 // Only rank 0 writes the output file
@@ -448,7 +451,7 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::output_SR_async_csr(const in
448451
449452 // Write matrix data in CSR format
450453 const double sparse_threshold = 1e-10 ;
451- hamilt:: Output_HContainer<TR > output_handler (&SR_async_serial, ofs, sparse_threshold, precision);
454+ Output_HContainer<TR > output_handler (&SR_async_serial, ofs, sparse_threshold, precision);
452455 output_handler.write ();
453456
454457 ofs.close ();
@@ -457,6 +460,8 @@ void hamilt::Overlap<hamilt::OperatorLCAO<TK, TR>>::output_SR_async_csr(const in
457460 ModuleBase::timer::end (" OverlapNew" , " output_SR_async_csr" );
458461}
459462
460- template class hamilt ::Overlap<hamilt::OperatorLCAO<double , double >>;
461- template class hamilt ::Overlap<hamilt::OperatorLCAO<std::complex <double >, double >>;
462- template class hamilt ::Overlap<hamilt::OperatorLCAO<std::complex <double >, std::complex <double >>>;
463+ template class Overlap <OperatorLCAO<double , double >>;
464+ template class Overlap <OperatorLCAO<std::complex <double >, double >>;
465+ template class Overlap <OperatorLCAO<std::complex <double >, std::complex <double >>>;
466+
467+ } // namespace hamilt
0 commit comments