# how does the lammps execute for a particular input script?

Dear ALL:
I am a little confused about how does the lammps execute for a particular input script. For example, parts of one particular input script are given:
﻿﻿﻿# initial velocities
compute mobile flow temp
velocity flow create 1.0 482748 temp mobile
fix 1 all nve
fix 2 flow temp/rescale 200 1.0 1.0 0.02 1.0
fix_modify 2 temp mobile

# Couette flow

velocity lower set 0.0 0.0 0.0
velocity upper set 3.0 0.0 0.0
fix 3 boundary setforce 0.0 0.0 0.0
I have 4 questions about the above input script:
(1) Are the “velocity lower set” and “velocity upper set” commands only executed at the intial time? or are they also executed for each calculating time step?
(2) According to the command “fix 3 boundary setforce 0.0 0.0 0.0”, the velocities of atoms belong to the group of boundary will not vary, and the positions of these atoms will be updated according to their constant velocites. Am I right?
(3) For the atoms belong to the group of boundary, the command “fix 1 all nve” is changed to “fix 3 boundary setforce 0.0 0.0 0.0”, so the command “fix 1 all nve” has no effect to the atoms belong to the group of boundary, am I right?
(4) What kinds of commands are only executed at the initial time? What kinds of commands are executed for each calculating time step?

Best regards,
Jun Zhang

Dear ALL:
I am a little confused about how does the lammps execute for a
particular input script. For example, parts of one particular input script
are given:
﻿﻿﻿# initial velocities
compute mobile flow temp
velocity flow create 1.0 482748 temp mobile
fix 1 all nve
fix 2 flow temp/rescale 200 1.0 1.0 0.02 1.0
fix_modify 2 temp mobile
# Couette flow
velocity lower set 0.0 0.0 0.0
velocity upper set 3.0 0.0 0.0
fix 3 boundary setforce 0.0 0.0 0.0
I have 4 questions about the above input script:
(1) Are the "velocity lower set" and "velocity upper set" commands only
executed at the intial time? or are they also executed for each calculating
time step?

every line in the lammps input script is evaluated immediately;
one after the other. however, some have immediate consequences,
others, like computes, fixes, XXXX_style create objects that are
then triggering certain actions being executed under specific circumstances.

the velocity commands have an immediate effect.

(2) According to the command "fix 3 boundary setforce 0.0 0.0 0.0", the
velocities of atoms belong to the group of boundary will not vary, and the
positions of these atoms will be updated according to their constant
velocites. Am I right?

not quite. the forces for these atoms will be reset to zero.

whether positions or velocities remain constant or are changed
depends on what else would affect forces and/or velocities/positions
of these atoms.

(3) For the atoms belong to the group of boundary, the command "fix 1 all
nve" is changed to "fix 3 boundary setforce 0.0 0.0 0.0", so the command
"fix 1 all nve" has no effect to the atoms belong to the group of boundary,
am I right?

no. fix 1 all nve and fix 3 boundary have two different fix
objects that are completely independent. fix nve implements
a plain velocity verlet. fix setforce changes forces.

however, iff the velocities for atoms in the group boundary
*and* the forces for atoms in the group boundary, applying
velocity verlet (i.e. fix nve) on these atoms, will result in
no motion, since an object without velocity and force will
remain at rest.

(4) What kinds of commands are only executed at the initial time? What kinds
of commands are executed for each calculating time step?

depends on the individual object.
perhaps you should have a look at the developer's guide
to get a feel for the flow of control in LAMMPS.

axel.

Dear Axel:
Thanks very much for your reply. I have one extra question to ask you. For the follwing three commands,
fix 1 all nve
velocity upper set 3.0 0.0 0.0
fix 3 upper setforce 0.0 0.0 0.0
I want to know the total effect to the atoms belong to the group of upper. I think that the velocities of atoms belong to the group of upper will not vary, and the positions of these atoms will be updated according to their constant velocites (3.0 0.0 0.0). Am I right?

Best regards,
Jun Zhang

Dear Axel:
Thanks very much for your reply. I have one extra question to ask you. For the follwing three commands,
fix 1 all nve
velocity upper set 3.0 0.0 0.0
fix 3 upper setforce 0.0 0.0 0.0
I want to know the total effect to the atoms belong to the group of upper. I think that the velocities of atoms belong to the group of upper will not vary, and the positions of these atoms will be updated according to their constant velocites (3.0 0.0 0.0). Am I right?

If you cannot figure this out by yourself, you should not be running MD simulations. If you need somebody to “bless” your input for something as trivial and straightforward as this, how would you ever become able to run a complicated simulation?

Axel