Skip to content

Commit 00b3046

Browse files
committed
change ucell in module_ri/matirx_orb21.cpp
1 parent 5564184 commit 00b3046

File tree

9 files changed

+31
-17
lines changed

9 files changed

+31
-17
lines changed

source/module_ri/ABFs_Construct-PCA.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ namespace PCA
7272
}
7373

7474
std::vector<std::vector<std::pair<std::vector<double>, RI::Tensor<double>>>> cal_PCA(
75+
const UnitCell &ucell,
7576
const LCAO_Orbitals& orb,
7677
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &lcaos,
7778
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &abfs,
@@ -96,14 +97,14 @@ namespace PCA
9697
}
9798

9899
Matrix_Orbs21 m_abfslcaos_lcaos;
99-
m_abfslcaos_lcaos.init( 1, orb, kmesh_times, 1 );
100+
m_abfslcaos_lcaos.init( 1, ucell , orb, kmesh_times, 1 );
100101
m_abfslcaos_lcaos.init_radial( abfs, lcaos, lcaos );
101102

102103
std::map<std::size_t,std::map<std::size_t,std::set<double>>> delta_R;
103104
for( std::size_t it=0; it!=abfs.size(); ++it ) {
104105
delta_R[it][it] = {0.0};
105106
}
106-
m_abfslcaos_lcaos.init_radial_table(delta_R);
107+
m_abfslcaos_lcaos.init_radial_table(ucell.lat0,delta_R);
107108

108109
GlobalC::exx_info.info_ri.abfs_Lmax = Lmax_bak;
109110

source/module_ri/ABFs_Construct-PCA.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define ABFS_CONSTRUCT_PCA_H
33

44
#include "../module_basis/module_ao/ORB_read.h"
5+
#include "module_cell/unitcell.h"
56
#include <vector>
67
#include <RI/global/Tensor.h>
78

@@ -15,6 +16,7 @@ namespace ABFs_Construct
1516
namespace PCA
1617
{
1718
extern std::vector<std::vector<std::pair<std::vector<double>,RI::Tensor<double>>>> cal_PCA(
19+
const UnitCell& ucell,
1820
const LCAO_Orbitals &orb,
1921
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &lcaos,
2022
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &abfs, // abfs must be orthonormal

source/module_ri/Exx_LRI.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void Exx_LRI<Tdata>::init(const MPI_Comm &mpi_comm_in,
6262
// #endif
6363

6464
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>>
65-
abfs_same_atom = Exx_Abfs::Construct_Orbs::abfs_same_atom( orb, this->lcaos, this->info.kmesh_times, this->info.pca_threshold );
65+
abfs_same_atom = Exx_Abfs::Construct_Orbs::abfs_same_atom(ucell, orb, this->lcaos, this->info.kmesh_times, this->info.pca_threshold );
6666
if(this->info.files_abfs.empty()) {
6767
this->abfs = abfs_same_atom;
6868
} else {

source/module_ri/LRI_CV.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void LRI_CV<Tdata>::set_orbitals(
6666
this->m_abfs_abfs.init_radial( this->abfs_ccp, this->abfs );
6767
this->m_abfs_abfs.init_radial_table();
6868

69-
this->m_abfslcaos_lcaos.init( 1, orb, kmesh_times, 1 );
69+
this->m_abfslcaos_lcaos.init( 1, ucell , orb, kmesh_times, 1 );
7070
this->m_abfslcaos_lcaos.init_radial( this->abfs_ccp, this->lcaos, this->lcaos );
7171
this->m_abfslcaos_lcaos.init_radial_table();
7272

source/module_ri/Matrix_Orbs21.cpp

Lines changed: 9 additions & 4 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_Orbs21::init(const int mode, const LCAO_Orbitals& orb, const double kmesh_times, const double rmesh_times)
12+
void Matrix_Orbs21::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_Orbs21", "init");
1519
ModuleBase::timer::tick("Matrix_Orbs21", "init");
@@ -20,7 +24,7 @@ void Matrix_Orbs21::init(const int mode, const LCAO_Orbitals& orb, const double
2024
for (int it = 0; it < ntype; it++)
2125
{
2226
lmax_orb = std::max(lmax_orb, orb.Phi[it].getLmax());
23-
lmax_beta = std::max(lmax_beta, GlobalC::ucell.infoNL.Beta[it].getLmax());
27+
lmax_beta = std::max(lmax_beta, ucell.infoNL.Beta[it].getLmax());
2428
}
2529
const double dr = orb.get_dR();
2630
const double dk = orb.get_dk();
@@ -116,7 +120,8 @@ void Matrix_Orbs21::init_radial_table()
116120
ModuleBase::timer::tick("Matrix_Orbs21", "init_radial_table");
117121
}
118122

119-
void Matrix_Orbs21::init_radial_table(const std::map<size_t, std::map<size_t, std::set<double>>>& Rs)
123+
void Matrix_Orbs21::init_radial_table(const double lat0,
124+
const std::map<size_t, std::map<size_t, std::set<double>>>& Rs)
120125
{
121126
ModuleBase::TITLE("Matrix_Orbs21", "init_radial_table_Rs");
122127
ModuleBase::timer::tick("Matrix_Orbs21", "init_radial_table");
@@ -133,7 +138,7 @@ void Matrix_Orbs21::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)
139144
radials.insert(iq + i);

source/module_ri/Matrix_Orbs21.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "module_basis/module_ao/ORB_gaunt_table.h"
1212
#include "module_basis/module_ao/ORB_read.h"
1313
#include "module_hamilt_lcao/hamilt_lcaodft/center2_orb-orb21.h"
14-
14+
#include "module_cell/unitcell.h"
1515
#include <RI/global/Tensor.h>
1616
#include <map>
1717
#include <set>
@@ -23,6 +23,7 @@ class Matrix_Orbs21
2323
// mode:
2424
// 1: <jYs lcaos|lcaos> <abfs lcaos|lcaos>
2525
void init(const int mode,
26+
const UnitCell& ucell,
2627
const LCAO_Orbitals& orb,
2728
const double kmesh_times, // extend Kcut, keep dK
2829
const double rmesh_times); // extend Rcut, keep dR
@@ -35,7 +36,8 @@ class Matrix_Orbs21
3536
const LCAO_Orbitals& orb_B);
3637

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

4042
enum class Matrix_Order
4143
{

source/module_ri/exx_abfs-construct_orbs.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> Exx_Abfs::Construct_
8888

8989
// P = f * Y
9090
std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> Exx_Abfs::Construct_Orbs::abfs_same_atom(
91+
const UnitCell &ucell,
9192
const LCAO_Orbitals& orb,
9293
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &orbs,
9394
const double kmesh_times_mot,
@@ -111,7 +112,7 @@ std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> Exx_Abfs::Construct_
111112
#endif
112113

113114
const std::vector<std::vector<std::vector<std::vector<double>>>>
114-
abfs_same_atom_pca_psi = pca( orb, abfs_same_atom, orbs, kmesh_times_mot, times_threshold );
115+
abfs_same_atom_pca_psi = pca(ucell,orb, abfs_same_atom, orbs, kmesh_times_mot, times_threshold );
115116

116117
#if TEST_EXX_LCAO==1
117118
print_orbs(abfs_same_atom_pca_psi,"abfs_same_atom_pca_psi.dat");
@@ -267,6 +268,7 @@ std::vector<std::vector<std::vector<std::vector<double>>>> Exx_Abfs::Construct_O
267268
}
268269

269270
std::vector<std::vector<std::vector<std::vector<double>>>> Exx_Abfs::Construct_Orbs::pca(
271+
const UnitCell &ucell,
270272
const LCAO_Orbitals& orb,
271273
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &abfs,
272274
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &orbs,
@@ -277,7 +279,7 @@ std::vector<std::vector<std::vector<std::vector<double>>>> Exx_Abfs::Construct_O
277279
return std::vector<std::vector<std::vector<std::vector<double>>>>(abfs.size());
278280

279281
const std::vector<std::vector<std::pair<std::vector<double>,RI::Tensor<double>>>>
280-
eig = ABFs_Construct::PCA::cal_PCA( orb, orbs, abfs, kmesh_times_mot );
282+
eig = ABFs_Construct::PCA::cal_PCA(ucell, orb, orbs, abfs, kmesh_times_mot );
281283

282284
const std::vector<std::vector<std::vector<std::vector<double>>>> psis = get_psi( abfs );
283285
std::vector<std::vector<std::vector<std::vector<double>>>> psis_new( psis.size() );

source/module_ri/exx_abfs-construct_orbs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Exx_Abfs::Construct_Orbs
2020
const double kmesh_times );
2121

2222
static std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> abfs_same_atom(
23+
const UnitCell &ucell,
2324
const LCAO_Orbitals& orb,
2425
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &lcaos,
2526
const double kmesh_times_mot,
@@ -43,6 +44,7 @@ class Exx_Abfs::Construct_Orbs
4344
const double norm_threshold = std::numeric_limits<double>::min() );
4445

4546
static std::vector<std::vector<std::vector<std::vector<double>>>> pca(
47+
const UnitCell &ucell,
4648
const LCAO_Orbitals& orb,
4749
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &abfs,
4850
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>> &orbs,

source/module_ri/exx_opt_orb.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void Exx_Opt_Orb::generate_matrix(const K_Vectors &kv, const UnitCell& ucell, co
2626
lcaos = Exx_Abfs::Construct_Orbs::change_orbs( orb, this->kmesh_times );
2727

2828
const std::vector<std::vector<std::vector<Numerical_Orbital_Lm>>>
29-
abfs = Exx_Abfs::Construct_Orbs::abfs_same_atom( orb, lcaos, this->kmesh_times, GlobalC::exx_info.info_ri.pca_threshold );
29+
abfs = Exx_Abfs::Construct_Orbs::abfs_same_atom(ucell,orb, lcaos, this->kmesh_times, GlobalC::exx_info.info_ri.pca_threshold );
3030

3131
// ofs_mpi<<"memory:\t"<<get_memory(10)<<std::endl;
3232

@@ -89,10 +89,10 @@ void Exx_Opt_Orb::generate_matrix(const K_Vectors &kv, const UnitCell& ucell, co
8989
const auto ms_lcaoslcaos_jys = [&]() -> std::map<size_t,std::map<size_t,std::map<size_t,std::map<size_t,std::vector<RI::Tensor<double>>>>>>
9090
{
9191
Matrix_Orbs21 m_jyslcaos_lcaos;
92-
m_jyslcaos_lcaos.init( 1, orb, this->kmesh_times, 1 );
92+
m_jyslcaos_lcaos.init( 1, ucell , orb, this->kmesh_times, 1 );
9393
m_jyslcaos_lcaos.init_radial( jle.jle, lcaos, lcaos );
9494
#if TEST_EXX_RADIAL>=1
95-
m_jyslcaos_lcaos.init_radial_table(radial_R);
95+
m_jyslcaos_lcaos.init_radial_table(ucell.lat0, radial_R);
9696
#else
9797
m_jyslcaos_lcaos.init_radial_table();
9898
#endif
@@ -137,10 +137,10 @@ void Exx_Opt_Orb::generate_matrix(const K_Vectors &kv, const UnitCell& ucell, co
137137
const auto ms_lcaoslcaos_abfs = [&]() -> std::map<size_t,std::map<size_t,std::map<size_t,std::map<size_t,std::vector<RI::Tensor<double>>>>>>
138138
{
139139
Matrix_Orbs21 m_abfslcaos_lcaos;
140-
m_abfslcaos_lcaos.init( 1, orb, this->kmesh_times, 1 );
140+
m_abfslcaos_lcaos.init( 1, ucell , orb, this->kmesh_times, 1 );
141141
m_abfslcaos_lcaos.init_radial( abfs, lcaos, lcaos );
142142
#if TEST_EXX_RADIAL>=1
143-
m_abfslcaos_lcaos.init_radial_table(radial_R);
143+
m_abfslcaos_lcaos.init_radial_table(ucell.lat0,radial_R);
144144
#else
145145
m_abfslcaos_lcaos.init_radial_table();
146146
#endif

0 commit comments

Comments
 (0)