Skip to content
51 changes: 33 additions & 18 deletions source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "module_hamilt_lcao/hamilt_lcaodft/operator_lcao/nonlocal_new.h"

template <typename T>
Force_Stress_LCAO<T>::Force_Stress_LCAO(Record_adj& ra, const int nat_in) : RA(&ra), f_pw(nat_in), nat(nat_in)
Force_Stress_LCAO<T>::Force_Stress_LCAO(Record_adj& ra, const int nat_in) : RA(&ra), nat(nat_in)
{
}
template <typename T>
Expand Down Expand Up @@ -861,24 +861,39 @@ void Force_Stress_LCAO<T>::calForcePwPart(UnitCell& ucell,
const Structure_Factor& sf)
{
ModuleBase::TITLE("Force_Stress_LCAO", "calForcePwPart");
//--------------------------------------------------------
// local pseudopotential force:
// use charge density; plane wave; local pseudopotential;
//--------------------------------------------------------
f_pw.cal_force_loc(ucell, fvl_dvl, rhopw, locpp.vloc, chr);
//--------------------------------------------------------
// ewald force: use plane wave only.
//--------------------------------------------------------
f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf); // remain problem
#ifdef __CUDA
if(PARAM.inp.device == "gpu")
{
Forces<double, base_device::DEVICE_GPU> f_pw(nat);

//--------------------------------------------------------
// local pseudopotential force:
// use charge density; plane wave; local pseudopotential;
//--------------------------------------------------------
f_pw.cal_force_loc(ucell, fvl_dvl, rhopw, locpp.vloc, chr);
//--------------------------------------------------------
// ewald force: use plane wave only.
//--------------------------------------------------------
f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf); // remain problem

//--------------------------------------------------------
// force due to core correlation.
//--------------------------------------------------------
f_pw.cal_force_cc(fcc, rhopw, chr, locpp.numeric, ucell);
//--------------------------------------------------------
// force due to self-consistent charge.
//--------------------------------------------------------
f_pw.cal_force_scc(fscc, rhopw, vnew, vnew_exist, locpp.numeric, ucell);
} else
#endif
{
Forces<double, base_device::DEVICE_CPU> f_pw(nat);
f_pw.cal_force_loc(ucell, fvl_dvl, rhopw, locpp.vloc, chr);
f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf); // remain problem
f_pw.cal_force_cc(fcc, rhopw, chr, locpp.numeric, ucell);
f_pw.cal_force_scc(fscc, rhopw, vnew, vnew_exist, locpp.numeric, ucell);
}

//--------------------------------------------------------
// force due to core correlation.
//--------------------------------------------------------
f_pw.cal_force_cc(fcc, rhopw, chr, locpp.numeric, ucell);
//--------------------------------------------------------
// force due to self-consistent charge.
//--------------------------------------------------------
f_pw.cal_force_scc(fscc, rhopw, vnew, vnew_exist, locpp.numeric, ucell);
return;
}

Expand Down
1 change: 0 additions & 1 deletion source/module_hamilt_lcao/hamilt_lcaodft/FORCE_STRESS.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class Force_Stress_LCAO
Record_adj* RA;
Force_LCAO<T> flk;
Stress_Func<double> sc_pw;
Forces<double> f_pw;

void forceSymmetry(const UnitCell& ucell,
ModuleBase::matrix& fcs,
Expand Down
Loading