|
23 | 23 | #include "source_lcao/module_operator_lcao/nonlocal_new.h" |
24 | 24 |
|
25 | 25 | template <typename T> |
26 | | -Force_Stress_LCAO<T>::Force_Stress_LCAO(Record_adj& ra, const int nat_in) : RA(&ra), f_pw(nat_in), nat(nat_in) |
| 26 | +Force_Stress_LCAO<T>::Force_Stress_LCAO(Record_adj& ra, const int nat_in) : RA(&ra), nat(nat_in) |
27 | 27 | { |
28 | 28 | } |
29 | 29 | template <typename T> |
@@ -811,24 +811,39 @@ void Force_Stress_LCAO<T>::calForcePwPart(UnitCell& ucell, |
811 | 811 | const Structure_Factor& sf) |
812 | 812 | { |
813 | 813 | ModuleBase::TITLE("Force_Stress_LCAO", "calForcePwPart"); |
814 | | - //-------------------------------------------------------- |
815 | | - // local pseudopotential force: |
816 | | - // use charge density; plane wave; local pseudopotential; |
817 | | - //-------------------------------------------------------- |
818 | | - f_pw.cal_force_loc(ucell, fvl_dvl, rhopw, locpp.vloc, chr); |
819 | | - //-------------------------------------------------------- |
820 | | - // ewald force: use plane wave only. |
821 | | - //-------------------------------------------------------- |
822 | | - f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf); // remain problem |
| 814 | +#ifdef __CUDA |
| 815 | + if(PARAM.inp.device == "gpu") |
| 816 | + { |
| 817 | + Forces<double, base_device::DEVICE_GPU> f_pw(nat); |
| 818 | + |
| 819 | + //-------------------------------------------------------- |
| 820 | + // local pseudopotential force: |
| 821 | + // use charge density; plane wave; local pseudopotential; |
| 822 | + //-------------------------------------------------------- |
| 823 | + f_pw.cal_force_loc(ucell, fvl_dvl, rhopw, locpp.vloc, chr); |
| 824 | + //-------------------------------------------------------- |
| 825 | + // ewald force: use plane wave only. |
| 826 | + //-------------------------------------------------------- |
| 827 | + f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf); // remain problem |
| 828 | + |
| 829 | + //-------------------------------------------------------- |
| 830 | + // force due to core correlation. |
| 831 | + //-------------------------------------------------------- |
| 832 | + f_pw.cal_force_cc(fcc, rhopw, chr, locpp.numeric, ucell); |
| 833 | + //-------------------------------------------------------- |
| 834 | + // force due to self-consistent charge. |
| 835 | + //-------------------------------------------------------- |
| 836 | + f_pw.cal_force_scc(fscc, rhopw, vnew, vnew_exist, locpp.numeric, ucell); |
| 837 | + } else |
| 838 | +#endif |
| 839 | + { |
| 840 | + Forces<double, base_device::DEVICE_CPU> f_pw(nat); |
| 841 | + f_pw.cal_force_loc(ucell, fvl_dvl, rhopw, locpp.vloc, chr); |
| 842 | + f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf); // remain problem |
| 843 | + f_pw.cal_force_cc(fcc, rhopw, chr, locpp.numeric, ucell); |
| 844 | + f_pw.cal_force_scc(fscc, rhopw, vnew, vnew_exist, locpp.numeric, ucell); |
| 845 | + } |
823 | 846 |
|
824 | | - //-------------------------------------------------------- |
825 | | - // force due to core correlation. |
826 | | - //-------------------------------------------------------- |
827 | | - f_pw.cal_force_cc(fcc, rhopw, chr, locpp.numeric, ucell); |
828 | | - //-------------------------------------------------------- |
829 | | - // force due to self-consistent charge. |
830 | | - //-------------------------------------------------------- |
831 | | - f_pw.cal_force_scc(fscc, rhopw, vnew, vnew_exist, locpp.numeric, ucell); |
832 | 847 | return; |
833 | 848 | } |
834 | 849 |
|
|
0 commit comments