Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions source/source_base/tool_quit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ void set_quit_out_dir(const std::string& dir)
g_quit_out_dir = dir;
}

const std::string& get_quit_out_dir()
{
return g_quit_out_dir;
}

void set_quit_calculation(const std::string& calculation)
{
g_quit_calculation = calculation;
Expand Down
6 changes: 6 additions & 0 deletions source/source_base/tool_quit.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ void WARNING(const std::string &file, const std::string &description);
*/
void set_quit_out_dir(const std::string& dir);

/**
* @brief Read back the injected global output directory.
* Returns an empty string if set_quit_out_dir was never called.
*/
const std::string& get_quit_out_dir();

/**
* @brief Inject the calculation tag used by CHECK_WARNING_QUIT to compose the
* fallback log filename ("running_<calculation>.log") when ofs_running
Expand Down
13 changes: 7 additions & 6 deletions source/source_basis/module_ao/ORB_atomic_lm.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "ORB_atomic_lm.h"
#include "source_base/sph_bessel_recursive.h"
#include "source_io/module_parameter/parameter.h"
#include "source_base/global_variable.h"
#include "source_base/tool_quit.h"
#include "source_base/module_external/blas_connector.h"
#include "source_base/timer.h"
#include "source_base/math_integral.h"
Expand Down Expand Up @@ -383,7 +384,7 @@ void Numerical_Orbital_Lm::use_uniform(const double &dr_uniform_in)
if(GlobalV::MY_RANK==0)
{
std::stringstream ss;
ss << PARAM.globalv.global_out_dir << this->label << "/"
ss << ModuleBase::get_quit_out_dir() << this->label << "/"
<< this->label << "-" << orbital_type << ".ORBITAL_NOR_uniform.txt";

std::ofstream ofs(ss.str().c_str());
Expand Down Expand Up @@ -722,16 +723,16 @@ void Numerical_Orbital_Lm::plot(void)const
if(GlobalV::MY_RANK==0)
{
std::stringstream ssr, ssk, ssru ,ssdru; // 2013-08-10 pengfei
ssr << PARAM.globalv.global_out_dir << this->label << "/"
ssr << ModuleBase::get_quit_out_dir() << this->label << "/"
<< this->label << "-"<< orbital_type << index_chi+1 << "-orbital-r.dat";

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

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

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

std::ofstream ofsr(ssr.str().c_str());
Expand Down
8 changes: 4 additions & 4 deletions source/source_basis/module_ao/ORB_nonlocal_lm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "source_base/math_sphbes.h"
#include "source_base/mathzone.h" /// use Polynomial_Interpolation_xy, Spherical_Bessel
#include "source_base/mathzone_add1.h" /// use SplineD2
#include "source_io/module_parameter/parameter.h"
#include "source_base/tool_quit.h"

#include <cassert>
#include <cmath>
Expand Down Expand Up @@ -237,13 +237,13 @@ void Numerical_Nonlocal_Lm::plot(const int &my_rank)const
if(my_rank==0)
{
std::stringstream ssr, ssk, ssru;
ssr << PARAM.globalv.global_out_dir << this->label << "/"
ssr << ModuleBase::get_quit_out_dir() << this->label << "/"
<< this->label << "-" << orbital_type << "-proj-r.dat";

ssk << PARAM.globalv.global_out_dir << this->label << "/"
ssk << ModuleBase::get_quit_out_dir() << this->label << "/"
<< this->label << "-" << orbital_type << "-proj-k.dat";

ssru << PARAM.globalv.global_out_dir << this->label << "/"
ssru << ModuleBase::get_quit_out_dir() << this->label << "/"
<< this->label << "-" << orbital_type << "-proj-ru.dat";

std::ofstream ofsr(ssr.str().c_str());
Expand Down
11 changes: 5 additions & 6 deletions source/source_basis/module_nao/two_center_bundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
#include "source_base/parallel_common.h"
#include "source_base/ylm.h"
#include "source_basis/module_nao/real_gaunt_table.h"
#include "source_io/module_parameter/parameter.h"

#include <memory>

void TwoCenterBundle::build_orb(int ntype, const std::string* file_orb0)
void TwoCenterBundle::build_orb(int ntype, const std::string* file_orb0, const std::string& orbital_dir)
{
std::vector<std::string> file_orb(ntype);
if (GlobalV::MY_RANK == 0)
{
std::transform(file_orb0, file_orb0 + ntype, file_orb.begin(), [](const std::string& file) {
return PARAM.inp.orbital_dir + file;
std::transform(file_orb0, file_orb0 + ntype, file_orb.begin(), [&orbital_dir](const std::string& file) {
return orbital_dir + file;
});
}
#ifdef __MPI
Expand All @@ -34,7 +33,7 @@ void TwoCenterBundle::build_beta(int ntype, Numerical_Nonlocal* nl)

void TwoCenterBundle::build_alpha(int ndesc, std::string* file_desc0)
{
if (PARAM.globalv.deepks_setorb)
if (ndesc > 0)
{
std::vector<std::string> file_desc(ndesc);
if (GlobalV::MY_RANK == 0)
Expand Down Expand Up @@ -245,7 +244,7 @@ void TwoCenterBundle::to_LCAO_Orbitals(LCAO_Orbitals& ORB,
(*orb_)(itype).to_numerical_orbital(ORB.Phi[itype], ORB.kmesh, ORB.dk, out_element_info, cal_force);
}

if (PARAM.globalv.deepks_setorb)
if (alpha_)
{
ORB.lmax_d = alpha_->lmax();
ORB.nchimax_d = alpha_->nzeta_max();
Expand Down
2 changes: 1 addition & 1 deletion source/source_basis/module_nao/two_center_bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TwoCenterBundle
TwoCenterBundle& operator=(TwoCenterBundle&&) = default;

// NOTE: some variables might be set only on RANK-0
void build_orb(int ntype, const std::string* file_orb0);
void build_orb(int ntype, const std::string* file_orb0, const std::string& orbital_dir);
void build_beta(int ntype, Numerical_Nonlocal* nl);
void build_alpha(int ndesc = 0, std::string* file_desc0 = nullptr);
void build_orb_onsite(const double& radius);
Expand Down
2 changes: 1 addition & 1 deletion source/source_lcao/LCAO_init_basis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void init_basis_lcao(Parallel_Orbitals& pv,
// * reading the localized orbitals/projectors
// * construct the interpolation tables.

two_center_bundle.build_orb(ucell.ntype, ucell.orbital_fn.data());
two_center_bundle.build_orb(ucell.ntype, ucell.orbital_fn.data(), PARAM.inp.orbital_dir);
two_center_bundle.build_alpha(PARAM.globalv.deepks_setorb, &ucell.descriptor_file);
two_center_bundle.build_orb_onsite(onsite_radius);
// currently deepks only use one descriptor file, so cast bool to int is
Expand Down
2 changes: 1 addition & 1 deletion source/source_lcao/module_lr/esolver_lrtd_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ LR::ESolver_LR<T, TR>::ESolver_LR(const Input_para& inp, UnitCell& ucell) : inpu
this->parameter_check();

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

LCAO_Orbitals orb;
two_center_bundle_.to_LCAO_Orbitals(orb, inp.lcao_ecut, inp.lcao_dk, inp.lcao_dr, inp.lcao_rmax,
Expand Down
Loading