Atom Distance

Hello Users,

I would like to track the distance between two atoms and print to a file during the simulation run. I was wondering if there was already a variable command to do this (I didn’t see one but may be overlooking) or if this is something that I will need to define?

Thanks

Hi John,

I think it is easily possible by defining a variable and then using a fix command for printing output file.

have a look at document pages:

http://lammps.sandia.gov/doc/variable.html
http://lammps.sandia.gov/doc/fix_print.html

variable distance equal “sqrt((x[i]-x[j])^2+(y[i]-y[j])^2+(z[i]-z[j])^2)”
fix 1 all print 100 “${distance}” file filename.txt

Regards,

Sara