Fw:Question occures during the use of fix npt

Dear Prof. Thompson,

A few days ago, I asked you a question about the use of fix rigid/npt. There is only a particle containing 120 formic acid molecules in my system, and I use fix rigid/npt to keep the temperature and pressure. The simulation crashes after some steps. Then, you gave me a suggestion:

Don’t start the main simulation with a system that is very far from equilibrium. I did a test where I first equilibrated the system using fix npt/rigid, but stopped it before it crashed, so the density was close to the equilibrium value (not off by 10x like your simulation). I then did unfix npt/rigid and issued a new fix npt/rigid command to reset all the internal variables the fix. After that, the simulation remained stable. See attached script.

However, when I test the ‘in’ file you gave me, the simulation still crashes at about

77000 steps. I have found that the volume of the system gradually decreases with time, and finally the error occurs: “Out of range atoms - cannot compute PPPM”. The pressure of the system is shown as follow:

D72E6A70@...5936....jpg

I do not know where the mistake lies, so I hope you can give me some help again.

I put the “in” and “data” file is in attached script.

Thanks very much, and I am looking forward to your reply.

Best regards!

Zhang Chao

0nacl0h2o.lammps05 (165 KB)

in.ch2o2_fast (2.52 KB)

Dear Prof. Thompson,

A few days ago, I asked you a question about the use of fix rigid/npt. There is only a particle containing 120 formic acid molecules in my system, and I use fix rigid/npt to keep the temperature and pressure. The simulation crashes after some steps. Then, you gave me a suggestion:

“Don't start the main simulation with a system that is very far from equilibrium. I did a test where I first equilibrated the system using fix npt/rigid, but stopped it before it crashed, so the density was close to the equilibrium value (not off by 10x like your simulation). I then did unfix npt/rigid and issued a new fix npt/rigid command to reset all the internal variables the fix. After that, the simulation remained stable. See attached script.”

However, when I test the ‘in’ file you gave me, the simulation still crashes at about

77000 steps. I have found that the volume of the system gradually decreases with time, and finally the error occurs: “Out of range atoms - cannot compute PPPM”. The pressure of the system is shown as follow:

I do not know where the mistake lies, so I hope you can give me some help again.

there are three major issues with your simulation.input.

- your initial configuration has a vast amount of vacuum. that doesn't
make much sense in combination with using fix npt. either you want to
simulate a bulk system, then you can start right away from a box with
min/max+safety boundaries or you want to simulate a droplet, then you
should not use fix npt, but fix nvt. also, in case you do want to
simulate a droplet, you may want to consider switching to non-periodic
shrinkwrap boundaries, cutoff coulomb and cranking up the cutoff to
include all particles (~30-40 \AA). that would be more accurate than
long-range electrostatics with PBC and avoid the artifacts from the
interactions with the periodic replica of the droplet. in case you
want to simulate a bulk system, this doesn't matter. pppm and PBC is
the way to go.

- your time step seems large. the integration of the rotational
degrees of freedom is more sensitive than translation and thus using
fix rigid may still require a rather short timestep, depending of the
magnitude of the moments of inertia.

- you make your molecules rigid, but still do compute forces for bonds
and angles. those forces do not contribute to the forces on the rigid
bodies as a whole and if they are not exactly zero they will
contribute to the virial, which is something you do not want. you can
simply set those force constants to zero.

axel.

Dear Prof. Kohlmeyer

Thanks very much for your reply.
There are still some questions that confused me. You said that “force of bond and angle do not contribute to the forces on the rigid bodies as a whole and if they are not exactly zero they will contribute to the virial” Is this means that the force of bond and angle in rigid molecules have influence on the fix rigid/nvt?

  1. In the manual, it says that “For computational efficiency, you may wish to turn off pairwise and bond interactions within each rigid body, as they no longer contribute to the motion. The neigh_modify exclude and delete_bonds commands are used to do this” I don’t know whether the computation of bond and angle force in rigid molecule only affect the computational efficiency, or it will influent the temperature control of the system?
  2. Whether can I eliminate the bonds and angles in the data file directly for rigid molecule?
  3. After turn off bond interaction, I use the “neigh_modify exclude molecule rigid” to turn off the pairwise interaction of atoms in the same molecule, but a warning occurs because “Excluding pairwise interactions will not work correctly when also using a long-range solver via the kspace_style command” I want to know how to deal with this warning and whether the computation of pairwise interaction in rigid molecules affect the simulation.
  4. My simulation follows a published paper, in which the npt ensemble is used to simulate a single particle. I hope I have a comparison of the simulation, so that my simulation is convincing. If I use nvt ensemble, I don’t know whether it still is convincing?

Thank you very much! I’m looking forward to your reply.

Best regards!
Zhang Chao

Axel Kohlmeyer 写:

Dear Prof. Kohlmeyer

Thanks very much for your reply.
There are still some questions that confused me. You said that “force of
bond and angle do not contribute to the forces on the rigid bodies as a
whole and if they are not exactly zero they will contribute to the virial”
Is this means that the force of bond and angle in rigid molecules have
influence on the fix rigid/nvt?

no. only your computed pressure will be off. when you run with
constant volume, it is only a diagnostic property and will not impact
the trajectory.

1. In the manual, it says that “For computational efficiency, you may wish
to turn off pairwise and bond interactions within each rigid body, as they
no longer contribute to the motion. The neigh_modify exclude and
delete_bonds commands are used to do this” I don’t know whether the
computation of bond and angle force in rigid molecule only affect the
computational efficiency, or it will influent the temperature control of the
system?

if you look at the breakdown of the computational cost, you will see,
that the cost of the bonded forces in your specific system is
negligible.

2. Whether can I eliminate the bonds and angles in the data file directly
for rigid molecule?

you can do this, but in your case, it would be much simpler to only
set the force constants to zero.

3. After turn off bond interaction, I use the “neigh_modify exclude molecule
rigid” to turn off the pairwise interaction of atoms in the same molecule,
but a warning occurs because “Excluding pairwise interactions will not work
correctly when also using a long-range solver via the kspace_style command”
I want to know how to deal with this warning and whether the computation of
pairwise interaction in rigid molecules affect the simulation.

this is a warning and not an error, because the code cannot know,
whether a neighbor list exclusion is proper or not. when you define
bonds or angles or dihedrals in your topology, the corresponding
interaction will be excluded from neighbor list for pairwise
interactions. since you have no dihedrals defined, there is going to
be a small difference, as your exclusion of all intra-molecular pairs
will also exclude the interactions between the two hydrogens. however,
if you remove/delete all bonds and angles, you *have* to use that
neigh_modify command, otherwise your intra-molecular contribution of
the virial will be quite from the pair-wise interactions from bonds
and angles.

in short, you either have to do what you did with deleting/removing
bonded interactions and "neigh_modify exclude molecule", or you keep
the bonds and angles and just set their force constants to zero.
computational efficiency is not affected when using kspace. if you
care about performance, you should use one of the rigid/small fixes.

4. My simulation follows a published paper, in which the npt ensemble is
used to simulate a single particle. I hope I have a comparison of the

an NPT ensemble is only possible for a bulk system. so this has to be
either a typo or the authors of the paper (and its reviewers) are
apparently lacking proper knowledge in statistical mechanics.
unfortunately, these days the fact that something got published does
not automatically mean that it has seen a thorough review and can be
trusted in every detail.

simulation, so that my simulation is convincing. If I use nvt ensemble, I
don’t know whether it still is convincing?

you won't have an NVT ensemble with your simulation either. that one
also requires a bulk system. the purpose of the nose-hoover thermostat
is not only to maintain temperature at the desired value to mimic the
embedding of the simulated system into a bulk of the same material,
but also to induce fluctuations that are due to the bulk system. the
latter affects the partition function and thus makes it that you can
get the same statistical sampling as in a bulk system, which in turn
makes it an NVT ensemble.

what you are doing is to run an isolated cluster/droplet with a
nose-hoover thermostat. even using the thermostat beyond equilibration
is questionable, since for an isolated object, where is the heat
reservoir (i.e. the embedding bulk) that it couples to?

as i outlined in the previous e-mail, in my personal opinion, the most
correct way to compute the interactions for an isolated
droplet/cluster is:

- use shrinkwrap non-periodic boundaries
- do not use kspace, but lj/coul/cut with a large enough cutoff. that
will make it so both lj and coulomb computed *exactly*.
- use either "neigh_modify exclude molecule" with bonds/angles removed
or set all force constants for bonds/angles to zero
- use "fix momentum 100 linear 1 1 1 angular rescale" or something
similar to avoid the flying/rotating ice cube syndrome.

using periodic boundaries and kspace/pppm is usually acceptable, too.
provided the distance between the periodic images is large enough. but
since LAMMPS doesn't have a poisson solver to decouple the coulomb
interactions between the periodic images, there is a risk of (small)
artifacts, depending on the magnitude of the multipole interactions
that forms between the droplet and its periodic images. if the
droplet/cluster is much larger, then using the full cutoff will become
computationally too demanding and kspace is the only viable choice.

axel.

Dear Prof. Kohlmeyer

Thanks for your patience reply.
You have said that “you make your molecules rigid, but still do compute forces for bonds and angles. those forces do not contribute to the forces on the rigid bodies as a whole and if they are not exactly zero they will contribute to the virial. This will not impact the trajectory when I use rigid/nvt.”
However, after a test, I have found that the trajectory charged. I put the “in” and “data” file in attached script. The first “in” file set the bond force constant to 0, and the second “in” file set bond and angle constants to 450 and 55 respectively. Then coordinate of atoms at 6000 step are export. Why are they different?

Thanks very much!

Best regards!
Zhang Chao

Axel Kohlmeyer 写:

0nacl0h2o.lammps05 (165 KB)

in.ch2o2_1 (2.28 KB)

in.ch2o2_2 (2.3 KB)

temp.dump.6000_1 (30 KB)

temp.dump.6000_2 (30 KB)

Dear Prof. Kohlmeyer

Thanks for your patience reply.
You have said that “you make your molecules rigid, but still do compute
forces for bonds and angles. those forces do not contribute to the forces on
the rigid bodies as a whole and if they are not exactly zero they will
contribute to the virial. This will not impact the trajectory when I use
rigid/nvt.”

yes. this is elementary physics knowledge. pick up a text book and
look up "classical mechanics of rigid bodies".

However, after a test, I have found that the trajectory charged. I put the
“in” and “data” file in attached script. The first “in” file set the bond
force constant to 0, and the second “in” file set bond and angle constants
to 450 and 55 respectively. Then coordinate of atoms at 6000 step are
export. Why are they different?

this is elementary computational science knowledge with some applied
math for good measure. floating point math is not exact, e.g. certain
numbers cannot be represented and the resolution for that depends on
the magnitude, also it is not associative, i.e. the value of a sum
depends on the order of the terms you sum up. thus things that should
be exactly zero are only approximately zero. add to this the fact that
coupled linear partial differential equations (i.e. MD) are
essentially a chaotic system, you'll have exponential divergence of
trajectories even with the tiniest of differences (sometimes also
referred to a "butterfly effect"). this has been discussed on this
mailing list numerous times and it is a common topic on
tutorials/schools for scientific and high-performance computing.

Dear Prof. Kohlmeyer

In order to test the “neigh_modify” command, I made two kinds of “in” files, in which one uses “neigh_modify exclude molecule all” and the other don’t use this command. The bond contants are set to 0. Then the energy between atom 1 and atom 2 (belongs to the same molecule) is export. I think the energy ought to be 0, because they are bond to each other.
However, for the “in” file with “neigh_modify exclude molecule all”, the energy is 0, but for the “in” file without “neigh_modify exclude molecule all”, the energy maintain at 13.112443. These results are put in attachment.
According to the manual which says that “Excluding pairwise interactions will not work correctly when also using a long-range solver via the kspace_style command”, the in file without “neigh_modify” should be right, but the energy is not 0. So I don’t know which “in” file is right. So I hope you can give me some help.

Attachment is the test file.
Thanks very much.

Best regards!
Zhang Chao

Axel Kohlmeyer 写:

0nacl0h2o.lammps05 (162 KB)

in.ch2o2_1 (2.27 KB)

in.ch2o2_2 (2.27 KB)

log.lammps_1 (7.31 KB)

log.lammps_2 (7.2 KB)

Dear Prof. Kohlmeyer

In order to test the “neigh_modify” command, I made two kinds of “in” files,
in which one uses “neigh_modify exclude molecule all” and the other don’t
use this command. The bond contants are set to 0. Then the energy between
atom 1 and atom 2 (belongs to the same molecule) is export. I think the
energy ought to be 0, because they are bond to each other.
However, for the “in” file with “neigh_modify exclude molecule all”, the
energy is 0, but for the “in” file without “neigh_modify exclude molecule
all”, the energy maintain at 13.112443. These results are put in attachment.
According to the manual which says that “Excluding pairwise interactions
will not work correctly when also using a long-range solver via the
kspace_style command”, the in file without “neigh_modify” should be right,
but the energy is not 0. So I don’t know which “in” file is right. So I hope
you can give me some help.

i already told you *twice* that my preferred choice for a droplet of
this small a size would be not using kspace at all.

also, it is not the energy that matters, but the forces. also, your
compute group/group statement only computes the non-bonded
contributions, kspace contributions are by default turned off (see the
docs). you should see a significant change from enabling kspace.

axel.