Skip to content

Commit

Permalink
Merge pull request lammps#4000 from akohlmey/collected-small-changes
Browse files Browse the repository at this point in the history
Collected small changes
  • Loading branch information
akohlmey authored Dec 2, 2023
2 parents d77ba37 + 7f3af78 commit 8389e2e
Show file tree
Hide file tree
Showing 32 changed files with 197 additions and 182 deletions.
29 changes: 15 additions & 14 deletions doc/src/compute_xrd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,29 @@ equations:
\frac{\sin(\theta)}{\lambda} &= \frac{\left\lVert\mathbf{k}\right\rVert}{2}
Here, :math:`\mathbf{k}` is the location of the reciprocal lattice node,
:math:`r_j` is the position of each atom, :math:`f_j` are atomic scattering
factors, *Lp* is the Lorentz-polarization factor, and :math:`\theta` is the
scattering angle of diffraction. The Lorentz-polarization factor can be turned
off using the optional *LP* keyword.
:math:`r_j` is the position of each atom, :math:`f_j` are atomic
scattering factors, *Lp* is the Lorentz-polarization factor, and
:math:`\theta` is the scattering angle of diffraction. The
Lorentz-polarization factor can be turned off using the optional *LP*
keyword.

Diffraction intensities are calculated on a three-dimensional mesh of
reciprocal lattice nodes. The mesh spacing is defined either (a) by the entire
simulation domain or (b) manually using selected values as
shown in the 2D diagram below.
reciprocal lattice nodes. The mesh spacing is defined either (a) by the
entire simulation domain or (b) manually using selected values as shown
in the 2D diagram below.

.. image:: img/xrd_mesh.jpg
.. image:: img/xrd_mesh.png
:scale: 75%
:align: center

For a mesh defined by the simulation domain, a rectilinear grid is
constructed with spacing :math:`c A^{-1}` along each reciprocal lattice
axis, where :math:`A` is a matrix containing the vectors corresponding to the
edges of the simulation cell. If one or two directions has non-periodic
boundary conditions, then the spacing in these directions is defined from the
average of the (inversed) box lengths with periodic boundary conditions.
Meshes defined by the simulation domain must contain at least one periodic
boundary.
axis, where :math:`A` is a matrix containing the vectors corresponding
to the edges of the simulation cell. If one or two directions has
non-periodic boundary conditions, then the spacing in these directions
is defined from the average of the (inversed) box lengths with periodic
boundary conditions. Meshes defined by the simulation domain must
contain at least one periodic boundary.

If the *manual* flag is included, the mesh of reciprocal lattice nodes
will be defined using the *c* values for the spacing along each
Expand Down
28 changes: 14 additions & 14 deletions doc/src/fix_adapt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -317,21 +317,21 @@ Currently *bond* does not support bond_style hybrid nor bond_style
hybrid/overlay as bond styles. The bond styles that currently work
with fix_adapt are

+------------------------------------+-------+-----------------+
+------------------------------------+------------+------------+
| :doc:`class2 <bond_class2>` | r0 | type bonds |
+------------------------------------+-------+-----------------+
+------------------------------------+------------+------------+
| :doc:`fene <bond_fene>` | k,r0 | type bonds |
+------------------------------------+-------+-----------------+
+------------------------------------+------------+------------+
| :doc:`fene/nm <bond_fene>` | k,r0 | type bonds |
+------------------------------------+-------+-----------------+
+------------------------------------+------------+------------+
| :doc:`gromos <bond_gromos>` | k,r0 | type bonds |
+------------------------------------+-------+-----------------+
+------------------------------------+------------+------------+
| :doc:`harmonic <bond_harmonic>` | k,r0 | type bonds |
+------------------------------------+-------+-----------------+
+------------------------------------+------------+------------+
| :doc:`morse <bond_morse>` | r0 | type bonds |
+------------------------------------+-------+-----------------+
+------------------------------------+------------+------------+
| :doc:`nonlinear <bond_nonlinear>` | epsilon,r0 | type bonds |
+------------------------------------+-------+-----------------+
+------------------------------------+------------+------------+

----------

Expand All @@ -355,11 +355,11 @@ Currently *angle* does not support angle_style hybrid nor angle_style
hybrid/overlay as angle styles. The angle styles that currently work
with fix_adapt are

+------------------------------------+-------+-----------------+
| :doc:`harmonic <angle_harmonic>` | k,theta0 | type angles |
+------------------------------------+-------+-----------------+
| :doc:`cosine <angle_cosine>` | k | type angles |
+------------------------------------+-------+-----------------+
+------------------------------------+----------+-------------+
| :doc:`harmonic <angle_harmonic>` | k,theta0 | type angles |
+------------------------------------+----------+-------------+
| :doc:`cosine <angle_cosine>` | k | type angles |
+------------------------------------+----------+-------------+

Note that internally, theta0 is stored in radians, so the variable
this fix uses to reset theta0 needs to generate values in radians.
Expand Down Expand Up @@ -484,7 +484,7 @@ Restrictions
Related commands
""""""""""""""""

:doc:`compute ti <compute_ti>`
:doc:`compute ti <compute_ti>`, :doc:`fix adapt/fep <fix_adapt_fep>`

Default
"""""""
Expand Down
Binary file removed doc/src/img/xrd_mesh.jpg
Binary file not shown.
Binary file added doc/src/img/xrd_mesh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions doc/src/pair_beck.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ Description

Style *beck* computes interactions based on the potential by
:ref:`(Beck) <Beck>`, originally designed for simulation of Helium. It
includes truncation at a cutoff distance Rc.
includes truncation at a cutoff distance :math:`r_c`.

.. math::
E(r) &= A \exp\left[-\alpha r - \beta r^6\right] - \frac{B}{\left(r^2+a^2\right)^3} \left(1+\frac{2.709+3a^2}{r^2+a^2}\right) \qquad r < R_c \\
E(r) &= A \exp\left[-\alpha r - \beta r^6\right] - \frac{B}{\left(r^2+a^2\right)^3} \left(1+\frac{2.709+3a^2}{r^2+a^2}\right) \qquad r < r_c \\
The following coefficients must be defined for each pair of atoms
types via the :doc:`pair_coeff <pair_coeff>` command as in the examples
Expand All @@ -50,7 +50,7 @@ commands.
* cutoff (distance units)

The last coefficient is optional. If not specified, the global cutoff
:math:`R_c` is used.
:math:`r_c` is used.

----------

Expand Down
62 changes: 34 additions & 28 deletions doc/src/pair_lj_cut_tip4p.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,40 @@ Examples
Description
"""""""""""

The *lj/cut/tip4p* styles implement the TIP4P water model of
:ref:`(Jorgensen) <Jorgensen2>` and similar models, which introduce a
massless site M located a short distance away from the oxygen atom along
the bisector of the HOH angle. The atomic types of the oxygen and
hydrogen atoms, the bond and angle types for OH and HOH interactions,
and the distance to the massless charge site are specified as pair_style
arguments and are used to identify the TIP4P-like molecules and
determine the position of the M site from the positions of the hydrogen
and oxygen atoms of the water molecules. The M site location is used
for all Coulomb interactions instead of the oxygen atom location, also
with all other atom types, while the location of the oxygen atom is used
for the Lennard-Jones interactions. Style *lj/cut/tip4p/cut* uses a
cutoff for Coulomb interactions; style *lj/cut/tip4p/long* is for use
with a long-range Coulombic solver (Ewald or PPPM).

.. note::

For each TIP4P water molecule in your system, the atom IDs for
the O and 2 H atoms must be consecutive, with the O atom first. This
is to enable LAMMPS to "find" the 2 H atoms associated with each O
atom. For example, if the atom ID of an O atom in a TIP4P water
molecule is 500, then its 2 H atoms must have IDs 501 and 502.

See the :doc:`Howto tip4p <Howto_tip4p>` page for more information
on how to use the TIP4P pair styles and lists of parameters to set.
Note that the neighbor list cutoff for Coulomb interactions is
effectively extended by a distance 2\*qdist when using the TIP4P pair
style, to account for the offset distance of the fictitious charges on
O atoms in water molecules. Thus it is typically best in an
efficiency sense to use a LJ cutoff >= Coulombic cutoff + 2\*qdist, to
shrink the size of the neighbor list. This leads to slightly larger
cost for the long-range calculation, so you can test the trade-off for
your model.

The *lj/cut/tip4p* styles compute the standard 12/6 Lennard-Jones potential,
given by

Expand Down Expand Up @@ -91,34 +125,6 @@ specified for this style means that pairwise interactions within this
distance are computed directly; interactions outside that distance are
computed in reciprocal space.

The *lj/cut/tip4p* styles implement the TIP4P
water model of :ref:`(Jorgensen) <Jorgensen2>`, which introduces a massless
site located a short distance away from the oxygen atom along the
bisector of the HOH angle. The atomic types of the oxygen and
hydrogen atoms, the bond and angle types for OH and HOH interactions,
and the distance to the massless charge site are specified as
pair_style arguments. Style *lj/cut/tip4p/cut* uses a cutoff for
Coulomb interactions; style *lj/cut/tip4p/long* is for use with a
long-range Coulombic solver (Ewald or PPPM).

.. note::

For each TIP4P water molecule in your system, the atom IDs for
the O and 2 H atoms must be consecutive, with the O atom first. This
is to enable LAMMPS to "find" the 2 H atoms associated with each O
atom. For example, if the atom ID of an O atom in a TIP4P water
molecule is 500, then its 2 H atoms must have IDs 501 and 502.

See the :doc:`Howto tip4p <Howto_tip4p>` page for more information
on how to use the TIP4P pair styles and lists of parameters to set.
Note that the neighbor list cutoff for Coulomb interactions is
effectively extended by a distance 2\*qdist when using the TIP4P pair
style, to account for the offset distance of the fictitious charges on
O atoms in water molecules. Thus it is typically best in an
efficiency sense to use a LJ cutoff >= Coulombic cutoff + 2\*qdist, to
shrink the size of the neighbor list. This leads to slightly larger
cost for the long-range calculation, so you can test the trade-off for
your model.

Coefficients
""""""""""""
Expand Down
9 changes: 5 additions & 4 deletions doc/src/pair_lj_smooth_linear.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ Style *lj/smooth/linear* computes a truncated and force-shifted LJ
interaction (aka Shifted Force Lennard-Jones) that combines the
standard 12/6 Lennard-Jones function and subtracts a linear term based
on the cutoff distance, so that both, the potential and the force, go
continuously to zero at the cutoff Rc :ref:`(Toxvaerd) <Toxvaerd>`:
continuously to zero at the cutoff :math:`r_c` :ref:`(Toxvaerd) <Toxvaerd>`:

.. math::
\phi\left(r\right) & = 4 \epsilon \left[ \left(\frac{\sigma}{r}\right)^{12} -
\left(\frac{\sigma}{r}\right)^6 \right] \\
E\left(r\right) & = \phi\left(r\right) - \phi\left(R_c\right) - \left(r - R_c\right) \left.\frac{d\phi}{d r} \right|_{r=R_c} \qquad r < R_c
E\left(r\right) & = \phi\left(r\right) - \phi\left(r_c\right) - \left(r - r_c\right) \left.\frac{d\phi}{d r} \right|_{r=r_c} \qquad r < r_c
The following coefficients must be defined for each pair of atoms
types via the :doc:`pair_coeff <pair_coeff>` command as in the examples
Expand Down Expand Up @@ -77,8 +77,9 @@ tail option for adding long-range tail corrections to energy and
pressure, since the energy of the pair interaction is smoothed to 0.0
at the cutoff.

This pair style writes its information to :doc:`binary restart files <restart>`, so pair_style and pair_coeff commands do not need
to be specified in an input script that reads a restart file.
This pair style writes its information to :doc:`binary restart files <restart>`,
so pair_style and pair_coeff commands do not need to be specified
in an input script that reads a restart file.

This pair style can only be used via the *pair* keyword of the
:doc:`run_style respa <run_style>` command. It does not support the
Expand Down
2 changes: 1 addition & 1 deletion doc/src/pair_mie.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The *mie/cut* style computes the Mie potential, given by
E = C \epsilon \left[ \left(\frac{\sigma}{r}\right)^{\gamma_{rep}} - \left(\frac{\sigma}{r}\right)^{\gamma_{att}} \right]
\qquad r < r_c
Rc is the cutoff and C is a function that depends on the repulsive and
:math:`r_c` is the cutoff and C is a function that depends on the repulsive and
attractive exponents, given by:

.. math::
Expand Down
4 changes: 2 additions & 2 deletions doc/src/pair_morse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Style *morse* computes pairwise interactions with the formula
E = D_0 \left[ e^{- 2 \alpha (r - r_0)} - 2 e^{- \alpha (r - r_0)} \right]
\qquad r < r_c
Rc is the cutoff.
:math:`r_c` is the cutoff.

The following coefficients must be defined for each pair of atoms
types via the :doc:`pair_coeff <pair_coeff>` command as in the examples
Expand All @@ -78,7 +78,7 @@ so that both, potential energy and force, go to zero at the cut-off:
.. math::
\phi\left(r\right) & = D_0 \left[ e^{- 2 \alpha (r - r_0)} - 2 e^{- \alpha (r - r_0)} \right] \qquad r < r_c \\
E\left(r\right) & = \phi\left(r\right) - \phi\left(R_c\right) - \left(r - R_c\right) \left.\frac{d\phi}{d r} \right|_{r=R_c} \qquad r < R_c
E\left(r\right) & = \phi\left(r\right) - \phi\left(r_c\right) - \left(r - r_c\right) \left.\frac{d\phi}{d r} \right|_{r=r_c} \qquad r < r_c
The syntax of the pair_style and pair_coeff commands are the same for
the *morse* and *morse/smooth/linear* styles.
Expand Down
5 changes: 3 additions & 2 deletions doc/src/pair_soft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ It is useful for pushing apart overlapping atoms, since it does not
blow up as r goes to 0. A is a prefactor that can be made to vary in
time from the start to the end of the run (see discussion below),
e.g. to start with a very soft potential and slowly harden the
interactions over time. Rc is the cutoff. See the :doc:`fix nve/limit <fix_nve_limit>` command for another way to push apart
overlapping atoms.
interactions over time. :math:`r_c` is the cutoff.
See the :doc:`fix nve/limit <fix_nve_limit>` command for another way
to push apart overlapping atoms.

The following coefficients must be defined for each pair of atom types
via the :doc:`pair_coeff <pair_coeff>` command as in the examples above,
Expand Down
2 changes: 1 addition & 1 deletion doc/src/pair_spica.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ given by
as required for the SPICA (formerly called SDK) and the pSPICA Coarse-grained MD parameterization discussed in
:ref:`(Shinoda) <Shinoda3>`, :ref:`(DeVane) <DeVane>`, :ref:`(Seo) <Seo>`, and :ref:`(Miyazaki) <Miyazaki>`.
Rc is the cutoff.
:math:`r_c` is the cutoff.
Summary information on these force fields can be found at https://www.spica-ff.org

Style *lj/spica/coul/long* computes the adds Coulombic interactions
Expand Down
10 changes: 5 additions & 5 deletions examples/PACKAGES/phonon/2-1D-diatomic/in.Ana
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
dimension 2
boundary p f p

units lj
atom_style bond
units lj
atom_style bond
atom_modify sort 0 1.
bond_style harmonic
pair_style none
communicate single cutoff 2.0
comm_modify cutoff 2.0

# geometry
read_data data.pos
read_data data.pos

#
neighbor 1.0 nsq
Expand Down Expand Up @@ -43,4 +43,4 @@ thermo_modify temp MyTemp
thermo 100

#
run 2000000
run 2000000
3 changes: 2 additions & 1 deletion src/MDI/fix_mdi_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ using namespace FixConst;

/* ---------------------------------------------------------------------- */

FixMDIEngine::FixMDIEngine(LAMMPS *_lmp, int narg, char **arg) : Fix(_lmp, narg, arg)
FixMDIEngine::FixMDIEngine(LAMMPS *_lmp, int narg, char **arg) :
Fix(_lmp, narg, arg), mdi_engine(nullptr)
{
if (narg != 3) error->all(FLERR, "Illegal fix mdi/engine command");
}
Expand Down
24 changes: 6 additions & 18 deletions src/MDI/fix_mdi_qm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ static int compare_IDs(const int, const int, void *);

/* ---------------------------------------------------------------------- */

FixMDIQM::FixMDIQM(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
FixMDIQM::FixMDIQM(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), id_mcfix(nullptr), mc_active_ptr(nullptr), exclusion_group_ptr(nullptr),
elements(nullptr), qmIDs(nullptr), qm2owned(nullptr), eqm(nullptr), eqm_mine(nullptr),
tqm(nullptr), tqm_mine(nullptr), xqm(nullptr), xqm_mine(nullptr), fqm(nullptr)
{
// check requirements for LAMMPS to work with MDI as an engine
// atom IDs do not need to be consecutive
Expand All @@ -58,9 +61,7 @@ FixMDIQM::FixMDIQM(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
addflag = 1;
every = 1;
connectflag = 1;
elements = nullptr;
mcflag = 0;
id_mcfix = nullptr;

int iarg = 3;
while (iarg < narg) {
Expand Down Expand Up @@ -178,18 +179,6 @@ FixMDIQM::FixMDIQM(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
nqm = nqm_last = max_nqm = 0;
nexclude = 0;

qmIDs = nullptr;
qm2owned = nullptr;

eqm = nullptr;
tqm = nullptr;
xqm = nullptr;
fqm = nullptr;

eqm_mine = nullptr;
tqm_mine = nullptr;
xqm_mine = nullptr;

// per-atom data

nmax = atom->nmax;
Expand Down Expand Up @@ -999,9 +988,8 @@ void FixMDIQM::send_box()
ierr = MDI_Send(qm_cell, 9, MDI_DOUBLE, mdicomm);
if (ierr) error->all(FLERR, "MDI: >CELL data");

} else if (domain->xperiodic == 1 || domain->yperiodic == 1 ||
domain->zperiodic == 1) {
error->all(FLERR,"MDI requires fully periodic or fully non-periodic system");
} else if (domain->xperiodic == 1 || domain->yperiodic == 1 || domain->zperiodic == 1) {
error->all(FLERR, "MDI requires fully periodic or fully non-periodic system");
}
}

Expand Down
12 changes: 7 additions & 5 deletions src/MDI/fix_mdi_qmmm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ static int compare_IDs(const int, const int, void *);

/* ---------------------------------------------------------------------- */

FixMDIQMMM::FixMDIQMMM(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
FixMDIQMMM::FixMDIQMMM(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), elements(nullptr), pair_coul(nullptr), qmIDs(nullptr), qm2owned(nullptr),
eqm(nullptr), eqm_mine(nullptr), tqm(nullptr), tqm_mine(nullptr), xqm(nullptr),
xqm_mine(nullptr), qqm(nullptr), qqm_mine(nullptr), qpotential(nullptr),
qpotential_mine(nullptr), fqm(nullptr), ecoul(nullptr)
{
// check requirements for LAMMPS to work with MDI for a QMMM engine
// atom IDs do not need to be consecutive
Expand Down Expand Up @@ -69,7 +73,6 @@ FixMDIQMMM::FixMDIQMMM(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)

virialflag = 0;
connectflag = 1;
elements = nullptr;

int iarg = 4;
while (iarg < narg) {
Expand Down Expand Up @@ -1782,9 +1785,8 @@ void FixMDIQMMM::send_box()
ierr = MDI_Send(qm_cell, 9, MDI_DOUBLE, mdicomm);
if (ierr) error->all(FLERR, "MDI: >CELL data");

} else if (domain->xperiodic == 1 || domain->yperiodic == 1 ||
domain->zperiodic == 1) {
error->all(FLERR,"MDI requires fully periodic or fully non-periodic system");
} else if (domain->xperiodic == 1 || domain->yperiodic == 1 || domain->zperiodic == 1) {
error->all(FLERR, "MDI requires fully periodic or fully non-periodic system");
}
}

Expand Down
Loading

0 comments on commit 8389e2e

Please sign in to comment.