cyrusyc commited on
Commit
da3f047
·
1 Parent(s): e693b09

avoid slow reading of long MD trajectory

Browse files
Files changed (1) hide show
  1. mlip_arena/tasks/md.py +2 -3
mlip_arena/tasks/md.py CHANGED
@@ -309,10 +309,9 @@ def run(
309
 
310
  if restart and traj_file.exists():
311
  try:
312
- traj = read(traj_file, index=":")
313
- last_atoms = traj[-1]
314
  assert isinstance(last_atoms, Atoms)
315
- last_step = last_atoms.info.get("step", len(traj) * traj_interval)
316
  n_steps -= last_step
317
  traj = Trajectory(traj_file, "a", atoms)
318
  atoms.set_positions(last_atoms.get_positions())
 
309
 
310
  if restart and traj_file.exists():
311
  try:
312
+ last_atoms = read(traj_file, index="-1")
 
313
  assert isinstance(last_atoms, Atoms)
314
+ last_step = last_atoms.info.get("step")
315
  n_steps -= last_step
316
  traj = Trajectory(traj_file, "a", atoms)
317
  atoms.set_positions(last_atoms.get_positions())