[lammps-users] Calculate particles displacement with periodic boundaries

Dear LAMMPS users,

I would like to know the displacement of each particle during certain time period, e.g. from t0 to t1 the particle moves some distance. Given that the periodic boundary (in my case, only X&Y are periodic) can remap the particles when they cross it, which may lead to more than 1 answer for the calculation of displacement in the post process.

So, may I ask do you have any experience solving this type of problems? Or do you know how to flag/mark the particle if it has ever crossed one of the periodic boundaries? Or is there any way can count one particle how many times it has been remapped by the periodic boundary? Or, if I have to modify the src code, then which file should I look at?

Thanks a lot in advance for any suggestions.

Best Regards,

Mingrui

Yes, you can access the count of how many times a particle has passed through PBC by accessing the image flags.
But things are even simpler if you access the unwrapped coordinates (xu, yu, zu) which would be the canonical property to base displacements on (also internally for all kinds of property calculations inside of LAMMPS).

You can probably even do your computation on-the-fly using fix store/state and atom style variables.

Axel.

Or you can use compute displace/atom which keeps track of PBC effects.

Steve

Dear Dr.Axel,

Thanks for quick the response and those suggestions. I got it, I guess the unwrapped coordinates is indeed straightforward for me.

Very appreciate!

Best Regards,

Mingrui