|
4 | 4 | #include "module_hamilt_lcao/hamilt_lcaodft/LCAO_domain.h" |
5 | 5 | #include <vector> |
6 | 6 |
|
| 7 | +void sparse_format::cal_dS(const UnitCell& ucell, |
| 8 | + const Parallel_Orbitals& pv, |
| 9 | + LCAO_HS_Arrays& HS_Arrays, |
| 10 | + const Grid_Driver& grid, |
| 11 | + const TwoCenterBundle& two_center_bundle, |
| 12 | + const LCAO_Orbitals& orb, |
| 13 | + const double& sparse_thr) |
| 14 | +{ |
| 15 | +ModuleBase::TITLE("sparse_format", "cal_dS"); |
| 16 | + |
| 17 | +sparse_format::set_R_range(HS_Arrays.all_R_coor, grid); |
| 18 | +const int nnr = pv.nnr; |
| 19 | + |
| 20 | +ForceStressArrays fsr_dh; |
| 21 | +fsr_dh.DHloc_fixedR_x = new double[nnr]; |
| 22 | +fsr_dh.DHloc_fixedR_y = new double[nnr]; |
| 23 | +fsr_dh.DHloc_fixedR_z = new double[nnr]; |
| 24 | +ModuleBase::GlobalFunc::ZEROS(fsr_dh.DHloc_fixedR_x, nnr); |
| 25 | +ModuleBase::GlobalFunc::ZEROS(fsr_dh.DHloc_fixedR_y, nnr); |
| 26 | +ModuleBase::GlobalFunc::ZEROS(fsr_dh.DHloc_fixedR_z, nnr); |
| 27 | +// the pointers of dS is different from dH, use the dh pointers to reuse the print functions |
| 28 | +fsr_dh.DSloc_Rx = fsr_dh.DHloc_fixedR_x; |
| 29 | +fsr_dh.DSloc_Ry = fsr_dh.DHloc_fixedR_y; |
| 30 | +fsr_dh.DSloc_Rz = fsr_dh.DHloc_fixedR_z; |
| 31 | +// cal dS=<phi|dphi> in LCAO |
| 32 | +const bool cal_deri = true; |
| 33 | +const bool cal_stress = false; |
| 34 | +LCAO_domain::build_ST_new(fsr_dh, |
| 35 | + 'S', |
| 36 | + cal_deri, |
| 37 | + cal_stress, |
| 38 | + ucell, |
| 39 | + orb, |
| 40 | + pv, |
| 41 | + two_center_bundle, |
| 42 | + &grid, |
| 43 | + nullptr, |
| 44 | + false); // delete unused parameter lm.Hloc_fixedR |
| 45 | + |
| 46 | +sparse_format::cal_dSTN_R(ucell,pv, HS_Arrays, fsr_dh, grid, orb.cutoffs(), 0, sparse_thr); |
| 47 | +delete[] fsr_dh.DHloc_fixedR_x; |
| 48 | +delete[] fsr_dh.DHloc_fixedR_y; |
| 49 | +delete[] fsr_dh.DHloc_fixedR_z; |
| 50 | +return; |
| 51 | +} |
| 52 | + |
7 | 53 | void sparse_format::cal_dH(const UnitCell& ucell, |
8 | 54 | const Parallel_Orbitals& pv, |
9 | 55 | LCAO_HS_Arrays& HS_Arrays, |
|
0 commit comments