Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions source/module_elecstate/elecstate_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ void ElecStatePW<T, Device>::parallelK()
{
#ifdef __MPI
this->charge->rho_mpi();
if(PARAM.inp.esolver_type == "sdft") //qinarui add it 2021-7-21
{
this->f_en.eband /= GlobalV::NPROC_IN_POOL;
MPI_Allreduce(MPI_IN_PLACE, &this->f_en.eband, 1, MPI_DOUBLE, MPI_SUM, STO_WORLD);
}
#endif
}

Expand Down
9 changes: 5 additions & 4 deletions source/module_esolver/esolver_ks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,16 @@ void ESolver_KS<T, Device>::runner(UnitCell& ucell, const int istep)
this->diag_ethr = PARAM.inp.pw_diag_thr;
for (int iter = 1; iter <= this->maxniter; ++iter)
{
// 6) initialization of SCF iterations
// 5) initialization of SCF iterations
this->iter_init(ucell, istep, iter);

// 6) use Hamiltonian to obtain charge density
this->hamilt2density(ucell, istep, iter, diag_ethr);

// 10) finish scf iterations
// 7) finish scf iterations
this->iter_finish(ucell, istep, iter);

// 13) check convergence
// 8) check convergence
if (this->conv_esolver || this->oscillate_esolver)
{
this->niter = iter;
Expand All @@ -462,7 +463,7 @@ void ESolver_KS<T, Device>::runner(UnitCell& ucell, const int istep)
}
} // end scf iterations

// 15) after scf
// 9) after scf
ModuleBase::timer::tick(this->classname, "after_scf");
this->after_scf(ucell, istep);
ModuleBase::timer::tick(this->classname, "after_scf");
Expand Down
8 changes: 4 additions & 4 deletions source/module_hamilt_pw/hamilt_stodft/sto_iter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,13 @@ void Stochastic_Iter<T, Device>::calHsqrtchi(Stochastic_WF<T, Device>& stowf)
}

template <typename T, typename Device>
void Stochastic_Iter<T, Device>::sum_stoband(Stochastic_WF<T, Device>& stowf,
void Stochastic_Iter<T, Device>::sum_stoeband(Stochastic_WF<T, Device>& stowf,
elecstate::ElecStatePW<T, Device>* pes,
hamilt::Hamilt<T, Device>* pHamilt,
ModulePW::PW_Basis_K* wfc_basis)
{
ModuleBase::TITLE("Stochastic_Iter", "sum_stoband");
ModuleBase::timer::tick("Stochastic_Iter", "sum_stoband");
ModuleBase::TITLE("Stochastic_Iter", "sum_stoeband");
ModuleBase::timer::tick("Stochastic_Iter", "sum_stoeband");
const int npwx = wfc_basis->npwk_max;
const int norder = p_che->norder;

Expand Down Expand Up @@ -556,7 +556,7 @@ void Stochastic_Iter<T, Device>::sum_stoband(Stochastic_WF<T, Device>& stowf,
MPI_Allreduce(MPI_IN_PLACE, &sto_eband, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
#endif
pes->f_en.eband += sto_eband;
ModuleBase::timer::tick("Stochastic_Iter", "sum_stoband");
ModuleBase::timer::tick("Stochastic_Iter", "sum_stoeband");
}

template <typename T, typename Device>
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_pw/hamilt_stodft/sto_iter.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Stochastic_Iter
* @param pHamilt hamiltonian
* @param wfc_basis wfc pw basis
*/
void sum_stoband(Stochastic_WF<T, Device>& stowf,
void sum_stoeband(Stochastic_WF<T, Device>& stowf,
elecstate::ElecStatePW<T, Device>* pes,
hamilt::Hamilt<T, Device>* pHamilt,
ModulePW::PW_Basis_K* wfc_basis);
Expand Down
20 changes: 15 additions & 5 deletions source/module_hsolver/hsolver_pw_sdft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,29 +108,39 @@ void HSolverPW_SDFT<T, Device>::solve(hamilt::Hamilt<T, Device>* pHamilt,
// prepare sqrt{f(\hat{H})}|\chi> to calculate density, force and stress
stoiter.calHsqrtchi(stowf);

// calculate eband = \sum_{ik,ib} w(ik)f(ik,ib)e_{ikib}, demet = -TS
elecstate::ElecStatePW<T, Device>* pes_pw = static_cast<elecstate::ElecStatePW<T, Device>*>(pes);
if (GlobalV::MY_STOGROUP == 0)
{
pes_pw->calEBand();
}
if (nbands > 0)
{
#ifdef __MPI
pes->f_en.eband /= GlobalV::NPROC_IN_POOL;
MPI_Allreduce(MPI_IN_PLACE, &pes->f_en.eband, 1, MPI_DOUBLE, MPI_SUM, STO_WORLD);
MPI_Bcast(&pes->f_en.eband, 1, MPI_DOUBLE, 0, PARAPW_WORLD);
#endif
}
stoiter.sum_stoeband(stowf, pes_pw, pHamilt, wfc_basis);



// for nscf, skip charge
if (skip_charge)
{
ModuleBase::timer::tick("HSolverPW_SDFT", "solve");
return;
}

//(5) calculate new charge density
// calculate KS rho.
pes_pw->init_rho_data();
if (nbands > 0)
{
pes_pw->psiToRho(psi);
#ifdef __MPI
MPI_Bcast(&pes->f_en.eband, 1, MPI_DOUBLE, 0, PARAPW_WORLD);
#endif
}

// calculate stochastic rho
stoiter.sum_stoband(stowf, pes_pw, pHamilt, wfc_basis);
stoiter.cal_storho(stowf, pes_pw, wfc_basis);

// will do rho symmetry and energy calculation in esolver
Expand Down
2 changes: 1 addition & 1 deletion source/module_hsolver/test/test_hsolver_sdft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void Stochastic_Iter<T, Device>::calHsqrtchi(Stochastic_WF<T, Device>& stowf)
}

template <typename T, typename Device>
void Stochastic_Iter<T, Device>::sum_stoband(Stochastic_WF<T, Device>& stowf,
void Stochastic_Iter<T, Device>::sum_stoeband(Stochastic_WF<T, Device>& stowf,
elecstate::ElecStatePW<T, Device>* pes,
hamilt::Hamilt<T, Device>* pHamilt,
ModulePW::PW_Basis_K* wfc_basis)
Expand Down
4 changes: 3 additions & 1 deletion tests/integrate/107_PW_OBOD_MemSaver/result.ref
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
etotref -206.9728084455294
etotperatomref -103.4864042228
totaldosref 1190.44
CompareBand_pass 0
totaltimeref 0.33861
totaltimeref 0.38
4 changes: 3 additions & 1 deletion tests/integrate/107_PW_OB_outputbands/result.ref
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
etotref -206.9727001566756
etotperatomref -103.4863500783
CompareBand_pass 0
totaltimeref 0.28457
totaltimeref 0.23
4 changes: 3 additions & 1 deletion tests/integrate/107_PW_OD_outputdos/result.ref
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
etotref -206.9727320695148
etotperatomref -103.4863660348
totaldosref 1190.44
totaltimeref
totaltimeref 0.26
4 changes: 3 additions & 1 deletion tests/integrate/107_PW_W90/result.ref
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
etotref -308.0061503011041
etotperatomref -154.0030751506
CompareAMN_pass 0
CompareMMN_pass 0
CompareEIG_pass 0
totaltimeref 9.3341
totaltimeref 2.15
4 changes: 3 additions & 1 deletion tests/integrate/117_PW_out_pot_nscf/result.ref
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
etotref -3526.200848639589
etotperatomref -3526.2008486396
ComparePot1_pass 0
pointgroupref O_h
spacegroupref O_h
nksibzref 3
totaltimeref 0.35
totaltimeref 0.33
4 changes: 3 additions & 1 deletion tests/integrate/186_PW_NSCF_KG_100/result.ref
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
etotref -150.4802162021569
etotperatomref -150.4802162022
CompareH_Failed 0
pointgroupref O_h
spacegroupref O_h
nksibzref 3
totaltimeref 0.67841
totaltimeref 1.46
6 changes: 3 additions & 3 deletions tests/integrate/186_PW_SDOS_MALL/result.ref
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
etotref 0
etotperatomref 0.0000000000
etotref -150.4802139726653
etotperatomref -150.4802139727
totaldosref 96.4227
pointgroupref O_h
spacegroupref O_h
nksibzref 3
totaltimeref 5.1234
totaltimeref 11.83
5 changes: 3 additions & 2 deletions tests/integrate/186_PW_SKG_10D10S/result.ref
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
etotref -150.5555663868826
etotperatomref -150.5555663869
CompareH_Failed 0
pointgroupref O_h
spacegroupref O_h
nksibzref 3
totaltimeref 58.0934
4.88
totaltimeref 3.67
4 changes: 3 additions & 1 deletion tests/integrate/207_NO_KP_OB/result.ref
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
etotref -205.4532897097782
etotperatomref -102.7266448549
CompareOrb_pass 0
CompareBand_pass 0
totaltimeref 0.27705
totaltimeref 0.31
4 changes: 3 additions & 1 deletion tests/integrate/207_NO_KP_OD/result.ref
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
etotref -205.4532897097782
etotperatomref -102.7266448549
totaldosref 1189.14
totaltimeref 0.31661
totaltimeref 0.31
4 changes: 3 additions & 1 deletion tests/integrate/207_NO_KP_OH_nscf/result.ref
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
etotref -205.4532897097782
etotperatomref -102.7266448549
CompareSR_pass 0
ComparerR_pass 0
ComparerTR_pass 0
totaltimeref 1.88
totaltimeref 2.21
4 changes: 3 additions & 1 deletion tests/integrate/214_NO_mulliken_nscf/result.ref
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
etotref -50.22627762925340
etotperatomref -25.1131388146
Compare_mulliken_pass 0
totaltimeref 0.20
totaltimeref 0.76
4 changes: 3 additions & 1 deletion tests/integrate/217_NO_out_pot_nscf/result.ref
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
etotref -196.6254071148604
etotperatomref -98.3127035574
ComparePot1_pass 0
pointgroupref T_d
spacegroupref O_h
nksibzref 1
totaltimeref 0.49
totaltimeref 0.35
2 changes: 1 addition & 1 deletion tests/integrate/tools/catch_properties.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ if [ ! -z $esolver_type ] && ([ $esolver_type == "lr" ] || [ $esolver_type == "k
is_lr=1
fi

if [ $calculation != "nscf" ] && [ $calculation != "get_wf" ]\
if [ $calculation != "get_wf" ]\
&& [ $calculation != "get_pchg" ] && [ $calculation != "get_S" ]\
&& [ $is_lr == 0 ]; then
#etot=`grep ETOT_ $running_path | awk '{print $2}'`
Expand Down
Loading