Skip to content

Commit 4c7c941

Browse files
committed
Add test case 58_KP_LR_BSE
1 parent 0cb76b7 commit 4c7c941

61 files changed

Lines changed: 1053 additions & 46 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2370,7 +2370,7 @@
23702370
- **Type**: String
23712371
- **Availability**: *[`basis_type`](#basis_type)==lcao*
23722372
- **Description**: The directory to save files for LibRPA.
2373-
- **Default**: "./OUT.librpa/"
2373+
- **Default**: "OUT.librpa"
23742374

23752375
### out_pchg
23762376

docs/parameters.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3617,7 +3617,7 @@ parameters:
36173617
type: String
36183618
description: |
36193619
The directory to save files for LibRPA.
3620-
default_value: "\"./OUT.librpa/\""
3620+
default_value: "\"OUT.librpa\""
36213621
unit: ""
36223622
availability: basis_type==lcao
36233623
- name: out_pchg

source/source_cell/atom_spec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Atom
4949
int stapos_wf = 0; ///< start position of wave functions
5050

5151
std::string label; ///< atomic symbol
52-
std::vector<ModuleBase::Vector3<double>> tau; ///< Cartesian coordinates of each atom in this type
52+
std::vector<ModuleBase::Vector3<double>> tau; ///< Cartesian coordinates of each atom in this type, in unit of lat0
5353
std::vector<ModuleBase::Vector3<double>> dis; ///< direct displacements of each atom in this type in current step (liuyu modify 2023-03-22)
5454
std::vector<ModuleBase::Vector3<double>> taud; ///< Direct coordinates of each atom in this type
5555
std::vector<ModuleBase::Vector3<int>> boundary_shift; ///< record for periodic boundary adjustment

source/source_cell/klist.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
class K_Vectors
1515
{
1616
public:
17-
std::vector<ModuleBase::Vector3<double>> kvec_c; ///< Cartesian coordinates of k points
17+
std::vector<ModuleBase::Vector3<double>> kvec_c; ///< Cartesian coordinates of k points in units of 2*pi/lat0
1818
std::vector<ModuleBase::Vector3<double>> kvec_d; ///< Direct coordinates of k points
19-
std::vector<ModuleBase::Vector3<double>> kvec_c_full; ///< Cartesian coordinates of full k mesh match with nkstot_full
19+
std::vector<ModuleBase::Vector3<double>> kvec_c_full; ///< Full-mesh (nkstot_full) Cartesian coordinates of k points, in units of 2*pi/lat0
2020

2121
std::vector<double> wk; ///< wk, weight of k points
2222

@@ -328,4 +328,4 @@ class K_Vectors
328328
friend void KVectorUtils::kvec_mpi_k(K_Vectors& kvec);
329329
#endif
330330
};
331-
#endif // KVECT_H
331+
#endif // KVECT_H

source/source_cell/unitcell_data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct Lattice
2424
double omega = 0.0; ///< the volume of the unit cell
2525
std::vector<int> lat_axis_free{0, 0, 0}; ///< whether each lattice axis (a,b,c) is allowed to relax (0=fixed, 1=free)
2626

27-
ModuleBase::Matrix3 latvec = ModuleBase::Matrix3(); ///< Unitcell lattice vectors
27+
ModuleBase::Matrix3 latvec = ModuleBase::Matrix3(); ///< Unit-cell lattice vectors in units of lat0
2828
ModuleBase::Vector3<double> a1, a2, a3; ///< Same as latvec, just at another form
2929
ModuleBase::Vector3<double> latcenter; ///< (a1+a2+a3)/2 the center of vector
3030
ModuleBase::Matrix3 latvec_supercell = ModuleBase::Matrix3(); ///< Supercell lattice vectors

source/source_io/module_parameter/input_parameter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ struct Input_para
465465
bool restart_save = false; ///< restart //Peize Lin add 2020-04-04
466466
bool rpa = false; ///< rpa calculation
467467
bool rpa_out_vel = false; ///< whether to output velocity matrix for librpa
468-
std::string rpa_outdir = "./OUT.librpa/";///< output directory for librpa
468+
std::string rpa_outdir = "OUT.librpa"; ///< output directory for librpa
469469
std::vector<int> out_pchg = {}; ///< specify the bands to be calculated for partial charge
470470
std::vector<int> out_wfc_norm = {}; ///< specify the bands to be calculated for norm of wfc
471471
std::vector<int> out_wfc_re_im = {}; ///< specify the bands to be calculated for real and imaginary parts of wfc

source/source_io/module_parameter/read_inp_out.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ If EXX(exact exchange) is calculated (i.e. dft_fuctional==hse/hf/pbe0/scan0 or r
14811481
item.category = "Output information";
14821482
item.type = "String";
14831483
item.description = "The directory to save files for LibRPA.";
1484-
item.default_value = "\"./OUT.librpa/\"";
1484+
item.default_value = "\"OUT.librpa\"";
14851485
item.unit = "";
14861486
item.set_availability("basis_type==lcao");
14871487
read_sync_string(input.rpa_outdir);

source/source_io/test/read_input_ptest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ TEST_F(InputParaTest, ParaRead)
362362
EXPECT_FALSE(param.inp.dft_plus_dmft);
363363
EXPECT_FALSE(param.inp.rpa);
364364
EXPECT_FALSE(param.inp.rpa_out_vel);
365-
EXPECT_EQ(param.inp.rpa_outdir, "./OUT.librpa/");
365+
EXPECT_EQ(param.inp.rpa_outdir, "OUT.librpa/");
366366
EXPECT_EQ(param.inp.imp_sol, 0);
367367
EXPECT_DOUBLE_EQ(param.inp.eb_k, 80.0);
368368
EXPECT_DOUBLE_EQ(param.inp.tau, 1.0798 * 1e-5);

source/source_lcao/module_bse/hamilt_bse.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ HamiltBSE<T>::HamiltBSE(const int& nspin,
142142

143143
template <typename T>
144144
void HamiltBSE<T>::cal_V_for_A(){
145-
ModuleBase::TITLE("HamiltBSE", "cal_V_for_A");
146-
ModuleBase::timer::start("HamiltBSE", "cal_V_for_A");
147-
std::cout<<"in cal_V_for_A"<<std::endl;
148145
if (!this->VA_local.empty()) {
149146
std::cout<< "V for A has been calculated, skip." <<std::endl;
150147
return;
151148
}
149+
ModuleBase::TITLE("HamiltBSE", "cal_V_for_A");
150+
ModuleBase::timer::start("HamiltBSE", "cal_V_for_A");
151+
std::cout<<"in cal_V_for_A"<<std::endl;
152152
BSE_Util::print_mem_estimate("V matrix of A", this->pA.get_local_size(), sizeof(T));
153153
this->VA_local.resize(this->pA.get_local_size(), 0.0);
154154
if (this->ri_hartree_benchmark == "aims" || this->ri_hartree_benchmark == "abacus") {
@@ -171,13 +171,13 @@ void HamiltBSE<T>::cal_V_for_A(){
171171

172172
template <typename T>
173173
void HamiltBSE<T>::cal_V_for_B(){
174-
ModuleBase::TITLE("HamiltBSE", "cal_V_for_B");
175-
ModuleBase::timer::start("HamiltBSE", "cal_V_for_B");
176-
std::cout<<"in cal_V_for_B"<<std::endl;
177174
if (!this->VB_local.empty()) {
178175
std::cout<< "V for B has been calculated, skip." <<std::endl;
179176
return;
180177
}
178+
ModuleBase::TITLE("HamiltBSE", "cal_V_for_B");
179+
ModuleBase::timer::start("HamiltBSE", "cal_V_for_B");
180+
std::cout<<"in cal_V_for_B"<<std::endl;
181181
BSE_Util::print_mem_estimate("V matrix of B", this->pA.get_local_size(), sizeof(T));
182182
this->VB_local.resize(this->pA.get_local_size(), 0.0);
183183
if (this->ri_hartree_benchmark == "aims" || this->ri_hartree_benchmark == "abacus") {
@@ -200,13 +200,13 @@ void HamiltBSE<T>::cal_V_for_B(){
200200

201201
template <typename T>
202202
void HamiltBSE<T>::cal_W_for_A(){
203-
ModuleBase::TITLE("HamiltBSE", "cal_W_for_A");
204-
ModuleBase::timer::start("HamiltBSE", "cal_W_for_A");
205-
std::cout<<"in cal_W_for_A"<<std::endl;
206203
if (!this->WA_local.empty()) {
207204
std::cout<< "W for A has been calculated, skip." <<std::endl;
208205
return;
209206
}
207+
ModuleBase::TITLE("HamiltBSE", "cal_W_for_A");
208+
ModuleBase::timer::start("HamiltBSE", "cal_W_for_A");
209+
std::cout<<"in cal_W_for_A"<<std::endl;
210210
BSE_Util::print_mem_estimate("W matrix of A", this->pA.get_local_size(), sizeof(T));
211211
this->WA_local.resize(this->pA.get_local_size(), 0.0);
212212
this->mo_lri.cal_W_for_A(this->WA_local, this->pA);
@@ -219,13 +219,13 @@ void HamiltBSE<T>::cal_W_for_A(){
219219

220220
template <typename T>
221221
void HamiltBSE<T>::cal_W_for_B(){
222-
ModuleBase::TITLE("HamiltBSE", "cal_W_for_B");
223-
ModuleBase::timer::start("HamiltBSE", "cal_W_for_B");
224-
std::cout<<"in cal_W_for_B"<<std::endl;
225222
if (!this->WB_local.empty()) {
226223
std::cout<< "W for B has been calculated, skip." <<std::endl;
227224
return;
228225
}
226+
ModuleBase::TITLE("HamiltBSE", "cal_W_for_B");
227+
ModuleBase::timer::start("HamiltBSE", "cal_W_for_B");
228+
std::cout<<"in cal_W_for_B"<<std::endl;
229229
BSE_Util::print_mem_estimate("W matrix of B", this->pA.get_local_size(), sizeof(T));
230230
this->WB_local.resize(this->pA.get_local_size(), 0.0);
231231
this->mo_lri.cal_W_for_B(this->WB_local, this->pA);
@@ -336,7 +336,7 @@ void HamiltBSE<T>::init_bse_matrix(const bool is_full, const int & st_index){
336336
}
337337
if (this->out_bse_ab)
338338
{
339-
this->write_AB_matrix("A_matrix_"+std::to_string(this->my_rank)+".dat", 6, this->BSE_A_local.data(), this->ndim, this->ndim);
339+
this->write_AB_matrix(this->out_dir+"A_matrix_"+std::to_string(this->my_rank)+".dat", 6, this->BSE_A_local.data(), this->ndim, this->ndim);
340340
}
341341

342342
if (is_full)
@@ -351,7 +351,7 @@ void HamiltBSE<T>::init_bse_matrix(const bool is_full, const int & st_index){
351351
}
352352
if (this->out_bse_ab)
353353
{
354-
this->write_AB_matrix("B_matrix_"+std::to_string(this->my_rank)+".dat", 6, this->BSE_B_local.data(), this->ndim, this->ndim);
354+
this->write_AB_matrix(this->out_dir+"B_matrix_"+std::to_string(this->my_rank)+".dat", 6, this->BSE_B_local.data(), this->ndim, this->ndim);
355355
}
356356
}
357357

source/source_lcao/module_lr/utils/lr_io.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ void read_librpa_eigenvectors(psi::Psi<TK>& wfc_ks,
323323
wfc_ks.get_pointer(), 1, 1, const_cast<int*>(pmat.desc_wfc)/*nbasis×nbands*/,
324324
pv_glb.blacs_ctxt);
325325
#else
326-
BlasConnector::copy(nbands*nlocal, wfc_ks_global.get_pointer(), 1, wfc_ks.get_pointer(), 1);
326+
BlasConnector::copy(nbands*nbasis, wfc_ks_global.get_pointer(), 1, wfc_ks.get_pointer(), 1);
327327
#endif
328328
}
329329
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "read librpa eigenvectors.");
@@ -423,7 +423,7 @@ void read_librpa_eigenvectors_from_band_files(psi::Psi<TK>& wfc_ks,
423423
wfc_ks.get_pointer(), 1, 1, const_cast<int*>(pmat.desc_wfc)/*nbasis×nbands*/,
424424
pv_glb.blacs_ctxt);
425425
#else
426-
BlasConnector::copy(nbands*nlocal, wfc_ks_global.get_pointer(), 1, wfc_ks.get_pointer(), 1);
426+
BlasConnector::copy(nbands*nbasis, wfc_ks_global.get_pointer(), 1, wfc_ks.get_pointer(), 1);
427427
#endif
428428
}
429429
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "read librpa eigenvectors.");

0 commit comments

Comments
 (0)