Skip to content

Commit f68dc9f

Browse files
authored
init nonlocal beta orbitals only when necessary (#5511)
1 parent 8c9e0da commit f68dc9f

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

source/module_basis/module_nao/two_center_bundle.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void TwoCenterBundle::tabulate()
6363
{
6464
ModuleBase::SphericalBesselTransformer sbt(true);
6565
orb_->set_transformer(sbt);
66-
beta_->set_transformer(sbt);
66+
if (beta_) { beta_->set_transformer(sbt); }
6767
if (alpha_) {
6868
alpha_->set_transformer(sbt);
6969
}
@@ -75,22 +75,17 @@ void TwoCenterBundle::tabulate()
7575
// build two-center integration tables
7676
//================================================================
7777
// set up a universal radial grid
78-
double rmax = std::max(orb_->rcut_max(), beta_->rcut_max());
79-
if (alpha_) {
80-
rmax = std::max(rmax, alpha_->rcut_max());
81-
}
78+
double rmax = orb_->rcut_max();
79+
if (beta_) { rmax = std::max(rmax, beta_->rcut_max()); }
80+
if (alpha_) { rmax = std::max(rmax, alpha_->rcut_max()); }
8281
double dr = 0.01;
8382
double cutoff = 2.0 * rmax;
8483
int nr = static_cast<int>(rmax / dr) + 1;
8584

8685
orb_->set_uniform_grid(true, nr, cutoff, 'i', true);
87-
beta_->set_uniform_grid(true, nr, cutoff, 'i', true);
88-
if (alpha_) {
89-
alpha_->set_uniform_grid(true, nr, cutoff, 'i', true);
90-
}
91-
if (orb_onsite_) {
92-
orb_onsite_->set_uniform_grid(true, nr, cutoff, 'i', true);
93-
}
86+
if (beta_) { beta_->set_uniform_grid(true, nr, cutoff, 'i', true); }
87+
if (alpha_) { alpha_->set_uniform_grid(true, nr, cutoff, 'i', true);}
88+
if (orb_onsite_) { orb_onsite_->set_uniform_grid(true, nr, cutoff, 'i', true);}
9489

9590
// build TwoCenterIntegrator objects
9691
kinetic_orb = std::unique_ptr<TwoCenterIntegrator>(new TwoCenterIntegrator);
@@ -101,9 +96,12 @@ void TwoCenterBundle::tabulate()
10196
overlap_orb->tabulate(*orb_, *orb_, 'S', nr, cutoff);
10297
ModuleBase::Memory::record("TwoCenterTable: Overlap", overlap_orb->table_memory());
10398

104-
overlap_orb_beta = std::unique_ptr<TwoCenterIntegrator>(new TwoCenterIntegrator);
105-
overlap_orb_beta->tabulate(*orb_, *beta_, 'S', nr, cutoff);
106-
ModuleBase::Memory::record("TwoCenterTable: Nonlocal", overlap_orb_beta->table_memory());
99+
if (beta_)
100+
{
101+
overlap_orb_beta = std::unique_ptr<TwoCenterIntegrator>(new TwoCenterIntegrator);
102+
overlap_orb_beta->tabulate(*orb_, *beta_, 'S', nr, cutoff);
103+
ModuleBase::Memory::record("TwoCenterTable: Nonlocal", overlap_orb_beta->table_memory());
104+
}
107105

108106
if (alpha_)
109107
{

source/module_hamilt_lcao/hamilt_lcaodft/LCAO_init_basis.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ void init_basis_lcao(Parallel_Orbitals& pv,
5555
// on the old interface for now.
5656
two_center_bundle.to_LCAO_Orbitals(orb, lcao_ecut, lcao_dk, lcao_dr, lcao_rmax);
5757

58-
ucell.infoNL.setupNonlocal(ucell.ntype, ucell.atoms, GlobalV::ofs_running, orb);
59-
60-
two_center_bundle.build_beta(ucell.ntype, ucell.infoNL.Beta);
58+
if (PARAM.inp.vnl_in_h)
59+
{
60+
ucell.infoNL.setupNonlocal(ucell.ntype, ucell.atoms, GlobalV::ofs_running, orb);
61+
two_center_bundle.build_beta(ucell.ntype, ucell.infoNL.Beta);
62+
}
6163

6264
int Lmax = 0;
6365
#ifdef __EXX

0 commit comments

Comments
 (0)