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
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 |
|---|---|---|
|
|
@@ -2231,6 +2231,12 @@ TEST_F(InputTest, Item_test2) | |
| it->second.reset_value(it->second, param); | ||
| EXPECT_EQ(TestParameters::input(param).mdp.md_nstep, 50); | ||
| } | ||
| { // md_thermo_freq | ||
| auto it = find_label("md_thermo_freq", readinput.input_lists); | ||
| it->second.str_values = {"100"}; | ||
| it->second.read_value(it->second, param); | ||
| EXPECT_EQ(TestParameters::input(param).mdp.md_thermo_freq, 100); | ||
|
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. Non-blocking: this verifies parsing but does not exercise the new output cadence. Please add output-level coverage for 0, 1, and a larger frequency, including startup and restart, checking the selected banner/scalar records and that forces and integration state stay unchanged. The current |
||
| } | ||
| { // md_prec_level | ||
| auto it = find_label("md_prec_level", readinput.input_lists); | ||
| TestParameters::input(param).mdp.md_prec_level = 1; | ||
|
|
||
| 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) | ||
| { | ||
| const int md_step = mdrun->step_ + mdrun->step_rst_; | ||
| const int thermo_step = mdrun->step_ == 0 ? md_step : md_step + 1; | ||
| const 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. | ||
|
|
@@ -235,8 +239,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); | ||
|
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. [P2] Apply the disabled setting to the setup banner too. With |
||
| } | ||
| mdrun->first_half(GlobalV::ofs_running); | ||
|
|
||
| /// update force and virial due to the update of atom positions | ||
|
|
@@ -246,8 +253,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 +274,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.