Skip to content

Commit bb765cc

Browse files
committed
fix compile
1 parent c0120d9 commit bb765cc

File tree

10 files changed

+265
-257
lines changed

10 files changed

+265
-257
lines changed

source/module_cell/klist.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "module_cell/module_paw/paw_cell.h"
1414
#endif
1515

16-
int K_Vectors::cal_ik_global()
16+
void K_Vectors::cal_ik_global()
1717
{
1818
const int my_pool = this->para_k.my_pool;
1919
this->ik2iktot.resize(this->nks);
@@ -23,7 +23,7 @@ int K_Vectors::cal_ik_global()
2323
for (int ik = 0; ik < this->nks / 2; ++ik)
2424
{
2525
this->ik2iktot[ik] = this->para_k.startk_pool[my_pool] + ik;
26-
this->ik2iktot[ik + this->nks / 2] = this->nsktot / 2 + this->para_k.startk_pool[my_pool] + ik;
26+
this->ik2iktot[ik + this->nks / 2] = this->nkstot / 2 + this->para_k.startk_pool[my_pool] + ik;
2727
}
2828
}
2929
else

source/module_cell/klist.h

Lines changed: 243 additions & 243 deletions
Large diffs are not rendered by default.

source/module_cell/parallel_kpoints.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,13 @@ class Parallel_Kpoints
6868
return *std::max_element(nks_pool.begin(), nks_pool.end());
6969
}
7070

71-
private:
72-
71+
public:
7372
int kpar = 0; // number of pools
7473
int my_pool = 0; // the pool index of the present processor
7574
int rank_in_pool = 0; // the rank in the present pool
7675
int nproc = 1; // number of processors
7776
int nspin = 1; // number of spins
78-
77+
private:
7978
std::vector<int> startpro_pool; // the first processor in each pool
8079
#ifdef __MPI
8180
void get_nks_pool(const int& nkstot);

source/module_elecstate/elecstate_print.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "elecstate_getters.h"
33
#include "module_base/formatter.h"
44
#include "module_base/global_variable.h"
5+
#include "module_base/parallel_common.h"
56
#include "module_elecstate/potentials/H_Hartree_pw.h"
67
#include "module_elecstate/potentials/efield.h"
78
#include "module_elecstate/potentials/gatefield.h"
@@ -173,8 +174,16 @@ void ElecState::print_eigenvalue(std::ofstream& ofs)
173174
{
174175
ModuleBase::WARNING_QUIT("print_eigenvalue", "Eigenvalues are too large!");
175176
}
176-
177-
std::string filename = ofs.rdbuf()->get_filename();
177+
std::stringstream ss;
178+
if(PARAM.inp.out_alllog)
179+
{
180+
ss << PARAM.globalv.global_out_dir << "running_" << PARAM.inp.calculation << ".log";
181+
}
182+
else
183+
{
184+
ss << PARAM.globalv.global_out_dir << "running_" << PARAM.inp.calculation << "_" << GlobalV::MY_RANK + 1 << ".log";
185+
}
186+
std::string filename = ss.str();
178187
std::vector<int> ngk_tot = this->klist->ngk;
179188

180189
#ifdef __MPI
@@ -187,7 +196,7 @@ void ElecState::print_eigenvalue(std::ofstream& ofs)
187196
ofs << "\n STATE ENERGY(eV) AND OCCUPATIONS ";
188197
const int nk_fac = PARAM.inp.nspin == 2 ? 2 : 1;
189198
const int nks_np = nks / nk_fac;
190-
const int nkstot_np + 1 = nkstot / nk_fac;
199+
const int nkstot_np = nkstot / nk_fac;
191200
ofs << " NSPIN == " << PARAM.inp.nspin << std::endl;
192201
for (int is = 0; is < nk_fac; ++is)
193202
{

source/module_io/to_wannier90_lcao_in_pw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void toWannier90_LCAO_IN_PW::calculate(
4646
ModulePW::PW_Basis_K* wfcpw_ptr = const_cast<ModulePW::PW_Basis_K*>(wfcpw);
4747
delete this->psi_initer_;
4848
this->psi_initer_ = new psi_initializer_nao<std::complex<double>>();
49-
this->psi_initer_->initialize(sf_ptr, wfcpw_ptr, &ucell, &kv.para_k, 1, nullptr, GlobalV::MY_RANK);
49+
this->psi_initer_->initialize(sf_ptr, wfcpw_ptr, &ucell, &kv, 1, nullptr, GlobalV::MY_RANK);
5050
this->psi_initer_->tabulate();
5151
delete this->psi;
5252
const int nks_psi = (PARAM.inp.calculation == "nscf" && PARAM.inp.mem_saver == 1)? 1 : wfcpw->nks;

source/module_psi/psi_init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void PSIInit<T, Device>::prepare_init(const int& random_seed)
7474
ModuleBase::WARNING_QUIT("PSIInit::prepare_init", "for new psi initializer, init_wfc type not supported");
7575
}
7676

77-
this->psi_initer->initialize(&sf, &pw_wfc, &ucell, &parakpts, random_seed, &nlpp, rank);
77+
this->psi_initer->initialize(&sf, &pw_wfc, &ucell, &kv, random_seed, &nlpp, rank);
7878
this->psi_initer->tabulate();
7979

8080
ModuleBase::timer::tick("PSIInit", "prepare_init");

source/module_psi/psi_initializer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void psi_initializer<T>::random_t(T* psi, const int iw_start, const int iw_end,
4444
if (this->random_seed_ > 0) // qianrui add 2021-8-13
4545
{
4646
#ifdef __MPI
47-
srand(unsigned(this->random_seed_ + this->p_parakpts_->startk_pool[GlobalV::MY_POOL] + ik));
47+
srand(unsigned(this->random_seed_ + this->p_kv->ik2iktot[ik]));
4848
#else
4949
srand(unsigned(this->random_seed_ + ik));
5050
#endif

source/module_psi/psi_initializer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#endif
1515
#include "module_base/macros.h"
1616
#include "module_base/parallel_global.h"
17-
#include "module_cell/parallel_kpoints.h"
17+
#include "module_cell/klist.h"
1818

1919
#include <type_traits>
2020
/*

source/module_psi/psi_initializer_file.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void psi_initializer_file<T>::init_psig(T* psig, const int& ik)
2424
ModuleBase::timer::tick("psi_initializer_file", "init_psig");
2525
const int npol = PARAM.globalv.npol;
2626
const int nbasis = this->pw_wfc_->npwk_max * npol;
27-
const int nkstot = this->p_kv->nkstot;
27+
const int nkstot = this->p_kv->get_nkstot();
2828
ModuleBase::ComplexMatrix wfcatom(this->nbands_start_, nbasis);
2929
std::stringstream filename;
3030
int ik_tot = this->p_kv->ik2iktot[ik];

source/module_psi/psi_initializer_random.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ template <typename T>
1111
void psi_initializer_random<T>::initialize(const Structure_Factor* sf,
1212
const ModulePW::PW_Basis_K* pw_wfc,
1313
const UnitCell* p_ucell,
14-
const K_Vectors* p_kv_in
14+
const K_Vectors* p_kv_in,
1515
const int& random_seed,
1616
const pseudopot_cell_vnl* p_pspot_nl,
1717
const int& rank)

0 commit comments

Comments
 (0)