[lammps-users] Treat moving and not moving things

Hi all,

let’s assume that we have two things inside the simulation box. The first is a wall and the 2nd some kind of moving molecules. The wall will not move in comparison with the molecules that move. When i will use nvt or nve with some thermostat or barostat i will impose them only to the molecules? and if so the temp/press that the wall will have would be evaluated by the rest of the molecules with some kind of “interpolation” or i have to give a value?

Thank you in advance
Nelson

Hi all,

let's assume that we have two things inside the simulation box. The
first is a wall and the 2nd some kind of moving molecules. The wall
will not move in comparison with the molecules that move. When i will
use nvt or nve with some thermostat or barostat i will impose them
only to the molecules? and if so the temp/press that the wall will
have would be evaluated by the rest of the molecules with some kind of
"interpolation" or i have to give a value?

if you mean by wall one of the wall fixes then
they will have no (direct) effect at all on the
computation of pressure or temperature.

if you mean by wall a group of non-moving atoms,
then the situation is different, and you'll have
to define which atoms you include when computing
the temperature for the system. please have a look
at the lammps manual. there is a whole segment
discussing these issues.

cheers,
   axel.

What i meant was a group of non-moving atoms.i defined which group is. the thing is that i can’t decide which is the right recipe.include them in the the nvt and or barostat keeping them not moving with a setforce and velocity equal to zero or just not include them at all in the integration. i mean from a physical point of view or should i seek for a practical recipe?

What i meant was a group of non-moving atoms.i defined which group is.
the thing is that i can't decide which is the right recipe.include
them in the the nvt and or barostat keeping them not moving with a
setforce and velocity equal to zero or just not include them at all in
the integration. i mean from a physical point of view or should i seek
for a practical recipe?

strictly speaking, from a physical point of view
there are no non-moving atoms.

as far as temperature control is concerned, it would
be more consistent to only use nvt on the mobile atoms.
you have to tell lammps to compute the "global" temperature
for only those atoms. otherwise the degrees of freedom for
the fixed atoms would enter in the temperature calculation
and thus the mobile atoms would be thermalized to a much
higher temperature.

as for pressure. here the answer is "it depends".
most of the time, it is probably easiest not to
try any pressure control perpendicular to the wall.

the best guide for these issues are:
- study of the literature (i.e. what have other people done,
  how and - most importantly - why?)
- careful analysis of your model (i.e. what do you want to
  learn from your simulation and how is this impacted by
  any "artificial" components of your model).
- common sense. there is no substitute for this.

cheers,
   axel.

That is what i thought. I am already using nvt but i had doubts if i had to use nvt only to the mobile atoms.

as for pressure. here the answer is “it depends”.
most of the time, it is probably easiest not to
try any pressure control perpendicular to the wall.

I cannot understand why it would be easier not to try any pressure control perpendicular to the wall?

the best guide for these issues are:

  • study of the literature (i.e. what have other people done,
    how and - most importantly - why?)

I have studied literature and some other people from lammps threads and they have the same questions. In literature everyone uses nvt but they say nothing more, so it is not enough info.

  • careful analysis of your model (i.e. what do you want to
    learn from your simulation and how is this impacted by
    any “artificial” components of your model).

What i want to study is how nanotubes act as adsorbents for various kind of gases. So it is not a wall to tell you the truth but only some not moving structure. tha’s why i don’t know how to control the pressure. not perpendicular to what direction? The first time that i used a barostat either with an nve or nvt i saw my moving molecules to move very slowly.

Moreover ,
when i am trying to impose nvt only to the moving particles with ex:

fix 1 gas nvt temp 300.0 300.0 100. 0

the output i am getting is totally wrong

Temp varies from 6.456-50.423 which is wrong…

the best guide for these issues are:
- study of the literature (i.e. what have other people done,
how and - most importantly - why?)

I have studied literature and some other people from lammps threads and they
have the same questions. In literature everyone uses nvt but they say
nothing more, so it is not enough info.

well, due to your description of the system below,
nvt is indeed a very obvious choice.

- careful analysis of your model (i.e. what do you want to
learn from your simulation and how is this impacted by
any "artificial" components of your model).

What i want to study is how nanotubes act as adsorbents for various kind of
gases. So it is not a wall to tell you the truth but only some not moving
structure. tha's why i don't know how to control the pressure. not
perpendicular to what direction? The first time that i used a barostat

for a gaseous system, particularly at comparatively "normal" (=low) densities,
there is not much reason to use npt. a gas has a high compressibility
and thus the volume changes should be small anyways. for reasonable
results you'd have to make sure that your simulation cell volume is
large enough. what i would be worrying me much more is ergodicity,
i.e. sufficient statistical sampling of relevant parts of phase space.

either with an nve or nvt i saw my moving molecules to move very slowly.

that doesn't make any sense to me. most likely there is some oversight
in your input. you'll have to provide an example to demonstrate what
you are talking about.

cheers,
    axel.

Moreover ,
when i am trying to impose nvt only to the moving particles with ex:

fix 1 gas nvt temp 300.0 300.0 100. 0

the output i am getting is totally wrong

most likely, you are looking at the wrong number.
you have to compute the temperature of the gas only.

Temp varies from 6.456-50.423 which is wrong..

this looks like you include the non-moving parts in
the temperature calculation. have a closer look
at the fix nvt documentation. it explains how it sets
up its own compute for temperature and you'd
have to look at that and not the overall temperature.

axel.

The first scenario which uses nve and is closer to what i want is :

dimension 3
boundary p p p
units real
atom_style atomic
neighbor 0.3 bin
neigh_modify delay 5
lattice fcc 4.0
######Data file######################################
read_data swnt10x10_500.dat

The first scenario which uses nve and is closer to what i want is :

you cannot really compare those two inputs.
the first will actually give you a wrong temperature
for the gas part of the system. it will be _way_ to high.
due to using langevin thermostat on the whole system,
that energy should slowly dissipate into the carbon nanotubes
regardless.

please talk to somebody that knows about MD and/or
statistical mechanics and have a proper look at some
text books on the subject. it is difficult to discuss how
to do things right, if we don't have at least a minimal
common ground.
you have to understand what temperature means (and
what not) in a classical MD simulation to be able to
make the right choices.
as aidan phrased it very fittingly in a recent email:
lammps will do what you tell it to do, but that may
not be what you mean.

cheers,
     axel.

This is a long discussion, so I will just repeat the bit where I think Axel predicted correctly what is wrong with both you scripts:

“have a closer look
at the fix nvt documentation. it explains how it sets
up its own compute for temperature and you’d
have to look at that and not the overall temperature.”

I think you will find that the temperature reported using something like

thermo_style custom 1_temp

(assuming fix 1 is nvt.)

will give you what you want.

Aidan

Thank you both for your answers. What Aidan suggested to do, i did it and the results seem correct. Considering what Axel says, ok i may not have 100% knowledge of MD, but i am trying to do it in parallel. We had discussed about using nvt only for the moving particles, but in the literature everyone i mean everyone in case of these problems what they say is that they only use nvt. nothing more nothing less. so except having a good knowledge MD are both practical recipes. So:
if using only nvt the physical results, as i visualized them through vmd are totally wrong,no adsorption (a very small amount of particles) or even lost atoms. so with the nvt the things that i have to do are very limited. that’s why i chose to use nve (in a wrong way at least at the beginning) with some kind of thermostat and/or barostat but no lack. I will keep looking for solutions.
thank you anyway for your help. Event my mistakes will show me where the correct solution is; hopefully

Thank you both for your answers. What Aidan suggested to do, i did it and
the results seem correct. Considering what Axel says, ok i may not have 100%
knowledge of MD, but i am trying to do it in parallel. We had discussed

trying to learn MD while trying to do MD on a "real" research
project is a recipe for disaster. at best you will be wasting time,
at worst you will get frustrated, disappoint, and irritate people.

about using nvt only for the moving particles, but in the literature
everyone i mean everyone in case of these problems what they say is that
they only use nvt. nothing more nothing less. so except having a good

that is because like the literature is written for people that
understand the basics. often details about what protocol is
used to set up and equilibrate a system are not produced
in detail, because you only mention them when they matter.
that doesn't mean that this is not done.

if you ask for directions to get from place A to place B
by car you don't expect instructions on how to operate
a car, do you? that is why you go to driving school first,
and why you practice, and get a driver's license.

yet, you expect to be able to drive a car in a race
_and_ learn how to drive at the same time.

what kind of advice would _you_ give a person
that would want to do something like that?

knowledge MD are both practical recipes. So:
if using only nvt the physical results, as i visualized them through vmd are
totally wrong,no adsorption (a very small amount of particles) or even lost

please don't call it wrong. they are most likely correct, but not what
you expect.

cheers,
    axel.

I tried to follow some of your recipes ;
in order to have a moving gas and the nanotube stationary i did the following;
I gave the gas a temperature=> kinetic energy. after i used nvt only at the gas. Equilibration time (used different periods) and then e different timestep for the rest of the problem. This is the “correct” based on the papers and the text books and of course on what i want to do.
But the result is a disaster; either lost atoms when changing the timestep or the molecules go everywhere but the nanotube. I tried to find an alternative;
nve at the gas with some temp/rescale and after a langevin. When i visualize my system just to see what i have said to lammps, from a first view it seems correct but there is a very small movement for the particles that have not been adsorbed by the nanotubes.

velocity gas create 300.0 4928459 dist gaussian

fix 1 gas nvt temp 300.0 300.0 100.0
fix 3 tubes rigid single
fix 4 tubes setforce 0.0 0.0 0.0
compute 1 co2 msd
compute Temp co2 temp
compute Press all pressure Temp
timestep 0.0001
run 100000
timestep 0.5
run 1000000

There are many reasons why MD simulations end in disaster. Maybe your initial geometry is bad. I suggest you start with something that works and proceed forward incrementally. Then, when something fails, you will only have a few possible causes to consider. Try just running 100 timesteps, and look at the output on every step. Is the temperature stable?

This is a long thread - I just want to emphasize the following:

If you want to thermostat only a portion of your atoms, you
can do that by putting them in a group and using fix nvt on
that group. If you want to monitor the temperature of that
group, then you can't just use the "temp" keyword in the thermo_style
command, you need to output just the temp of that group. The
fix nvt doc page tells you how to do that.

Steve