Skip to content

Commit 32ee682

Browse files
authored
Merge branch 'develop' into hotfix
2 parents 15e6673 + 706633f commit 32ee682

File tree

18 files changed

+111
-37
lines changed

18 files changed

+111
-37
lines changed

examples/hefei-namd/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Example case for Hefei-NAMD.
22
If cal_syns = 1 , the maximum displacement of all atoms in one step dmax(bohr) need to be set for calculating asynchronous overlap matrix.
3-
Find overlap matrix file in OUT.autotest/data-0-S and wavefunction file in OUT.autotest/LOWF_GAMMA_S1.dat .
3+
Find overlap matrix file in OUT.autotest/data-0-S and wavefunction file in OUT.autotest/WFC_NAO_GAMMA1.dat .

examples/wfc/README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ The wave function is output in a file called 'WAVEFUNC1.txt'
1111

1212
For LCAO basis:
1313
- set 'out_wfc_lcao' to '1'
14-
Several `LOWF_K_#.dat` files will be output in multi-k calculation and
15-
`LOWF_GAMMA_S1.dat` in gamma-only calculation.
14+
Several `WFC_NAO_K#.txt` files will be output in multi-k calculation and
15+
`WFC_NAO_GAMMA1.txt` in gamma-only calculation.
1616

1717

1818
For the wave functions in Real Space:

source/module_cell/module_neighbor/sltk_grid.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,19 @@ void Grid::setMemberVariables(std::ofstream& ofs_in, // output data to ofs
152152
this->clear_atoms();
153153

154154
// random selection, in order to estimate again.
155-
this->x_min = ucell.atoms[0].tau[0].x;
156-
this->y_min = ucell.atoms[0].tau[0].y;
157-
this->z_min = ucell.atoms[0].tau[0].z;
158-
this->x_max = ucell.atoms[0].tau[0].x;
159-
this->y_max = ucell.atoms[0].tau[0].y;
160-
this->z_max = ucell.atoms[0].tau[0].z;
155+
for (int it = 0; it < ucell.ntype; it++)
156+
{
157+
if (ucell.atoms[it].na > 0)
158+
{
159+
this->x_min = ucell.atoms[it].tau[0].x;
160+
this->y_min = ucell.atoms[it].tau[0].y;
161+
this->z_min = ucell.atoms[it].tau[0].z;
162+
this->x_max = ucell.atoms[it].tau[0].x;
163+
this->y_max = ucell.atoms[it].tau[0].y;
164+
this->z_max = ucell.atoms[it].tau[0].z;
165+
break;
166+
}
167+
}
161168

162169
ModuleBase::Vector3<double> vec1(ucell.latvec.e11, ucell.latvec.e12, ucell.latvec.e13);
163170
ModuleBase::Vector3<double> vec2(ucell.latvec.e21, ucell.latvec.e22, ucell.latvec.e23);

source/module_io/write_wfc_nao.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ void wfc_nao_write2file(const std::string &name, const double* ctot, const int n
108108
ofs << "\n" << wg(ik,i) << " (Occupations)";
109109
for (int j=0; j<nlocal; j++)
110110
{
111-
if (j % 5 == 0) ofs << "\n";
111+
if (j % 5 == 0) { ofs << "\n";
112+
}
112113
ofs << ctot[i*nlocal + j] << " ";
113114
}
114115
}
@@ -173,8 +174,8 @@ void wfc_nao_write2file_complex(const std::string &name, const std::complex<doub
173174
{
174175
ModuleBase::WARNING("ModuleIO::write_wfc_nao","Can't write local orbital wave functions.");
175176
}
176-
ofs << std::setprecision(25);
177-
ofs << ik+1 << " (index of k points)" << std::endl;
177+
ofs << std::setprecision(8);
178+
ofs << ik+1 << " (index of k points)" << std::endl;
178179
ofs << kvec_c.x << " " << kvec_c.y << " " << kvec_c.z << std::endl;
179180
ofs << nbands << " (number of bands)" << std::endl;
180181
ofs << nlocal << " (number of orbitals)";
@@ -189,7 +190,8 @@ void wfc_nao_write2file_complex(const std::string &name, const std::complex<doub
189190
ofs << "\n" << wg(ik,i) << " (Occupations)";
190191
for (int j=0; j<nlocal; j++)
191192
{
192-
if (j % 5 == 0) ofs << "\n";
193+
if (j % 5 == 0) { ofs << "\n";
194+
}
193195
ofs << ctot[i*nlocal + j].real() << " " << ctot[i*nlocal + j].imag() << " ";
194196
}
195197
}

source/module_lr/AX/AX.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ namespace LR
1313
const psi::Psi<double>& c,
1414
const int& nocc,
1515
const int& nvirt,
16-
double* AX_istate);
16+
double* const AX_istate);
1717
void cal_AX_blas(
1818
const std::vector<container::Tensor>& V_istate,
1919
const psi::Psi<double>& c,
2020
const int& nocc,
2121
const int& nvirt,
22-
double* AX_istate,
22+
double* const AX_istate,
2323
const bool add_on = true);
2424
#ifdef __MPI
2525
void cal_AX_pblas(
@@ -31,7 +31,7 @@ namespace LR
3131
const int& nocc,
3232
const int& nvirt,
3333
const Parallel_2D& pX,
34-
double* AX_istate,
34+
double* const AX_istate,
3535
const bool add_on=true);
3636
#endif
3737
// complex
@@ -40,13 +40,13 @@ namespace LR
4040
const psi::Psi<std::complex<double>>& c,
4141
const int& nocc,
4242
const int& nvirt,
43-
std::complex<double>* AX_istate);
43+
std::complex<double>* const AX_istate);
4444
void cal_AX_blas(
4545
const std::vector<container::Tensor>& V_istate,
4646
const psi::Psi<std::complex<double>>& c,
4747
const int& nocc,
4848
const int& nvirt,
49-
std::complex<double>* AX_istate,
49+
std::complex<double>* const AX_istate,
5050
const bool add_on = true);
5151

5252
#ifdef __MPI
@@ -59,7 +59,7 @@ namespace LR
5959
const int& nocc,
6060
const int& nvirt,
6161
const Parallel_2D& pX,
62-
std::complex<double>* AX_istate,
62+
std::complex<double>* const AX_istate,
6363
const bool add_on = true);
6464
#endif
6565
}

source/module_lr/AX/AX_parallel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace LR
7171
const int& nocc,
7272
const int& nvirt,
7373
const Parallel_2D& pX,
74-
std::complex<double>* AX_istate,
74+
std::complex<double>* const AX_istate,
7575
const bool add_on)
7676
{
7777
ModuleBase::TITLE("hamilt_lrtd", "cal_AX_plas");

source/module_lr/AX/AX_serial.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace LR
4040
const psi::Psi<std::complex<double>>& c,
4141
const int& nocc,
4242
const int& nvirt,
43-
std::complex<double>* AX_istate)
43+
std::complex<double>* const AX_istate)
4444
{
4545
ModuleBase::TITLE("hamilt_lrtd", "cal_AX_forloop");
4646
const int nks = V_istate.size();
@@ -107,7 +107,7 @@ namespace LR
107107
const psi::Psi<std::complex<double>>& c,
108108
const int& nocc,
109109
const int& nvirt,
110-
std::complex<double>* AX_istate,
110+
std::complex<double>* const AX_istate,
111111
const bool add_on)
112112
{
113113
ModuleBase::TITLE("hamilt_lrtd", "cal_AX_blas");

source/module_lr/dm_trans/dm_trans.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace LR
1414
/// \f[ \tilde{\rho}_{\mu_j\mu_b}=\sum_{jb}c_{j,\mu_j}X_{jb}c^*_{b,\mu_b} \f]
1515
template<typename T>
1616
std::vector<container::Tensor> cal_dm_trans_pblas(
17-
const T* X_istate,
17+
const T* const X_istate,
1818
const Parallel_2D& px,
1919
const psi::Psi<T>& c,
2020
const Parallel_2D& pc,
@@ -29,7 +29,7 @@ namespace LR
2929
/// @brief calculate the 2d-block transition density matrix in AO basis using ?gemm
3030
template<typename T>
3131
std::vector<container::Tensor> cal_dm_trans_blas(
32-
const T* X_istate,
32+
const T* const X_istate,
3333
const psi::Psi<T>& c,
3434
const int& nocc, const int& nvirt,
3535
const bool renorm_k = true,
@@ -39,7 +39,7 @@ namespace LR
3939
/// @brief calculate the 2d-block transition density matrix in AO basis using for loop (for test)
4040
template<typename T>
4141
std::vector<container::Tensor> cal_dm_trans_forloop_serial(
42-
const T* X_istate,
42+
const T* const X_istate,
4343
const psi::Psi<T>& c,
4444
const int& nocc, const int& nvirt,
4545
const bool renorm_k = true,

source/module_lr/dm_trans/dm_trans_parallel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace LR
1010
// c: nao*nbands in para2d, nbands*nao in psi (row-para and constructed: nao)
1111
// X: nvirt*nocc in para2d, nocc*nvirt in psi (row-para and constructed: nvirt)
1212
template <>
13-
std::vector<container::Tensor> cal_dm_trans_pblas(const double* X_istate,
13+
std::vector<container::Tensor> cal_dm_trans_pblas(const double* const X_istate,
1414
const Parallel_2D& px,
1515
const psi::Psi<double>& c,
1616
const Parallel_2D& pc,
@@ -62,7 +62,7 @@ std::vector<container::Tensor> cal_dm_trans_pblas(const double* X_istate,
6262
return dm_trans;
6363
}
6464
template <>
65-
std::vector<container::Tensor> cal_dm_trans_pblas(const std::complex<double>* X_istate,
65+
std::vector<container::Tensor> cal_dm_trans_pblas(const std::complex<double>* const X_istate,
6666
const Parallel_2D& px,
6767
const psi::Psi<std::complex<double>>& c,
6868
const Parallel_2D& pc,

source/module_lr/dm_trans/dm_trans_serial.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace LR
77
{
88
template<> std::vector<container::Tensor> cal_dm_trans_forloop_serial(
9-
const double* X_istate,
9+
const double* const X_istate,
1010
const psi::Psi<double>& c,
1111
const int& nocc,
1212
const int& nvirt,
@@ -41,7 +41,7 @@ namespace LR
4141
}
4242

4343
template<> std::vector<container::Tensor> cal_dm_trans_forloop_serial(
44-
const std::complex<double>* X_istate,
44+
const std::complex<double>* const X_istate,
4545
const psi::Psi<std::complex<double>>& c,
4646
const int& nocc,
4747
const int& nvirt,
@@ -78,7 +78,7 @@ namespace LR
7878

7979

8080
template<> std::vector<container::Tensor> cal_dm_trans_blas(
81-
const double* X_istate,
81+
const double* const X_istate,
8282
const psi::Psi<double>& c,
8383
const int& nocc,
8484
const int& nvirt,
@@ -112,7 +112,7 @@ namespace LR
112112

113113

114114
template<> std::vector<container::Tensor> cal_dm_trans_blas(
115-
const std::complex<double>* X_istate,
115+
const std::complex<double>* const X_istate,
116116
const psi::Psi<std::complex<double>>& c,
117117
const int& nocc,
118118
const int& nvirt,

0 commit comments

Comments
 (0)