unwrapped coordinates

Hello LAMMPS users,
I’ve been having hard time with unwrapped coordinates – It works fine when a group is partially beyond the boundary, but when the whole group completely crosses the boundary and re-enters the simulation box from the other side, the unwrapped coords seem to lose track of their history and just go for an abrupt change. It could be hazardous for calculating center-of-mass positions and forces related to that.

I’m not quite familiar with every attribute in the atom class, so I was wondering if there is anything I can use to fix this issue. Thanks!

Hello LAMMPS users,

hello yuchong,

I've been having hard time with unwrapped coordinates -- It works fine when
a group is partially beyond the boundary, but when the whole group
completely crosses the boundary and re-enters the simulation box from the
other side, the unwrapped coords seem to lose track of their history and
just go for an abrupt change. It could be hazardous for calculating
center-of-mass positions and forces related to that.
I'm not quite familiar with every attribute in the atom class, so I was
wondering if there is anything I can use to fix this issue. Thanks!

your question is missing vital information about in which context
to are looking at the coordinates. part of your messages suggests
that you are doing data analysis, other parts hint that you are
modifying LAMMPS' source code.

it is impossible to provide good advice without context.

axel.

Hi Axel,
Sorry for the confusion. For now I’m only doing data analysis from a simulation with its boundary conditions screwed up.
I was using fix spring/couple and saw an abrupt change of the spring force calculated from center-of-mass of two groups, one of which was a rigid body controlled by fix rigid/nvt. According to the manual, the atom image flags are not incremented/decremented as they would be for non-rigid atoms as the rigid body crosses periodic boundaries. But in my simulation, I need the correct unwrapped coords of center-of-mass to get correct the spring forces. I was wondering what I should do to fix this.

Thank you.

Hi Axel,
Sorry for the confusion. For now I'm only doing data analysis from a
simulation with its boundary conditions screwed up.
I was using fix spring/couple and saw an abrupt change of the spring force
calculated from center-of-mass of two groups, one of which was a rigid body
controlled by fix rigid/nvt. According to the manual, the atom image flags
are not incremented/decremented as they would be for non-rigid atoms as the
rigid body crosses periodic boundaries. But in my simulation, I need the
correct unwrapped coords of center-of-mass to get correct the spring forces.
I was wondering what I should do to fix this.

you may need to do some programming. fix rigid/nvt should provide the proper
center of mass coordinates of the rigid body and you'd need to teach fix
spring to read its reference coordinates from variables. at least that is what
comes to my mind. perhaps somebody else has a better idea.

cheers,
    axel.

I wrote about the fix rigid last year.

See

http://lammps.sandia.gov/threads/msg15632.html

The image flags for the COM should work in fix rigid, but it doesn't
update the image flags for the atoms. You have to take care of this
in post-process. The image flags of the COM are not accessible via
the generate dump custom dump of the image flags, but by a fix
attribute.

I've used the pbctools unwrap, followed by a wrap in VMD sometimes for
visualization and to rewrite the trajectory file. Works if the first
frame is already unwrapped I think. Might work for you if you just
want a quick unwrap of your trajectory to work on.

Thanks for the heads-up Joshua. Your threads definitely helped me locate the problem.
Unfortunately what I need is not just a simple modification on the post-processing; I won’t have the correct spring-forces I need unless I get the correct image flags of the individual atoms in the rigid body.

The image flags for the COM should work in fix rigid, but it doesn't
update the image flags for the atoms.

This is intentional, not something we forgot. The image flags
are what are used within fix rigid to reconstruct the rigid body itself.
See this note on the fix rigid doc page:

IMPORTANT NOTE: The periodic image flags of atoms in rigid bodies are
altered so that the rigid body can be reconstructed correctly when it
straddles periodic boundaries. The atom image flags are not
incremented/decremented as they would be for non-rigid atoms as the
rigid body crosses periodic boundaries. This means you cannot
interpret them as you normally would. For example, the image flag
values written to a dump file will be different than they would be if
the atoms were not in a rigid body. Likewise the compute msd will not
compute the expected mean-squared displacement for such atoms if the
body moves across periodic boundaries. It also means that if you have
bonds between a pair of rigid bodies and the bond straddles a periodic
boundary, you cannot use the replicate command to increase the system
size. Note that this fix does define image flags for each rigid body,
which are incremented when the rigid body crosses a periodic boundary
in the usual way. These image flags have the same meaning as atom
images (see the "dump" command) and can be accessed and output as
described below.

Fix spring (couple or tether) does not have any logic to work with
atoms (or groups
or rigid bodies) that cross periodic boundaries. It's not designed to do that.
It's not clear to me that it should. Why don't you construct a system where
the atoms you are attaching to the spring do not cross boundaries?

Steve

Fix spring (couple or tether) does not have any logic to work with
atoms (or groups
or rigid bodies) that cross periodic boundaries.

whoops - I lied. The routine that calculates the center-of-mass
of the group does respect the periodic boundaries by using
image flags. So it is only rigid bodies that will not work
in that mode with fix spring. I put a NOTE on the fix spring
doc page to that effect.

Steve

Thanks for the explanation Steve.
Could you say a bit more about the reconstruction of rigid body? It doesn’t seem clear to me why we need a different set of flags when handling the dynamics of rigid body.

The way fix rigid uses the per-atom image flags has to
do with how it also maintains the image flag for the center-of-mass
of the body. The per-atom image flags are adjusted when
the center-of-mass image flag changes, which is different than
would occur if the atoms weren't in a rigid body.

Steve