Skip to content

Commit

Permalink
Updated the revise_lmp_input_dump function. (#1137)
Browse files Browse the repository at this point in the history
Added the `model_devi_merge_traj` parameter to allow the merging of
trajectories into one file using the lmp_input template.

---------

Signed-off-by: Pan Xiang <panxiang126@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
panxiang126 and pre-commit-ci[bot] authored Feb 13, 2023
1 parent 7a1ceb4 commit a4eca19
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions dpgen/generator/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,12 +921,19 @@ def revise_lmp_input_model(lmp_lines, task_model_list, trj_freq, deepmd_version=
return lmp_lines


def revise_lmp_input_dump(lmp_lines, trj_freq):
def revise_lmp_input_dump(lmp_lines, trj_freq, model_devi_merge_traj=False):
idx = find_only_one_key(lmp_lines, ["dump", "dpgen_dump"])
lmp_lines[idx] = (
"dump dpgen_dump all custom %d traj/*.lammpstrj id type x y z\n"
% trj_freq
)
if model_devi_merge_traj:
lmp_lines[idx] = (
"dump dpgen_dump all custom %d all.lammpstrj id type x y z\n"
% trj_freq
)
else:
lmp_lines[idx] = (
"dump dpgen_dump all custom %d traj/*.lammpstrj id type x y z\n"
% trj_freq
)

return lmp_lines


Expand Down Expand Up @@ -1317,7 +1324,9 @@ def _make_model_devi_revmat(iter_index, jdata, mdata, conf_systems):
deepmd_version=deepmd_version,
)

lmp_lines = revise_lmp_input_dump(lmp_lines, trj_freq)
lmp_lines = revise_lmp_input_dump(
lmp_lines, trj_freq, model_devi_merge_traj
)
lmp_lines = revise_by_keys(
lmp_lines,
total_rev_keys[:total_num_lmp],
Expand Down

0 comments on commit a4eca19

Please sign in to comment.