Skip to content

Commit e62b1ce

Browse files
authored
Merge branch 'develop' into refactor/iter-header
2 parents de3d057 + 91c0c03 commit e62b1ce

276 files changed

Lines changed: 3921 additions & 31 deletions

File tree

Some content is hidden

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

source/source_base/tool_quit.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ void set_quit_out_dir(const std::string& dir)
2525
g_quit_out_dir = dir;
2626
}
2727

28+
const std::string& get_global_out_dir()
29+
{
30+
return g_quit_out_dir;
31+
}
32+
2833
void set_quit_calculation(const std::string& calculation)
2934
{
3035
g_quit_calculation = calculation;

source/source_base/tool_quit.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ void WARNING(const std::string &file, const std::string &description);
3737
*/
3838
void set_quit_out_dir(const std::string& dir);
3939

40+
/**
41+
* @brief Read back the injected global output directory.
42+
* Returns an empty string if set_quit_out_dir was never called.
43+
*/
44+
const std::string& get_global_out_dir();
45+
4046
/**
4147
* @brief Inject the calculation tag used by CHECK_WARNING_QUIT to compose the
4248
* fallback log filename ("running_<calculation>.log") when ofs_running

source/source_basis/module_ao/ORB_atomic_lm.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "ORB_atomic_lm.h"
22
#include "source_base/sph_bessel_recursive.h"
3-
#include "source_io/module_parameter/parameter.h"
3+
#include "source_base/global_variable.h"
4+
#include "source_base/tool_quit.h"
45
#include "source_base/module_external/blas_connector.h"
56
#include "source_base/timer.h"
67
#include "source_base/math_integral.h"
@@ -383,7 +384,7 @@ void Numerical_Orbital_Lm::use_uniform(const double &dr_uniform_in)
383384
if(GlobalV::MY_RANK==0)
384385
{
385386
std::stringstream ss;
386-
ss << PARAM.globalv.global_out_dir << this->label << "/"
387+
ss << ModuleBase::get_global_out_dir() << this->label << "/"
387388
<< this->label << "-" << orbital_type << ".ORBITAL_NOR_uniform.txt";
388389
389390
std::ofstream ofs(ss.str().c_str());
@@ -722,16 +723,16 @@ void Numerical_Orbital_Lm::plot(void)const
722723
if(GlobalV::MY_RANK==0)
723724
{
724725
std::stringstream ssr, ssk, ssru ,ssdru; // 2013-08-10 pengfei
725-
ssr << PARAM.globalv.global_out_dir << this->label << "/"
726+
ssr << ModuleBase::get_global_out_dir() << this->label << "/"
726727
<< this->label << "-"<< orbital_type << index_chi+1 << "-orbital-r.dat";
727728

728-
ssk << PARAM.globalv.global_out_dir << this->label << "/"
729+
ssk << ModuleBase::get_global_out_dir() << this->label << "/"
729730
<< this->label << "-" << orbital_type << index_chi+1 << "-orbital-k.dat";
730731

731-
ssru << PARAM.globalv.global_out_dir << this->label << "/"
732+
ssru << ModuleBase::get_global_out_dir() << this->label << "/"
732733
<< this->label << "-" << orbital_type << index_chi+1 << "-orbital-ru.dat";
733734

734-
ssdru << PARAM.globalv.global_out_dir << this->label << "/" // 2013-08-10 pengfei
735+
ssdru << ModuleBase::get_global_out_dir() << this->label << "/" // 2013-08-10 pengfei
735736
<< this->label << "-" << orbital_type << index_chi+1 << "-orbital-dru.dat";
736737

737738
std::ofstream ofsr(ssr.str().c_str());

source/source_basis/module_ao/ORB_nonlocal_lm.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "source_base/math_sphbes.h"
88
#include "source_base/mathzone.h" /// use Polynomial_Interpolation_xy, Spherical_Bessel
99
#include "source_base/mathzone_add1.h" /// use SplineD2
10-
#include "source_io/module_parameter/parameter.h"
10+
#include "source_base/tool_quit.h"
1111

1212
#include <cassert>
1313
#include <cmath>
@@ -237,13 +237,13 @@ void Numerical_Nonlocal_Lm::plot(const int &my_rank)const
237237
if(my_rank==0)
238238
{
239239
std::stringstream ssr, ssk, ssru;
240-
ssr << PARAM.globalv.global_out_dir << this->label << "/"
240+
ssr << ModuleBase::get_global_out_dir() << this->label << "/"
241241
<< this->label << "-" << orbital_type << "-proj-r.dat";
242242

243-
ssk << PARAM.globalv.global_out_dir << this->label << "/"
243+
ssk << ModuleBase::get_global_out_dir() << this->label << "/"
244244
<< this->label << "-" << orbital_type << "-proj-k.dat";
245245

246-
ssru << PARAM.globalv.global_out_dir << this->label << "/"
246+
ssru << ModuleBase::get_global_out_dir() << this->label << "/"
247247
<< this->label << "-" << orbital_type << "-proj-ru.dat";
248248

249249
std::ofstream ofsr(ssr.str().c_str());

source/source_basis/module_nao/two_center_bundle.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
#include "source_base/parallel_common.h"
66
#include "source_base/ylm.h"
77
#include "source_basis/module_nao/real_gaunt_table.h"
8-
#include "source_io/module_parameter/parameter.h"
98

109
#include <memory>
1110

12-
void TwoCenterBundle::build_orb(int ntype, const std::string* file_orb0)
11+
void TwoCenterBundle::build_orb(int ntype, const std::string* file_orb0, const std::string& orbital_dir)
1312
{
1413
std::vector<std::string> file_orb(ntype);
1514
if (GlobalV::MY_RANK == 0)
1615
{
17-
std::transform(file_orb0, file_orb0 + ntype, file_orb.begin(), [](const std::string& file) {
18-
return PARAM.inp.orbital_dir + file;
16+
std::transform(file_orb0, file_orb0 + ntype, file_orb.begin(), [&orbital_dir](const std::string& file) {
17+
return orbital_dir + file;
1918
});
2019
}
2120
#ifdef __MPI
@@ -34,7 +33,7 @@ void TwoCenterBundle::build_beta(int ntype, Numerical_Nonlocal* nl)
3433

3534
void TwoCenterBundle::build_alpha(int ndesc, std::string* file_desc0)
3635
{
37-
if (PARAM.globalv.deepks_setorb)
36+
if (ndesc > 0)
3837
{
3938
std::vector<std::string> file_desc(ndesc);
4039
if (GlobalV::MY_RANK == 0)
@@ -245,7 +244,7 @@ void TwoCenterBundle::to_LCAO_Orbitals(LCAO_Orbitals& ORB,
245244
(*orb_)(itype).to_numerical_orbital(ORB.Phi[itype], ORB.kmesh, ORB.dk, out_element_info, cal_force);
246245
}
247246

248-
if (PARAM.globalv.deepks_setorb)
247+
if (alpha_)
249248
{
250249
ORB.lmax_d = alpha_->lmax();
251250
ORB.nchimax_d = alpha_->nzeta_max();

source/source_basis/module_nao/two_center_bundle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TwoCenterBundle
1515
TwoCenterBundle& operator=(TwoCenterBundle&&) = default;
1616

1717
// NOTE: some variables might be set only on RANK-0
18-
void build_orb(int ntype, const std::string* file_orb0);
18+
void build_orb(int ntype, const std::string* file_orb0, const std::string& orbital_dir);
1919
void build_beta(int ntype, Numerical_Nonlocal* nl);
2020
void build_alpha(int ndesc = 0, std::string* file_desc0 = nullptr);
2121
void build_orb_onsite(const double& radius);

source/source_lcao/LCAO_init_basis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void init_basis_lcao(Parallel_Orbitals& pv,
4141
// * reading the localized orbitals/projectors
4242
// * construct the interpolation tables.
4343

44-
two_center_bundle.build_orb(ucell.ntype, ucell.orbital_fn.data());
44+
two_center_bundle.build_orb(ucell.ntype, ucell.orbital_fn.data(), PARAM.inp.orbital_dir);
4545
two_center_bundle.build_alpha(PARAM.globalv.deepks_setorb, &ucell.descriptor_file);
4646
two_center_bundle.build_orb_onsite(onsite_radius);
4747
// currently deepks only use one descriptor file, so cast bool to int is

source/source_lcao/module_lr/esolver_lrtd_lcao.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ LR::ESolver_LR<T, TR>::ESolver_LR(const Input_para& inp, UnitCell& ucell) : inpu
305305
this->parameter_check();
306306

307307
/// read orbitals and build the interpolation table
308-
two_center_bundle_.build_orb(ucell.ntype, ucell.orbital_fn.data());
308+
two_center_bundle_.build_orb(ucell.ntype, ucell.orbital_fn.data(), inp.orbital_dir);
309309

310310
LCAO_Orbitals orb;
311311
two_center_bundle_.to_LCAO_Orbitals(orb, inp.lcao_ecut, inp.lcao_dk, inp.lcao_dr, inp.lcao_rmax,
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
INPUT_PARAMETERS
2+
suffix autotest
3+
calculation scf
4+
basis_type lcao
5+
ecutwfc 20
6+
gamma_only 0
7+
8+
nspin 2
9+
#nbands 28
10+
scf_thr 1.0e-6
11+
scf_nmax 50
12+
out_chg 0
13+
smearing_method gaussian
14+
smearing_sigma 0.01
15+
mixing_type broyden
16+
mixing_beta 0.4
17+
ks_solver genelpa
18+
symmetry 0
19+
20+
21+
22+
pseudo_dir ../../PP_ORB
23+
orbital_dir ../../PP_ORB
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
K_POINTS
2+
0
3+
Gamma
4+
1 1 1 0 0 0

0 commit comments

Comments
 (0)