Repository navigation
feat(md): add thermodynamic output frequency #8160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
1021a75
19f64d4
32e94cd
4a0bdfe
91ac9d8
e23e031
f45fa74
b9a2c63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,6 +186,17 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or | |
| read_sync_int(input.mdp.md_dumpfreq); | ||
| this->add_item(item); | ||
| } | ||
| { | ||
| Input_Item item("md_thermo_freq"); | ||
| item.annotation = "The period to output MD thermodynamic information"; | ||
| item.category = "Molecular dynamics"; | ||
| item.type = "Integer"; | ||
| item.description = "The output frequency of MD step, energy, temperature, and pressure information in OUT.${suffix}/running_md.log and on screen. Set to 0 to disable this output."; | ||
| item.default_value = "1"; | ||
| item.unit = ""; | ||
| read_sync_int(input.mdp.md_thermo_freq); | ||
| this->add_item(item); | ||
| } | ||
| { | ||
| Input_Item item("md_neighbor_skin"); | ||
| item.annotation = "extra MDCell neighbor-list radius"; | ||
|
|
@@ -200,18 +211,6 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or | |
| read_sync_double(input.mdp.md_neighbor_skin); | ||
| this->add_item(item); | ||
| } | ||
| { | ||
| Input_Item item("md_out_force"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing |
||
| item.annotation = "output all atomic forces into running_md.log or not"; | ||
| item.category = "Molecular dynamics"; | ||
| item.type = "Boolean"; | ||
| item.description = "Whether to output the TOTAL-FORCE table in OUT.${suffix}/running_md.log for MDCell molecular dynamics. This does not affect force calculation or molecular dynamics integration."; | ||
| item.default_value = "True"; | ||
| item.unit = ""; | ||
| item.set_availability(""); | ||
| read_sync_bool(input.mdp.md_out_force); | ||
| this->add_item(item); | ||
| } | ||
| { | ||
| Input_Item item("dump_force"); | ||
| item.annotation = "output atomic forces into the file MD_dump or not"; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -191,6 +191,10 @@ void md_line(MDCell& mdcell, | |
| /// md cycle, mohan update 2026-01-04, change '<=' to '<' | ||
| while ((mdrun->step_ + mdrun->step_rst_) < param_in.mdp.md_nstep && !mdrun->stop) | ||
| { | ||
| int md_step = mdrun->step_ + mdrun->step_rst_; | ||
| int thermo_step = mdrun->step_ == 0 ? md_step : md_step + 1; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The gating index is inconsistent: step 0 is tested with the 0-based
Suggest using |
||
| bool print_thermo = param_in.mdp.md_thermo_freq > 0 | ||
| && thermo_step % param_in.mdp.md_thermo_freq == 0; | ||
| #ifdef __JSON | ||
| // JSON output currently follows the UnitCell-backed electronic-structure path. | ||
| // Start one output record before the solver appends SCF information for this MD step. | ||
|
|
@@ -204,6 +208,20 @@ void md_line(MDCell& mdcell, | |
| { | ||
| mdrun->setup(p_esolver, param_in.globalv.global_readin_dir, decomp); | ||
|
|
||
| // setup() may load step_rst_ from Restart_md.txt. | ||
| md_step = mdrun->step_ + mdrun->step_rst_; | ||
| thermo_step = md_step; | ||
| print_thermo = param_in.mdp.md_thermo_freq > 0 | ||
| && thermo_step % param_in.mdp.md_thermo_freq == 0; | ||
|
|
||
| if (print_thermo) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ordering regression: |
||
| { | ||
| const int stress_step = 0; | ||
| const int force_step = 0; | ||
| const int istep_print = md_step + 1; | ||
| ModuleIO::print_screen(stress_step, force_step, istep_print); | ||
| } | ||
|
|
||
| if (param_in.mdp.plumed) | ||
| { | ||
| int nproc = 1; | ||
|
|
@@ -235,8 +253,11 @@ void md_line(MDCell& mdcell, | |
| // mohan add 2026-01-04 | ||
| const int stress_step = 0; | ||
| const int force_step = 0; | ||
| const int istep_print = mdrun->step_ + mdrun->step_rst_ + 1; | ||
| ModuleIO::print_screen(stress_step, force_step, istep_print); | ||
| const int istep_print = thermo_step; | ||
| if (print_thermo) | ||
| { | ||
| ModuleIO::print_screen(stress_step, force_step, istep_print); | ||
|
19hello marked this conversation as resolved.
|
||
| } | ||
| mdrun->first_half(GlobalV::ofs_running); | ||
|
|
||
| /// update force and virial due to the update of atom positions | ||
|
|
@@ -246,8 +267,7 @@ void md_line(MDCell& mdcell, | |
| decomp, | ||
| mdrun->potential, | ||
| param_in.inp.cal_stress, | ||
| mdrun->virial, | ||
| param_in.mdp.md_out_force); | ||
| mdrun->virial); | ||
|
|
||
| if (plumed.active()) | ||
| { | ||
|
|
@@ -268,7 +288,10 @@ void md_line(MDCell& mdcell, | |
| mdrun->frozen_freedom_); | ||
| } | ||
|
|
||
| mdrun->print_md(GlobalV::ofs_running, PARAM.inp.cal_stress); | ||
| if (print_thermo) | ||
| { | ||
| mdrun->print_md(GlobalV::ofs_running, param_in.inp.cal_stress); | ||
| } | ||
| if (param_in.mdp.md_dumpfreq > 0 | ||
| && (mdrun->step_ + mdrun->step_rst_) % param_in.mdp.md_dumpfreq == 0) | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.