From c89ebdc94e888191238ccdfce0d97d4764a1ad7e Mon Sep 17 00:00:00 2001 From: maki49 <1579492865@qq.com> Date: Fri, 20 Sep 2024 00:51:25 +0800 Subject: [PATCH] remove GlobalV::NSPIN --- source/module_hamilt_lcao/hamilt_lcaodft/FORCE_gamma.cpp | 2 +- source/module_hamilt_lcao/hamilt_lcaodft/FORCE_k.cpp | 2 +- source/module_hamilt_lcao/hamilt_lcaodft/edm.cpp | 1 + .../hamilt_lcaodft/pulay_force_stress_center2.cpp | 4 ++-- .../hamilt_lcaodft/pulay_force_stress_center2_template.hpp | 3 ++- .../hamilt_lcaodft/pulay_force_stress_gint.hpp | 3 ++- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_gamma.cpp b/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_gamma.cpp index 4eff6d7280..db631841cd 100644 --- a/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_gamma.cpp +++ b/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_gamma.cpp @@ -220,7 +220,7 @@ void Force_LCAO::ftable(const bool isforce, const double* dSxy[6] = { fsr.DSloc_11, fsr.DSloc_12, fsr.DSloc_13, fsr.DSloc_22, fsr.DSloc_23, fsr.DSloc_33 }; // calculate the force related to 'energy density matrix'. PulayForceStress::cal_pulay_fs(foverlap, soverlap, - this->cal_edm(pelec, *psi, *dm, *kv, pv, GlobalV::NSPIN, GlobalV::NBANDS, ucell, *ra), + this->cal_edm(pelec, *psi, *dm, *kv, pv, PARAM.inp.nspin, PARAM.inp.nbands, ucell, *ra), ucell, pv, dSx, dSxy, isforce, isstress); const double* dHx[3] = { fsr.DHloc_fixed_x, fsr.DHloc_fixed_y, fsr.DHloc_fixed_z }; diff --git a/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_k.cpp b/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_k.cpp index 22e270a21b..1c4b10f251 100644 --- a/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_k.cpp +++ b/source/module_hamilt_lcao/hamilt_lcaodft/FORCE_k.cpp @@ -317,7 +317,7 @@ void Force_LCAO>::ftable(const bool isforce, // calculate the energy density matrix // and the force related to overlap matrix and energy density matrix. PulayForceStress::cal_pulay_fs(foverlap, soverlap, - this->cal_edm(pelec, *psi, *dm, *kv, pv, GlobalV::NSPIN, GlobalV::NBANDS, ucell, *ra), + this->cal_edm(pelec, *psi, *dm, *kv, pv, PARAM.inp.nspin, PARAM.inp.nbands, ucell, *ra), ucell, pv, dSx, fsr.DH_r, isforce, isstress, ra, -1.0, 1.0); const double* dHx[3] = { fsr.DHloc_fixedR_x, fsr.DHloc_fixedR_y, fsr.DHloc_fixedR_z }; // T+Vnl diff --git a/source/module_hamilt_lcao/hamilt_lcaodft/edm.cpp b/source/module_hamilt_lcao/hamilt_lcaodft/edm.cpp index 064e4fa52a..aacaa742dc 100644 --- a/source/module_hamilt_lcao/hamilt_lcaodft/edm.cpp +++ b/source/module_hamilt_lcao/hamilt_lcaodft/edm.cpp @@ -1,6 +1,7 @@ #include "FORCE.h" #include "module_elecstate/module_dm/cal_dm_psi.h" #include "module_base/memory.h" +#include "module_parameter/parameter.h" template<> elecstate::DensityMatrix Force_LCAO::cal_edm(const elecstate::ElecState* pelec, const psi::Psi& psi, diff --git a/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_center2.cpp b/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_center2.cpp index 04c89a9163..ea49096da5 100644 --- a/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_center2.cpp +++ b/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_center2.cpp @@ -19,8 +19,8 @@ namespace PulayForceStress ModuleBase::TITLE("Force_LCAO", "cal_pulay_fs_center2"); ModuleBase::timer::tick("Force_LCAO", "cal_pulay_fs_center2"); - const int nspin = GlobalV::NSPIN; - const int nlocal = GlobalV::NLOCAL; + const int nspin = PARAM.inp.nspin; + const int nlocal = PARAM.globalv.nlocal; for (int i = 0; i < nlocal; ++i) { diff --git a/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_center2_template.hpp b/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_center2_template.hpp index ba1345d90a..e0eedffaad 100644 --- a/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_center2_template.hpp +++ b/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_center2_template.hpp @@ -1,6 +1,7 @@ #pragma once #include "pulay_force_stress.h" #include "module_base/timer.h" +#include "module_parameter/parameter.h" namespace PulayForceStress { // common kernel @@ -24,7 +25,7 @@ namespace PulayForceStress ModuleBase::TITLE("Force_LCAO", "cal_pulay_fs_center2"); ModuleBase::timer::tick("Force_LCAO", "cal_pulay_fs_center2"); - const int nspin_DMR = (GlobalV::NSPIN == 2) ? 2 : 1; + const int nspin_DMR = (PARAM.inp.nspin == 2) ? 2 : 1; int total_irr = 0; #ifdef _OPENMP #pragma omp parallel diff --git a/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_gint.hpp b/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_gint.hpp index 5b29d0e269..feb567eca2 100644 --- a/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_gint.hpp +++ b/source/module_hamilt_lcao/hamilt_lcaodft/pulay_force_stress_gint.hpp @@ -2,6 +2,7 @@ #include "pulay_force_stress.h" #include "module_hamilt_lcao/hamilt_lcaodft/stress_tools.h" #include "module_hamilt_general/module_xc/xc_functional.h" +#include "module_parameter/parameter.h" namespace PulayForceStress { template @@ -17,7 +18,7 @@ namespace PulayForceStress const bool& set_dmr_gint) { if (set_dmr_gint) { gint.transfer_DM2DtoGrid(dm.get_DMR_vector()); } // 2d block to grid - const int nspin = GlobalV::NSPIN; + const int nspin = PARAM.inp.nspin; for (int is = 0; is < nspin; ++is) { const double* vr_eff1 = pot->get_effective_v(is);