Skip to content

Commit 402cc4a

Browse files
committed
change file in the LCAO_hamilt.hpp
1 parent 0b18f08 commit 402cc4a

File tree

8 files changed

+26
-15
lines changed

8 files changed

+26
-15
lines changed

source/module_hamilt_lcao/hamilt_lcaodft/LCAO_hamilt.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
template <typename Tdata>
2424
void sparse_format::cal_HR_exx(
25+
const UnitCell& ucell,
2526
const Parallel_Orbitals& pv,
2627
LCAO_HS_Arrays& HS_Arrays,
2728
const int& current_spin,
@@ -36,15 +37,15 @@ void sparse_format::cal_HR_exx(
3637
const Tdata frac = GlobalC::exx_info.info_global.hybrid_alpha;
3738

3839
std::map<int, std::array<double, 3>> atoms_pos;
39-
for (int iat = 0; iat < GlobalC::ucell.nat; ++iat) {
40+
for (int iat = 0; iat < ucell.nat; ++iat) {
4041
atoms_pos[iat] = RI_Util::Vector3_to_array3(
41-
GlobalC::ucell.atoms[GlobalC::ucell.iat2it[iat]]
42-
.tau[GlobalC::ucell.iat2ia[iat]]);
42+
ucell.atoms[ucell.iat2it[iat]]
43+
.tau[ucell.iat2ia[iat]]);
4344
}
4445
const std::array<std::array<double, 3>, 3> latvec
45-
= {RI_Util::Vector3_to_array3(GlobalC::ucell.a1), // too bad to use GlobalC here,
46-
RI_Util::Vector3_to_array3(GlobalC::ucell.a2),
47-
RI_Util::Vector3_to_array3(GlobalC::ucell.a3)};
46+
= {RI_Util::Vector3_to_array3(ucell.a1), // too bad to use GlobalC here,
47+
RI_Util::Vector3_to_array3(ucell.a2),
48+
RI_Util::Vector3_to_array3(ucell.a3)};
4849

4950
const std::array<int, 3> Rs_period = {nmp[0], nmp[1], nmp[2]};
5051

source/module_hamilt_lcao/hamilt_lcaodft/spar_exx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <map>
1010
#include <vector>
1111

12+
#include "module_cell/unitcell.h"
1213
#include "module_hamilt_lcao/hamilt_lcaodft/LCAO_HS_arrays.hpp"
1314
#include "module_basis/module_ao/parallel_orbitals.h"
1415

@@ -17,6 +18,7 @@ namespace sparse_format
1718

1819
template <typename Tdata>
1920
void cal_HR_exx(
21+
const UnitCell& ucell,
2022
const Parallel_Orbitals& pv,
2123
LCAO_HS_Arrays& HS_Arrays,
2224
const int& current_spin,

source/module_hamilt_lcao/hamilt_lcaodft/spar_hsr.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
#include "spar_exx.h"
88
#include "spar_u.h"
99

10-
void sparse_format::cal_HSR(const Parallel_Orbitals& pv,
10+
void sparse_format::cal_HSR(const UnitCell& ucell,
11+
const Parallel_Orbitals& pv,
1112
LCAO_HS_Arrays& HS_Arrays,
1213
Grid_Driver& grid,
1314
const int& current_spin,
@@ -99,7 +100,9 @@ void sparse_format::cal_HSR(const Parallel_Orbitals& pv,
99100
if (GlobalC::exx_info.info_global.cal_exx) {
100101
if (Hexxd && GlobalC::exx_info.info_ri.real_number)
101102
{
102-
sparse_format::cal_HR_exx(pv,
103+
sparse_format::cal_HR_exx(
104+
ucell,
105+
pv,
103106
HS_Arrays,
104107
current_spin,
105108
sparse_thr,
@@ -108,7 +111,9 @@ void sparse_format::cal_HSR(const Parallel_Orbitals& pv,
108111
}
109112
else if (Hexxc && !GlobalC::exx_info.info_ri.real_number)
110113
{
111-
sparse_format::cal_HR_exx(pv,
114+
sparse_format::cal_HR_exx(
115+
ucell,
116+
pv,
112117
HS_Arrays,
113118
current_spin,
114119
sparse_thr,

source/module_hamilt_lcao/hamilt_lcaodft/spar_hsr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
namespace sparse_format {
77
using TAC = std::pair<int, std::array<int, 3>>;
8-
void cal_HSR(const Parallel_Orbitals& pv,
8+
void cal_HSR(const UnitCell& ucell,
9+
const Parallel_Orbitals& pv,
910
LCAO_HS_Arrays& HS_Arrays,
1011
Grid_Driver& grid,
1112
const int& current_spin,

source/module_hamilt_pw/hamilt_pwdft/forces_cc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void Forces<FPTYPE, Device>::cal_force_cc(ModuleBase::matrix& forcecc,
3333
ModulePW::PW_Basis* rho_basis,
3434
const Charge* const chr,
3535
const bool* numeric,
36-
UnitCell& ucell_in)
36+
UnitCell& ucell_in)
3737
{
3838
ModuleBase::TITLE("Forces", "cal_force_cc");
3939
// recalculate the exchange-correlation potential.

source/module_io/output_mat_sparse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void output_mat_sparse(const bool& out_mat_hsR,
4545
//! generate a file containing the Hamiltonian and S(overlap) matrices
4646
if (out_mat_hsR)
4747
{
48-
output_HSR(istep, v_eff, pv, HS_Arrays, grid, kv, p_ham);
48+
output_HSR(istep, ucell, v_eff, pv, HS_Arrays, grid, kv, p_ham);
4949
}
5050

5151
//! generate a file containing the kinetic energy matrix

source/module_io/write_HS_R.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// If the absolute value of the matrix element is less than or equal to the
1414
// 'sparse_thr', it will be ignored.
1515
void ModuleIO::output_HSR(const int& istep,
16+
const UnitCell& ucell,
1617
const ModuleBase::matrix& v_eff,
1718
const Parallel_Orbitals& pv,
1819
LCAO_HS_Arrays& HS_Arrays,
@@ -37,7 +38,7 @@ void ModuleIO::output_HSR(const int& istep,
3738
if (nspin == 1 || nspin == 4) {
3839
const int spin_now = 0;
3940
// jingan add 2021-6-4, modify 2021-12-2
40-
sparse_format::cal_HSR(pv, HS_Arrays, grid, spin_now, sparse_thr, kv.nmp, p_ham
41+
sparse_format::cal_HSR(ucell,pv, HS_Arrays, grid, spin_now, sparse_thr, kv.nmp, p_ham
4142
#ifdef __EXX
4243
, Hexxd, Hexxc
4344
#endif
@@ -47,7 +48,7 @@ void ModuleIO::output_HSR(const int& istep,
4748
int spin_now = 1;
4849

4950
// save HR of spin down first (the current spin always be down)
50-
sparse_format::cal_HSR(pv, HS_Arrays, grid, spin_now, sparse_thr, kv.nmp, p_ham
51+
sparse_format::cal_HSR(ucell,pv, HS_Arrays, grid, spin_now, sparse_thr, kv.nmp, p_ham
5152
#ifdef __EXX
5253
, Hexxd, Hexxc
5354
#endif
@@ -61,7 +62,7 @@ void ModuleIO::output_HSR(const int& istep,
6162
spin_now = 0;
6263
}
6364

64-
sparse_format::cal_HSR(pv, HS_Arrays, grid, spin_now, sparse_thr, kv.nmp, p_ham
65+
sparse_format::cal_HSR(ucell,pv, HS_Arrays, grid, spin_now, sparse_thr, kv.nmp, p_ham
6566
#ifdef __EXX
6667
, Hexxd, Hexxc
6768
#endif

source/module_io/write_HS_R.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace ModuleIO
1212
{
1313
using TAC = std::pair<int, std::array<int, 3>>;
1414
void output_HSR(const int& istep,
15+
const UnitCell& ucell,
1516
const ModuleBase::matrix& v_eff,
1617
const Parallel_Orbitals& pv,
1718
LCAO_HS_Arrays& HS_Arrays,

0 commit comments

Comments
 (0)