Skip to content

Instantly share code, notes, and snippets.

@whitead
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save whitead/9325454 to your computer and use it in GitHub Desktop.

Select an option

Save whitead/9325454 to your computer and use it in GitHub Desktop.
Lammps Replay Snippet
#the 3 is the number of frames in the trajectory to replay
variable i loop 3
#the stride is the time between frames
variable stride equal 1
#set-up run here, including reading data/restart file
...
...
...
...
#Paranoid. Rebuild neighbor list every step.
#Haven't figured out if read_dump forces a neighbor list rebuild.
neigh_modify delay 0 every 1
#now replay trajectory
label replay
#calculate the timestep
variable t equal "(v_i-1)*v_stride"
#read the file with read_dump
#Reading a dcd requires the USER-MOLFILE package to be compiled
read_dump traj.dcd $t x y z format molfile box yes reader dcd
#Using XYZ reader instead
#NOTE: If you use xyz instead, set stride to 1 since lammps doesn't read the timestep
#read_dump traj.xyz $t x y z box no format xyz
#set the timestep
reset_timestep $t
#calculate forces
run 0
#next frame
next i
jump SELF replay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment