Skip to content

Commit 5564184

Browse files
committed
change ucell in module_ri/matirx_orb11.cpp
1 parent d7a453c commit 5564184

File tree

6 files changed

+52
-42
lines changed

6 files changed

+52
-42
lines changed

source/module_ri/Exx_LRI.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ void Exx_LRI<Tdata>::init(const MPI_Comm &mpi_comm_in,
9797
}
9898

9999
this->cv.set_orbitals(
100+
ucell,
100101
orb,
101102
this->lcaos, this->abfs, this->abfs_ccp,
102103
this->info.kmesh_times, this->info.ccp_rmesh_times );

source/module_ri/LRI_CV.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class LRI_CV
3434
~LRI_CV();
3535

3636
void set_orbitals(
37+
const UnitCell &ucell,
3738
const LCAO_Orbitals& orb,
3839
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &lcaos_in,
3940
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &abfs_in,

source/module_ri/LRI_CV.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ LRI_CV<Tdata>::~LRI_CV()
3737

3838
template<typename Tdata>
3939
void LRI_CV<Tdata>::set_orbitals(
40+
const UnitCell &ucell,
4041
const LCAO_Orbitals& orb,
4142
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &lcaos_in,
4243
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &abfs_in,
@@ -61,7 +62,7 @@ void LRI_CV<Tdata>::set_orbitals(
6162
range_abfs = Exx_Abfs::Abfs_Index::construct_range( abfs );
6263
this->index_abfs = ModuleBase::Element_Basis_Index::construct_index( range_abfs );
6364

64-
this->m_abfs_abfs.init( 2, orb, kmesh_times, (1+this->ccp_rmesh_times)/2.0 );
65+
this->m_abfs_abfs.init( 2, ucell,orb, kmesh_times, (1+this->ccp_rmesh_times)/2.0 );
6566
this->m_abfs_abfs.init_radial( this->abfs_ccp, this->abfs );
6667
this->m_abfs_abfs.init_radial_table();
6768

source/module_ri/Matrix_Orbs11.cpp

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
#include "module_base/tool_title.h"
1010
#include "module_hamilt_pw/hamilt_pwdft/global.h"
1111

12-
void Matrix_Orbs11::init(const int mode, const LCAO_Orbitals& orb, const double kmesh_times, const double rmesh_times)
12+
void Matrix_Orbs11::init(const int mode,
13+
const UnitCell& ucell,
14+
const LCAO_Orbitals& orb,
15+
const double kmesh_times,
16+
const double rmesh_times)
1317
{
1418
ModuleBase::TITLE("Matrix_Orbs11", "init");
1519
ModuleBase::timer::tick("Matrix_Orbs11", "init");
@@ -21,7 +25,7 @@ void Matrix_Orbs11::init(const int mode, const LCAO_Orbitals& orb, const double
2125
for (int it = 0; it < ntype; it++)
2226
{
2327
lmax_orb = std::max(lmax_orb, orb.Phi[it].getLmax());
24-
lmax_beta = std::max(lmax_beta, GlobalC::ucell.infoNL.Beta[it].getLmax());
28+
lmax_beta = std::max(lmax_beta, ucell.infoNL.Beta[it].getLmax());
2529
}
2630
const double dr = orb.get_dR();
2731
const double dk = orb.get_dk();
@@ -64,13 +68,13 @@ void Matrix_Orbs11::init_radial(const std::vector<std::vector<std::vector<Numeri
6468
for (size_t NB = 0; NB != orb_B[TB][LB].size(); ++NB) {
6569
center2_orb11_s[TA][TB][LA][NA][LB].insert(std::make_pair(
6670
NB,
67-
Center2_Orb::Orb11(orb_A[TA][LA][NA], orb_B[TB][LB][NB], psb_, this->MGT)));
68-
}
69-
}
70-
}
71-
}
72-
}
73-
}
71+
Center2_Orb::Orb11(orb_A[TA][LA][NA], orb_B[TB][LB][NB], psb_, this->MGT)));
72+
}
73+
}
74+
}
75+
}
76+
}
77+
}
7478
ModuleBase::timer::tick("Matrix_Orbs11", "init_radial");
7579
}
7680

@@ -89,13 +93,13 @@ void Matrix_Orbs11::init_radial(const LCAO_Orbitals& orb_A, const LCAO_Orbitals&
8993
Center2_Orb::Orb11(orb_A.Phi[TA].PhiLN(LA, NA),
9094
orb_B.Phi[TB].PhiLN(LB, NB),
9195
psb_,
92-
this->MGT)));
93-
}
94-
}
95-
}
96-
}
97-
}
98-
}
96+
this->MGT)));
97+
}
98+
}
99+
}
100+
}
101+
}
102+
}
99103
ModuleBase::timer::tick("Matrix_Orbs11", "init_radial");
100104
}
101105

@@ -109,17 +113,18 @@ void Matrix_Orbs11::init_radial_table()
109113
for (auto& coD: coC.second) {
110114
for (auto& coE: coD.second) {
111115
for (auto& coF: coE.second) {
112-
coF.second.init_radial_table();
113-
}
114-
}
115-
}
116-
}
117-
}
118-
}
116+
coF.second.init_radial_table();
117+
}
118+
}
119+
}
120+
}
121+
}
122+
}
119123
ModuleBase::timer::tick("Matrix_Orbs11", "init_radial_table");
120124
}
121125

122-
void Matrix_Orbs11::init_radial_table(const std::map<size_t, std::map<size_t, std::set<double>>>& Rs)
126+
void Matrix_Orbs11::init_radial_table(const double lat0,
127+
const std::map<size_t, std::map<size_t, std::set<double>>>& Rs)
123128
{
124129
ModuleBase::TITLE("Matrix_Orbs11", "init_radial_table_Rs");
125130
ModuleBase::timer::tick("Matrix_Orbs11", "init_radial_table");
@@ -133,23 +138,23 @@ void Matrix_Orbs11::init_radial_table(const std::map<size_t, std::map<size_t, st
133138
std::set<size_t> radials;
134139
for (const double& R: RsB.second)
135140
{
136-
const double position = R * GlobalC::ucell.lat0 / lcao_dr_;
141+
const double position = R * lat0 / lcao_dr_;
137142
const size_t iq = static_cast<size_t>(position);
138143
for (size_t i = 0; i != 4; ++i) {
139-
radials.insert(iq + i);
140-
}
144+
radials.insert(iq + i);
145+
}
141146
}
142147
for (auto& coC: *center2_orb11_sAB) {
143148
for (auto& coD: coC.second) {
144149
for (auto& coE: coD.second) {
145150
for (auto& coF: coE.second) {
146-
coF.second.init_radial_table(radials);
147-
}
148-
}
149-
}
150-
}
151+
coF.second.init_radial_table(radials);
152+
}
153+
}
154+
}
155+
}
151156
}
152-
}
157+
}
153158
}
154159
ModuleBase::timer::tick("Matrix_Orbs11", "init_radial_table");
155160
}

source/module_ri/Matrix_Orbs11.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "module_basis/module_ao/ORB_gaunt_table.h"
1313
#include "module_basis/module_ao/ORB_read.h"
1414
#include "module_hamilt_lcao/hamilt_lcaodft/center2_orb-orb11.h"
15-
15+
#include "module_cell/unitcell.h"
1616
#include <RI/global/Tensor.h>
1717
#include <map>
1818
#include <set>
@@ -25,6 +25,7 @@ class Matrix_Orbs11
2525
// 1: <lcaos|lcaos>
2626
// 2: <jYs|jYs> <abfs|abfs>
2727
void init(const int mode,
28+
const UnitCell& ucell,
2829
const LCAO_Orbitals& orb,
2930
const double kmesh_times, // extend Kcut, keep dK
3031
const double rmesh_times); // extend Rcut, keep dR
@@ -34,7 +35,8 @@ class Matrix_Orbs11
3435
void init_radial(const LCAO_Orbitals& orb_A, const LCAO_Orbitals& orb_B);
3536

3637
void init_radial_table();
37-
void init_radial_table(const std::map<size_t, std::map<size_t, std::set<double>>>& Rs); // unit: ucell.lat0
38+
void init_radial_table(const double lat0,
39+
const std::map<size_t, std::map<size_t, std::set<double>>>& Rs); // unit: ucell.lat0
3840

3941
enum class Matrix_Order
4042
{

source/module_ri/exx_opt_orb.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ void Exx_Opt_Orb::generate_matrix(const K_Vectors &kv, const UnitCell& ucell, co
105105
const auto ms_jys_jys = [&]() -> std::map<size_t,std::map<size_t,std::map<size_t,std::map<size_t,RI::Tensor<double>>>>>
106106
{
107107
Matrix_Orbs11 m_jys_jys;
108-
m_jys_jys.init( 2, orb, this->kmesh_times, 1 );
108+
m_jys_jys.init( 2,ucell,orb, this->kmesh_times, 1 );
109109
m_jys_jys.init_radial( jle.jle, jle.jle );
110110
#if TEST_EXX_RADIAL>=1
111-
m_jys_jys.init_radial_table(radial_R);
111+
m_jys_jys.init_radial_table(ucell.lat0,radial_R);
112112
#else
113113
m_jys_jys.init_radial_table();
114114
#endif
@@ -121,10 +121,10 @@ void Exx_Opt_Orb::generate_matrix(const K_Vectors &kv, const UnitCell& ucell, co
121121
const auto ms_abfs_abfs = [&]() -> std::map<size_t,std::map<size_t,std::map<size_t,std::map<size_t,RI::Tensor<double>>>>>
122122
{
123123
Matrix_Orbs11 m_abfs_abfs;
124-
m_abfs_abfs.init( 2, orb, this->kmesh_times, 1 );
124+
m_abfs_abfs.init( 2, ucell, orb, this->kmesh_times, 1 );
125125
m_abfs_abfs.init_radial( abfs, abfs );
126126
#if TEST_EXX_RADIAL>=1
127-
m_abfs_abfs.init_radial_table(radial_R);
127+
m_abfs_abfs.init_radial_table(ucell.lat0,radial_R);
128128
#else
129129
m_abfs_abfs.init_radial_table();
130130
#endif
@@ -153,10 +153,10 @@ void Exx_Opt_Orb::generate_matrix(const K_Vectors &kv, const UnitCell& ucell, co
153153
const auto ms_jys_abfs = [&]() -> std::map<size_t,std::map<size_t,std::map<size_t,std::map<size_t,RI::Tensor<double>>>>>
154154
{
155155
Matrix_Orbs11 m_jys_abfs;
156-
m_jys_abfs.init( 2, orb, this->kmesh_times, 1 );
156+
m_jys_abfs.init( 2, ucell,orb, this->kmesh_times, 1 );
157157
m_jys_abfs.init_radial( jle.jle, abfs );
158158
#if TEST_EXX_RADIAL>=1
159-
m_jys_abfs.init_radial_table(radial_R);
159+
m_jys_abfs.init_radial_table(ucell.lat0,radial_R);
160160
#else
161161
m_jys_abfs.init_radial_table();
162162
#endif

0 commit comments

Comments
 (0)