|
| 1 | +#include "force_stress_lcao.h" |
| 2 | + |
| 3 | +#include "source_base/parallel_reduce.h" |
| 4 | +#include "source_lcao/module_dftu/dftu_lcao.h" //Quxin add for DFT+U on 20201029 |
| 5 | +#include "source_lcao/module_dftu/dftu_force.h" |
| 6 | +#include "source_io/module_output/output_log.h" |
| 7 | +#include "source_io/module_parameter/parameter.h" |
| 8 | +// new |
| 9 | +#include "source_base/timer.h" |
| 10 | +#include "source_base/tool_quit.h" |
| 11 | +#include "source_cell/module_neighbor/sltk_grid_driver.h" |
| 12 | +#include "source_estate/elecstate_lcao.h" |
| 13 | +#include "source_estate/module_pot/h_tddft_pw.h" // Taoni add 2025-02-20 |
| 14 | +#include "source_estate/module_pot/efield.h" // liuyu add 2022-05-18 |
| 15 | +#include "source_estate/module_pot/gatefield.h" // liuyu add 2022-09-13 |
| 16 | +#include "source_hamilt/module_surchem/surchem.h" //sunml add 2022-08-10 |
| 17 | +#include "source_hamilt/module_vdw/vdw.h" |
| 18 | +#include "source_io/module_parameter/parameter.h" |
| 19 | +#ifdef __MLALGO |
| 20 | +#include "source_lcao/module_deepks/lcao_deepks.h" //caoyu add for deepks 2021-06-03 |
| 21 | +#include "source_lcao/module_deepks/lcao_deepks_io.h" // mohan add 2024-07-22 |
| 22 | +#include "source_lcao/module_deepks/deepks_force.h" |
| 23 | +#endif |
| 24 | +#include "source_lcao/module_dftu/dftu_lcao_op.h" |
| 25 | +#include "source_lcao/module_operator_lcao/dspin_lcao.h" |
| 26 | +#include "source_lcao/module_operator_lcao/nonlocal.h" |
| 27 | +#include "source_lcao/module_operator_lcao/ekinetic.h" |
| 28 | +#include "source_lcao/module_operator_lcao/overlap.h" |
| 29 | +#include "source_lcao/module_operator_lcao/td_pot_hybrid.h" |
| 30 | +#include "source_lcao/pulay_fs.h" |
| 31 | +#include "source_lcao/module_rt/force_rt_overlap.h" |
| 32 | + |
| 33 | + |
| 34 | +// local pseudopotential, ewald, core correction, scc terms in force |
| 35 | +template <typename T> |
| 36 | +void Force_Stress_LCAO<T>::calForcePwPart(UnitCell& ucell, |
| 37 | + ModuleBase::matrix& fvl_dvl, |
| 38 | + ModuleBase::matrix& fewalds, |
| 39 | + ModuleBase::matrix& fcc, |
| 40 | + ModuleBase::matrix& fscc, |
| 41 | + const double& etxc, |
| 42 | + const ModuleBase::matrix& vnew, |
| 43 | + const bool vnew_exist, |
| 44 | + const Charge* const chr, |
| 45 | + ModulePW::PW_Basis* rhopw, |
| 46 | + const pseudopot_cell_vl& locpp, |
| 47 | + const Structure_Factor& sf) |
| 48 | +{ |
| 49 | + ModuleBase::TITLE("Force_Stress_LCAO", "calForcePwPart"); |
| 50 | +#ifdef __CUDA |
| 51 | + if(PARAM.inp.device == "gpu") |
| 52 | + { |
| 53 | + Forces<double, base_device::DEVICE_GPU> f_pw(nat); |
| 54 | + f_pw.cal_force_loc(ucell, fvl_dvl, rhopw, locpp.vloc, chr); |
| 55 | + f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf); |
| 56 | + f_pw.cal_force_cc(fcc, rhopw, chr, locpp.numeric, ucell); |
| 57 | + f_pw.cal_force_scc(fscc, rhopw, vnew, vnew_exist, locpp.numeric, ucell); |
| 58 | + } |
| 59 | + else |
| 60 | +#endif |
| 61 | + { |
| 62 | + Forces<double, base_device::DEVICE_CPU> f_pw(nat); |
| 63 | + f_pw.cal_force_loc(ucell, fvl_dvl, rhopw, locpp.vloc, chr); |
| 64 | + f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf); |
| 65 | + f_pw.cal_force_cc(fcc, rhopw, chr, locpp.numeric, ucell); |
| 66 | + f_pw.cal_force_scc(fscc, rhopw, vnew, vnew_exist, locpp.numeric, ucell); |
| 67 | + } |
| 68 | + |
| 69 | + return; |
| 70 | +} |
| 71 | + |
| 72 | +template class Force_Stress_LCAO<double>; |
| 73 | +template class Force_Stress_LCAO<std::complex<double>>; |
0 commit comments