Skip to content

Commit 0c20f5a

Browse files
committed
Revert "Improve md calculation stress output in running log"
This reverts commit 3fbf986.
1 parent 3fbf986 commit 0c20f5a

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

source/source_io/output_log.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ void print_stress(const std::string& name, const ModuleBase::matrix& scs,
285285
}
286286
else
287287
{
288-
title += " (kbar)";
289-
unit = " kbar";
288+
title += " (KBAR)";
289+
unit = " KBAR";
290290
unit_transform = ModuleBase::RYDBERG_SI / pow(ModuleBase::BOHR_RADIUS_SI, 3) * 1.0e-8;
291291
}
292292
std::vector<double> stress_x;
@@ -317,7 +317,7 @@ void print_stress(const std::string& name, const ModuleBase::matrix& scs,
317317
fmt << stress_x << stress_y << stress_z;
318318
table = fmt.str();
319319
ofs << table;
320-
if (name == "TOTAL-STRESS" && PARAM.inp.calculation != "md")
320+
if (name == "TOTAL-STRESS")
321321
{
322322
ofs << " #TOTAL-PRESSURE# (EXCLUDE KINETIC PART OF IONS): " << std::fixed
323323
<< std::setprecision(6) << pressure << unit

source/source_md/md_base.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,6 @@ void MD_base::print_md(std::ofstream& ofs, const bool& cal_stress)
184184
<< std::endl;
185185

186186
// running_log output
187-
188-
if (cal_stress)
189-
{
190-
MD_func::print_stress(ofs, virial, stress);
191-
ofs << std::endl;
192-
}
193-
194187
ofs.unsetf(std::ios::fixed);
195188
ofs << std::setprecision(8);
196189
ofs << " ------------------------------------------------------------------------------------------------"
@@ -216,7 +209,12 @@ void MD_base::print_md(std::ofstream& ofs, const bool& cal_stress)
216209
ofs << std::endl;
217210
ofs << " ------------------------------------------------------------------------------------------------"
218211
<< std::endl;
219-
ofs << std::endl;
212+
213+
if (cal_stress)
214+
{
215+
MD_func::print_stress(ofs, virial, stress);
216+
}
217+
220218
return;
221219
}
222220

source/source_md/md_func.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,9 @@ void print_stress(std::ofstream& ofs, const ModuleBase::matrix& virial, const Mo
300300

301301
const double unit_transform = ModuleBase::HARTREE_SI / pow(ModuleBase::BOHR_RADIUS_SI, 3) * 1.0e-8;
302302

303-
303+
ofs << " MD PRESSURE (ELECTRONS+IONS) : " << stress_scalar * unit_transform << " kbar" << std::endl;
304304
ofs << " ELECTRONIC PART OF STRESS: " << virial_scalar * unit_transform << " kbar" << std::endl;
305305
ofs << " IONIC (KINETIC) PART OF STRESS: " << (stress_scalar - virial_scalar) * unit_transform << " kbar" << std::endl;
306-
ofs << " MD PRESSURE (ELECTRONS+IONS) : " << stress_scalar * unit_transform << " kbar" << std::endl;
307306

308307
// one should use 'print_stress' function in ../source/source_io/output_log.cpp
309308
/*

0 commit comments

Comments
 (0)