Skip to content

Commit a96be8f

Browse files
authored
Merge branch 'develop' into fft12
2 parents 7d5d77c + 06cffb7 commit a96be8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+537
-639
lines changed

docs/quick_start/output.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ The following files are the central output files for ABACUS. After executing the
66

77
Different from `INPUT` given by the users, `OUT.suffix/INPUT` contains all parameters in ABACUS.
88

9-
> **Note:** `OUT.suffix/INPUT` contain the initial default of ABACUS instead of the real parameters used in calculations. This file is stored for reproduction in case the default value is changed during development. If you want to figure out the real parameters used in calculations, you can open `OUT.suffix/runing_scf.log` and research corresponding parameter you are interested.
9+
> **Note:** `OUT.suffix/INPUT` contains the **actual parameters used in the calculation**, including:
10+
> 1. **User-specified parameters** (explicitly defined in your input file or command-line arguments, overriding default parameters).
11+
> 2. **System default parameters** (automatically applied when not explicitly provided by the user).
12+
13+
14+
This file ensures calculations can be fully reproduced, even if default values change in future ABACUS versions.
15+
Also notice that in rare cases, a small number of parameters may be dynamically reset to appropriate values during runtime.
1016

1117
For a complete list of input parameters, please consult this [instruction](../advanced/input_files/input-main.md).
1218

source/module_base/kernels/math_ylm_op.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct cal_ylm_real_op {
2020
/// @param PI_HALF - ModuleBase::PI_HALF
2121
/// @param FOUR_PI - ModuleBase::FOUR_PI,
2222
/// @param SQRT_INVERSE_FOUR_PI - ModuleBase::SQRT_INVERSE_FOUR_PI,
23-
/// @param g - input array with size npw * 3, GlobalC::wf.get_1qvec_cartesian
23+
/// @param g - input array with size npw * 3, wf.get_1qvec_cartesian
2424
/// @param p - intermediate array
2525
///
2626
/// Output Parameters

source/module_basis/module_nao/two_center_bundle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TwoCenterBundle
2828
void tabulate(const double lcao_ecut, const double lcao_dk, const double lcao_dr, const double lcao_rmax);
2929

3030
/**
31-
* @brief Overwrites the content of a LCAO_Orbitals object (e.g. GlobalC::ORB)
31+
* @brief Overwrites the content of a LCAO_Orbitals object (e.g. ORB)
3232
* with the current object.
3333
*
3434
* This function provides an interface to the corresponding object in the old module_ao.

source/module_cell/test/klist_test.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ Fcoef::~Fcoef()
8484
{
8585
}
8686

87-
namespace GlobalC
88-
{
89-
Parallel_Kpoints Pkpoints;
90-
} // namespace GlobalC
9187

9288
/************************************************
9389
* unit test of class K_Vectors

source/module_cell/test/klist_test_para.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ Fcoef::~Fcoef()
8787
{
8888
}
8989

90-
namespace GlobalC
91-
{
92-
Parallel_Kpoints Pkpoints;
93-
UnitCell ucell;
94-
} // namespace GlobalC
9590

9691
/************************************************
9792
* unit test of class K_Vectors

source/module_esolver/esolver_ks_lcao.cpp

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
#include "module_io/write_wfc_nao.h"
3131
#include "module_parameter/parameter.h"
3232

33-
//be careful of hpp, there may be multiple definitions of functions, 20250302, mohan
33+
// be careful of hpp, there may be multiple definitions of functions, 20250302, mohan
34+
#include "module_hamilt_lcao/hamilt_lcaodft/hs_matrix_k.hpp"
3435
#include "module_io/write_eband_terms.hpp"
3536
#include "module_io/write_vxc.hpp"
3637
#include "module_io/write_vxc_r.hpp"
37-
#include "module_hamilt_lcao/hamilt_lcaodft/hs_matrix_k.hpp"
3838

3939
//--------------temporary----------------------------
4040
#include "module_base/global_function.h"
@@ -179,15 +179,13 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa
179179

180180
// 7) initialize exact exchange calculations
181181
#ifdef __EXX
182-
if (PARAM.inp.calculation == "scf"
183-
|| PARAM.inp.calculation == "relax"
184-
|| PARAM.inp.calculation == "cell-relax"
182+
if (PARAM.inp.calculation == "scf" || PARAM.inp.calculation == "relax" || PARAM.inp.calculation == "cell-relax"
185183
|| PARAM.inp.calculation == "md")
186184
{
187185
if (GlobalC::exx_info.info_global.cal_exx)
188186
{
189187
if (PARAM.inp.init_wfc != "file")
190-
{ // if init_wfc==file, directly enter the EXX loop
188+
{ // if init_wfc==file, directly enter the EXX loop
191189
XC_Functional::set_xc_first_loop(ucell);
192190
}
193191

@@ -307,7 +305,6 @@ void ESolver_KS_LCAO<TK, TR>::before_all_runners(UnitCell& ucell, const Input_pa
307305
return;
308306
}
309307

310-
311308
template <typename TK, typename TR>
312309
double ESolver_KS_LCAO<TK, TR>::cal_energy()
313310
{
@@ -316,7 +313,6 @@ double ESolver_KS_LCAO<TK, TR>::cal_energy()
316313
return this->pelec->f_en.etot;
317314
}
318315

319-
320316
template <typename TK, typename TR>
321317
void ESolver_KS_LCAO<TK, TR>::cal_force(UnitCell& ucell, ModuleBase::matrix& force)
322318
{
@@ -460,7 +456,7 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners(UnitCell& ucell)
460456
this->pelec->ekb,
461457
this->kv);
462458
}
463-
}
459+
}
464460

465461
// 4) write projected band structure by jiyy-2022-4-20
466462
if (PARAM.inp.out_proj_band)
@@ -489,49 +485,50 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners(UnitCell& ucell)
489485
if (PARAM.inp.out_mat_xc)
490486
{
491487
ModuleIO::write_Vxc<TK, TR>(PARAM.inp.nspin,
492-
PARAM.globalv.nlocal,
493-
GlobalV::DRANK,
494-
&this->pv,
495-
*this->psi,
496-
ucell,
497-
this->sf,
498-
this->solvent,
499-
*this->pw_rho,
500-
*this->pw_rhod,
501-
this->locpp.vloc,
502-
this->chr,
503-
this->GG,
504-
this->GK,
505-
this->kv,
506-
orb_.cutoffs(),
507-
this->pelec->wg,
508-
this->gd
488+
PARAM.globalv.nlocal,
489+
GlobalV::DRANK,
490+
&this->pv,
491+
*this->psi,
492+
ucell,
493+
this->sf,
494+
this->solvent,
495+
*this->pw_rho,
496+
*this->pw_rhod,
497+
this->locpp.vloc,
498+
this->chr,
499+
this->GG,
500+
this->GK,
501+
this->kv,
502+
orb_.cutoffs(),
503+
this->pelec->wg,
504+
this->gd
509505
#ifdef __EXX
510-
,
511-
this->exx_lri_double ? &this->exx_lri_double->Hexxs : nullptr,
512-
this->exx_lri_complex ? &this->exx_lri_complex->Hexxs : nullptr
506+
,
507+
this->exx_lri_double ? &this->exx_lri_double->Hexxs : nullptr,
508+
this->exx_lri_complex ? &this->exx_lri_complex->Hexxs : nullptr
513509
#endif
514510
);
515511
}
516512
if (PARAM.inp.out_mat_xc2)
517513
{
518514
ModuleIO::write_Vxc_R<TK, TR>(PARAM.inp.nspin,
519-
&this->pv,
520-
ucell,
521-
this->sf,
522-
this->solvent,
523-
*this->pw_rho,
524-
*this->pw_rhod,
525-
this->locpp.vloc,
526-
this->chr,
527-
this->GG,
528-
this->GK,
529-
this->kv,
530-
orb_.cutoffs(),
531-
this->gd
515+
&this->pv,
516+
ucell,
517+
this->sf,
518+
this->solvent,
519+
*this->pw_rho,
520+
*this->pw_rhod,
521+
this->locpp.vloc,
522+
this->chr,
523+
this->GG,
524+
this->GK,
525+
this->kv,
526+
orb_.cutoffs(),
527+
this->gd
532528
#ifdef __EXX
533-
, this->exx_lri_double ? &this->exx_lri_double->Hexxs : nullptr,
534-
this->exx_lri_complex ? &this->exx_lri_complex->Hexxs : nullptr
529+
,
530+
this->exx_lri_double ? &this->exx_lri_double->Hexxs : nullptr,
531+
this->exx_lri_complex ? &this->exx_lri_complex->Hexxs : nullptr
535532
#endif
536533
);
537534
}
@@ -569,7 +566,6 @@ void ESolver_KS_LCAO<TK, TR>::after_all_runners(UnitCell& ucell)
569566
ModuleBase::timer::tick("ESolver_KS_LCAO", "after_all_runners");
570567
}
571568

572-
573569
template <typename TK, typename TR>
574570
void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const int iter)
575571
{
@@ -639,11 +635,10 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
639635
if (GlobalC::exx_info.info_global.cal_exx)
640636
{
641637
// the following steps are only needed in the first outer exx loop
642-
exx_two_level_step = GlobalC::exx_info.info_ri.real_number ?
643-
this->exd->two_level_step
644-
: this->exc->two_level_step;
638+
exx_two_level_step
639+
= GlobalC::exx_info.info_ri.real_number ? this->exd->two_level_step : this->exc->two_level_step;
645640
}
646-
#endif
641+
#endif
647642
if (iter == 1 && exx_two_level_step == 0)
648643
{
649644
std::cout << " WAVEFUN -> CHARGE " << std::endl;
@@ -742,6 +737,11 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
742737
{
743738
this->p_hamilt->refresh();
744739
}
740+
if (iter == 1 && istep == 0)
741+
{
742+
// initialize DMR
743+
this->ld.init_DMR(ucell, orb_, this->pv, this->gd);
744+
}
745745
#endif
746746

747747
if (PARAM.inp.vl_in_h)
@@ -758,7 +758,6 @@ void ESolver_KS_LCAO<TK, TR>::iter_init(UnitCell& ucell, const int istep, const
758758
}
759759
}
760760

761-
762761
template <typename TK, typename TR>
763762
void ESolver_KS_LCAO<TK, TR>::hamilt2rho_single(UnitCell& ucell, int istep, int iter, double ethr)
764763
{
@@ -822,7 +821,6 @@ void ESolver_KS_LCAO<TK, TR>::hamilt2rho_single(UnitCell& ucell, int istep, int
822821
this->pelec->f_en.deband = this->pelec->cal_delta_eband(ucell);
823822
}
824823

825-
826824
template <typename TK, typename TR>
827825
void ESolver_KS_LCAO<TK, TR>::update_pot(UnitCell& ucell, const int istep, const int iter, const bool conv_esolver)
828826
{
@@ -840,7 +838,6 @@ void ESolver_KS_LCAO<TK, TR>::update_pot(UnitCell& ucell, const int istep, const
840838
}
841839
}
842840

843-
844841
template <typename TK, typename TR>
845842
void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int& iter, bool& conv_esolver)
846843
{
@@ -878,6 +875,7 @@ void ESolver_KS_LCAO<TK, TR>::iter_finish(UnitCell& ucell, const int istep, int&
878875
= dynamic_cast<const elecstate::ElecStateLCAO<TK>*>(this->pelec)->get_DM()->get_DMK_vector();
879876

880877
ld.dpks_cal_e_delta_band(dm, this->kv.get_nks());
878+
DeePKS_domain::update_dmr(this->kv.kvec_d, dm, ucell, orb_, this->pv, this->gd, ld.dm_r);
881879
this->pelec->f_en.edeepks_scf = ld.E_delta - ld.e_delta_band;
882880
this->pelec->f_en.edeepks_delta = ld.E_delta;
883881
}

source/module_hamilt_general/module_surchem/test/cal_epsilon_test.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ TEST_F(cal_epsilon_test, cal_epsilon)
4545
device_flag = "cpu";
4646

4747
ModulePW::PW_Basis pwtest(device_flag, precision_flag);
48-
GlobalC::rhopw = &pwtest;
49-
5048
ModuleBase::Matrix3 latvec;
5149
int nx, ny, nz; // f*G
5250
double wfcecut;
@@ -70,17 +68,17 @@ TEST_F(cal_epsilon_test, cal_epsilon)
7068
#endif
7169

7270
#ifdef __MPI
73-
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
71+
pwtest.initmpi(1, 0, POOL_WORLD);
7472
#endif
7573
// pwtest.initgrids(lat0,latvec,wfcecut);
76-
GlobalC::rhopw->initgrids(lat0, latvec, wfcecut);
77-
GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
78-
GlobalC::rhopw->setuptransform();
79-
GlobalC::rhopw->collect_local_pw();
74+
pwtest.initgrids(lat0, latvec, wfcecut);
75+
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
76+
pwtest.setuptransform();
77+
pwtest.collect_local_pw();
8078

81-
GlobalC::rhopw->nrxx = 125000;
82-
const int npw = GlobalC::rhopw->npw;
83-
const int nrxx = GlobalC::rhopw->nrxx;
79+
pwtest.nrxx = 125000;
80+
const int npw = pwtest.npw;
81+
const int nrxx = pwtest.nrxx;
8482

8583
std::ifstream fin;
8684
fin.open("./support/PS_TOTN_real.in");
@@ -99,8 +97,7 @@ TEST_F(cal_epsilon_test, cal_epsilon)
9997
double* epsilon = new double[nrxx];
10098
double* epsilon0 = new double[nrxx];
10199

102-
GlobalC::rhopw = &pwtest;
103-
solvent_model.cal_epsilon(GlobalC::rhopw, PS_TOTN_real, epsilon, epsilon0);
100+
solvent_model.cal_epsilon(&pwtest, PS_TOTN_real, epsilon, epsilon0);
104101

105102
EXPECT_EQ(PS_TOTN_real[0], 0.274231);
106103
EXPECT_EQ(epsilon[0], 1);

source/module_hamilt_general/module_surchem/test/cal_pseudo_test.cpp

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ TEST_F(cal_pseudo_test, gauss_charge)
3737
device_flag = "cpu";
3838

3939
ModulePW::PW_Basis pwtest(device_flag, precision_flag);
40-
GlobalC::rhopw = &pwtest;
4140
ModuleBase::Matrix3 latvec;
4241
int nx, ny, nz; // f*G
4342
double wfcecut;
@@ -58,26 +57,26 @@ TEST_F(cal_pseudo_test, gauss_charge)
5857
#endif
5958

6059
#ifdef __MPI
61-
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
60+
pwtest.initmpi(1, 0, POOL_WORLD);
6261
#endif
6362
// pwtest.initgrids(lat0,latvec,wfcecut);
6463

65-
GlobalC::rhopw->initgrids(ucell.lat0, ucell.latvec, wfcecut);
64+
pwtest.initgrids(ucell.lat0, ucell.latvec, wfcecut);
6665

67-
GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
68-
GlobalC::rhopw->setuptransform();
69-
GlobalC::rhopw->collect_local_pw();
70-
GlobalC::rhopw->collect_uniqgg();
66+
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
67+
pwtest.setuptransform();
68+
pwtest.collect_local_pw();
69+
pwtest.collect_uniqgg();
7170

72-
const int npw = GlobalC::rhopw->npw;
73-
const int nrxx = GlobalC::rhopw->nrxx;
71+
const int npw = pwtest.npw;
72+
const int nrxx = pwtest.nrxx;
7473
complex<double>* N = new complex<double>[npw];
7574
ModuleBase::GlobalFunc::ZEROS(N, npw);
7675

7776
Structure_Factor sf;
7877
sf.nbspline = -1;
7978

80-
solvent_model.gauss_charge(ucell, pgrid, GlobalC::rhopw, N, &sf);
79+
solvent_model.gauss_charge(ucell, pgrid, &pwtest, N, &sf);
8180

8281
EXPECT_NEAR(N[14].real(), 0.002, 1e-9);
8382
EXPECT_NEAR(N[16].real(), -0.001573534, 1e-9);
@@ -92,7 +91,6 @@ TEST_F(cal_pseudo_test, cal_pseudo)
9291
device_flag = "cpu";
9392
Setcell::setupcell(ucell);
9493
ModulePW::PW_Basis pwtest(device_flag, precision_flag);
95-
GlobalC::rhopw = &pwtest;
9694
ModuleBase::Matrix3 latvec;
9795
int nx, ny, nz; // f*G
9896
double wfcecut;
@@ -113,18 +111,18 @@ TEST_F(cal_pseudo_test, cal_pseudo)
113111
#endif
114112

115113
#ifdef __MPI
116-
GlobalC::rhopw->initmpi(1, 0, POOL_WORLD);
114+
pwtest.initmpi(1, 0, POOL_WORLD);
117115
#endif
118116
// pwtest.initgrids(lat0,latvec,wfcecut);
119117

120-
GlobalC::rhopw->initgrids(ucell.lat0, ucell.latvec, wfcecut);
121-
GlobalC::rhopw->initparameters(gamma_only, wfcecut, distribution_type, xprime);
122-
GlobalC::rhopw->setuptransform();
123-
GlobalC::rhopw->collect_local_pw();
124-
GlobalC::rhopw->collect_uniqgg();
118+
pwtest.initgrids(ucell.lat0, ucell.latvec, wfcecut);
119+
pwtest.initparameters(gamma_only, wfcecut, distribution_type, xprime);
120+
pwtest.setuptransform();
121+
pwtest.collect_local_pw();
122+
pwtest.collect_uniqgg();
125123

126-
const int npw = GlobalC::rhopw->npw;
127-
const int nrxx = GlobalC::rhopw->nrxx;
124+
const int npw = pwtest.npw;
125+
const int nrxx = pwtest.nrxx;
128126

129127
Structure_Factor sf;
130128
sf.nbspline = -1;
@@ -137,7 +135,7 @@ TEST_F(cal_pseudo_test, cal_pseudo)
137135
}
138136

139137
complex<double>* PS_TOTN = new complex<double>[npw];
140-
solvent_model.cal_pseudo(ucell, pgrid, GlobalC::rhopw, Porter_g, PS_TOTN, &sf);
138+
solvent_model.cal_pseudo(ucell, pgrid, &pwtest, Porter_g, PS_TOTN, &sf);
141139

142140
EXPECT_NEAR(PS_TOTN[16].real(), 0.098426466, 1e-9);
143141
EXPECT_NEAR(PS_TOTN[14].real(), 0.102, 1e-9);

0 commit comments

Comments
 (0)