Repository navigation
Conversation
mohanchen
left a comment
There was a problem hiding this comment.
This is a breaking change and it looks good to me.
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The STRU output migration leaves regressions in ASE reading, legacy restart output and final-stress collection. The inline comments identify five defects and three non-blocking improvements.
Static review only; no builds or runtime tests were run.
| log_steps.append(ion_move) | ||
| if len(log_steps) != len(energies): | ||
| log_steps = list(range(1, len(energies) + 1)) | ||
| selected = [log_steps.index(step) for step in step_ids] |
There was a problem hiding this comment.
Restarted STRU markers use cumulative MD steps, while the solver logs local #ION MOVE# IDs. If Restart_md.txt contains 5 and the run resumes into a new output suffix with md_nstep=7, the STRU markers are 6/7 but this lookup searches 1/2 and raises ValueError. Please account for the restart offset/run segment before matching frame results, and add a restarted-log reader fixture.
| energies = [energies[i] for i in selected] | ||
| if len(forces) == len(log_steps): | ||
| forces = [forces[i] for i in selected] | ||
| if len(stress) == len(log_steps): |
There was a problem hiding this comment.
The MD guards now remove every #TOTAL-STRESS (kbar)# table, but read_stress_from_running_log() still recognizes only that header. Consequently the new ASE path silently returns stress=None even with cal_stress=1. Please read the replacement MD tensors, preserve the electronic-stress convention, and align them by step; the new reader tests currently reuse an old-format log.
| { | ||
| write_stru_frame(current_step); | ||
| ModuleBase::ensure_directory(stru_out_dir); | ||
| const std::string filename = ModuleIO::stru_frame_filename( |
There was a problem hiding this comment.
The restart reader still accepts legacy OUT.<suffix>/STRU/STRU_MD_<step> files, but modes 0/1 now unconditionally write periodic frames to OUT.<suffix>/STRU. On such a restart that path is a directory, so the first frame fails to open and terminates the run. Please retain a safe legacy-directory output route and cover it with a restart case.
| press3=0 | ||
| fi | ||
| if ! awk -v p1="$press1" -v p2="$press2" -v p3="$press3" ' | ||
| /VIRIAL \(kbar\):/ { rows = 3; count = 0; next } |
There was a problem hiding this comment.
This selects the last printed virial without checking its MD STEP. With md_nstep=5 and out_thermo_freq=3, that tensor is labelled MD STEP: 4, while the final energy and STRU_FINAL forces belong to step 5. Please reject unavailable final-step stress or require an explicit validation cadence, so an earlier tensor is not silently compared as the final result.
| """Read MD frames from appended, numbered, or final STRU output.""" | ||
| periodic = directory / 'STRU' | ||
| numbered = sorted((directory / 'STRUC').glob('STRU[0-9]*'), | ||
| key=lambda path: int(path.name[4:])) |
There was a problem hiding this comment.
The glob also matches leftover relaxation files such as STRUC/STRU1.cif, so int("1.cif") raises ValueError before the current-run announcements can filter them—even when a valid current STRU exists. Please restrict numbered candidates to a full STRU[0-9]+ filename match before converting the suffix.
| } | ||
| } | ||
|
|
||
| TEST(MDCellReaderTest, STRUAtomOrderStaysStableAcrossOwnerChanges) |
There was a problem hiding this comment.
Non-blocking: the new stable-order fixture fits in one gather batch, while the removed dump tests covered one-row and multiple-batch boundaries. Please retain a writer-level case that crosses the batch boundary and includes an empty rank, so index-range advancement and frame completeness stay covered.
| const std::pair<std::int64_t, std::string>& right) { return left.first < right.first; }); | ||
| } | ||
| for (std::size_t it = 0; it < stru_meta.species.size(); ++it) | ||
| const int row_bytes = std::max(domain.max(local_row_bytes), 1); |
There was a problem hiding this comment.
Non-blocking: please store domain.max(local_row_bytes) in a named local before passing it to std::max, as required by AGENTS rule 14. This also keeps the collective visible as a separate operation; the new out_stru > 0 argument in run_md.cpp can be named similarly.
| "containing atomic velocities."; | ||
| ModuleBase::WARNING_QUIT("ReadInput::set_global_dir", message); | ||
| } | ||
| log_read_file(sys.global_in_stru); |
There was a problem hiding this comment.
Non-blocking: please emit or flush this confirmation after make_dir_out opens the running log. set_global_dir runs earlier, so the new ofs_running insertion cannot record the restart source in the log on normal startup.
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.source/changes.Linked Issue
No issue: this refactor follows the developer's MD output redesign request.
Unit Tests and/or Case Tests for my changes
origin/develop(all passed):cmake --build build_parallel_md1_current --target MODULE_CELL_NEIGHBOR_mdcell_reader abacus_basic_para -j 12env OMP_NUM_THREADS=1 ctest --test-dir build_parallel_md1_current -R '^(MODULE_CELL_NEIGHBOR_mdcell_reader_np4|MODULE_MD_func|MODULE_IO_input_test_para|04_FF_md_output_cadence)$' --output-on-failure— 4/4 passed.python3 tools/03_code_analysis/agent_governance_check.py --base origin/develop --head HEAD --format text— exit 0, migration-neutral global-reference warnings only (9 added, 14 removed, net -5).git diff --check origin/develop...HEAD— passed.build_parallel_md1_current/abacus_basic_para --version— v3.11.0-beta13.04_FFCTest group; targeted Autotest casesmd_nvt(LCAO),103_PW_MD_2O(PW),25_OF_MD_LDA(OFDFT),05_PW_MD_SDFT_10S(SDFT), andrelax_cell_fix_ac(non-MD);bash -n tests/integrate/validation_tools/props_basic.sh;python3 -m unittest tests/integrate/validation_tools/test_props_basic.py.-h out_thermo_freqreports default 1;-h md_thermo_freqrejects the removed name. A valid temporary INPUT acceptedout_thermo_freq; the old name was rejected by the parser.cmake --build build_parallel_md1_current --target abacus_basic_para -j 12passed; `env OMP_NUM_THREADS=1 bash ../integrate/Autotest.sh -a /home/fy19/abacus-develop/build_parallel_md1_current/abacus_basic_para -n 4 -o 1 -j 2 -r '^(md_nvt|relax_cell_vdw3) DeePMD and NEP runtime cases could not run because those optional features are disabled in this build. The last change only removes an internal velocity toggle; MDCell STRU always wrote velocities in production before and after it.What's changed?
out_app_flagmodes. Periodic frames useout_freq_ion;out_stru=1writesSTRU_FINALon completion.STRU_restartandRestart_md.txtindependent checkpoints controlled bymd_restartfreq. Restart structures always retain velocities; ordinary MD structures include velocities and per-atom forces. Distributed MDCell rows are sorted by stable atom identity and checked for duplicates/missing atoms.MD_dumpandmd_dumpfreq,dump_force,dump_vel,dump_virial, andmd_out_forceINPUT keywords; migrate included cases, ASE reader, postprocessing script, and property collector to STRU.out_thermo_freq(default 1) for MD log summaries, always print the one-basedMD STEPlabel for each summary, and print complete 3x3 virial/total-stress tensors when stress is enabled. Remove themd_thermo_freqalias. MD solvers continue computing forces and stress every step but no longer print solver-specific force/stress tables outside the MD output cadence; non-MD output remains unchanged.geo_in_type ABACUSreader needs trajectory conversion for the new STRU output.Governance Notes
read_input_item_md.cpp,read_inp_out.cpp,docs/advanced/md.md,docs/advanced/input_files/stru.md, and affected examples/cases are updated. Generated input reference files are intentionally not committed. The final removal of the internalinclude_velocityargument has no user-visible output change. TheMD STEPcorrection brings the log into line with the existingout_thermo_freqdescription, which already promises step output regardless ofcal_stress.PARAMreferences in output/logging functions are local aliases of existing accesses. The oneGlobalV::ofs_runningreference in restart input reports the required file-read confirmation. The PR-level global-reference count decreases by 5.fromtests/03_NAO_multikpassed 8/8 properties outside the sandbox. This only moves MD guards before the LCAO print calls, with no user-visible output change.\n- MD step label follow-up:cmake --build build_parallel_md1_current --target MODULE_MD_base MODULE_MD_base_mpi abacus_basic_para -j 12passed;env OMP_NUM_THREADS=1 ctest --test-dir build_parallel_md1_current -R '^(MODULE_MD_base|MODULE_MD_base_mpi_np4|04_FF_md_output_cadence) DeePMD and NEP runtime cases could not run because those optional features are disabled in this build. The last change only removes an internal velocity toggle; MDCell STRU always wrote velocities in production before and after it.What's changed?
out_app_flagmodes. Periodic frames useout_freq_ion;out_stru=1writesSTRU_FINALon completion.STRU_restartandRestart_md.txtindependent checkpoints controlled bymd_restartfreq. Restart structures always retain velocities; ordinary MD structures include velocities and per-atom forces. Distributed MDCell rows are sorted by stable atom identity and checked for duplicates/missing atoms.MD_dumpandmd_dumpfreq,dump_force,dump_vel,dump_virial, andmd_out_forceINPUT keywords; migrate included cases, ASE reader, postprocessing script, and property collector to STRU.out_thermo_freq(default 1) for MD log summaries and complete 3x3 virial/total-stress tensors. Remove themd_thermo_freqalias. MD solvers continue computing forces and stress every step but no longer print solver-specific force/stress tables outside the MD output cadence; non-MD output remains unchanged.geo_in_type ABACUSreader needs trajectory conversion for the new STRU output.Governance Notes
read_input_item_md.cpp,read_inp_out.cpp,docs/advanced/md.md,docs/advanced/input_files/stru.md, and affected examples/cases are updated. Generated input reference files are intentionally not committed. The final removal of the internalinclude_velocityargument has no user-visible output change and needs no further documentation.PARAMreferences in output/logging functions are local aliases of existing accesses. The oneGlobalV::ofs_runningreference in restart input reports the required file-read confirmation. The PR-level global-reference count decreases by 5.--output-on-failure
passed 3/3. The addedtest_md_base.cppcase verifiesMD STEP: 6in the log withcal_stress=0.\n- Stress print guard cleanup:cmake --build build_parallel_md1_current --target abacus_basic_para -j 12passed;env OMP_NUM_THREADS=1 ctest --test-dir build_parallel_md1_current -R '^04_FF_md_output_cadence DeePMD and NEP runtime cases could not run because those optional features are disabled in this build. The last change only removes an internal velocity toggle; MDCell STRU always wrote velocities in production before and after it.What's changed?
out_app_flagmodes. Periodic frames useout_freq_ion;out_stru=1writesSTRU_FINALon completion.STRU_restartandRestart_md.txtindependent checkpoints controlled bymd_restartfreq. Restart structures always retain velocities; ordinary MD structures include velocities and per-atom forces. Distributed MDCell rows are sorted by stable atom identity and checked for duplicates/missing atoms.MD_dumpandmd_dumpfreq,dump_force,dump_vel,dump_virial, andmd_out_forceINPUT keywords; migrate included cases, ASE reader, postprocessing script, and property collector to STRU.out_thermo_freq(default 1) for MD log summaries and complete 3x3 virial/total-stress tensors. Remove themd_thermo_freqalias. MD solvers continue computing forces and stress every step but no longer print solver-specific force/stress tables outside the MD output cadence; non-MD output remains unchanged.geo_in_type ABACUSreader needs trajectory conversion for the new STRU output.Governance Notes
read_input_item_md.cpp,read_inp_out.cpp,docs/advanced/md.md,docs/advanced/input_files/stru.md, and affected examples/cases are updated. Generated input reference files are intentionally not committed. The final removal of the internalinclude_velocityargument has no user-visible output change and needs no further documentation.PARAMreferences in output/logging functions are local aliases of existing accesses. The oneGlobalV::ofs_runningreference in restart input reports the required file-read confirmation. The PR-level global-reference count decreases by 5.--output-on-failure
passed 1/1;env OMP_NUM_THREADS=1 bash ../integrate/Autotest.sh -a /home/fy19/abacus-develop/build_parallel_md1_current/abacus_basic_para -n 4 -o 1 -j 2 -r '^(md_nvt|relax_cell_vdw3) DeePMD and NEP runtime cases could not run because those optional features are disabled in this build. The last change only removes an internal velocity toggle; MDCell STRU always wrote velocities in production before and after it.What's changed?
out_app_flagmodes. Periodic frames useout_freq_ion;out_stru=1writesSTRU_FINALon completion.STRU_restartandRestart_md.txtindependent checkpoints controlled bymd_restartfreq. Restart structures always retain velocities; ordinary MD structures include velocities and per-atom forces. Distributed MDCell rows are sorted by stable atom identity and checked for duplicates/missing atoms.MD_dumpandmd_dumpfreq,dump_force,dump_vel,dump_virial, andmd_out_forceINPUT keywords; migrate included cases, ASE reader, postprocessing script, and property collector to STRU.out_thermo_freq(default 1) for MD log summaries and complete 3x3 virial/total-stress tensors. Remove themd_thermo_freqalias. MD solvers continue computing forces and stress every step but no longer print solver-specific force/stress tables outside the MD output cadence; non-MD output remains unchanged.geo_in_type ABACUSreader needs trajectory conversion for the new STRU output.Governance Notes
read_input_item_md.cpp,read_inp_out.cpp,docs/advanced/md.md,docs/advanced/input_files/stru.md, and affected examples/cases are updated. Generated input reference files are intentionally not committed. The final removal of the internalinclude_velocityargument has no user-visible output change and needs no further documentation.PARAMreferences in output/logging functions are local aliases of existing accesses. The oneGlobalV::ofs_runningreference in restart input reports the required file-read confirmation. The PR-level global-reference count decreases by 5.fromtests/03_NAO_multikpassed 8/8 properties. This commit removes an unnecessaryPARAM.inpalias and a redundant condition inModuleIO::print_stress`; output behavior is unchanged and no documentation update is needed.\n- Full integration suite not run locally. DeePMD and NEP runtime cases could not run because those optional features are disabled in this build. The last change only removes an internal velocity toggle; MDCell STRU always wrote velocities in production before and after it.What's changed?
out_app_flagmodes. Periodic frames useout_freq_ion;out_stru=1writesSTRU_FINALon completion.STRU_restartandRestart_md.txtindependent checkpoints controlled bymd_restartfreq. Restart structures always retain velocities; ordinary MD structures include velocities and per-atom forces. Distributed MDCell rows are sorted by stable atom identity and checked for duplicates/missing atoms.MD_dumpandmd_dumpfreq,dump_force,dump_vel,dump_virial, andmd_out_forceINPUT keywords; migrate included cases, ASE reader, postprocessing script, and property collector to STRU.out_thermo_freq(default 1) for MD log summaries and complete 3x3 virial/total-stress tensors. Remove themd_thermo_freqalias. MD solvers continue computing forces and stress every step but no longer print solver-specific force/stress tables outside the MD output cadence; non-MD output remains unchanged.geo_in_type ABACUSreader needs trajectory conversion for the new STRU output.Governance Notes
read_input_item_md.cpp,read_inp_out.cpp,docs/advanced/md.md,docs/advanced/input_files/stru.md, and affected examples/cases are updated. Generated input reference files are intentionally not committed. The final removal of the internalinclude_velocityargument has no user-visible output change and needs no further documentation.PARAMreferences in output/logging functions are local aliases of existing accesses. The oneGlobalV::ofs_runningreference in restart input reports the required file-read confirmation. The PR-level global-reference count decreases by 5.