Skip to content

Commit 0e70265

Browse files
committed
update format of esolver_ks_pw.cpp
1 parent 632b1c6 commit 0e70265

File tree

1 file changed

+11
-38
lines changed

1 file changed

+11
-38
lines changed

source/source_esolver/esolver_ks_pw.cpp

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include "source_estate/elecstate_pw_sdft.h"
99
#include "source_estate/elecstate_tools.h"
1010
#include "source_estate/module_charge/symmetry_rho.h"
11-
#include "source_hamilt/module_ewald/H_Ewald_pw.h"
12-
#include "source_hamilt/module_vdw/vdw.h"
11+
//#include "source_hamilt/module_ewald/H_Ewald_pw.h"
12+
//#include "source_hamilt/module_vdw/vdw.h"
1313
#include "source_hsolver/diago_iter_assist.h"
1414
#include "source_hsolver/hsolver_pw.h"
1515
#include "source_hsolver/kernels/dngvd_op.h"
@@ -23,7 +23,7 @@
2323
#include "source_pw/module_pwdft/forces.h"
2424
#include "source_pw/module_pwdft/stress_pw.h"
2525

26-
#include <iostream>
26+
//#include <iostream>
2727

2828
#include <ATen/kernels/blas.h>
2929
#include <ATen/kernels/lapack.h>
@@ -107,24 +107,14 @@ void ESolver_KS_PW<T, Device>::before_all_runners(UnitCell& ucell, const Input_p
107107
{
108108
//! SDFT only supports double precision currently
109109
this->pelec = new elecstate::ElecStatePW_SDFT<std::complex<double>, Device>(this->pw_wfc,
110-
&(this->chr),
111-
&(this->kv),
112-
&ucell,
113-
&(this->ppcell),
114-
this->pw_rhod,
115-
this->pw_rho,
116-
this->pw_big);
110+
&(this->chr), &(this->kv), &ucell, &(this->ppcell),
111+
this->pw_rhod, this->pw_rho, this->pw_big);
117112
}
118113
else
119114
{
120115
this->pelec = new elecstate::ElecStatePW<T, Device>(this->pw_wfc,
121-
&(this->chr),
122-
&(this->kv),
123-
&ucell,
124-
&this->ppcell,
125-
this->pw_rhod,
126-
this->pw_rho,
127-
this->pw_big);
116+
&(this->chr), &(this->kv), &ucell, &this->ppcell,
117+
this->pw_rhod, this->pw_rho, this->pw_big);
128118
}
129119
}
130120

@@ -141,19 +131,12 @@ void ESolver_KS_PW<T, Device>::before_all_runners(UnitCell& ucell, const Input_p
141131
this->vsep_cell->init_vsep(*this->pw_rhod, ucell.sep_cell);
142132
}
143133

144-
145134
//! 4) initialize the potential.
146135
if (this->pelec->pot == nullptr)
147136
{
148137
this->pelec->pot = new elecstate::Potential(this->pw_rhod,
149-
this->pw_rho,
150-
&ucell,
151-
&this->locpp.vloc,
152-
&(this->sf),
153-
&(this->solvent),
154-
&(this->pelec->f_en.etxc),
155-
&(this->pelec->f_en.vtxc),
156-
this->vsep_cell);
138+
this->pw_rho, &ucell, &this->locpp.vloc, &(this->sf),
139+
&(this->solvent), &(this->pelec->f_en.etxc), &(this->pelec->f_en.vtxc), this->vsep_cell);
157140
}
158141

159142
//! 5) Initalize local pseudopotential
@@ -569,25 +552,18 @@ void ESolver_KS_PW<T, Device>::after_scf(UnitCell& ucell, const int istep, const
569552
ModuleBase::TITLE("ESolver_KS_PW", "after_scf");
570553
ModuleBase::timer::tick("ESolver_KS_PW", "after_scf");
571554

572-
//------------------------------------------------------------------
573-
// 1) since ESolver_KS::psi is hidden by ESolver_KS_PW::psi,
555+
// since ESolver_KS::psi is hidden by ESolver_KS_PW::psi,
574556
// we need to copy the data from ESolver_KS::psi to ESolver_KS_PW::psi.
575557
// This part needs to be removed when we have a better design.
576558
// sunliang 2025-04-10
577-
//------------------------------------------------------------------
578559
if (PARAM.inp.out_elf[0] > 0)
579560
{
580561
this->ESolver_KS<T, Device>::psi = new psi::Psi<T>(this->psi[0]);
581562
}
582563

583-
//------------------------------------------------------------------
584-
// 2) call after_scf() of ESolver_KS
585-
//------------------------------------------------------------------
586564
ESolver_KS<T, Device>::after_scf(ucell, istep, conv_esolver);
587565

588-
//------------------------------------------------------------------
589-
// 3) transfer data from GPU to CPU in pw basis
590-
//------------------------------------------------------------------
566+
// transfer data from GPU to CPU in pw basis
591567
if (this->device == base_device::GpuDevice)
592568
{
593569
castmem_2d_d2h_op()(this->psi[0].get_pointer() - this->psi[0].get_psi_bias(),
@@ -660,9 +636,6 @@ void ESolver_KS_PW<T, Device>::cal_stress(UnitCell& ucell, ModuleBase::matrix& s
660636
template <typename T, typename Device>
661637
void ESolver_KS_PW<T, Device>::after_all_runners(UnitCell& ucell)
662638
{
663-
//----------------------------------------------------------
664-
//! 1) after_all_runners in ESolver_KS
665-
//----------------------------------------------------------
666639
ESolver_KS<T, Device>::after_all_runners(ucell);
667640

668641
ModuleIO::ctrl_runner_pw<T, Device>(ucell, this->pelec, this->pw_wfc,

0 commit comments

Comments
 (0)