Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 33 additions & 18 deletions source/source_lcao/FORCE_STRESS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "source_lcao/module_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 @@ -811,24 +811,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/source_lcao/FORCE_STRESS.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,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, ModuleSymmetry::Symmetry* symm);

Expand Down
Loading