Skip to content

Commit bd6244b

Browse files
authored
Refactor: rename some MD input parameters (#2012)
1 parent 04a2467 commit bd6244b

File tree

9 files changed

+40
-34
lines changed

9 files changed

+40
-34
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
[exx_hybrid_alpha](#exx_hybrid_alpha) | [exx_hse_omega](#exx_hse_omega) | [exx_separate_loop](#exx_separate_loop) | [exx_hybrid_step](#exx_hybrid_step) | [exx_lambda](#exx_lambda) | [exx_pca_threshold](#exx_pca_threshold) | [exx_c_threshold](#exx_c_threshold) | [exx_v_threshold](#exx_v_threshold) | [exx_c_grad_threshold](#exx_c_grad_threshold) | [exx_v_grad_threshold](#exx_v_grad_threshold) | [exx_dm_threshold](#exx_dm_threshold) | [exx_schwarz_threshold](#exx_schwarz_threshold) | [exx_cauchy_threshold](#exx_cauchy_threshold) | [exx_cauchy_grad_threshold](#exx_cauchy_grad_threshold) | [exx_ccp_threshold](#exx_ccp_threshold) | [exx_ccp_rmesh_times](#exx_ccp_rmesh_times) | [exx_distribute_type](#exx_distribute_type) | [exx_opt_orb_lmax](#exx_opt_orb_lmax) | [exx_opt_orb_ecut](#exx_opt_orb_ecut) | [exx_opt_orb_tolerence](#exx_opt_orb_tolerence) | [exx_real_number](#exx_real_number)
3333
- [Molecular dynamics](#molecular-dynamics)
3434

35-
[md_type](#md_type) | [md_thermostat](#md_thermostat) | [md_nstep](#md_nstep) | [md_restart](#md_restart) | [md_dt](#md_dt) | [md_tfirst, md_tlast](#md_tfirst-md_tlast) | [md_dumpfreq](#md_dumpfreq) | [md_restartfreq](#md_restartfreq) | [md_seed](#md_seed) | [md_tfreq](#md_tfreq) | [md_tchain](#md_tchain) | [md_pmode](#md_pmode) | [md_pcouple](#md_pcouple) | [md_pfirst, md_plast](#md_pfirst-md_plast) | [md_pfreq](#md_pfreq) | [md_pchain](#md_pchain) | [out_force](#out_force) | [out_vel](#out_vel) | [out_virial](#out_virial) | [lj_rcut](#lj_rcut) | [lj_epsilon](#lj_epsilon) | [lj_sigma](#lj_sigma) | [pot_file](#pot_file) | [msst_direction](#msst_direction) | [msst_vel](#msst_vel) | [msst_vis](#msst_vis) | [msst_tscale](#msst_tscale) | [msst_qmass](#msst_qmass) | [md_damp](#md_damp) | [md_tolerance](#md_tolerance) | [md_nraise](#md_nraise)
35+
[md_type](#md_type) | [md_thermostat](#md_thermostat) | [md_nstep](#md_nstep) | [md_restart](#md_restart) | [md_dt](#md_dt) | [md_tfirst, md_tlast](#md_tfirst-md_tlast) | [md_dumpfreq](#md_dumpfreq) | [md_restartfreq](#md_restartfreq) | [md_seed](#md_seed) | [md_tfreq](#md_tfreq) | [md_tchain](#md_tchain) | [md_pmode](#md_pmode) | [md_pcouple](#md_pcouple) | [md_pfirst, md_plast](#md_pfirst-md_plast) | [md_pfreq](#md_pfreq) | [md_pchain](#md_pchain) | [dump_force](#dump_force) | [dump_vel](#dump_vel) | [dump_virial](#dump_virial) | [lj_rcut](#lj_rcut) | [lj_epsilon](#lj_epsilon) | [lj_sigma](#lj_sigma) | [pot_file](#pot_file) | [msst_direction](#msst_direction) | [msst_vel](#msst_vel) | [msst_vis](#msst_vis) | [msst_tscale](#msst_tscale) | [msst_qmass](#msst_qmass) | [md_damp](#md_damp) | [md_tolerance](#md_tolerance) | [md_nraise](#md_nraise)
3636
- [vdW correction](#vdw-correction)
3737

3838
[vdw_method](#vdw_method) | [vdw_s6](#vdw_s6) | [vdw_s8](#vdw_s8) | [vdw_a1](#vdw_a1) | [vdw_a2](#vdw_a2) | [vdw_d](#vdw_d) | [vdw_abc](#vdw_abc) | [vdw_C6_file](#vdw_c6_file) | [vdw_C6_unit](#vdw_c6_unit) | [vdw_R0_file](#vdw_r0_file) | [vdw_R0_unit](#vdw_r0_unit) | [vdw_cutoff_type](#vdw_cutoff_type) | [vdw_cutoff_radius](#vdw_cutoff_radius) | [vdw_radius_unit](#vdw_radius_unit) | [vdw_cutoff_period](#vdw_cutoff_period) | [vdw_cn_thr](#vdw_cn_thr) | [vdw_cn_thr_unit](#vdw_cn_thr_unit)
@@ -1662,19 +1662,19 @@ These variables are used to control the molecular dynamics calculations.
16621662
- **Description**: number of thermostats coupled with the barostat in the Nose Hoover Chain method.
16631663
- **Default**: 1
16641664

1665-
### out_force
1665+
### dump_force
16661666

16671667
- **Type**: Boolean
16681668
- **Description**: Output atomic forces into the file `MD_dump` or not. If `true`, forces will be written, otherwise forces will not be written.
16691669
- **Default**: false
16701670

1671-
### out_vel
1671+
### dump_vel
16721672

16731673
- **Type**: Boolean
16741674
- **Description**: Output atomic velocities into the file `MD_dump` or not. If `true`, velocities will be written, otherwise velocities will not be written.
16751675
- **Default**: false
16761676

1677-
### out_virial
1677+
### dump_virial
16781678

16791679
- **Type**: Boolean
16801680
- **Description**: Output lattice virial into the file `MD_dump` or not. If `true`, lattice virial will be written, otherwise lattice virial will not be written.

docs/advanced/md.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Furthermore, ABACUS also provides a [list of keywords](./input_files/input-main.
3030
To employ CMD calculations, `esolver_type` should be set to be `lj` or `dp`.
3131
If DP model is selected, the filename of DP model is specified by keyword `pot_file`.
3232

33-
The MD output information will be written into the file `MD_dump`, in which the atomic forces, atomic velocities, and lattice virial are controlled by keyword `out_force`, `out_vel`, and `out_virial`, respectively.
33+
The MD output information will be written into the file `MD_dump`, in which the atomic forces, atomic velocities, and lattice virial are controlled by keyword `dump_force`, `dump_vel`, and `dump_virial`, respectively.
3434

3535
[Examples](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/md/lcao_gammaonly_Sn64) of MD simulations are also provided.
3636
There are eight INPUT files corresponding to eight different MD evolution methods in the directory.

source/module_io/input.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ void Input::Default(void)
186186
init_vel = false;
187187
symmetry_prec = 1.0e-5; // LiuXh add 2021-08-12, accuracy for symmetry
188188
cal_force = 0;
189-
out_force = false;
190-
out_vel = false;
191-
out_virial = false;
189+
dump_force = true;
190+
dump_vel = true;
191+
dump_virial = true;
192192
force_thr = 1.0e-3;
193193
force_thr_ev2 = 0;
194194
stress_thr = 1.0e-2; // LiuXh add 20180515
@@ -844,17 +844,17 @@ bool Input::Read(const std::string &fn)
844844
{
845845
read_bool(ifs, cal_force);
846846
}
847-
else if (strcmp("out_force", word) == 0)
847+
else if (strcmp("dump_force", word) == 0)
848848
{
849-
read_bool(ifs, out_force);
849+
read_bool(ifs, dump_force);
850850
}
851-
else if (strcmp("out_vel", word) == 0)
851+
else if (strcmp("dump_vel", word) == 0)
852852
{
853-
read_bool(ifs, out_vel);
853+
read_bool(ifs, dump_vel);
854854
}
855-
else if (strcmp("out_virial", word) == 0)
855+
else if (strcmp("dump_virial", word) == 0)
856856
{
857-
read_bool(ifs, out_virial);
857+
read_bool(ifs, dump_virial);
858858
}
859859
else if (strcmp("force_thr", word) == 0)
860860
{
@@ -2709,9 +2709,9 @@ void Input::Bcast()
27092709
Parallel_Common::bcast_bool(init_vel); // liuyu 2021-07-14
27102710
Parallel_Common::bcast_double(symmetry_prec); // LiuXh add 2021-08-12, accuracy for symmetry
27112711
Parallel_Common::bcast_bool(cal_force);
2712-
Parallel_Common::bcast_bool(out_force);
2713-
Parallel_Common::bcast_bool(out_vel);
2714-
Parallel_Common::bcast_bool(out_virial);
2712+
Parallel_Common::bcast_bool(dump_force);
2713+
Parallel_Common::bcast_bool(dump_vel);
2714+
Parallel_Common::bcast_bool(dump_virial);
27152715
Parallel_Common::bcast_double(force_thr);
27162716
Parallel_Common::bcast_double(force_thr_ev2);
27172717
Parallel_Common::bcast_double(stress_thr); // LiuXh add 20180515

source/module_io/input.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Input
4646
int pw_seed; // random seed for initializing wave functions qianrui 2021-8-12
4747

4848
bool init_vel; // read velocity from STRU or not liuyu 2021-07-14
49-
bool out_vel; // output atomic velocities into the file MD_dump or not. liuyu 2023-03-01
49+
bool dump_vel; // output atomic velocities into the file MD_dump or not. liuyu 2023-03-01
5050

5151
/* symmetry level:
5252
-1, no symmetry at all;
@@ -107,7 +107,7 @@ class Input
107107
// Forces
108108
//==========================================================
109109
bool cal_force;
110-
bool out_force; // output atomic forces into the file MD_dump or not. liuyu 2023-03-01
110+
bool dump_force; // output atomic forces into the file MD_dump or not. liuyu 2023-03-01
111111
double force_thr; // threshold of force in unit (Ry/Bohr)
112112
double force_thr_ev2; // invalid force threshold, mohan add 2011-04-17
113113

@@ -119,7 +119,7 @@ class Input
119119
double press2;
120120
double press3;
121121
bool cal_stress; // calculate the stress
122-
bool out_virial; // output lattice virial into the file MD_dump or not. liuyu 2023-03-01
122+
bool dump_virial; // output lattice virial into the file MD_dump or not. liuyu 2023-03-01
123123

124124
std::string fixed_axes; // which axes are fixed
125125
bool fixed_ibrav; //whether to keep type of lattice; must be used along with latname

source/module_io/test/INPUT

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ cond_nonlocal 1 #Nonlocal effects for conductivities
8585
#Parameters (4.Relaxation)
8686
ks_solver genelpa #cg; dav; lapack; genelpa; scalapack_gvx; cusolver
8787
scf_nmax 50 ##number of electron iterations
88-
out_force 0 #output the out_force or not
8988
relax_nmax 1 #number of ion iteration steps
9089
out_stru 0 #output the structure files after each ion step
9190
force_thr 0.001 #force threshold, unit: Ry/Bohr
@@ -198,6 +197,9 @@ md_pchain 1 #num of thermostats coupled with barostat
198197
md_pfirst -1 #initial target pressure
199198
md_plast -1 #final target pressure
200199
md_pfreq 0 #oscillation frequency, used to determine qmass of thermostats coupled with barostat
200+
dump_force 0 #output atomic forces into the file MD_dump or not.
201+
dump_vel 0 #output atomic velocities into the file MD_dump or not
202+
dump_virial 0 #output lattice virial into the file MD_dump or not
201203

202204
#Parameters (10.Electric field and dipole correction)
203205
efield_flag 0 #add electric field

source/module_io/test/input_test.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ TEST_F(InputTest, Default)
8080
EXPECT_FALSE(INPUT.init_vel);
8181
EXPECT_DOUBLE_EQ(INPUT.symmetry_prec,1.0e-5);
8282
EXPECT_EQ(INPUT.cal_force,0);
83-
EXPECT_FALSE(INPUT.out_force);
83+
EXPECT_TRUE(INPUT.dump_force);
84+
EXPECT_TRUE(INPUT.dump_vel);
85+
EXPECT_TRUE(INPUT.dump_virial);
8486
EXPECT_DOUBLE_EQ(INPUT.force_thr,1.0e-3);
8587
EXPECT_DOUBLE_EQ(INPUT.force_thr_ev2,0);
8688
EXPECT_DOUBLE_EQ(INPUT.stress_thr,1.0e-2);
@@ -404,7 +406,9 @@ TEST_F(InputTest, Read)
404406
EXPECT_FALSE(INPUT.init_vel);
405407
EXPECT_DOUBLE_EQ(INPUT.symmetry_prec,1.0e-5);
406408
EXPECT_EQ(INPUT.cal_force,0);
407-
EXPECT_FALSE(INPUT.out_force);
409+
EXPECT_FALSE(INPUT.dump_force);
410+
EXPECT_FALSE(INPUT.dump_vel);
411+
EXPECT_FALSE(INPUT.dump_virial);
408412
EXPECT_NEAR(INPUT.force_thr,1.0e-3,1.0e-7);
409413
EXPECT_DOUBLE_EQ(INPUT.force_thr_ev2,0);
410414
EXPECT_DOUBLE_EQ(INPUT.stress_thr,1.0e-2);

source/module_io/write_input.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ ModuleBase::GlobalFunc::OUTP(ofs, "out_bandgap", out_bandgap, "if true, print ou
267267
ModuleBase::GlobalFunc::OUTP(ofs,"md_pfirst",mdp.md_pfirst,"initial target pressure");
268268
ModuleBase::GlobalFunc::OUTP(ofs,"md_plast",mdp.md_plast,"final target pressure");
269269
ModuleBase::GlobalFunc::OUTP(ofs,"md_pfreq",mdp.md_pfreq,"oscillation frequency, used to determine qmass of thermostats coupled with barostat");
270-
ModuleBase::GlobalFunc::OUTP(ofs, "out_force", out_force, "output atomic forces into the file MD_dump or not");
271-
ModuleBase::GlobalFunc::OUTP(ofs, "out_vel", out_vel, "output atomic velocities into the file MD_dump or not");
272-
ModuleBase::GlobalFunc::OUTP(ofs, "out_virial", out_virial, "output atomic velocities into the file MD_dump or not");
270+
ModuleBase::GlobalFunc::OUTP(ofs, "dump_force", dump_force, "output atomic forces into the file MD_dump or not");
271+
ModuleBase::GlobalFunc::OUTP(ofs, "dump_vel", dump_vel, "output atomic velocities into the file MD_dump or not");
272+
ModuleBase::GlobalFunc::OUTP(ofs, "dump_virial", dump_virial, "output lattice virial into the file MD_dump or not");
273273

274274
ofs << "\n#Parameters (10.Electric field and dipole correction)" << std::endl;
275275
ModuleBase::GlobalFunc::OUTP(ofs,"efield_flag",efield_flag,"add electric field");

source/module_md/MD_func.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void MD_func::MDdump(const int &step,
300300
ofs << " " << unit_in.latvec.e21 << " " << unit_in.latvec.e22 << " " << unit_in.latvec.e23 << std::endl;
301301
ofs << " " << unit_in.latvec.e31 << " " << unit_in.latvec.e32 << " " << unit_in.latvec.e33 << std::endl;
302302

303-
if(GlobalV::CAL_STRESS && inp.out_virial)
303+
if(GlobalV::CAL_STRESS && inp.dump_virial)
304304
{
305305
ofs << "VIRIAL (kBar)" << std::endl;
306306
for(int i=0; i<3; ++i)
@@ -312,11 +312,11 @@ void MD_func::MDdump(const int &step,
312312
}
313313

314314
ofs << "INDEX LABEL POSITION (Angstrom)";
315-
if(inp.out_force)
315+
if(inp.dump_force)
316316
{
317317
ofs << " FORCE (eV/Angstrom)";
318318
}
319-
if(inp.out_vel)
319+
if(inp.dump_vel)
320320
{
321321
ofs << " VELOCITY (Angstrom/fs)";
322322
}
@@ -333,14 +333,14 @@ void MD_func::MDdump(const int &step,
333333
<< " " << unit_in.atoms[it].tau[ia].y * unit_pos
334334
<< " " << unit_in.atoms[it].tau[ia].z * unit_pos;
335335

336-
if(inp.out_force)
336+
if(inp.dump_force)
337337
{
338338
ofs << " " << force[index].x * unit_force
339339
<< " " << force[index].y * unit_force
340340
<< " " << force[index].z * unit_force;
341341
}
342342

343-
if(inp.out_vel)
343+
if(inp.dump_vel)
344344
{
345345
ofs << " " << vel[index].x * unit_vel
346346
<< " " << vel[index].y * unit_vel

source/module_md/test/setcell.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ class Setcell
111111
GlobalV::SEARCH_RADIUS = 8.5 * ModuleBase::ANGSTROM_AU;
112112
GlobalV::CAL_STRESS = 1;
113113

114-
INPUT.out_virial = true;
115-
INPUT.out_force = true;
116-
INPUT.out_vel = true;
114+
INPUT.dump_virial = true;
115+
INPUT.dump_force = true;
116+
INPUT.dump_vel = true;
117117

118118
INPUT.mdp.md_restart = 0;
119119
INPUT.mdp.md_dt = 1;

0 commit comments

Comments
 (0)