Skip to content

Commit c7b70a8

Browse files
committed
Revert reference change by adding option dm_no_renormalize to init_chg
This reverts commit ed14d9f.
1 parent be860ce commit c7b70a8

7 files changed

Lines changed: 12 additions & 9 deletions

File tree

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@
703703
- file: the density will be read in from a binary file charge-density.dat first. If it does not exist, the charge density will be read in from cube files.
704704
- wfc: the density will be calculated by wavefunctions and occupations.
705705
- dm: the density will be calculated by real space density matrix(DMR) of LCAO base.
706+
- dm_no_renormalize: same as dm, but the charge density is not renormalized to the number of electrons.
706707
- hr: the real space Hamiltonian matrix(HR) will be read in from file hrs1_nao.csr in directory read_file_dir.
707708
- auto: Abacus first attempts to read the density from a file; if not found, it defaults to using atomic density.
708709
- **Default**: atomic

source/source_esolver/esolver_ks_lcao.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(UnitCell& ucell, const int istep)
180180
if(istep == 0)//if the first scf step, readin DMR from file,
181181
{
182182
//calculate or readin the density matrix DMR
183-
if(PARAM.inp.init_chg == "dm")
183+
if(PARAM.inp.init_chg == "dm" || PARAM.inp.init_chg == "dm_no_renormalize")
184184
{
185185
//! 13.1.1) init charge density from density matrix file
186186
LCAO_domain::init_chg_dm<TK>(PARAM.globalv.global_readin_dir, PARAM.inp.nspin,

source/source_estate/init_scf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void init_scf(const UnitCell& ucell,
1717
pelec->charge->set_rho_core(ucell, strucfac, numeric);
1818

1919
//! renormalize the charge density
20-
if(PARAM.inp.init_chg != "dm")
20+
if(PARAM.inp.init_chg != "dm_no_renormalize")
2121
{
2222
pelec->charge->renormalize_rho();
2323
}

source/source_io/module_parameter/read_input_item_system.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ Available options are:
468468
* file: the density will be read in from a binary file charge-density.dat first. If it does not exist, the charge density will be read in from cube files.
469469
* wfc: the density will be calculated by wavefunctions and occupations.
470470
* dm: the density will be calculated by real space density matrix(DMR) of LCAO base.
471+
* dm_no_renormalize: same as dm, but the charge density is not renormalized to the number of electrons.
471472
* hr: the real space Hamiltonian matrix(HR) will be read in from file hrs1_nao.csr in directory read_file_dir.
472473
* auto: Abacus first attempts to read the density from a file; if not found, it defaults to using atomic density.)";
473474
item.default_value = "atomic";
@@ -482,6 +483,7 @@ Available options are:
482483
// dm and hr are valid options for nscf calculation (e.g., band structure, wannier90)
483484
if (para.input.init_chg != "file" &&
484485
para.input.init_chg != "dm" &&
486+
para.input.init_chg != "dm_no_renormalize" &&
485487
para.input.init_chg != "hr")
486488
{
487489
ModuleBase::GlobalFunc::AUTO_SET("init_chg", para.input.init_chg);
@@ -490,7 +492,7 @@ Available options are:
490492
}
491493
};
492494
item.check_value = [](const Input_Item& item, const Parameter& para) {
493-
const std::vector<std::string> init_chgs = {"atomic", "file", "wfc", "auto", "dm", "hr"};
495+
const std::vector<std::string> init_chgs = {"atomic", "file", "wfc", "auto", "dm", "dm_no_renormalize", "hr"};
494496
if (std::find(init_chgs.begin(), init_chgs.end(), para.input.init_chg) == init_chgs.end())
495497
{
496498
const std::string warningstr = nofound_str(init_chgs, "init_chg");

source/source_lcao/module_operator_lcao/op_exx_lcao.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ OperatorEXX<OperatorLCAO<TK, TR>>::OperatorEXX(HS_Matrix_K<TK>* hsk_in,
170170
return true;
171171
};
172172

173-
if (PARAM.inp.init_chg == "dm")
173+
if (PARAM.inp.init_chg == "dm" || PARAM.inp.init_chg == "dm_no_renormalize")
174174
{
175175
// 1. cal Cs, Vs
176176
if (GlobalC::exx_info.info_ri.real_number)

source/source_lcao/setup_exx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void Exx_NAO<TK>::before_runner(
6363
}
6464
}
6565
}
66-
else if (inp.calculation == "nscf" && inp.init_chg == "dm")
66+
else if (inp.calculation == "nscf" && (inp.init_chg == "dm" || inp.init_chg == "dm_no_renormalize"))
6767
{
6868
// init exx integration tables for Cs/Vs, but not use symmetry for nscf
6969
if (GlobalC::exx_info.info_global.cal_exx)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
etotref -5069.1660719143756069
2-
etotperatomref -2534.5830359572
3-
totalforceref 89.291628
4-
totalstressref 2011.565086
1+
etotref -5069.1660720303607377
2+
etotperatomref -2534.5830360152
3+
totalforceref 89.291634
4+
totalstressref 2011.565088
55
totaltimeref 0.33

0 commit comments

Comments
 (0)