2006-09-22 00:22:34 +08:00
|
|
|
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
|
|
|
|
|
|
|
|
:link(lws,http://lammps.sandia.gov)
|
|
|
|
:link(ld,Manual.html)
|
|
|
|
:link(lc,Section_commands.html#comm)
|
|
|
|
|
|
|
|
:line
|
|
|
|
|
2007-03-28 00:58:07 +08:00
|
|
|
fix shake command :h3
|
2011-06-09 05:46:03 +08:00
|
|
|
fix shake/cuda command :h3
|
2015-03-05 06:27:27 +08:00
|
|
|
fix rattle command :h3
|
2006-09-22 00:22:34 +08:00
|
|
|
|
|
|
|
[Syntax:]
|
|
|
|
|
2015-03-05 06:27:27 +08:00
|
|
|
fix ID group-ID style tol iter N constraint values ... keyword value ... :pre
|
2006-09-22 00:22:34 +08:00
|
|
|
|
|
|
|
ID, group-ID are documented in "fix"_fix.html command :ulb,l
|
2015-03-05 06:27:27 +08:00
|
|
|
style = shake or rattle = style name of this fix command :l
|
2006-09-22 00:22:34 +08:00
|
|
|
tol = accuracy tolerance of SHAKE solution :l
|
|
|
|
iter = max # of iterations in each SHAKE solution :l
|
|
|
|
N = print SHAKE statistics every this many timesteps (0 = never) :l
|
2014-01-08 02:06:02 +08:00
|
|
|
one or more constraint/value pairs are appended :l
|
|
|
|
constraint = {b} or {a} or {t} or {m} :l
|
2006-09-22 00:22:34 +08:00
|
|
|
{b} values = one or more bond types
|
|
|
|
{a} values = one or more angle types
|
|
|
|
{t} values = one or more atom types
|
|
|
|
{m} value = one or more mass values :pre
|
2014-01-08 02:06:02 +08:00
|
|
|
zero or more keyword/value pairs may be appended :l
|
|
|
|
keyword = {mol} :l
|
|
|
|
{mol} value = template-ID
|
|
|
|
template-ID = ID of molecule template specified in a separate "molecule"_molecule.html command :pre
|
2006-09-22 00:22:34 +08:00
|
|
|
:ule
|
|
|
|
|
|
|
|
[Examples:]
|
|
|
|
|
|
|
|
fix 1 sub shake 0.0001 20 10 b 4 19 a 3 5 2
|
2014-01-08 02:06:02 +08:00
|
|
|
fix 1 sub shake 0.0001 20 10 t 5 6 m 1.0 a 31
|
2015-03-05 06:27:27 +08:00
|
|
|
fix 1 sub shake 0.0001 20 10 t 5 6 m 1.0 a 31 mol myMol
|
2015-03-05 06:08:07 +08:00
|
|
|
fix 1 sub rattle 0.0001 20 10 t 5 6 m 1.0 a 31
|
|
|
|
fix 1 sub rattle 0.0001 20 10 t 5 6 m 1.0 a 31 mol myMol :pre
|
2006-09-22 00:22:34 +08:00
|
|
|
|
|
|
|
[Description:]
|
|
|
|
|
|
|
|
Apply bond and angle constraints to specified bonds and angles in the
|
2015-03-05 06:27:27 +08:00
|
|
|
simulation by either the SHAKE or RATTLE algorithms. This typically
|
|
|
|
enables a longer timestep.
|
2006-09-22 00:22:34 +08:00
|
|
|
|
2015-03-05 06:27:27 +08:00
|
|
|
[SHAKE vs RATTLE:]
|
2015-03-05 06:08:07 +08:00
|
|
|
|
2015-03-05 06:27:27 +08:00
|
|
|
The SHAKE algorithm was invented for schemes such as standard Verlet
|
|
|
|
timesteppnig, where only the coordinates are integrated and the
|
|
|
|
velocities are approximated as finite differences to the trajectories
|
|
|
|
("Ryckaert et al. (1977)"_#Ryckaert). If the velocities are
|
|
|
|
integrated explicitly, as with velocity Verlet which is what LAMMPS
|
|
|
|
uses as an integration method, a second set of constraining forces is
|
|
|
|
required in order to eliminate velocity components along the bonds
|
|
|
|
("Andersen (1983)"_#Andersen).
|
2015-03-05 06:08:07 +08:00
|
|
|
|
2015-03-05 06:27:27 +08:00
|
|
|
In order to formulate individual constraints for SHAKE and RATTLE,
|
|
|
|
focus on a single molecule whose bonds are constrained. Let Ri and Vi
|
|
|
|
be the position and velocity of atom {i} at time {n}, for
|
|
|
|
{i}=1,...,{N}, where {N} is the number of sites of our reference
|
|
|
|
molecule. The distance vector between sites {i} and {j} is given by
|
2015-03-05 06:08:07 +08:00
|
|
|
|
2015-03-05 06:27:27 +08:00
|
|
|
:c,image(Eqs/fix_rattle_rij.jpg)
|
|
|
|
|
|
|
|
The constraints can then be formulated as
|
2015-03-05 06:08:07 +08:00
|
|
|
|
|
|
|
:c,image(Eqs/fix_rattle_constraints.jpg)
|
|
|
|
|
2015-03-05 06:27:27 +08:00
|
|
|
The SHAKE algorithm satisfies the first condition, i.e. the sites at
|
|
|
|
time {n+1} will have the desired separations Dij immediately after the
|
|
|
|
coordinates are integrated. If we also enforce the second condition,
|
|
|
|
the velocity components along the bonds will vanish. RATTLE satisfies
|
|
|
|
both conditions. As implemented in LAMMPS, fix rattle uses fix shake
|
2015-03-05 06:28:12 +08:00
|
|
|
for satisfying the coordinate constraints. Therefore the settings and
|
|
|
|
optional keywords are the same for both fixes, and all the information
|
|
|
|
below about SHAKE is also relevant for RATTLE.
|
2015-03-05 06:08:07 +08:00
|
|
|
|
|
|
|
[SHAKE:]
|
|
|
|
|
2006-09-22 00:22:34 +08:00
|
|
|
Each timestep the specified bonds and angles are reset to their
|
2015-03-05 06:27:27 +08:00
|
|
|
equilibrium lengths and angular values via the SHAKE algorithm
|
|
|
|
("Ryckaert et al. (1977)"_#Ryckaert). This is done by applying an
|
|
|
|
additional constraint force so that the new positions preserve the
|
|
|
|
desired atom separations. The equations for the additional force are
|
|
|
|
solved via an iterative method that typically converges to an accurate
|
|
|
|
solution in a few iterations. The desired tolerance (e.g. 1.0e-4 = 1
|
|
|
|
part in 10000) and maximum # of iterations are specified as arguments.
|
|
|
|
Setting the N argument will print statistics to the screen and log
|
|
|
|
file about regarding the lengths of bonds and angles that are being
|
|
|
|
constrained. Small delta values mean SHAKE is doing a good job.
|
2006-09-22 00:22:34 +08:00
|
|
|
|
|
|
|
In LAMMPS, only small clusters of atoms can be constrained. This is
|
|
|
|
so the constraint calculation for a cluster can be performed by a
|
|
|
|
single processor, to enable good parallel performance. A cluster is
|
|
|
|
defined as a central atom connected to others in the cluster by
|
|
|
|
constrained bonds. LAMMPS allows for the following kinds of clusters
|
|
|
|
to be constrained: one central atom bonded to 1 or 2 or 3 atoms, or
|
|
|
|
one central atom bonded to 2 others and the angle between the 3 atoms
|
2008-03-01 09:13:20 +08:00
|
|
|
also constrained. This means water molecules or CH2 or CH3 groups may
|
2006-09-22 00:22:34 +08:00
|
|
|
be constrained, but not all the C-C backbone bonds of a long polymer
|
|
|
|
chain.
|
|
|
|
|
2014-01-08 02:06:02 +08:00
|
|
|
The {b} constraint lists bond types that will be constrained. The {t}
|
|
|
|
constraint lists atom types. All bonds connected to an atom of the
|
|
|
|
specified type will be constrained. The {m} constraint lists atom
|
2006-09-22 00:22:34 +08:00
|
|
|
masses. All bonds connected to atoms of the specified masses will be
|
|
|
|
constrained (within a fudge factor of MASSDELTA specified in
|
2014-01-08 02:06:02 +08:00
|
|
|
fix_shake.cpp). The {a} constraint lists angle types. If both bonds
|
|
|
|
in the angle are constrained then the angle will also be constrained
|
|
|
|
if its type is in the list.
|
2006-09-22 00:22:34 +08:00
|
|
|
|
2014-01-08 02:06:02 +08:00
|
|
|
For all constraints, a particular bond is only constrained if both
|
|
|
|
atoms in the bond are in the group specified with the SHAKE fix.
|
2006-09-22 00:22:34 +08:00
|
|
|
|
|
|
|
The degrees-of-freedom removed by SHAKE bonds and angles are accounted
|
|
|
|
for in temperature and pressure computations. Similarly, the SHAKE
|
2008-01-10 23:50:00 +08:00
|
|
|
contribution to the pressure of the system (virial) is also accounted
|
|
|
|
for.
|
2006-09-22 00:22:34 +08:00
|
|
|
|
2015-12-11 01:23:56 +08:00
|
|
|
NOTE: This command works by using the current forces on atoms to
|
|
|
|
caculate an additional constraint force which when added will leave
|
|
|
|
the atoms in positions that satisfy the SHAKE constraints (e.g. bond
|
|
|
|
length) after the next time integration step. If you define fixes
|
|
|
|
(e.g. "fix efield"_fix_efield.html) that add additional force to the
|
|
|
|
atoms after fix shake operates, then this fix will not take them into
|
|
|
|
account and the time integration will typically not satisfy the SHAKE
|
|
|
|
constraints. The solution for this is to make sure that fix shake is
|
|
|
|
defined in your input script after any other fixes which add or change
|
|
|
|
forces (to atoms that fix shake operates on).
|
2012-01-20 23:13:16 +08:00
|
|
|
|
2011-06-09 05:46:03 +08:00
|
|
|
:line
|
|
|
|
|
2014-01-08 02:06:02 +08:00
|
|
|
The {mol} keyword should be used when other commands, such as "fix
|
|
|
|
deposit"_fix_deposit.html or "fix pour"_fix_pour.html, add molecules
|
|
|
|
on-the-fly during a simulation, and you wish to contrain the new
|
|
|
|
molecules via SHAKE. You specify a {template-ID} previously defined
|
|
|
|
using the "molecule"_molecule.html command, which reads a file that
|
|
|
|
defines the molecule. You must use the same {template-ID} that the
|
|
|
|
command adding molecules uses. The coordinates, atom types, special
|
|
|
|
bond restrictions, and SHAKE info can be specified in the molecule
|
|
|
|
file. See the "molecule"_molecule.html command for details. The only
|
|
|
|
settings required to be in this file (by this command) are the SHAKE
|
|
|
|
info of atoms in the molecule.
|
|
|
|
|
|
|
|
:line
|
|
|
|
|
2011-06-09 05:46:03 +08:00
|
|
|
Styles with a {cuda} suffix are functionally the same as the
|
|
|
|
corresponding style without the suffix. They have been optimized to
|
|
|
|
run faster, depending on your available hardware, as discussed in
|
2011-12-14 04:35:35 +08:00
|
|
|
"Section_accelerate"_Section_accelerate.html of the manual. The
|
|
|
|
accelerated styles take the same arguments and should produce the same
|
|
|
|
results, except for round-off and precision issues.
|
2011-06-09 05:46:03 +08:00
|
|
|
|
2011-08-27 02:53:00 +08:00
|
|
|
These accelerated styles are part of the USER-CUDA package. They are
|
|
|
|
only enabled if LAMMPS was built with that package. See the "Making
|
|
|
|
LAMMPS"_Section_start.html#start_3 section for more info.
|
2011-06-09 05:46:03 +08:00
|
|
|
|
|
|
|
You can specify the accelerated styles explicitly in your input script
|
|
|
|
by including their suffix, or you can use the "-suffix command-line
|
2012-01-28 07:39:14 +08:00
|
|
|
switch"_Section_start.html#start_7 when you invoke LAMMPS, or you can
|
2011-08-26 00:46:23 +08:00
|
|
|
use the "suffix"_suffix.html command in your input script.
|
2011-06-09 05:46:03 +08:00
|
|
|
|
2011-12-14 04:35:35 +08:00
|
|
|
See "Section_accelerate"_Section_accelerate.html of the manual for
|
|
|
|
more instructions on how to use the accelerated styles effectively.
|
2011-06-09 05:46:03 +08:00
|
|
|
|
2015-03-05 06:08:07 +08:00
|
|
|
:line
|
|
|
|
|
|
|
|
[RATTLE:]
|
|
|
|
|
|
|
|
The velocity constraints lead to a linear system of equations which
|
2015-03-05 06:27:27 +08:00
|
|
|
can be solved analytically. The implementation of the algorithm in
|
2015-03-05 07:01:51 +08:00
|
|
|
LAMMPS closely follows ("Andersen (1983)"_#Andersen).
|
2015-03-05 06:08:07 +08:00
|
|
|
|
2015-12-11 01:23:56 +08:00
|
|
|
NOTE: The fix rattle command modifies forces and velocities and thus
|
|
|
|
should be defined after all other integration fixes in your input
|
|
|
|
script. If you define other fixes that modify velocities or forces
|
|
|
|
after fix rattle operates, then fix rattle will not take them into
|
|
|
|
account and the overall time integration will typically not satisfy
|
|
|
|
the RATTLE constraints. You can check whether the constraints work
|
|
|
|
correctly by setting the value of RATTLE_DEBUG in src/fix_rattle.cpp
|
|
|
|
to 1 and recompiling LAMMPS.
|
2015-03-05 06:08:07 +08:00
|
|
|
|
2011-06-09 05:46:03 +08:00
|
|
|
:line
|
|
|
|
|
2007-10-11 06:28:11 +08:00
|
|
|
[Restart, fix_modify, output, run start/stop, minimize info:]
|
2007-06-26 08:03:39 +08:00
|
|
|
|
2015-03-05 06:27:27 +08:00
|
|
|
No information about these fixes is written to "binary restart
|
2007-06-26 08:03:39 +08:00
|
|
|
files"_restart.html. None of the "fix_modify"_fix_modify.html options
|
2015-03-05 06:27:27 +08:00
|
|
|
are relevant to these fixes. No global or per-atom quantities are
|
|
|
|
stored by these fixes for access by various "output
|
|
|
|
commands"_Section_howto.html#howto_15. No parameter of these fixes
|
|
|
|
can be used with the {start/stop} keywords of the "run"_run.html
|
|
|
|
command. These fixes are not invoked during "energy
|
|
|
|
minimization"_minimize.html.
|
2007-06-26 08:03:39 +08:00
|
|
|
|
2006-09-22 00:22:34 +08:00
|
|
|
[Restrictions:]
|
|
|
|
|
2015-03-05 06:27:27 +08:00
|
|
|
These fixes are part of the RIGID package. They are only enabled if
|
|
|
|
LAMMPS was built with that package. See the "Making
|
2014-01-08 04:59:37 +08:00
|
|
|
LAMMPS"_Section_start.html#start_3 section for more info.
|
|
|
|
|
2015-03-05 06:27:27 +08:00
|
|
|
For computational efficiency, there can only be one shake or rattle
|
|
|
|
fix defined in a simulation.
|
2006-09-22 00:22:34 +08:00
|
|
|
|
|
|
|
If you use a tolerance that is too large or a max-iteration count that
|
|
|
|
is too small, the constraints will not be enforced very strongly,
|
|
|
|
which can lead to poor energy conservation. You can test for this in
|
|
|
|
your system by running a constant NVE simulation with a particular set
|
|
|
|
of SHAKE parameters and monitoring the energy versus time.
|
|
|
|
|
2015-07-29 22:07:41 +08:00
|
|
|
SHAKE or RATTLE should not be used to contrain an angle at 180 degrees
|
|
|
|
(e.g. linear CO2 molecule). This causes numeric difficulties.
|
|
|
|
|
2006-09-22 00:22:34 +08:00
|
|
|
[Related commands:] none
|
|
|
|
|
|
|
|
[Default:] none
|
2015-03-05 06:08:07 +08:00
|
|
|
|
|
|
|
:line
|
|
|
|
|
|
|
|
:link(Ryckaert)
|
|
|
|
[(Ryckaert)] J.-P. Ryckaert, G. Ciccotti and H. J. C. Berendsen,
|
2015-03-06 23:36:22 +08:00
|
|
|
J of Comp Phys, 23, 327-341 (1977).
|
2015-03-05 06:08:07 +08:00
|
|
|
|
|
|
|
:link(Andersen)
|
2015-03-06 23:36:22 +08:00
|
|
|
[(Andersen)] H. Andersen, J of Comp Phys, 52, 24-34 (1983).
|