11#include " esolver_ks_pw.h"
22
3- // #include "source_base/formatter.h"
43#include " source_base/global_variable.h"
54#include " source_base/kernels/math_kernel_op.h"
65#include " source_base/memory.h"
1918#include " source_pw/module_pwdft/onsite_projector.h"
2019#include " source_lcao/module_dftu/dftu.h"
2120#include " source_pw/module_pwdft/VSep_in_pw.h"
22- // #include "source_pw/module_pwdft/elecond.h"
2321#include " source_pw/module_pwdft/forces.h"
2422#include " source_pw/module_pwdft/hamilt_pw.h"
2523#include " source_pw/module_pwdft/stress_pw.h"
2624
2725#include < iostream>
2826
29- // #ifdef __MLALGO
30- // #include "source_io/write_mlkedf_descriptors.h"
31- // #endif
32-
3327#include < ATen/kernels/blas.h>
3428#include < ATen/kernels/lapack.h>
3529
@@ -55,7 +49,6 @@ ESolver_KS_PW<T, Device>::ESolver_KS_PW()
5549template <typename T, typename Device>
5650ESolver_KS_PW<T, Device>::~ESolver_KS_PW ()
5751{
58-
5952 // delete Hamilt
6053 this ->deallocate_hamilt ();
6154
@@ -495,6 +488,7 @@ void ESolver_KS_PW<T, Device>::hamilt2rho_single(UnitCell& ucell, const int iste
495488 skip_solve = true ;
496489 }
497490 }
491+
498492 if (!skip_solve)
499493 {
500494 hsolver::HSolverPW<T, Device> hsolver_pw_obj (this ->pw_wfc ,
@@ -645,8 +639,8 @@ void ESolver_KS_PW<T, Device>::iter_finish(UnitCell& ucell, const int istep, int
645639 }
646640 }
647641
648- // ModuleIO::ctrl_iter_pw(istep, iter, conv_esolver, this->psi,
649- // this->kv, this->pw_wfc, PARAM.inp);
642+ ModuleIO::ctrl_iter_pw (istep, iter, conv_esolver, this ->psi ,
643+ this ->kv , this ->pw_wfc , PARAM.inp );
650644}
651645
652646template <typename T, typename Device>
@@ -681,9 +675,9 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
681675 this ->psi [0 ].size ());
682676 }
683677
684- // ModuleIO::ctrl_scf_pw<T, Device>(istep, ucell, this->pelec, this->chr, this->kv, this->pw_wfc,
685- // this->pw_rho, this->pw_rhod, this->pw_big, this->psi, this->kspw_psi,
686- // this->__kspw_psi, /* this->ctx,*/ this->Pgrid, PARAM.inp);
678+ ModuleIO::ctrl_scf_pw<T, Device>(istep, ucell, this ->pelec , this ->chr , this ->kv , this ->pw_wfc ,
679+ this ->pw_rho , this ->pw_rhod , this ->pw_big , this ->psi , this ->kspw_psi ,
680+ this ->__kspw_psi , this ->ctx , this ->Pgrid , PARAM.inp );
687681
688682 ModuleBase::timer::tick (" ESolver_KS_PW" , " after_scf" );
689683}
@@ -710,18 +704,9 @@ void ESolver_KS_PW<T, Device>::cal_force(UnitCell& ucell, ModuleBase::matrix& fo
710704 : reinterpret_cast <psi::Psi<std::complex <double >, Device>*>(this ->kspw_psi );
711705
712706 // Calculate forces
713- ff.cal_force (ucell,
714- force,
715- *this ->pelec ,
716- this ->pw_rhod ,
717- &ucell.symm ,
718- &this ->sf ,
719- this ->solvent ,
720- &this ->locpp ,
721- &this ->ppcell ,
722- &this ->kv ,
723- this ->pw_wfc ,
724- this ->__kspw_psi );
707+ ff.cal_force (ucell, force, *this ->pelec , this ->pw_rhod , &ucell.symm ,
708+ &this ->sf , this ->solvent , &this ->locpp , &this ->ppcell ,
709+ &this ->kv , this ->pw_wfc , this ->__kspw_psi );
725710}
726711
727712template <typename T, typename Device>
@@ -738,16 +723,9 @@ void ESolver_KS_PW<T, Device>::cal_stress(UnitCell& ucell, ModuleBase::matrix& s
738723 this ->__kspw_psi = PARAM.inp .precision == " single"
739724 ? new psi::Psi<std::complex <double >, Device>(this ->kspw_psi [0 ])
740725 : reinterpret_cast <psi::Psi<std::complex <double >, Device>*>(this ->kspw_psi );
741- ss.cal_stress (stress,
742- ucell,
743- this ->locpp ,
744- this ->ppcell ,
745- this ->pw_rhod ,
746- &ucell.symm ,
747- &this ->sf ,
748- &this ->kv ,
749- this ->pw_wfc ,
750- this ->__kspw_psi );
726+
727+ ss.cal_stress (stress, ucell, this ->locpp , this ->ppcell , this ->pw_rhod ,
728+ &ucell.symm , &this ->sf , &this ->kv , this ->pw_wfc , this ->__kspw_psi );
751729
752730 // external stress
753731 double unit_transform = 0.0 ;
@@ -767,10 +745,10 @@ void ESolver_KS_PW<T, Device>::after_all_runners(UnitCell& ucell)
767745 // ----------------------------------------------------------
768746 ESolver_KS<T, Device>::after_all_runners (ucell);
769747
770- // ModuleIO::ctrl_runner_pw<T, Device>(ucell, this->pelec, this->pw_wfc,
771- // this->pw_rho, this->pw_rhod, this->chr, this->psi,
772- // this->kspw_psi, this->__kspw_psi, this->sf,
773- // this->ppcell, this->solvent, /* this->ctx,*/ this->Pgrid, PARAM.inp);
748+ ModuleIO::ctrl_runner_pw<T, Device>(ucell, this ->pelec , this ->pw_wfc ,
749+ this ->pw_rho , this ->pw_rhod , this ->chr , this -> kv , this ->psi ,
750+ this ->kspw_psi , this ->__kspw_psi , this ->sf ,
751+ this ->ppcell , this ->solvent , this ->ctx , this ->Pgrid , PARAM.inp );
774752
775753}
776754
0 commit comments