How to get maximum distance atoms move on one step?

Dear everyone:
Usually, we use fix dt/reset command to control the maximum distance atoms move. If we give the Xmax in the command, it automatically gives us the dt on every simulation step.
If I want this in the opposite way, i.e., I set the timestep to be a constant number, like timestep 0.00001 in metal units. Is it possible to get the maximum distance that one atom move among all atoms on one step?
Any help would be much appreciated!

My Best Regards
Liu

There are multiple ways that you could potentially do this. In fact, compute displace/atom and a compute reduce would give you this. In each, your biggest obstacle would be updating the vector of atom positions from the initial time (t_i), so that you can calculate |x(t_i+1)-x(t_i)|. displace/atom calculates x(t_i+1)-x(t_1)

All in all, your output via dump from compute displace/atom wouldn’t be hard to post-process and get said incremental max displacement; some plotting softwares, e.g. Tecplot, will even be able to calculate this from the output of compute displace/atom.

If you are doing NVE, you could calculate the per-timestep

displacement yourself as abs(v*dt) in an atom-style variable, run

it thru compute reduce max, and print it out with thermo

output on any step you like.

There is also fix nve/limit which allows you to set them

max distance any atom can move and will count

the number of atoms that exceeded it, and output

that count.

Steve

Hi Steve. Thanks very much for your help!

I followed your instruction and tried. But I am sorry that I still have some problems.I write these commands “variable disall atom abs(vdt); compute diamax all reduce max v_disall; variable mydismax equal c_dismax”, and I think I can output the max of atom’s displacement. But when I output this through “fix ID all print 100 “${mydismax}”or “thermo custom XXX c_dismax”or “thermo custom XXX v_mydismax”, it shows the error “Invalid thermo keyword in variable formula”. It seems “variable disall atom abs(vdt)” is not right, but I do not know how to solve this? Could you please give me more details?

And one more question is that you mentioned doing this in NVE ensemble, if I am doing this in NVT or NVP, I cannot use abs(v*dt) to calculate the displacement of atoms?

Thanks you very much!

  Hi Steve. Thanks very much for your help!

I followed your instruction and tried. But I am sorry that I still have
some problems.I write these commands “variable disall atom abs(v*dt);
compute diamax all reduce max v_disall; variable mydismax equal c_dismax”,
and I think I can output the max of atom’s displacement. But when I output
this through “fix ID all print 100 “${mydismax}”or “thermo custom XXX
c_dismax”or “thermo custom XXX v_mydismax”, it shows the error “Invalid
thermo keyword in variable formula”. It seems “variable disall atom
abs(v*dt)” is not right, but I do not know how to solve this? Could you
please give me more details?

And one more question is that you mentioned doing this in NVE ensemble, if
I am doing this in NVT or NVP, I cannot use abs(v*dt) to calculate the
displacement of atoms?

​there is no such property as "v". what steve has been giving you is just
the concept. he expects that you read the documentation and figure out the
details.
after a quick glance at the variable documentation, it should be obvious
that you can get abs(v*dt) from sqrt(vx*vx+vy*vy+vz*vz)*dt

thus if i add the following to the in.melt example, it works fine:

variable displace atom sqrt(vx*vx+vy*vy+vz*vz)*dt
compute c1 all reduce max v_displace

thermo_style custom step temp c_c1

as for using this approach with a nvt/nvp thermostat, you have to be aware
that the nose-hoover thermostats will modify the forces, so there will be
some small error to your output. but then again, in the velocity verlet
scheme, your displacement between two steps isn't exactly v*dt either, but
rather 1/2*v_old*dt + 1/2*v_new*dt. v*dt is the displacement between the
respective middle of two timesteps.

for more details on this, i suggest you look up how velocity verlet
integration and thermostats work in your favorite MD text book.

axel.

Dear Eric, Thanks very much for your help!

Liu