[lammps-users] dump custom not writing unwrapped coordinates with fix rigid/nvt?

Dear all,

This is somewhat in regard to my previous post about using fix/rigid
with a massless site: http://lammps.sandia.gov/threads/msg15547.html

Since the massless site was my COM and this is what I was wanting, I
dumped only this massless site to a custom xyz file.

dump 1 com custom 500 test.xyz id xu yu zu

where "com" was just this massless site.

The resulting trajectory seems to have the coordinates wrapped instead
of unwrapped about the PBC as I expected.

I was using the October 3, 2010 source of Lammps.

Does this have to do with dumping part of a rigid molecule or something?

Sorry if I missed it in the manual.

Thanks.

Josh

joshua,

Dear all,

This is somewhat in regard to my previous post about using fix/rigid
with a massless site: http://lammps.sandia.gov/threads/msg15547.html

Since the massless site was my COM and this is what I was wanting, I
dumped only this massless site to a custom xyz file.

dump 1 com custom 500 test.xyz id xu yu zu

where "com" was just this massless site.

The resulting trajectory seems to have the coordinates wrapped instead
of unwrapped about the PBC as I expected.

I was using the October 3, 2010 source of Lammps.

Does this have to do with dumping part of a rigid molecule or something?

very likely. from the fix rigid documentation:

IMPORTANT NOTE: The periodic image flags of atoms in rigid bodies are
modified when the center-of-mass of the rigid body moves across a
periodic boundary. They are not incremented/decremented as they would be
for non-rigid atoms. This change does not affect dynamics, but means
that any diagnostic computation based on the atomic image flag values
must be adjusted accordingly. For example, the compute msd will not
compute the expected mean-squared displacement for such atoms, and 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. 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.

cheers,
   axel.

Thanks! Sorry I missed that. I guess I'm going to have to stop being
lazy and unwrap them myself.

Hi,

So thanks to Axel pointing me into the right direction in the manual
concerning the image flags for rigid molecules, I want to make sure I
understand things correctly.

According to the manual it says:

"The periodic image flags of atoms in rigid bodies are modified when
the center-of-mass of the rigid body moves across a periodic
boundary."

I find that they aren't updated per atom. The per atom image flags
seem to stay the same (i.e., they all start ix=0,iy=0,iz=0 and stay
that way).

Furthermore it states that the COM positions (which is what I actually
need) are stored in some "global" array.

Is there a way to access these COM positions of the rigid molecules
(dump custom doesn't seem to work because they are not per atom
quantities??) ?

Can I access their image flags?

It makes sense now why the image flags are not updated per atom, but I
hope there is a way to access the image flags for the rigid molecule
as well as the COM.

Thanks again.

Josh

As I recall the atom image flags are relative to the COM
in a rigid body.

The COM of each rigid body is stored by the fix and can
be accessed like any other fix quantity. See the bottom
of the fix rigid doc page and Section 4.15 of the manual.

Steve

Dear Steve,

Thanks. I guess I am still confused.

My rigid body has three sites. One of the sites is the center of
mass. I output this site by dumping the coordinates and the image
flags (dump 1 site custom 500 site.xyz id x y z ix iy iz). Or replace
by xu,yu,zu.

When visualizing the trajectories I can see the atoms pass the
periodic boundary (and come in the other side since they trajectory is
wrapped). Yet ix iy and iz do not change. The values remain the same
(i.e, they remain ix = 0, iy=0,iz=0, the starting values of the
simulation, even when the trajectory clearly shows that the atoms pass
through a periodic boundary).

I can understand that the atomic site values (in general) should have
the incorrect image flags, but they should be altered regardless,
according to the manual.

Also as I understand it, since one of my sites is the center of mass,
it should have the correct image flags (i.e., the ones that correspond
to the unwrapped coordinates)? This is because the image flags for
the atomic sites are supposed to be updated when the center of mass
passes through a PBC.

I furthermore don't see how to output the "global" array vector of the
COM. In the documentation on fix rigid, it says:

"These fixes compute a global array of values which can be accessed by
various output commands. The number of rows in the array is equal to
the number of rigid bodies. The number of columns is 12. Thus for each
rigid body, 12 values are stored: the xyz coords of the center of mass
(COM), the xyz components of the COM velocity, the xyz components of
the force acting on the COM, and the xyz components of the torque
acting on the COM."

So I need to output a "global array", accessing
f_ID[1],f_ID[2],f_ID[3], where ID = whatever my fix was. The
available command seems to be fix ave/time, but when I use this:

fix 1 fluid rigid/nvt molecule temp 300.0 300.0 0.5
fix 2 fluid ave/time 500 1 500 f_1[1] f_1[2] f_1[3] file
test.xyz mode vector

(note my intention was to output the first 3 columns of the output
produced by fix rigid/nvt every 500 steps without averaging).

I get:

ERROR: Fix ave/time fix does not calculate a array

Sorry for my frustration. I had basically given up trying, and I'm
now unwrapping the trajectory using a VMD script with pbcunwrap in
VMD.

Regardless, even if I can access the COM positions of the rigid body,
they will likely be wrapped and the image flags of the rigid bodies
are not stored. It seems easier to put a massless site on the center
of mass of the rigid body (which I already have), output that, which
should have the correct image flags, but it appears to not. Then I
should be able to output the unwrapped coordinates as I've been doing
with dump custom (with xu,yu,zu).

Best.

Josh

The fix rigid doc page on these per-atom image flags was
confusing. I've updated it (see below). Basically these flags
are used differently when atoms are in rigid bodies and do
not increment when the rigid bodies cross boundaries.

However, the fix keeps image flags for each rigid body internally
which are the same thing as normal per-atom images flags,
only for the COM of the rigid body. I just added those to the
list of things the fix can output.

The fix ave/time issue you had was a bug.

All of this is part of the 9Oct10 patch I just posted.

Steve

new 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"_dump.html will be different than they
would be if the atoms were not in a rigid body. Likewise the "compute
msd"_compute_msd.html 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"_replicate.html 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.

Thanks!

Seems to work.

I'm still confused about the per-atom image flags. Should they be
updated? I still find that they don't seem to be, i.e., when the COM
of the rigid molecule is updated (their flags are updated), a "COM"
site that I have on the rigid molecule doesn't have the per-atom flags
updated (they are still ix=0,iy=0,iz=0 and not the same as the COM
image flags outputted with fix ave/time). The wrapped positions
match between the two, at least to the significant digits outputted,
so I expected they would.

This was only a short test and only a few of the COM's of the rigid
molecules moved across the PBCs.

Regardless, I have the flags of the COM with the fix ave/time output!
This is a nice feature added.

Josh

I'm still confused about the per-atom image flags. Should they be
updated?

no - as the new paragraph on the doc page says, they are
not updated - they are used to keep the rigid body consistent
rather than to track atom's motion thru the periodic images.
The body COM is what you want. Or you can just track this
yourself from the dump file output. It's not hard to figure out
when atoms cross periodic boundaries.

Steve