Skip to content

Commit 5e33625

Browse files
authored
Merge branch 'develop' into refactor/blas-headers
2 parents 7ea83eb + a94c62d commit 5e33625

File tree

11 files changed

+41
-61
lines changed

11 files changed

+41
-61
lines changed

source/source_lcao/FORCE_STRESS.cpp

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,6 @@ void Force_Stress_LCAO<T>::getForceStress(UnitCell& ucell,
480480
fcs(iat, i) -= sum / nat;
481481
}
482482
}
483-
484-
// xiaohui add "OUT_LEVEL", 2015-09-16
485-
// if (PARAM.inp.out_level != "m")
486-
// {
487-
// GlobalV::ofs_running << " correction force for each atom along direction " << i + 1 << " is "
488-
// << sum / nat << std::endl;
489-
// }
490483
}
491484

492485
if (PARAM.inp.gate_flag || PARAM.inp.efield_flag)
@@ -550,16 +543,16 @@ void Force_Stress_LCAO<T>::getForceStress(UnitCell& ucell,
550543
//-----------------------------
551544
// this->print_force("OVERLAP FORCE",foverlap,1,ry);
552545
ModuleIO::print_force(GlobalV::ofs_running, ucell, "OVERLAP FORCE", foverlap, false);
553-
// this->print_force("TVNL_DPHI force",ftvnl_dphi,PARAM.inp.test_force);
554-
// this->print_force("VNL_DBETA force",fvnl_dbeta,PARAM.inp.test_force);
546+
// this->print_force("TVNL_DPHI force",ftvnl_dphi,PARAM.inp.test_force);
547+
// this->print_force("VNL_DBETA force",fvnl_dbeta,PARAM.inp.test_force);
555548
// this->print_force("T_VNL FORCE",ftvnl,1,ry);
556549
ModuleIO::print_force(GlobalV::ofs_running, ucell, "T_VNL FORCE", ftvnl, false);
557550
ModuleIO::print_force(GlobalV::ofs_running, ucell, "VL_dPHI FORCE", fvl_dphi, false);
558551
// this->print_force("VL_dPHI FORCE",fvl_dphi,1,ry);
559552
// this->print_force("VL_dVL FORCE",fvl_dvl,1,ry);
560553
ModuleIO::print_force(GlobalV::ofs_running, ucell, "VL_dVL FORCE", fvl_dvl, false);
561554
ModuleIO::print_force(GlobalV::ofs_running, ucell, "EWALD FORCE", fewalds, false);
562-
// this->print_force("VLOCAL FORCE",fvlocal,PARAM.inp.test_force);
555+
// this->print_force("VLOCAL FORCE",fvlocal,PARAM.inp.test_force);
563556
// this->print_force("EWALD FORCE",fewalds,1,ry);
564557
ModuleIO::print_force(GlobalV::ofs_running, ucell, "NLCC FORCE", fcc, false);
565558
ModuleIO::print_force(GlobalV::ofs_running, ucell, "SCC FORCE", fscc, false);
@@ -815,31 +808,17 @@ void Force_Stress_LCAO<T>::calForcePwPart(UnitCell& ucell,
815808
if(PARAM.inp.device == "gpu")
816809
{
817810
Forces<double, base_device::DEVICE_GPU> f_pw(nat);
818-
819-
//--------------------------------------------------------
820-
// local pseudopotential force:
821-
// use charge density; plane wave; local pseudopotential;
822-
//--------------------------------------------------------
823811
f_pw.cal_force_loc(ucell, fvl_dvl, rhopw, locpp.vloc, chr);
824-
//--------------------------------------------------------
825-
// ewald force: use plane wave only.
826-
//--------------------------------------------------------
827-
f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf); // remain problem
828-
829-
//--------------------------------------------------------
830-
// force due to core correlation.
831-
//--------------------------------------------------------
812+
f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf);
832813
f_pw.cal_force_cc(fcc, rhopw, chr, locpp.numeric, ucell);
833-
//--------------------------------------------------------
834-
// force due to self-consistent charge.
835-
//--------------------------------------------------------
836814
f_pw.cal_force_scc(fscc, rhopw, vnew, vnew_exist, locpp.numeric, ucell);
837-
} else
815+
}
816+
else
838817
#endif
839818
{
840819
Forces<double, base_device::DEVICE_CPU> f_pw(nat);
841820
f_pw.cal_force_loc(ucell, fvl_dvl, rhopw, locpp.vloc, chr);
842-
f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf); // remain problem
821+
f_pw.cal_force_ew(ucell, fewalds, rhopw, &sf);
843822
f_pw.cal_force_cc(fcc, rhopw, chr, locpp.numeric, ucell);
844823
f_pw.cal_force_scc(fscc, rhopw, vnew, vnew_exist, locpp.numeric, ucell);
845824
}

source/source_main/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#ifndef VERSION
2-
#define VERSION "v3.9.0.9"
2+
#define VERSION "v3.9.0.10"
33
#endif

source/source_pw/module_pwdft/stress_func_cc.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void Stress_Func<FPTYPE, Device>::stress_cc(ModuleBase::matrix& sigma,
6161
// vtxc = std::get<1>(etxc_vtxc_v);
6262
vxc = std::get<2>(etxc_vtxc_v);
6363
#else
64-
ModuleBase::WARNING_QUIT("cal_force_cc","to use mGGA, compile with LIBXC");
64+
ModuleBase::WARNING_QUIT("stress_cc","to use mGGA, compile with LIBXC");
6565
#endif
6666
}
6767
else
@@ -108,7 +108,6 @@ void Stress_Func<FPTYPE, Device>::stress_cc(ModuleBase::matrix& sigma,
108108
{
109109
if(ucell.atoms[nt].ncpp.nlcc)
110110
{
111-
//drhoc();
112111
this->deriv_drhoc(
113112
numeric,
114113
ucell.omega,
@@ -131,9 +130,11 @@ void Stress_Func<FPTYPE, Device>::stress_cc(ModuleBase::matrix& sigma,
131130
std::complex<double> local_sigmadiag;
132131
if (rho_basis->ig_gge0 == ig) {
133132
local_sigmadiag = conj(psic[ig]) * p_sf->strucFac(nt, ig) * rhocg[rho_basis->ig2igg[ig]];
134-
} else {
135-
local_sigmadiag = conj(psic[ig]) * p_sf->strucFac(nt, ig) * rhocg[rho_basis->ig2igg[ig]] * fact;
136-
}
133+
}
134+
else
135+
{
136+
local_sigmadiag = conj(psic[ig]) * p_sf->strucFac(nt, ig) * rhocg[rho_basis->ig2igg[ig]] * fact;
137+
}
137138
sigmadiag += local_sigmadiag.real();
138139
}
139140
this->deriv_drhoc (
@@ -171,7 +172,6 @@ void Stress_Func<FPTYPE, Device>::stress_cc(ModuleBase::matrix& sigma,
171172
const std::complex<FPTYPE> t
172173
= conj(psic[ig]) * p_sf->strucFac(nt, ig) * rhocg[rho_basis->ig2igg[ig]]
173174
* ucell.tpiba * rho_basis->gcar[ig][l] * rho_basis->gcar[ig][m] / norm_g * fact;
174-
// sigmacc [l][ m] += t.real();
175175
local_sigma(l,m) += t.real();
176176
}//end m
177177
}//end l

source/source_relax/bfgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ void BFGS::CalculateLargestGrad(const ModuleBase::matrix& _force,UnitCell& ucell
344344
Ions_Move_Basic::largest_grad /= ucell.lat0;
345345
if (PARAM.inp.out_level == "ie")
346346
{
347-
std::cout << " LARGEST GRAD (eV/A) : " << Ions_Move_Basic::largest_grad
347+
std::cout << " LARGEST GRAD (eV/Angstrom) : " << Ions_Move_Basic::largest_grad
348348
* ModuleBase::Ry_to_eV / 0.5291772109
349349
<< std::endl;
350350
}

source/source_relax/ions_move_basic.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ void Ions_Move_Basic::check_converged(const UnitCell &ucell, const double *grad)
147147
if (PARAM.inp.out_level == "ie")
148148
{
149149
std::cout << " ETOT DIFF (eV) : " << Ions_Move_Basic::ediff * ModuleBase::Ry_to_eV << std::endl;
150-
std::cout << " LARGEST GRAD (eV/A) : " << Ions_Move_Basic::largest_grad * ModuleBase::Ry_to_eV / 0.529177
150+
std::cout << " LARGEST GRAD (eV/Angstrom) : " << Ions_Move_Basic::largest_grad * ModuleBase::Ry_to_eV / 0.529177
151151
<< std::endl;
152152

153153
GlobalV::ofs_running << "\n Largest force is " << largest_grad * ModuleBase::Ry_to_eV / 0.529177
154-
<< " eV/A while threshold is "
155-
<< PARAM.inp.force_thr_ev << " eV/A" << std::endl;
154+
<< " eV/Angstrom while threshold is "
155+
<< PARAM.inp.force_thr_ev << " eV/Angstrom" << std::endl;
156156
}
157157

158158
const double etot_diff = std::abs(Ions_Move_Basic::ediff);

source/source_relax/lbfgs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ void LBFGS::calculate_largest_grad(const ModuleBase::matrix& _force,UnitCell& uc
287287
Ions_Move_Basic::largest_grad /= ucell.lat0;
288288
if (PARAM.inp.out_level == "ie")
289289
{
290-
std::cout << " LARGEST GRAD (eV/A) : " << Ions_Move_Basic::largest_grad * ModuleBase::Ry_to_eV / 0.5291772109
290+
std::cout << " LARGEST GRAD (eV/Angstrom) : "
291+
<< Ions_Move_Basic::largest_grad * ModuleBase::Ry_to_eV / 0.5291772109
291292
<< std::endl;
292293
}
293294

source/source_relax/relax_driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void Relax_Driver::relax_driver(
176176

177177
if (inp.calculation == "relax" || inp.calculation == "cell-relax")
178178
{
179-
if (istep-1 == inp.relax_nmax || stop)
179+
if (istep-1 == inp.relax_nmax)
180180
{
181181
std::cout << "\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
182182
std::cout << " Geometry relaxation stops here due to reaching the maximum " << std::endl;

source/source_relax/relax_sync.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void Relax::init_relax(const int nat_in)
2727
etot = 0;
2828
etot_p = 0;
2929

30-
force_thr_eva = PARAM.inp.force_thr * ModuleBase::Ry_to_eV / ModuleBase::BOHR_TO_A; // convert to eV/A
30+
force_thr_eva = PARAM.inp.force_thr * ModuleBase::Ry_to_eV / ModuleBase::BOHR_TO_A; // convert to eV/Angstrom
3131
fac_force = PARAM.inp.relax_scale_force * 0.1;
3232
fac_stress = fac_force / nat;
3333

@@ -114,7 +114,7 @@ bool Relax::setup_gradient(const UnitCell& ucell, const ModuleBase::matrix& forc
114114
//=========================================
115115

116116
grad_ion.zero_out();
117-
ModuleBase::matrix force_eva = force * (ModuleBase::Ry_to_eV / ModuleBase::BOHR_TO_A); // convert to eV/A
117+
ModuleBase::matrix force_eva = force * (ModuleBase::Ry_to_eV / ModuleBase::BOHR_TO_A); // convert to eV/Angstrom
118118

119119
int iat = 0;
120120
for (int it = 0; it < ucell.ntype; it++)
@@ -158,14 +158,14 @@ bool Relax::setup_gradient(const UnitCell& ucell, const ModuleBase::matrix& forc
158158
}
159159
if (PARAM.inp.out_level == "ie")
160160
{
161-
std::cout << " ETOT DIFF (eV) : " << etot - etot_p << std::endl;
162-
std::cout << " LARGEST GRAD (eV/A) : " << max_grad << std::endl;
161+
std::cout << " ETOT DIFF (eV) : " << etot - etot_p << std::endl;
162+
std::cout << " LARGEST GRAD (eV/Angstrom) : " << max_grad << std::endl;
163163
etot_p = etot;
164164
}
165165

166166

167167
GlobalV::ofs_running << "\n Largest force is " << max_grad <<
168-
" eV/A while threshold is " << PARAM.inp.force_thr_ev << " eV/A" << std::endl;
168+
" eV/Angstrom while threshold is " << PARAM.inp.force_thr_ev << " eV/Angstrom" << std::endl;
169169
//=========================================
170170
// set gradient for cell degrees of freedom
171171
//=========================================

source/source_relax/test/ions_move_basic_test.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ TEST_F(IonsMoveBasicTest, CheckConvergedCase1)
133133
std::string expected_ofs
134134
= " old total energy (ry) = 0\n new total energy (ry) = 0\n "
135135
" energy difference (ry) = 0\n largest gradient (ry/bohr) = 0\n\n"
136-
" Largest force is 0 eV/A while threshold is -1 eV/A\n largest force is 0, no "
136+
" Largest force is 0 eV/Angstrom while threshold is -1 eV/Angstrom\n largest force is 0, no "
137137
"movement is possible.\n it may converged, otherwise no movement of atom is allowed.\n";
138-
std::string expected_std = " ETOT DIFF (eV) : 0\n LARGEST GRAD (eV/A) : 0\n";
138+
std::string expected_std = " ETOT DIFF (eV) : 0\n LARGEST GRAD (eV/Angstrom) : 0\n";
139139

140140
EXPECT_THAT(ofs_output , ::testing::HasSubstr(expected_ofs));
141141
EXPECT_EQ(expected_std, std_outout);
@@ -172,9 +172,9 @@ TEST_F(IonsMoveBasicTest, CheckConvergedCase2)
172172
std::string expected_ofs
173173
= " old total energy (ry) = 0\n new total energy (ry) = 0\n "
174174
" energy difference (ry) = 0\n largest gradient (ry/bohr) = 0.1\n\n"
175-
" Largest force is 2.57111 eV/A while threshold is -1 eV/A\n\n Ion relaxation is "
175+
" Largest force is 2.57111 eV/Angstrom while threshold is -1 eV/Angstrom\n\n Ion relaxation is "
176176
"converged!\n\n Energy difference (Ry) = 0\n";
177-
std::string expected_std = " ETOT DIFF (eV) : 0\n LARGEST GRAD (eV/A) : 2.57111\n";
177+
std::string expected_std = " ETOT DIFF (eV) : 0\n LARGEST GRAD (eV/Angstrom) : 2.57111\n";
178178

179179
EXPECT_THAT(ofs_output , ::testing::HasSubstr(expected_ofs));
180180
EXPECT_EQ(expected_std, std_outout);
@@ -211,9 +211,9 @@ TEST_F(IonsMoveBasicTest, CheckConvergedCase3)
211211
std::string expected_ofs
212212
= " old total energy (ry) = 0\n new total energy (ry) = 0\n "
213213
" energy difference (ry) = 1\n largest gradient (ry/bohr) = 0.1\n\n"
214-
" Largest force is 2.57111 eV/A while threshold is -1 eV/A\n\n Ion relaxation is not "
214+
" Largest force is 2.57111 eV/Angstrom while threshold is -1 eV/Angstrom\n\n Ion relaxation is not "
215215
"converged yet (threshold is 25.7111)\n";
216-
std::string expected_std = " ETOT DIFF (eV) : 13.6057\n LARGEST GRAD (eV/A) : 2.57111\n";
216+
std::string expected_std = " ETOT DIFF (eV) : 13.6057\n LARGEST GRAD (eV/Angstrom) : 2.57111\n";
217217

218218
EXPECT_THAT(ofs_output , ::testing::HasSubstr(expected_ofs));
219219
EXPECT_EQ(expected_std, std_outout);

source/source_relax/test/ions_move_cg_test.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ TEST_F(IonsMoveCGTest, TestStartConverged)
114114
GlobalV::ofs_running.close();
115115

116116
// Check output
117-
std::string expected_output = "\n Largest force is 0 eV/A while threshold is -1 eV/A\n"
117+
std::string expected_output = "\n Largest force is 0 eV/Angstrom while threshold is -1 eV/Angstrom\n"
118118
" largest force is 0, no movement is possible.\n it may converged, otherwise no "
119119
"movement of atom is allowed.\n end of geometry optimization\n "
120120
" istep = 1\n update iteration = 5\n";
@@ -152,7 +152,7 @@ TEST_F(IonsMoveCGTest, TestStartSd)
152152
GlobalV::ofs_running.close();
153153

154154
// Check output
155-
std::string expected_output = "\n Largest force is 0.257111 eV/A while threshold is -1 eV/A\n\n"
155+
std::string expected_output = "\n Largest force is 0.257111 eV/Angstrom while threshold is -1 eV/Angstrom\n\n"
156156
" Ion relaxation is not converged yet (threshold is 0.0257111)\n";
157157
std::ifstream ifs("TestStartSd.log");
158158
std::string output((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
@@ -191,7 +191,7 @@ TEST_F(IonsMoveCGTest, TestStartTrialGoto)
191191
GlobalV::ofs_running.close();
192192

193193
// Check output
194-
std::string expected_output = "\n Largest force is 0.0257111 eV/A while threshold is -1 eV/A\n\n"
194+
std::string expected_output = "\n Largest force is 0.0257111 eV/Angstrom while threshold is -1 eV/Angstrom\n\n"
195195
" Ion relaxation is not converged yet (threshold is 0.0257111)\n";
196196
std::ifstream ifs("TestStartTrialGoto.log");
197197
std::string output((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
@@ -229,7 +229,7 @@ TEST_F(IonsMoveCGTest, TestStartTrial)
229229
GlobalV::ofs_running.close();
230230

231231
// Check output
232-
std::string expected_output = "\n Largest force is 0.257111 eV/A while threshold is -1 eV/A\n\n"
232+
std::string expected_output = "\n Largest force is 0.257111 eV/Angstrom while threshold is -1 eV/Angstrom\n\n"
233233
" Ion relaxation is not converged yet (threshold is 0.0257111)\n";
234234
std::ifstream ifs("TestStartTrial.log");
235235
std::string output((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
@@ -269,7 +269,7 @@ TEST_F(IonsMoveCGTest, TestStartNoTrialGotoCase1)
269269
GlobalV::ofs_running.close();
270270

271271
// Check output
272-
std::string expected_output = "\n Largest force is 0.0257111 eV/A while threshold is -1 eV/A\n\n"
272+
std::string expected_output = "\n Largest force is 0.0257111 eV/Angstrom while threshold is -1 eV/Angstrom\n\n"
273273
" Ion relaxation is not converged yet (threshold is 0.0257111)\n";
274274
std::ifstream ifs("TestStartNoTrialGotoCase1.log");
275275
std::string output((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
@@ -308,7 +308,7 @@ TEST_F(IonsMoveCGTest, TestStartNoTrialGotoCase2)
308308
GlobalV::ofs_running.close();
309309

310310
// Check output
311-
std::string expected_output = "\n Largest force is 0.257111 eV/A while threshold is -1 eV/A\n\n"
311+
std::string expected_output = "\n Largest force is 0.257111 eV/Angstrom while threshold is -1 eV/Angstrom\n\n"
312312
" Ion relaxation is not converged yet (threshold is 0.0257111)\n";
313313
std::ifstream ifs("TestStartNoTrialGotoCase2.log");
314314
std::string output((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
@@ -348,7 +348,7 @@ TEST_F(IonsMoveCGTest, TestStartNoTrial)
348348
GlobalV::ofs_running.close();
349349

350350
// Check output
351-
std::string expected_output = "\n Largest force is 0.0257111 eV/A while threshold is -1 eV/A\n\n"
351+
std::string expected_output = "\n Largest force is 0.0257111 eV/Angstrom while threshold is -1 eV/Angstrom\n\n"
352352
" Ion relaxation is not converged yet (threshold is 0.0257111)\n";
353353
std::ifstream ifs("TestStartNoTrial.log");
354354
std::string output((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());

0 commit comments

Comments
 (0)