Adding d2min doc

This commit is contained in:
jtclemm
2023-06-16 16:28:48 -06:00
parent a1513a7d3b
commit ca636ffa7d
4 changed files with 91 additions and 95 deletions

View File

@ -8,129 +8,114 @@ Syntax
.. parsed-literal:: .. parsed-literal::
fix ID group nonaffine/displacement style args reference/style args fix ID group nonaffine/displacement style args reference/style nstep
* ID, group are documented in :doc:`fix <fix>` command * ID, group are documented in :doc:`fix <fix>` command
* gravity = style name of this fix command * nonaffine/displacement = style name of this fix command
* magnitude = size of acceleration (force/mass units) * nevery = calculate nonaffine displacement every this many timesteps
* magnitude can be a variable (see below) * style = *d2min* or *integrated*
* style = *chute* or *spherical* or *gradient* or *vector*
.. parsed-literal:: .. parsed-literal::
*chute* args = angle *d2min* args = cutoff args
angle = angle in +x away from -z or -y axis in 3d/2d (in degrees) cutoff = *type* or *radius* or *custom*
angle can be a variable (see below) *type* args = none, cutoffs determined by atom types
*spherical* args = phi theta *radius* args = none, cutoffs determined based on atom diameters (atom style sphere)
phi = azimuthal angle from +x axis (in degrees) *custom* args = *rmax*, cutoff set by a constant numeric value *rmax*
theta = angle from +z or +y axis in 3d/2d (in degrees) *integrated* args = none
phi or theta can be a variable (see below)
*vector* args = x y z * reference/style = *fixed* or *update* or *offset*
x y z = vector direction to apply the acceleration
x or y or z can be a variable (see below) .. parsed-literal::
*fixed* = use a fixed reference frame at *nstep*
*update* = update the reference frame every *nstep* timesteps
*offset* = update the reference frame *nstep* timesteps before calculating the non/affine displacement
Examples Examples
"""""""" """"""""
.. code-block:: LAMMPS .. code-block:: LAMMPS
fix 1 all gravity 1.0 chute 24.0 fix 1 all nonaffine/displacement 100 integrated update 100
fix 1 all gravity v_increase chute 24.0 fix 1 all nonaffine/displacement 1000 d2min type fixed 0
fix 1 all gravity 1.0 spherical 0.0 -180.0 fix 1 all nonaffine/displacement 1000 d2min custom 2.0 offset 100
fix 1 all gravity 10.0 spherical v_phi v_theta
fix 1 all gravity 100.0 vector 1 1 0
Description Description
""""""""""" """""""""""
Impose an additional acceleration on each particle in the group. This This fix computes different metrics of the nonaffine displacement of
fix is typically used with granular systems to include a "gravity" particles. The first metric, *d2min* calculates the :math:`D^2_\mathrm{min}`
term acting on the macroscopic particles. More generally, it can nonaffine displacement by Falk and Langer in :ref:`(Falk) <d2min-Falk>`.
represent any kind of driving field, e.g. a pressure gradient inducing For each atom, the fix computes the two tensors
a Poiseuille flow in a fluid. Note that this fix operates differently
than the :doc:`fix addforce <fix_addforce>` command. The addforce fix
adds the same force to each atom, independent of its mass. This
command imparts the same acceleration to each atom (force/mass).
The *magnitude* of the acceleration is specified in force/mass units. .. math::
For granular systems (LJ units) this is typically 1.0. See the
:doc:`units <units>` command for details.
Style *chute* is typically used for simulations of chute flow where X = \sum_{\mathrm{neighbors}} \vec{r} \left(\vec{r}_{0} \right)^T
the specified *angle* is the chute angle, with flow occurring in the +x
direction. For 3d systems, the tilt is away from the z axis; for 2d
systems, the tilt is away from the y axis.
Style *spherical* allows an arbitrary 3d direction to be specified for and
the acceleration vector. *Phi* and *theta* are defined in the usual
spherical coordinates. Thus for acceleration acting in the -z
direction, *theta* would be 180.0 (or -180.0). *Theta* = 90.0 and
*phi* = -90.0 would mean acceleration acts in the -y direction. For
2d systems, *phi* is ignored and *theta* is an angle in the xy plane
where *theta* = 0.0 is the y-axis.
Style *vector* imposes an acceleration in the vector direction given .. math::
by (x,y,z). Only the direction of the vector is important; it's
length is ignored. For 2d systems, the *z* component is ignored.
Any of the quantities *magnitude*, *angle*, *phi*, *theta*, *x*, *y*, Y = \sum_{\mathrm{neighbors}} \vec{r}_0 \left(\vec{r}_{0} \right)^T
*z* which define the gravitational magnitude and direction, can be
specified as an equal-style :doc:`variable <variable>`. If the value is
a variable, it should be specified as v_name, where name is the
variable name. In this case, the variable will be evaluated each
timestep, and its value used to determine the quantity. You should
insure that the variable calculates a result in the appropriate units,
e.g. force/mass or degrees.
Equal-style variables can specify formulas with various mathematical where the neighbors include all other atoms within the distance criterion
functions, and include :doc:`thermo_style <thermo_style>` command set by the cutoff option, discussed below, :math:`\vec{r}` is the current
keywords for the simulation box parameters and timestep and elapsed displacement between particles, and :math:`\vec{r}_0` is the reference
time. Thus it is easy to specify a time-dependent gravitational displacement. A deformation gradient tensor is then calculated as
field. :math:`F = X Y^{-1}` from which
---------- .. math::
.. include:: accel_styles.rst D^2_\mathrm{min} = \sum_{\mathrm{neighbors}} \left| \vec{r} - F \vec{r}_0 \right|^2
and a strain tensor is calculated :math:`E = F F^{T} - I` where :math:`I`
is the identity tensor.
The *integrated* style simply integrates the velocity of particles
every timestep to calculate a displacement. This style only works if
used in conjunction with another fix that deforms the box and displaces
atom positions such as :doc:`the remap x option of fix deform <fix_deform>`,
:doc:`fix press/berendsen <fix_press_berendsen>`, or :doc:`fix nh <fix_nh>`.
---------- ----------
Restart, fix_modify, output, run start/stop, minimize info Restart, fix_modify, output, run start/stop, minimize info
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
No information about this fix is written to :doc:`binary restart files <restart>`. The reference state is saved to :doc:`binary restart files <restart>`.
The :doc:`fix_modify <fix_modify>` *energy* option is supported by None of the :doc:`fix_modify <fix_modify>` options are relevant to this
this fix to add the gravitational potential energy of the system to fix.
the global potential energy of the system as part of
:doc:`thermodynamic output <thermo_style>`. The default setting for
this fix is :doc:`fix_modify energy no <fix_modify>`.
The :doc:`fix_modify <fix_modify>` *respa* option is supported by this This fix computes a peratom array with 3 columns, which can be accessed
fix. This allows to set at which level of the :doc:`r-RESPA by indices 1-3 using any command that uses per-atom values from a fix
<run_style>` integrator the fix is adding its forces. Default is the as input.
outermost level.
This fix computes a global scalar which can be accessed by various For the *integrated* style, the three columns are the nonaffine
:doc:`output commands <Howto_output>`. This scalar is the displacements in the x, y, and z directions. For the *d2min* style,
gravitational potential energy of the particles in the defined field, the three columns are the calculated :math:`D^2_\mathrm{min}`, the
namely mass \* (g dot x) for each particles, where x and mass are the volumetric strain, and the deviatoric strain.
particles position and mass, and g is the gravitational field. The
scalar value calculated by this fix is "extensive".
No parameter of this fix can be used with the *start/stop* keywords of
the :doc:`run <run>` command. This fix is not invoked during
:doc:`energy minimization <minimize>`.
Restrictions Restrictions
"""""""""""" """"""""""""
none
This compute is part of the EXTRA-FIX package. It is only enabled if
LAMMPS was built with that package. See the
:doc:`Build package <Build_package>` page for more info.
Related commands Related commands
"""""""""""""""" """"""""""""""""
:doc:`atom_style sphere <atom_style>`, :doc:`fix addforce <fix_addforce>` none
Default Default
""""""" """""""
none none
----------
.. _nh-Martyna:
**(Martyna)** Martyna, Tobias and Klein, J Chem Phys, 101, 4177 (1994).

View File

@ -11,6 +11,10 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing authors: Joel Clemmer (SNL), Ishan Srivastava (LBNL)
------------------------------------------------------------------------- */
#include "compute_fabric.h" #include "compute_fabric.h"
#include "atom.h" #include "atom.h"

View File

@ -11,6 +11,10 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing authors: Joel Clemmer (SNL), Ishan Srivastava (LBNL)
------------------------------------------------------------------------- */
#include "compute_rattlers.h" #include "compute_rattlers.h"
#include "atom.h" #include "atom.h"

View File

@ -12,6 +12,10 @@
See the README file in the top-level LAMMPS directory. See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing authors: Joel Clemmer (SNL), Ishan Srivastava (LBNL)
------------------------------------------------------------------------- */
#include "fix_nonaffine_displacement.h" #include "fix_nonaffine_displacement.h"
#include "atom.h" #include "atom.h"
@ -63,31 +67,30 @@ FixNonaffineDisplacement::FixNonaffineDisplacement(LAMMPS *lmp, int narg, char *
{ {
if (narg < 4) error->all(FLERR,"Illegal fix nonaffine/displacement command"); if (narg < 4) error->all(FLERR,"Illegal fix nonaffine/displacement command");
int iarg = 3; nevery = utils::inumeric(FLERR, arg[3], false, lmp);
if (nevery <= 0) error->all(FLERR,"Illegal nevery value {} in fix nonaffine/displacement", nevery);
int iarg = 4;
if (strcmp(arg[iarg], "integrated") == 0) { if (strcmp(arg[iarg], "integrated") == 0) {
nad_style = INTEGRATED; nad_style = INTEGRATED;
nevery = 1; nevery = 1;
iarg += 1; iarg += 1;
} else if (strcmp(arg[iarg], "d2min") == 0) { } else if (strcmp(arg[iarg], "d2min") == 0) {
if (iarg + 2 > narg) error->all(FLERR,"Illegal fix nonaffine/displacement command"); if (iarg + 1 > narg) error->all(FLERR,"Illegal fix nonaffine/displacement command");
nad_style = D2MIN; nad_style = D2MIN;
nevery = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (strcmp(arg[iarg + 1], "type") == 0) {
if (nevery <= 0) error->all(FLERR,"Illegal nevery value {} in fix nonaffine/displacement", nevery);
if (strcmp(arg[iarg + 2], "type") == 0) {
cut_style = TYPE; cut_style = TYPE;
} else if (strcmp(arg[iarg + 2], "radius") == 0) { } else if (strcmp(arg[iarg + 1], "radius") == 0) {
cut_style = RADIUS; cut_style = RADIUS;
} else if (strcmp(arg[iarg + 2], "custom") == 0) { } else if (strcmp(arg[iarg + 1], "custom") == 0) {
if (iarg + 3 > narg) error->all(FLERR,"Illegal fix nonaffine/displacement command"); if (iarg + 2 > narg) error->all(FLERR,"Illegal fix nonaffine/displacement command");
cut_style = CUSTOM; cut_style = CUSTOM;
cutoff_custom = utils::numeric(FLERR, arg[iarg + 3], false, lmp); cutoff_custom = utils::numeric(FLERR, arg[iarg + 2], false, lmp);
cutsq_custom = cutoff_custom * cutoff_custom; cutsq_custom = cutoff_custom * cutoff_custom;
if (cutoff_custom <= 0) if (cutoff_custom <= 0)
error->all(FLERR, "Illegal custom cutoff length {}", arg[iarg + 3]); error->all(FLERR, "Illegal custom cutoff length {}", arg[iarg + 2]);
iarg += 1; iarg += 1;
} else error->all(FLERR,"Illegal cutoff style {} in fix nonaffine/displacement", arg[iarg + 2]); } else error->all(FLERR,"Illegal cutoff style {} in fix nonaffine/displacement", arg[iarg + 1]);
iarg += 3; iarg += 3;
} }