Merge remote-tracking branch 'github/develop' into collected-small-fixes

This commit is contained in:
Axel Kohlmeyer
2024-08-26 11:37:56 -04:00
26 changed files with 1170 additions and 1102 deletions

View File

@ -59,11 +59,12 @@ may also contribute to the virial term.
A symmetric pressure tensor, stored as a 6-element vector, is also A symmetric pressure tensor, stored as a 6-element vector, is also
calculated by this compute. The six components of the vector are calculated by this compute. The six components of the vector are
ordered :math:`xx,` :math:`yy,` :math:`zz,` :math:`xy,` :math:`xz,` :math:`yz.` ordered :math:`xx,` :math:`yy,` :math:`zz,` :math:`xy,` :math:`xz,`
The equation for the :math:`(I,J)` components (where :math:`I` and :math:`J` :math:`yz.` The equation for the :math:`(I,J)` components (where
are :math:`x`, :math:`y`, or :math:`z`) is similar to the above formula, :math:`I` and :math:`J` are :math:`x`, :math:`y`, or :math:`z`) is
except that the first term uses components of the kinetic energy tensor and the similar to the above formula, except that the first term uses
second term uses components of the virial tensor: components related to the kinetic energy tensor and the second term
uses components of the virial tensor:
.. math:: .. math::
@ -75,8 +76,8 @@ calculated. This includes a kinetic energy (temperature) term and the
virial as the sum of pair, bond, angle, dihedral, improper, kspace virial as the sum of pair, bond, angle, dihedral, improper, kspace
(long-range), and fix contributions to the force on each atom. If any (long-range), and fix contributions to the force on each atom. If any
extra keywords are listed, then only those components are summed to extra keywords are listed, then only those components are summed to
compute temperature or ke and/or the virial. The *virial* keyword compute temperature or ke and/or the virial. The *virial* keyword means
means include all terms except the kinetic energy *ke*\ . include all terms except the kinetic energy *ke*\ .
The *pair/hybrid* keyword means to only include contribution The *pair/hybrid* keyword means to only include contribution
from a sub-style in a *hybrid* or *hybrid/overlay* pair style. from a sub-style in a *hybrid* or *hybrid/overlay* pair style.
@ -86,26 +87,31 @@ system, including for many-body potentials and accounting for the
effects of periodic boundary conditions are discussed in effects of periodic boundary conditions are discussed in
:ref:`(Thompson) <Thompson1>`. :ref:`(Thompson) <Thompson1>`.
The temperature and kinetic energy tensor is not calculated by this The temperature and kinetic energy tensor are not calculated by this
compute, but rather by the temperature compute specified with the compute, but rather by the temperature compute specified with the
command. If the kinetic energy is not included in the pressure, than command. See the doc pages for individual compute temp variants for an
the temperature compute is not used and can be specified as NULL. explanation of how they calculate temperature and a symmetric tensor
Normally the temperature compute used by compute pressure should (6-element vector) whose components are twice that of the traditional KE
calculate the temperature of all atoms for consistency with the virial tensor. That tensor is what appears in the pressure tensor formula
term, but any compute style that calculates temperature can be used above.
(e.g., one that excludes frozen atoms or other degrees of freedom).
If the kinetic energy is not included in the pressure, than the
temperature compute is not used and can be specified as NULL. Normally
the temperature compute used by compute pressure should calculate the
temperature of all atoms for consistency with the virial term, but any
compute style that calculates temperature can be used (e.g., one that
excludes frozen atoms or other degrees of freedom).
Note that if desired the specified temperature compute can be one that Note that if desired the specified temperature compute can be one that
subtracts off a bias to calculate a temperature using only the thermal subtracts off a bias to calculate a temperature using only the thermal
velocity of the atoms (e.g., by subtracting a background streaming velocity of the atoms (e.g., by subtracting a background streaming
velocity). velocity). See the doc pages for individual :doc:`compute commands
See the doc pages for individual :doc:`compute commands <compute>` to determine <compute>` to determine which ones include a bias.
which ones include a bias.
Also note that the :math:`N` in the first formula above is really Also note that the :math:`N` in the first formula above is really
degrees-of-freedom divided by :math:`d` = dimensionality, where the DOF value degrees-of-freedom divided by :math:`d` = dimensionality, where the
is calculated by the temperature compute. DOF value is calculated by the temperature compute. See the various
See the various :doc:`compute temperature <compute>` styles for details. :doc:`compute temperature <compute>` styles for details.
A compute of this style with the ID of thermo_press is created when A compute of this style with the ID of thermo_press is created when
LAMMPS starts up, as if this command were in the input script: LAMMPS starts up, as if this command were in the input script:
@ -136,9 +142,8 @@ The ordering of values in the symmetric pressure tensor is as follows:
:math:`p_{xx},` :math:`p_{yy},` :math:`p_{zz},` :math:`p_{xy},` :math:`p_{xx},` :math:`p_{yy},` :math:`p_{zz},` :math:`p_{xy},`
:math:`p_{xz},` :math:`p_{yz}.` :math:`p_{xz},` :math:`p_{yz}.`
The scalar and vector values calculated by this compute are The scalar and vector values calculated by this compute are "intensive".
"intensive". The scalar and vector values will be in pressure The scalar and vector values will be in pressure :doc:`units <units>`.
:doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -48,14 +48,18 @@ the group, :math:`N_\mathrm{fix DOFs}` is the number of degrees of
freedom removed by fix commands (see below), :math:`k_B` is the freedom removed by fix commands (see below), :math:`k_B` is the
Boltzmann constant, and :math:`T` is the resulting computed temperature. Boltzmann constant, and :math:`T` is the resulting computed temperature.
A kinetic energy tensor, stored as a six-element vector, is also A symmetric tensor, stored as a six-element vector, is also calculated
calculated by this compute for use in the computation of a pressure by this compute for use in the computation of a pressure tensor by the
tensor. The formula for the components of the tensor is the same as the :doc:`compute pressue <compute_pressure>` command. The formula for
above expression for :math:`E_\mathrm{kin}`, except that :math:`v_i^2` is the components of the tensor is the same as the above expression for
replaced by :math:`v_{i,x} v_{i,y}` for the :math:`xy` component, and so on. :math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
The six components of the vector are ordered :math:`xx`, :math:`yy`, the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. :math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the constant for the duration of the run; use the *dynamic* option of the
:doc:`compute_modify <compute_modify>` command if this is not the case. :doc:`compute_modify <compute_modify>` command if this is not the case.
@ -94,16 +98,17 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length six (KE tensor), which can be accessed by indices vector of length six (symmetric tensor), which can be accessed by
1--6. These values can be used by any command that uses global scalar indices 1--6. These values can be used by any command that uses
or vector values from a compute as input. See the :doc:`Howto output global scalar or vector values from a compute as input. See the
<Howto_output>` page for an overview of LAMMPS output options. :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value is in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -41,8 +41,8 @@ translational and rotational kinetic energy. This differs from the
usual :doc:`compute temp <compute_temp>` command, which assumes point usual :doc:`compute temp <compute_temp>` command, which assumes point
particles with only translational kinetic energy. particles with only translational kinetic energy.
Only finite-size particles (aspherical or spherical) can be included Only finite-size particles (aspherical or spherical) can be included in
in the group. For 3d finite-size particles, each has six degrees of the group. For 3d finite-size particles, each has six degrees of
freedom (three translational, three rotational). For 2d finite-size freedom (three translational, three rotational). For 2d finite-size
particles, each has three degrees of freedom (two translational, one particles, each has three degrees of freedom (two translational, one
rotational). rotational).
@ -70,25 +70,39 @@ axis. It will also be the case for biaxial ellipsoids when exactly two
of the semiaxes have the same length and the corresponding relative well of the semiaxes have the same length and the corresponding relative well
depths are equal. depths are equal.
The translational kinetic energy is computed the same as is described The translational kinetic energy is computed the same as is described by
by the :doc:`compute temp <compute_temp>` command. The rotational the :doc:`compute temp <compute_temp>` command. The rotational kinetic
kinetic energy is computed as :math:`\frac12 I \omega^2`, where :math:`I` is energy is computed as :math:`\frac12 I \omega^2`, where :math:`I` is the
the inertia tensor for the aspherical particle and :math:`\omega` is its inertia tensor for the aspherical particle and :math:`\omega` is its
angular velocity, which is computed from its angular momentum. angular velocity, which is computed from its angular momentum.
.. note:: .. note::
For :doc:`2d models <dimension>`, particles are treated as For :doc:`2d models <dimension>`, particles are treated as
ellipsoids, not ellipses, meaning their moments of inertia will be the ellipsoids, not ellipses, meaning their moments of inertia will be
same as in 3d. the same as in 3d.
A kinetic energy tensor, stored as a six-element vector, is also A kinetic energy tensor, stored as a six-element vector, is also
calculated by this compute. The formula for the components of the calculated by this compute. The formula for the components of the
tensor is the same as the above formula, except that :math:`v^2` and tensor is the same as the above formula, except that :math:`v^2` and
:math:`\omega^2` are replaced by :math:`v_x v_y` and :math:`\omega_x \omega_y` :math:`\omega^2` are replaced by :math:`v_x v_y` and :math:`\omega_x
for the :math:`xy` component, and the appropriate elements of the moment of \omega_y` for the :math:`xy` component, and the appropriate elements of
inertia tensor are used. The six components of the vector are ordered the moment of inertia tensor are used. The six components of the vector
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for the
components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` and :math:`\omega^2` are replaced by :math:`v_x v_y`
and :math:`\omega_x \omega_y` for the :math:`xy` component, and so on.
And the appropriate elements of the moment of inertia tensor are used.
Note that because it lacks the 1/2 factor, these tensor components are
twice those of the traditional kinetic energy tensor. The six
components of the vector are ordered :math:`xx`, :math:`yy`, :math:`zz`,
:math:`xy`, :math:`xz`, :math:`yz`.
The number of atoms contributing to the temperature is assumed to be The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic/dof* option of constant for the duration of the run; use the *dynamic/dof* option of
@ -131,27 +145,26 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by indices
These values can be used by any command that uses global scalar or 1--6. These values can be used by any command that uses global scalar
vector values from a compute as input. or vector values from a compute as input. See the :doc:`Howto output
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS <Howto_output>` page for an overview of LAMMPS output options.
output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The vector
vector values are "extensive". values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value is in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""
This compute is part of the ASPHERE package. It is only enabled if This compute is part of the ASPHERE package. It is only enabled if
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info. LAMMPS was built with that package. See the :doc:`Build package
<Build_package>` page for more info.
This compute requires that atoms store angular momentum and a This compute requires that atoms store angular momentum and a quaternion
quaternion as defined by the :doc:`atom_style ellipsoid <atom_style>` as defined by the :doc:`atom_style ellipsoid <atom_style>` command.
command.
All particles in the group must be finite-size. They cannot be point All particles in the group must be finite-size. They cannot be point
particles, but they can be aspherical or spherical as defined by their particles, but they can be aspherical or spherical as defined by their

View File

@ -62,12 +62,17 @@ kinetic energy is computed as :math:`\frac12 I \omega^2`, where :math:`I`
is the moment of inertia tensor for the aspherical particle and :math:`\omega` is the moment of inertia tensor for the aspherical particle and :math:`\omega`
is its angular velocity, which is computed from its angular momentum. is its angular velocity, which is computed from its angular momentum.
A kinetic energy tensor, stored as a 6-element vector, is also calculated by A symmetric tensor, stored as a six-element vector, is also calculated
this compute. The formula for the components of the tensor is the same as the by this compute for use in the computation of a pressure tensor by the
above formula, except that :math:`v^2` and :math:`\omega^2` are :doc:`compute pressue <compute_pressure>` command. The formula for
replaced by :math:`v_x v_y` and :math:`\omega_x \omega_y` for the the components of the tensor is the same as the above expression for
math:`xy` component, and the appropriate elements of the inertia tensor are :math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
used. The six components of the vector are ordered :math:`xx`, :math:`yy`, the :math:`v_i^2` and :math:`\omega^2` are replaced by :math:`v_x v_y`
and :math:`\omega_x \omega_y` for the :math:`xy` component, and so on.
And the appropriate elements of the moment of inertia tensor are used.
Note that because it lacks the 1/2 factor, these tensor components are
twice those of the traditional kinetic energy tensor. The six
components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
The number of atoms contributing to the temperature is assumed to be The number of atoms contributing to the temperature is assumed to be
@ -111,17 +116,17 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1--6. These values can be used by any command that uses
vector values from a compute as input. global scalar or vector values from a compute as input. See the
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options. output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The scalar value is in temperature :doc:`units <units>`. The vector
The vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -85,12 +85,14 @@ By default, *adof* = 2 or 3 = dimensionality of system, as set via the
:doc:`dimension <dimension>` command, and *cdof* = 0.0. :doc:`dimension <dimension>` command, and *cdof* = 0.0.
This gives the usual formula for temperature. This gives the usual formula for temperature.
A kinetic energy tensor, stored as a six-element vector, is also A symmetric tensor, stored as a six-element vector, is also calculated
calculated by this compute for use in the computation of a pressure by this compute. The formula for the components of the tensor is the
tensor. The formula for the components of the tensor is the same as same as the above expression for :math:`E_\mathrm{kin}`, except that
the above formula, except that :math:`v^2` is replaced by the 1/2 factor is NOT included and the :math:`v_i^2` is replaced by
:math:`v_x v_y` for the :math:`xy` component, and so on. :math:`v_{i,x} v_{i,y}` for the :math:`xy` component, and so on. Note
The six components of the vector are ordered :math:`xx`, :math:`yy`, that because it lacks the 1/2 factor, these tensor components are
twice those of the traditional kinetic energy tensor. The six
components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
Note that the number of atoms contributing to the temperature is Note that the number of atoms contributing to the temperature is
@ -227,10 +229,10 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1--6. These values can be used by any command that uses
vector values from a compute as input. global scalar or vector values from a compute as input. See the
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options. output options.
This compute also optionally calculates a global array, if one or more This compute also optionally calculates a global array, if one or more
@ -245,9 +247,9 @@ page for an overview of LAMMPS output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". The array values are "intensive". vector values are "extensive". The array values are "intensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value is in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. The array values values are in energy :doc:`units <units>`. The array values will be
will be in temperature :doc:`units <units>` for the *temp* value, and in in temperature :doc:`units <units>` for the *temp* value, and in
energy :doc:`units <units>` for the *kecom* and *internal* values. energy :doc:`units <units>` for the *kecom* and *internal* values.
Restrictions Restrictions

View File

@ -44,12 +44,17 @@ where KE is the total kinetic energy of the group of atoms (sum of
simulation, :math:`N` is number of atoms in the group, :math:`k_B` is simulation, :math:`N` is number of atoms in the group, :math:`k_B` is
the Boltzmann constant, and :math:`T` is the absolute temperature. the Boltzmann constant, and :math:`T` is the absolute temperature.
A kinetic energy tensor, stored as a six-element vector, is also A symmetric tensor, stored as a six-element vector, is also calculated
calculated by this compute for use in the computation of a pressure by this compute for use in the computation of a pressure tensor by the
tensor. The formula for the components of the tensor is the same as :doc:`compute pressue <compute_pressure>` command. The formula for
the above formula, except that :math:`v^2` is replaced by :math:`v_x v_y` the components of the tensor is the same as the above expression for
for the :math:`xy` component, and so on. The six components of the vector are :math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the constant for the duration of the run; use the *dynamic* option of the
@ -81,17 +86,17 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1--6. These values can be used by any command that uses
vector values from a compute as input. See the global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
options. output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The scalar value is in temperature :doc:`units <units>`. The vector
The vector values will be in energy :doc:`units <units>`. values is in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -31,27 +31,27 @@ on the center-of-mass velocity of atom pairs that are bonded to each
other. This compute is designed to be used with the adiabatic other. This compute is designed to be used with the adiabatic
core/shell model of :ref:`(Mitchell and Fincham) <MitchellFincham1>`. core/shell model of :ref:`(Mitchell and Fincham) <MitchellFincham1>`.
See the :doc:`Howto coreshell <Howto_coreshell>` page for an overview of See the :doc:`Howto coreshell <Howto_coreshell>` page for an overview of
the model as implemented in LAMMPS. Specifically, this compute the model as implemented in LAMMPS. Specifically, this compute enables
enables correct temperature calculation and thermostatting of correct temperature calculation and thermostatting of core/shell pairs
core/shell pairs where it is desirable for the internal degrees of where it is desirable for the internal degrees of freedom of the
freedom of the core/shell pairs to not be influenced by a thermostat. core/shell pairs to not be influenced by a thermostat. A compute of
A compute of this style can be used by any command that computes a this style can be used by any command that computes a temperature via
temperature via :doc:`fix_modify <fix_modify>` :doc:`fix_modify <fix_modify>` (e.g., :doc:`fix temp/rescale
(e.g., :doc:`fix temp/rescale <fix_temp_rescale>`, :doc:`fix npt <fix_nh>`). <fix_temp_rescale>`, :doc:`fix npt <fix_nh>`).
Note that this compute does not require all ions to be polarized, Note that this compute does not require all ions to be polarized, hence
hence defined as core/shell pairs. One can mix core/shell pairs and defined as core/shell pairs. One can mix core/shell pairs and ions
ions without a satellite particle if desired. The compute will without a satellite particle if desired. The compute will consider the
consider the non-polarized ions according to the physical system. non-polarized ions according to the physical system.
For this compute, core and shell particles are specified by two For this compute, core and shell particles are specified by two
respective group IDs, which can be defined using the respective group IDs, which can be defined using the :doc:`group
:doc:`group <group>` command. The number of atoms in the two groups <group>` command. The number of atoms in the two groups must be the
must be the same and there should be one bond defined between a pair same and there should be one bond defined between a pair of atoms in the
of atoms in the two groups. Non-polarized ions which might also be two groups. Non-polarized ions which might also be included in the
included in the treated system should not be included into either of treated system should not be included into either of these groups, they
these groups, they are taken into account by the *group-ID* (second are taken into account by the *group-ID* (second argument) of the
argument) of the compute. compute.
The temperature is calculated by the formula The temperature is calculated by the formula
@ -60,52 +60,56 @@ The temperature is calculated by the formula
\text{KE} = \frac{\text{dim}}{2} N k_B T, \text{KE} = \frac{\text{dim}}{2} N k_B T,
where KE is the total kinetic energy of the group of atoms (sum of where KE is the total kinetic energy of the group of atoms (sum of
:math:`\frac12 m v^2`), dim = 2 or 3 is the dimensionality of the simulation, :math:`\frac12 m v^2`), dim = 2 or 3 is the dimensionality of the
:math:`N` is the number of atoms in the group, :math:`k_B` is the Boltzmann simulation, :math:`N` is the number of atoms in the group, :math:`k_B`
constant, and :math:`T` is the absolute temperature. Note that is the Boltzmann constant, and :math:`T` is the absolute temperature.
the velocity of each core or shell atom used in the KE calculation is Note that the velocity of each core or shell atom used in the KE
the velocity of the center-of-mass (COM) of the core/shell pair the calculation is the velocity of the center-of-mass (COM) of the
atom is part of. core/shell pair the atom is part of.
A kinetic energy tensor, stored as a six-element vector, is also calculated by A symmetric tensor, stored as a six-element vector, is also calculated
this compute for use in the computation of a pressure tensor. The formula for by this compute for use in the computation of a pressure tensor by the
the components of the tensor is the same as the above formula, except that :doc:`compute pressue <compute_pressure>` command. The formula for the
:math:`v^2` is replaced by :math:`v_x v_y` for the :math:`xy` component, and so components of the tensor is the same as the above expression for
on. The six components of the vector are ordered :math:`xx`, :math:`yy`, :math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. In contrast to the temperature, the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
the velocity of each core or shell atom is taken individually. :math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
The change this fix makes to core/shell atom velocities is essentially The change this fix makes to core/shell atom velocities is essentially
computing the temperature after a "bias" has been removed from the velocity of computing the temperature after a "bias" has been removed from the
the atoms. This "bias" is the velocity of the atom relative to the velocity of the atoms. This "bias" is the velocity of the atom relative
center-of-mass velocity of the core/shell pair. If this compute is used with a to the center-of-mass velocity of the core/shell pair. If this compute
fix command that performs thermostatting then this bias will be subtracted from is used with a fix command that performs thermostatting then this bias
each atom, thermostatting of the remaining center-of-mass velocity will be will be subtracted from each atom, thermostatting of the remaining
performed, and the bias will be added back in. This means the thermostatting center-of-mass velocity will be performed, and the bias will be added
will effectively be performed on the core/shell pairs, instead of on the back in. This means the thermostatting will effectively be performed on
individual core and shell atoms. Thermostatting fixes that work in this way the core/shell pairs, instead of on the individual core and shell atoms.
include :doc:`fix nvt <fix_nh>`, :doc:`fix temp/rescale <fix_temp_rescale>`, Thermostatting fixes that work in this way include :doc:`fix nvt
:doc:`fix temp/berendsen <fix_temp_berendsen>`, and <fix_nh>`, :doc:`fix temp/rescale <fix_temp_rescale>`, :doc:`fix
:doc:`fix langevin <fix_langevin>`. temp/berendsen <fix_temp_berendsen>`, and :doc:`fix langevin
<fix_langevin>`.
The internal energy of core/shell pairs can be calculated by the The internal energy of core/shell pairs can be calculated by the
:doc:`compute temp/chunk <compute_temp_chunk>` command, if chunks are defined :doc:`compute temp/chunk <compute_temp_chunk>` command, if chunks are
as core/shell pairs. See the :doc:`Howto coreshell <Howto_coreshell>` doc defined as core/shell pairs. See the :doc:`Howto coreshell
page for more discussion on how to do this. <Howto_coreshell>` doc page for more discussion on how to do this.
Output info Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by indices
These values can be used by any command that uses global scalar or 1--6. These values can be used by any command that uses global scalar
vector values from a compute as input. or vector values from a compute as input.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The vector
vector values are "extensive". values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value is in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -73,12 +73,16 @@ simulation, :math:`N` is the number of atoms in the group, :math:`k_B`
is the Boltzmann constant, and :math:`T` is the temperature. Note that is the Boltzmann constant, and :math:`T` is the temperature. Note that
:math:`v` in the kinetic energy formula is the atom's velocity. :math:`v` in the kinetic energy formula is the atom's velocity.
A kinetic energy tensor, stored as a six-element vector, is also A symmetric tensor, stored as a six-element vector, is also calculated
calculated by this compute for use in the computation of a pressure by this compute for use in the computation of a pressure tensor by the
tensor. The formula for the components of the tensor is the same as :doc:`compute pressue <compute_pressure>` command. The formula for
the above formula, except that :math:`v^2` is replaced by :math:`v_x v_y` for the components of the tensor is the same as the above expression for
the :math:`xy` component, and so on. The six components of the vector are :math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`. :math:`yz`.
The number of atoms contributing to the temperature is assumed to be The number of atoms contributing to the temperature is assumed to be
@ -128,17 +132,17 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1--6. These values can be used by any command that uses
vector values from a compute as input. See the global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
options. output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The scalar value is in temperature :doc:`units <units>`. The vector
The vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -29,17 +29,20 @@ model, after subtracting out a streaming velocity induced by the
simulation box changing size and/or shape, for example in a simulation box changing size and/or shape, for example in a
non-equilibrium MD (NEMD) simulation. The size/shape change is non-equilibrium MD (NEMD) simulation. The size/shape change is
induced by use of the :doc:`fix deform <fix_deform>` command. A induced by use of the :doc:`fix deform <fix_deform>` command. A
compute of this style is created by the compute of this style is created by the :doc:`fix nvt/sllod/eff
:doc:`fix nvt/sllod/eff <fix_nvt_sllod_eff>` command to compute the thermal <fix_nvt_sllod_eff>` command to compute the thermal temperature of
temperature of atoms for thermostatting purposes. A compute of this atoms for thermostatting purposes. A compute of this style can also
style can also be used by any command that computes a temperature be used by any command that computes a temperature (e.g.,
(e.g., :doc:`thermo_modify <thermo_modify>`, :doc:`fix npt/eff <fix_nh_eff>`). :doc:`thermo_modify <thermo_modify>`, :doc:`fix npt/eff
<fix_nh_eff>`).
The calculation performed by this compute is exactly like that The calculation performed by this compute is exactly like that
described by the :doc:`compute temp/deform <compute_temp_deform>` described by the :doc:`compute temp/deform <compute_temp_deform>`
command, except that the formula for the temperature includes the command, except that the formulas for the temperature (scalar) and
radial electron velocity contributions, as discussed by the :doc:`compute temp/eff <compute_temp_eff>` command. Note that only the diagonal components of the symmetric tensor (vector) include the
translational degrees of freedom for each nuclei or electron are radial electron velocity contributions, as discussed by the
:doc:`compute temp/eff <compute_temp_eff>` command. Note that only
the translational degrees of freedom for each nuclei or electron are
affected by the streaming velocity adjustment. The radial velocity affected by the streaming velocity adjustment. The radial velocity
component of the electrons is not affected. component of the electrons is not affected.
@ -47,17 +50,17 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1--6. These values can be used by any command that uses
vector values from a compute as input. See the global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
options. output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value is in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -44,12 +44,16 @@ constant, and :math:`T` = temperature. The calculation of KE excludes the
is 0. The dim parameter is adjusted to give the correct number of is 0. The dim parameter is adjusted to give the correct number of
degrees of freedom. degrees of freedom.
A kinetic energy tensor, stored as a six-element vector, is also A symmetric tensor, stored as a six-element vector, is also calculated
calculated by this compute for use in the calculation of a pressure by this compute for use in the computation of a pressure tensor by the
tensor. The formula for the components of the tensor is the same as :doc:`compute pressue <compute_pressure>` command. The formula for
the above formula, except that :math:`v^2` is replaced by :math:`v_x v_y` for the components of the tensor is the same as the above expression for
the :math:`xy` component, and so on. The six components of the vector are :math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`. :math:`yz`.
The number of atoms contributing to the temperature is assumed to be The number of atoms contributing to the temperature is assumed to be
@ -88,17 +92,17 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1--6. These values can be used by any command that uses
vector values from a compute as input. global scalar or vector values from a compute as input. See the
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options. output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value is in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -97,21 +97,27 @@ center-of-mass velocity across the group in directions where streaming velocity
is *not* subtracted. This can be altered using the *extra* option of the is *not* subtracted. This can be altered using the *extra* option of the
:doc:`compute_modify <compute_modify>` command. :doc:`compute_modify <compute_modify>` command.
If the *out* keyword is used with a *tensor* value, which is the default, If the *out* keyword is used with a *tensor* value, which is the
a kinetic energy tensor, stored as a six-element vector, is also calculated by default, then a symmetric tensor, stored as a six-element vector, is
this compute for use in the computation of a pressure tensor. The formula for also calculated by this compute for use in the computation of a
the components of the tensor is the same as the above formula, except that pressure tensor by the :doc:`compute pressue <compute_pressure>`
:math:`v^2` is replaced by :math:`v_x v_y` for the :math:`xy` component, and command. The formula for the components of the tensor is the same as
so on. The six components of the vector are ordered :math:`xx`, :math:`yy`, the above expression for :math:`E_\mathrm{kin}`, except that the 1/2
factor is NOT included and the :math:`v_i^2` is replaced by
:math:`v_{i,x} v_{i,y}` for the :math:`xy` component, and so on. Note
that because it lacks the 1/2 factor, these tensor components are
twice those of the traditional kinetic energy tensor. The six
components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
If the *out* keyword is used with a *bin* value, the count of atoms and If the *out* keyword is used with a *bin* value, the count of atoms
computed temperature for each bin are stored for output, as an array of values, and computed temperature for each bin are stored for output, as an
as described below. The temperature of each bin is calculated as described array of values, as described below. The temperature of each bin is
above, where the bias velocity is subtracted and only the remaining thermal calculated as described above, where the bias velocity is subtracted
velocity of atoms in the bin contributes to the temperature. See the note and only the remaining thermal velocity of atoms in the bin
below for how the temperature is normalized by the degrees-of-freedom of atoms contributes to the temperature. See the note below for how the
in the bin. temperature is normalized by the degrees-of-freedom of atoms in the
bin.
The number of atoms contributing to the temperature is assumed to be The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the constant for the duration of the run; use the *dynamic* option of the
@ -166,16 +172,17 @@ Output info
This compute calculates a global scalar (the temperature). Depending This compute calculates a global scalar (the temperature). Depending
on the setting of the *out* keyword, it also calculates a global on the setting of the *out* keyword, it also calculates a global
vector or array. For *out* = *tensor*, it calculates a vector of vector or array. For *out* = *tensor*, it calculates a vector of
length 6 (KE tensor), which can be accessed by indices 1--6. For *out* length 6 (symmetric tensor), which can be accessed by indices 1--6.
= *bin* it calculates a global array which has 2 columns and :math:`N` rows, For *out* = *bin* it calculates a global array which has 2 columns and
where :math:`N` is the number of bins. The first column contains the number :math:`N` rows, where :math:`N` is the number of bins. The first
of atoms in that bin. The second contains the temperature of that column contains the number of atoms in that bin. The second contains
bin, calculated as described above. The ordering of rows in the array the temperature of that bin, calculated as described above. The
is as follows. Bins in :math:`x` vary fastest, then :math:`y`, then ordering of rows in the array is as follows. Bins in :math:`x` vary
:math:`z`. Thus for a :math:`10\times 10\times 10` 3d array of bins, there fastest, then :math:`y`, then :math:`z`. Thus for a :math:`10\times
will be 1000 rows. The bin with indices :math:`(i_x,i_y,i_z) = (2,3,4)` would 10\times 10` 3d array of bins, there will be 1000 rows. The bin with
map to row :math:`M = 10^2(i_z-1) + 10(i_y-1) + i_x = 322`, where the rows are indices :math:`(i_x,i_y,i_z) = (2,3,4)` would map to row :math:`M =
numbered from 1 to 1000 and the bin indices are numbered from 1 to 10 in each 10^2(i_z-1) + 10(i_y-1) + i_x = 322`, where the rows are numbered from
1 to 1000 and the bin indices are numbered from 1 to 10 in each
dimension. dimension.
These values can be used by any command that uses global scalar or These values can be used by any command that uses global scalar or
@ -186,9 +193,9 @@ options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". The array values are "intensive". vector values are "extensive". The array values are "intensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value us in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. The first column values are in energy :doc:`units <units>`. The first column of array
of array values are counts; the values in the second column will be in values are counts; the values in the second column will be in
temperature :doc:`units <units>`. temperature :doc:`units <units>`.
Restrictions Restrictions
@ -203,7 +210,10 @@ will be for most thermostats.
Related commands Related commands
"""""""""""""""" """"""""""""""""
:doc:`compute temp <compute_temp>`, :doc:`compute temp/ramp <compute_temp_ramp>`, :doc:`compute temp/deform <compute_temp_deform>`, :doc:`compute pressure <compute_pressure>` :doc:`compute temp <compute_temp>`,
:doc:`compute temp/ramp <compute_temp_ramp>`,
:doc:`compute temp/deform <compute_temp_deform>`,
:doc:`compute pressure <compute_pressure>`
Default Default
""""""" """""""

View File

@ -63,12 +63,17 @@ command (e.g., :math:`\AA` for units = real or metal). A
velocity in lattice spacings per unit time). The :doc:`lattice <lattice>` velocity in lattice spacings per unit time). The :doc:`lattice <lattice>`
command must have been previously used to define the lattice spacing. command must have been previously used to define the lattice spacing.
A kinetic energy tensor, stored as a six-element vector, is also calculated by A symmetric tensor, stored as a six-element vector, is also calculated
this compute for use in the computation of a pressure tensor. The formula for by this compute for use in the computation of a pressure tensor by the
the components of the tensor is the same as the above formula, except that :doc:`compute pressue <compute_pressure>` command. The formula for
:math:`v^2` is replaced by :math:`v_x v_y` for the :math:`xy` component, and the components of the tensor is the same as the above expression for
so on. The six components of the vector are ordered :math:`xx`, :math:`yy`, :math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be constant The number of atoms contributing to the temperature is assumed to be constant
for the duration of the run; use the *dynamic* option of the for the duration of the run; use the *dynamic* option of the
@ -100,17 +105,17 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1--6. These values can be used by any command that uses
vector values from a compute as input. See the global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
options. output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value is in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""
@ -119,7 +124,10 @@ Restrictions
Related commands Related commands
"""""""""""""""" """"""""""""""""
:doc:`compute temp <compute_temp>`, :doc:`compute temp/profie <compute_temp_profile>`, :doc:`compute temp/deform <compute_temp_deform>`, :doc:`compute pressure <compute_pressure>` :doc:`compute temp <compute_temp>`,
:doc:`compute temp/profile <compute_temp_profile>`,
:doc:`compute temp/deform <compute_temp_deform>`,
:doc:`compute pressure <compute_pressure>`
Default Default
""""""" """""""

View File

@ -49,12 +49,17 @@ where KE = is the total kinetic energy of the group of atoms (sum of
:math:`N` is the number of atoms in both the group and region, :math:`k_B` is :math:`N` is the number of atoms in both the group and region, :math:`k_B` is
the Boltzmann constant, and :math:`T` temperature. the Boltzmann constant, and :math:`T` temperature.
A kinetic energy tensor, stored as a six-element vector, is also A symmetric tensor, stored as a six-element vector, is also calculated
calculated by this compute for use in the computation of a pressure by this compute for use in the computation of a pressure tensor by the
tensor. The formula for the components of the tensor is the same as :doc:`compute pressue <compute_pressure>` command. The formula for
the above formula, except that :math:`v^2` is replaced by :math:`v_x v_y` the components of the tensor is the same as the above expression for
for the :math:`xy` component, and so on. The six components of the vector are :math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is calculated each The number of atoms contributing to the temperature is calculated each
time the temperature is evaluated since it is assumed atoms can time the temperature is evaluated since it is assumed atoms can
@ -78,12 +83,13 @@ will operate only on atoms that are currently in the geometric region.
Unlike other compute styles that calculate temperature, this compute Unlike other compute styles that calculate temperature, this compute
does not subtract out degrees-of-freedom due to fixes that constrain does not subtract out degrees-of-freedom due to fixes that constrain
motion, such as :doc:`fix shake <fix_shake>` and :doc:`fix rigid <fix_rigid>`. This is because those degrees of freedom motion, such as :doc:`fix shake <fix_shake>` and :doc:`fix rigid
(e.g., a constrained bond) could apply to sets of atoms that straddle <fix_rigid>`. This is because those degrees of freedom (e.g., a
the region boundary, and hence the concept is somewhat ill-defined. constrained bond) could apply to sets of atoms that straddle the
If needed the number of subtracted degrees of freedom can be set region boundary, and hence the concept is somewhat ill-defined. If
explicitly using the *extra* option of the needed the number of subtracted degrees of freedom can be set
:doc:`compute_modify <compute_modify>` command. explicitly using the *extra* option of the :doc:`compute_modify
<compute_modify>` command.
See the :doc:`Howto thermostat <Howto_thermostat>` page for a See the :doc:`Howto thermostat <Howto_thermostat>` page for a
discussion of different ways to compute temperature and perform discussion of different ways to compute temperature and perform
@ -93,17 +99,17 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1--6. These values can be used by any command that uses
vector values from a compute as input. See the global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
options. output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The scalar value is in temperature :doc:`units <units>`. The vector
The vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -32,32 +32,33 @@ temperature (e.g., :doc:`thermo_modify <thermo_modify>`).
The operation of this compute is exactly like that described by the The operation of this compute is exactly like that described by the
:doc:`compute temp/region <compute_temp_region>` command, except that :doc:`compute temp/region <compute_temp_region>` command, except that
the formula for the temperature itself includes the radial electron the formulas for the temperature (scalar) and diagonal components of
velocity contributions, as discussed by the the symmetric tensor (vector) include the radial electron velocity
:doc:`compute temp/eff <compute_temp_eff>` command. contributions, as discussed by the :doc:`compute temp/eff
<compute_temp_eff>` command.
Output info Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1--6. These values can be used by any command that uses
vector values from a compute as input. See the global scalar or vector values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
options. output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value is in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""
This compute is part of the EFF package. It is only enabled if This compute is part of the EFF package. It is only enabled if LAMMPS
LAMMPS was built with that package. was built with that package. See the :doc:`Build package
See the :doc:`Build package <Build_package>` page for more info. <Build_package>` page for more info.
Related commands Related commands
"""""""""""""""" """"""""""""""""

View File

@ -43,12 +43,17 @@ where KE is the total kinetic energy of the group of atoms (sum of
:math:`N` is the number of atoms in the group, :math:`k_B` is the Boltzmann :math:`N` is the number of atoms in the group, :math:`k_B` is the Boltzmann
constant, and :math:`T` is the absolute temperature. constant, and :math:`T` is the absolute temperature.
A kinetic energy tensor, stored as a six-element vector, is also calculated by A symmetric tensor, stored as a six-element vector, is also calculated
this compute for use in the computation of a pressure tensor. The formula for by this compute for use in the computation of a pressure tensor by the
the components of the tensor is the same as the above formula, except that :doc:`compute pressue <compute_pressure>` command. The formula for
:math:`v^2` is replaced by :math:`v_x v_y` for the :math:`xy` component, and the components of the tensor is the same as the above expression for
so on. The six components of the vector are ordered :math:`xx`, :math:`yy`, :math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the constant for the duration of the run; use the *dynamic* option of the
@ -80,17 +85,16 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1-6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1-6. These values can be used by any command that uses global
vector values from a compute as input. See the scalar or vector values from a compute as input. See the :doc:`Howto
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS output output <Howto_output>` page for an overview of LAMMPS output options.
options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value is in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -77,6 +77,18 @@ tensor is the same as the above formulas, except that :math:`v^2` and
vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, vector are ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`,
:math:`xz`, :math:`yz`. :math:`xz`, :math:`yz`.
A symmetric tensor, stored as a six-element vector, is also calculated
by this compute for use in the computation of a pressure tensor by the
:doc:`compute pressue <compute_pressure>` command. The formula for
the components of the tensor is the same as the above expression for
:math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
the :math:`v_i^2` and :math:`\omega^2` are replaced by :math:`v_x v_y`
and :math:`\omega_x \omega_y` for the :math:`xy` component, and so on.
Note that because it lacks the 1/2 factor, these tensor components are
twice those of the traditional kinetic energy tensor. The six
components of the vector are ordered :math:`xx`, :math:`yy`,
:math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`.
The number of atoms contributing to the temperature is assumed to be The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the constant for the duration of the run; use the *dynamic* option of the
:doc:`compute_modify <compute_modify>` command if this is not the case. :doc:`compute_modify <compute_modify>` command if this is not the case.
@ -117,17 +129,17 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 6 (KE tensor), which can be accessed by indices 1--6. vector of length 6 (symmetric tensor), which can be accessed by
These values can be used by any command that uses global scalar or indices 1--6. These values can be used by any command that uses
vector values from a compute as input. global scalar or vector values from a compute as input. See the
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS :doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options. output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
vector values are "extensive". vector values are "extensive".
The scalar value will be in temperature :doc:`units <units>`. The The scalar value is in temperature :doc:`units <units>`. The vector
vector values will be in energy :doc:`units <units>`. values are in energy :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -86,12 +86,17 @@ where KE is the total kinetic energy of the group of atoms (sum of
:math:`N` is the number of atoms in the group, :math:`k_B` is the Boltzmann :math:`N` is the number of atoms in the group, :math:`k_B` is the Boltzmann
constant, and :math:`T` is the absolute temperature. constant, and :math:`T` is the absolute temperature.
A kinetic energy tensor, stored as a six-element vector, is also A symmetric tensor, stored as a six-element vector, is also calculated
calculated by this compute for use in the computation of a pressure by this compute for use in the computation of a pressure tensor by the
tensor. The formula for the components of the tensor is the same as :doc:`compute pressue <compute_pressure>` command. The formula for
the above formula, except that :math:`v^2` is replaced by :math:`v_x v_y` for the components of the tensor is the same as the above expression for
the :math:`xy` component, and so on. The six components of the vector are :math:`E_\mathrm{kin}`, except that the 1/2 factor is NOT included and
ordered :math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`, :math:`yz`. the :math:`v_i^2` is replaced by :math:`v_{i,x} v_{i,y}` for the
:math:`xy` component, and so on. Note that because it lacks the 1/2
factor, these tensor components are twice those of the traditional
kinetic energy tensor. The six components of the vector are ordered
:math:`xx`, :math:`yy`, :math:`zz`, :math:`xy`, :math:`xz`,
:math:`yz`.
The number of atoms contributing to the temperature is assumed to be The number of atoms contributing to the temperature is assumed to be
constant for the duration of the run; use the *dynamic* option of the constant for the duration of the run; use the *dynamic* option of the
@ -126,21 +131,21 @@ Output info
""""""""""" """""""""""
This compute calculates a global scalar (the temperature) and a global This compute calculates a global scalar (the temperature) and a global
vector of length 7, which can be accessed by indices 1--7. vector of length 7, which can be accessed by indices 1--7. The first
The first six elements of the vector are the KE tensor, six elements of the vector are those of the symmetric tensor discussed
and the seventh is the cosine-shaped velocity amplitude :math:`V`, above. The seventh is the cosine-shaped velocity amplitude :math:`V`,
which can be used to calculate the reciprocal viscosity, as shown in the example. which can be used to calculate the reciprocal viscosity, as shown in
These values can be used by any command that uses global scalar or the example. These values can be used by any command that uses global
vector values from a compute as input. scalar or vector values from a compute as input. See the :doc:`Howto
See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS output options. output <Howto_output>` page for an overview of LAMMPS output options.
The scalar value calculated by this compute is "intensive". The The scalar value calculated by this compute is "intensive". The
first six elements of vector values are "extensive", first six elements of vector values are "extensive",
and the seventh element of vector values is "intensive". and the seventh element of vector values is "intensive".
The scalar value will be in temperature :doc:`units <units>`. The scalar value is in temperature :doc:`units <units>`. The first
The first six elements of vector values will be in energy :doc:`units <units>`. six elements of vector values are in energy :doc:`units <units>`. The
The seventh element of vector value will be in velocity :doc:`units <units>`. seventh element of vector value us in velocity :doc:`units <units>`.
Restrictions Restrictions
"""""""""""" """"""""""""

View File

@ -785,3 +785,7 @@ reset_mol_ids = yes, custom_charges = no, molecule = off, modify_create = *fit a
.. _Gissinger2020: .. _Gissinger2020:
**(Gissinger2020)** Gissinger, Jensen and Wise, Macromolecules, 53, 22, 9953-9961 (2020). **(Gissinger2020)** Gissinger, Jensen and Wise, Macromolecules, 53, 22, 9953-9961 (2020).
.. _Gissinger2024:
**(Gissinger2024)** Gissinger, Jensen and Wise, Computer Physics Communications, 304, 109287 (2024).

View File

@ -44,6 +44,7 @@ thermo 50
fix myrxns all bond/react stabilization yes statted_grp .03 & fix myrxns all bond/react stabilization yes statted_grp .03 &
react rxn1 all 1 0.0 2.9 mol1 mol2 rxn1_stp1_map & react rxn1 all 1 0.0 2.9 mol1 mol2 rxn1_stp1_map &
react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map
react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map rescale_charges yes
fix 1 statted_grp_REACT nvt temp 300 300 100 fix 1 statted_grp_REACT nvt temp 300 300 100

View File

@ -47,7 +47,7 @@ thermo 50
fix myrxns all bond/react stabilization yes statted_grp .03 & fix myrxns all bond/react stabilization yes statted_grp .03 &
react rxn1 all 1 0.0 5.0 mol1 mol2 rxn1_stp1_map prob v_prob1 1234 & react rxn1 all 1 0.0 5.0 mol1 mol2 rxn1_stp1_map prob v_prob1 1234 &
react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map prob v_prob2 1234 react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map prob v_prob2 1234 rescale_charges yes
fix 1 statted_grp_REACT nvt temp 300 300 100 fix 1 statted_grp_REACT nvt temp 300 300 100

View File

@ -44,7 +44,7 @@ thermo 50
fix myrxns all bond/react stabilization no & fix myrxns all bond/react stabilization no &
react rxn1 all 1 0.0 2.9 mol1 mol2 rxn1_stp1_map & react rxn1 all 1 0.0 2.9 mol1 mol2 rxn1_stp1_map &
react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map react rxn2 all 1 0.0 5.0 mol3 mol4 rxn1_stp2_map rescale_charges yes
fix 1 all nve/limit .03 fix 1 all nve/limit .03

View File

@ -48,27 +48,6 @@ Types
17 hc 17 hc
18 hc 18 hc
Charges
1 -0.300000
2 0.000000
3 0.000000
4 0.000000
5 0.000000
6 0.000000
7 0.000000
8 0.000000
9 0.000000
10 0.300000
11 0.000000
12 0.000000
13 0.000000
14 0.000000
15 0.000000
16 0.000000
17 0.000000
18 0.000000
Molecules Molecules
1 1 1 1

View File

@ -44,21 +44,21 @@ Types
Charges Charges
1 -0.300000 1 -0.60533
2 0.000000 2 -0.01149
3 0.000000 3 -0.76306
4 0.410000 4 0.38
5 0.000000 5 0.29346
6 0.000000 6 0.18360
7 0.000000 7 0.15396
8 0.000000 8 -0.72636
9 0.000000 9 -0.27437
10 0.300000 10 0.40603
11 0.000000 11 -0.65530
12 -0.820000 12 -0.76
13 0.000000 13 0.21423
14 0.000000 14 0.18949
15 0.410000 15 0.38
Molecules Molecules

File diff suppressed because it is too large Load Diff

View File

@ -58,7 +58,7 @@ using namespace MathConst;
static const char cite_fix_bond_react[] = static const char cite_fix_bond_react[] =
"fix bond/react: reacter.org doi:10.1016/j.polymer.2017.09.038, " "fix bond/react: reacter.org doi:10.1016/j.polymer.2017.09.038, "
"doi:10.1021/acs.macromol.0c02012\n\n" "doi:10.1021/acs.macromol.0c02012, doi:10.1016/j.cpc.2024.109287\n\n"
"@Article{Gissinger17,\n" "@Article{Gissinger17,\n"
" author = {J. R. Gissinger and B. D. Jensen and K. E. Wise},\n" " author = {J. R. Gissinger and B. D. Jensen and K. E. Wise},\n"
" title = {Modeling Chemical Reactions in Classical Molecular Dynamics Simulations},\n" " title = {Modeling Chemical Reactions in Classical Molecular Dynamics Simulations},\n"
@ -75,6 +75,14 @@ static const char cite_fix_bond_react[] =
" volume = 53,\n" " volume = 53,\n"
" number = 22,\n" " number = 22,\n"
" pages = {9953--9961}\n" " pages = {9953--9961}\n"
"}\n\n"
"@Article{Gissinger24,\n"
" author = {J. R. Gissinger, B. D. Jensen, K. E. Wise},\n"
" title = {Molecular Modeling of Reactive Systems with REACTER},\n"
" journal = {Computer Physics Communications},\n"
" year = 2024,\n"
" volume = 304,\n"
" number = 109287\n"
"}\n\n"; "}\n\n";
static constexpr double BIG = 1.0e20; static constexpr double BIG = 1.0e20;
@ -225,8 +233,8 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
memory->create(reacted_mol,nreacts,"bond/react:reacted_mol"); memory->create(reacted_mol,nreacts,"bond/react:reacted_mol");
memory->create(fraction,nreacts,"bond/react:fraction"); memory->create(fraction,nreacts,"bond/react:fraction");
memory->create(max_rxn,nreacts,"bond/react:max_rxn"); memory->create(max_rxn,nreacts,"bond/react:max_rxn");
memory->create(nlocalskips,nreacts,"bond/react:nlocalskips"); memory->create(nlocalkeep,nreacts,"bond/react:nlocalkeep");
memory->create(nghostlyskips,nreacts,"bond/react:nghostlyskips"); memory->create(nghostlykeep,nreacts,"bond/react:nghostlykeep");
memory->create(seed,nreacts,"bond/react:seed"); memory->create(seed,nreacts,"bond/react:seed");
memory->create(limit_duration,nreacts,"bond/react:limit_duration"); memory->create(limit_duration,nreacts,"bond/react:limit_duration");
memory->create(rate_limit,3,nreacts,"bond/react:rate_limit"); memory->create(rate_limit,3,nreacts,"bond/react:rate_limit");
@ -486,10 +494,6 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
get_molxspecials(); get_molxspecials();
read_map_file(i); read_map_file(i);
fclose(fp); fclose(fp);
if (ncreate == 0 && onemol->natoms != twomol->natoms)
error->all(FLERR,"Fix bond/react: Reaction templates must contain the same number of atoms");
else if (ncreate > 0 && onemol->natoms + ncreate != twomol->natoms)
error->all(FLERR,"Fix bond/react: Incorrect number of created atoms");
iatomtype[i] = onemol->type[ibonding[i]-1]; iatomtype[i] = onemol->type[ibonding[i]-1];
jatomtype[i] = onemol->type[jbonding[i]-1]; jatomtype[i] = onemol->type[jbonding[i]-1];
find_landlocked_atoms(i); find_landlocked_atoms(i);
@ -644,8 +648,8 @@ FixBondReact::~FixBondReact()
memory->destroy(fraction); memory->destroy(fraction);
memory->destroy(seed); memory->destroy(seed);
memory->destroy(max_rxn); memory->destroy(max_rxn);
memory->destroy(nlocalskips); memory->destroy(nlocalkeep);
memory->destroy(nghostlyskips); memory->destroy(nghostlykeep);
memory->destroy(limit_duration); memory->destroy(limit_duration);
memory->destroy(var_flag); memory->destroy(var_flag);
memory->destroy(var_id); memory->destroy(var_id);
@ -716,6 +720,7 @@ int FixBondReact::setmask()
int mask = 0; int mask = 0;
mask |= POST_INTEGRATE; mask |= POST_INTEGRATE;
mask |= POST_INTEGRATE_RESPA; mask |= POST_INTEGRATE_RESPA;
mask |= POST_FORCE;
return mask; return mask;
} }
@ -872,8 +877,8 @@ void FixBondReact::post_integrate()
reaction_count[i] = 0; reaction_count[i] = 0;
local_rxn_count[i] = 0; local_rxn_count[i] = 0;
ghostly_rxn_count[i] = 0; ghostly_rxn_count[i] = 0;
nlocalskips[i] = 0; nlocalkeep[i] = INT_MAX;
nghostlyskips[i] = 0; nghostlykeep[i] = INT_MAX;
// update reaction probability // update reaction probability
if (var_flag[PROB][i]) if (var_flag[PROB][i])
fraction[i] = input->variable->compute_equal(var_id[PROB][i]); fraction[i] = input->variable->compute_equal(var_id[PROB][i]);
@ -1424,10 +1429,13 @@ void FixBondReact::superimpose_algorithm()
MPI_Allreduce(&local_rxn_count[0],&reaction_count[0],nreacts,MPI_INT,MPI_SUM,world); MPI_Allreduce(&local_rxn_count[0],&reaction_count[0],nreacts,MPI_INT,MPI_SUM,world);
int rxnflag = 0; int rxnflag = 0;
int *delta_rxn;
memory->create(delta_rxn,nreacts,"bond/react:delta_rxn");
if (comm->me == 0) if (comm->me == 0)
for (int i = 0; i < nreacts; i++) { for (int i = 0; i < nreacts; i++) {
reaction_count_total[i] += reaction_count[i] + ghostly_rxn_count[i]; delta_rxn[i] = reaction_count[i] + ghostly_rxn_count[i];
rxnflag += reaction_count[i] + ghostly_rxn_count[i]; reaction_count_total[i] += delta_rxn[i];
rxnflag += delta_rxn[i];
} }
MPI_Bcast(&reaction_count_total[0], nreacts, MPI_INT, 0, world); MPI_Bcast(&reaction_count_total[0], nreacts, MPI_INT, 0, world);
@ -1460,42 +1468,43 @@ void FixBondReact::superimpose_algorithm()
if (overstep > 0) { if (overstep > 0) {
// let's randomly choose rxns to skip, unbiasedly from local and ghostly // let's randomly choose rxns to skip, unbiasedly from local and ghostly
int *local_rxncounts; int *local_rxncounts;
int *all_localskips; int *all_localkeep;
memory->create(local_rxncounts,nprocs,"bond/react:local_rxncounts"); memory->create(local_rxncounts,nprocs,"bond/react:local_rxncounts");
memory->create(all_localskips,nprocs,"bond/react:all_localskips"); memory->create(all_localkeep,nprocs,"bond/react:all_localkeep");
MPI_Gather(&local_rxn_count[i],1,MPI_INT,local_rxncounts,1,MPI_INT,0,world); MPI_Gather(&local_rxn_count[i],1,MPI_INT,local_rxncounts,1,MPI_INT,0,world);
if (comm->me == 0) { if (comm->me == 0) {
int delta_rxn = reaction_count[i] + ghostly_rxn_count[i];
// when using variable input for rate_limit, rate_limit_overstep could be > delta_rxn (below) // when using variable input for rate_limit, rate_limit_overstep could be > delta_rxn (below)
// we need to limit overstep to the number of reactions on this timestep // we need to limit overstep to the number of reactions on this timestep
// essentially skipping all reactions, would be more efficient to use a skip_all flag // essentially skipping all reactions, would be more efficient to use a skip_all flag
if (overstep > delta_rxn) overstep = delta_rxn; if (overstep > delta_rxn[i]) overstep = delta_rxn[i];
int nkeep = delta_rxn[i] - overstep;
int *rxn_by_proc; int *rxn_by_proc;
memory->create(rxn_by_proc,delta_rxn,"bond/react:rxn_by_proc"); memory->create(rxn_by_proc,delta_rxn[i],"bond/react:rxn_by_proc");
for (int j = 0; j < delta_rxn; j++) for (int j = 0; j < delta_rxn[i]; j++)
rxn_by_proc[j] = -1; // corresponds to ghostly rxn_by_proc[j] = -1; // corresponds to ghostly
int itemp = 0; int itemp = 0;
for (int j = 0; j < nprocs; j++) for (int j = 0; j < nprocs; j++)
for (int k = 0; k < local_rxncounts[j]; k++) for (int k = 0; k < local_rxncounts[j]; k++)
rxn_by_proc[itemp++] = j; rxn_by_proc[itemp++] = j;
std::shuffle(&rxn_by_proc[0],&rxn_by_proc[delta_rxn], park_rng); std::shuffle(&rxn_by_proc[0],&rxn_by_proc[delta_rxn[i]], park_rng);
for (int j = 0; j < nprocs; j++) for (int j = 0; j < nprocs; j++)
all_localskips[j] = 0; all_localkeep[j] = 0;
nghostlyskips[i] = 0; nghostlykeep[i] = 0;
for (int j = 0; j < overstep; j++) { for (int j = 0; j < nkeep; j++) {
if (rxn_by_proc[j] == -1) nghostlyskips[i]++; if (rxn_by_proc[j] == -1) nghostlykeep[i]++;
else all_localskips[rxn_by_proc[j]]++; else all_localkeep[rxn_by_proc[j]]++;
} }
memory->destroy(rxn_by_proc); memory->destroy(rxn_by_proc);
reaction_count_total[i] -= overstep; reaction_count_total[i] -= overstep;
} }
MPI_Scatter(&all_localskips[0],1,MPI_INT,&nlocalskips[i],1,MPI_INT,0,world); MPI_Scatter(&all_localkeep[0],1,MPI_INT,&nlocalkeep[i],1,MPI_INT,0,world);
MPI_Bcast(&nghostlyskips[i],1,MPI_INT,0,world); MPI_Bcast(&nghostlykeep[i],1,MPI_INT,0,world);
memory->destroy(local_rxncounts); memory->destroy(local_rxncounts);
memory->destroy(all_localskips); memory->destroy(all_localkeep);
} }
} }
MPI_Bcast(&reaction_count_total[0], nreacts, MPI_INT, 0, world); MPI_Bcast(&reaction_count_total[0], nreacts, MPI_INT, 0, world);
memory->destroy(delta_rxn);
// this updates topology next step // this updates topology next step
next_reneighbor = update->ntimestep; next_reneighbor = update->ntimestep;
@ -2965,6 +2974,8 @@ void FixBondReact::update_everything()
int *type = atom->type; int *type = atom->type;
int **nspecial = atom->nspecial; int **nspecial = atom->nspecial;
tagint **special = atom->special; tagint **special = atom->special;
tagint *tag = atom->tag;
AtomVec *avec = atom->avec;
int **bond_type = atom->bond_type; int **bond_type = atom->bond_type;
tagint **bond_atom = atom->bond_atom; tagint **bond_atom = atom->bond_atom;
@ -2977,13 +2988,16 @@ void FixBondReact::update_everything()
memory->create(mark,nmark,"bond/react:mark"); memory->create(mark,nmark,"bond/react:mark");
for (int i = 0; i < nmark; i++) mark[i] = 0; for (int i = 0; i < nmark; i++) mark[i] = 0;
// used when creating atoms
addatomtag = 0;
for (int i = 0; i < nlocal; i++) addatomtag = MAX(addatomtag,tag[i]);
MPI_Allreduce(MPI_IN_PLACE,&addatomtag,1,MPI_LMP_TAGINT,MPI_MAX,world);
addatoms.clear();
// flag used to delete special interactions // flag used to delete special interactions
int *delflag; int *delflag;
memory->create(delflag,atom->maxspecial,"bond/react:delflag"); memory->create(delflag,atom->maxspecial,"bond/react:delflag");
tagint *tag = atom->tag;
AtomVec *avec = atom->avec;
// used when creating atoms // used when creating atoms
int inserted_atoms_flag = 0; int inserted_atoms_flag = 0;
@ -3026,13 +3040,14 @@ void FixBondReact::update_everything()
for (int pass = 0; pass < 2; pass++) { for (int pass = 0; pass < 2; pass++) {
update_num_mega = 0; update_num_mega = 0;
int *iskip = new int[nreacts]; int *noccur = new int[nreacts];
for (int i = 0; i < nreacts; i++) iskip[i] = 0; for (int i = 0; i < nreacts; i++) noccur[i] = 0;
if (pass == 0) { if (pass == 0) {
for (int i = 0; i < local_num_mega; i++) { for (int i = 0; i < local_num_mega; i++) {
rxnID = (int) local_mega_glove[0][i]; rxnID = (int) local_mega_glove[0][i];
// reactions already shuffled from dedup procedure, so can skip first N // reactions already shuffled from dedup procedure, so can skip first N
if (iskip[rxnID]++ < nlocalskips[rxnID]) continue; // wait, this check needs to be after add atoms, because they can also be 'skipped' due to overlap
if (noccur[rxnID] >= nlocalkeep[rxnID]) continue;
// this will be overwritten if reaction skipped by create_atoms below // this will be overwritten if reaction skipped by create_atoms below
update_mega_glove[0][update_num_mega] = (tagint) local_mega_glove[0][i]; update_mega_glove[0][update_num_mega] = (tagint) local_mega_glove[0][i];
@ -3043,13 +3058,14 @@ void FixBondReact::update_everything()
if (create_atoms_flag[rxnID] == 1) { if (create_atoms_flag[rxnID] == 1) {
onemol = atom->molecules[unreacted_mol[rxnID]]; onemol = atom->molecules[unreacted_mol[rxnID]];
twomol = atom->molecules[reacted_mol[rxnID]]; twomol = atom->molecules[reacted_mol[rxnID]];
if (insert_atoms(update_mega_glove,update_num_mega)) { if (insert_atoms_setup(update_mega_glove,update_num_mega)) {
inserted_atoms_flag = 1; inserted_atoms_flag = 1;
} else { // create aborted } else { // create aborted
reaction_count_total[rxnID]--; reaction_count_total[rxnID]--;
continue; continue;
} }
} }
noccur[rxnID]++;
if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = local_mega_glove[1][i]; if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = local_mega_glove[1][i];
update_num_mega++; update_num_mega++;
@ -3058,7 +3074,7 @@ void FixBondReact::update_everything()
for (int i = 0; i < global_megasize; i++) { for (int i = 0; i < global_megasize; i++) {
rxnID = (int) global_mega_glove[0][i]; rxnID = (int) global_mega_glove[0][i];
// reactions already shuffled from dedup procedure, so can skip first N // reactions already shuffled from dedup procedure, so can skip first N
if (iskip[rxnID]++ < nghostlyskips[rxnID]) continue; if (noccur[rxnID] >= nghostlykeep[rxnID]) continue;
// this will be overwritten if reaction skipped by create_atoms below // this will be overwritten if reaction skipped by create_atoms below
update_mega_glove[0][update_num_mega] = (tagint) global_mega_glove[0][i]; update_mega_glove[0][update_num_mega] = (tagint) global_mega_glove[0][i];
@ -3071,29 +3087,48 @@ void FixBondReact::update_everything()
if (create_atoms_flag[rxnID] == 1) { if (create_atoms_flag[rxnID] == 1) {
onemol = atom->molecules[unreacted_mol[rxnID]]; onemol = atom->molecules[unreacted_mol[rxnID]];
twomol = atom->molecules[reacted_mol[rxnID]]; twomol = atom->molecules[reacted_mol[rxnID]];
if (insert_atoms(update_mega_glove,update_num_mega)) { if (insert_atoms_setup(update_mega_glove,update_num_mega)) {
inserted_atoms_flag = 1; inserted_atoms_flag = 1;
} else { // create aborted } else { // create aborted
reaction_count_total[rxnID]--; reaction_count_total[rxnID]--;
continue; continue;
} }
} }
noccur[rxnID]++;
if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = global_mega_glove[1][i]; if (rescale_charges_flag[rxnID]) sim_total_charges[update_num_mega] = global_mega_glove[1][i];
update_num_mega++; update_num_mega++;
} }
} }
delete [] iskip; delete [] noccur;
if (update_num_mega == 0) continue; if (update_num_mega == 0) continue;
// if inserted atoms and global map exists, reset map now instead // insert all atoms for all rxns here
// of waiting for comm since other pre-exchange fixes may use it if (inserted_atoms_flag == 1) {
// invoke map_init() b/c atom count has grown // clear to-be-overwritten ghost info
// do this once after all atom insertions atom->nghost = 0;
if (inserted_atoms_flag == 1 && atom->map_style != Atom::MAP_NONE) { atom->avec->clear_bonus();
atom->map_init();
atom->map_set(); for (auto & myaddatom : addatoms) {
atom->avec->create_atom(myaddatom.type,myaddatom.x);
int n = atom->nlocal - 1;
atom->tag[n] = myaddatom.tag;
atom->molecule[n] = myaddatom.molecule;
atom->mask[n] = myaddatom.mask;
atom->image[n] = myaddatom.image;
atom->v[n][0] = myaddatom.v[0];
atom->v[n][1] = myaddatom.v[1];
atom->v[n][2] = myaddatom.v[2];
if (atom->rmass) atom->rmass[n]= myaddatom.rmass;
modify->create_attribute(n);
}
// reset atom->map
if (atom->map_style != Atom::MAP_NONE) {
atom->map_init();
atom->map_set();
}
} }
// mark to-delete atoms // mark to-delete atoms
@ -3620,10 +3655,6 @@ void FixBondReact::update_everything()
atom->natoms -= ndel; atom->natoms -= ndel;
// done deleting atoms // done deleting atoms
// reset mol ids
if (reset_mol_ids_flag) reset_mol_ids->reset();
// something to think about: this could done much more concisely if // something to think about: this could done much more concisely if
// all atom-level info (bond,angles, etc...) were kinda inherited from a common data struct --JG // all atom-level info (bond,angles, etc...) were kinda inherited from a common data struct --JG
@ -3651,10 +3682,11 @@ void FixBondReact::update_everything()
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
insert created atoms setup for inserting created atoms
atoms for all rxns are actually created all at once in update_everything
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate) int FixBondReact::insert_atoms_setup(tagint **my_update_mega_glove, int iupdate)
{ {
// inserting atoms based off fix_deposit->pre_exchange // inserting atoms based off fix_deposit->pre_exchange
int flag; int flag;
@ -3682,14 +3714,9 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
tagint *molecule = atom->molecule; tagint *molecule = atom->molecule;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
tagint maxtag_all,maxmol_all; tagint maxmol_all;
tagint max = 0; for (int i = 0; i < nlocal; i++) maxmol_all = MAX(maxmol_all,molecule[i]);
for (int i = 0; i < nlocal; i++) max = MAX(max,tag[i]); MPI_Allreduce(MPI_IN_PLACE,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world);
MPI_Allreduce(&max,&maxtag_all,1,MPI_LMP_TAGINT,MPI_MAX,world);
max = 0;
for (int i = 0; i < nlocal; i++) max = MAX(max,molecule[i]);
MPI_Allreduce(&max,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world);
int dimension = domain->dimension; int dimension = domain->dimension;
@ -3786,6 +3813,26 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
if (abortflag) break; if (abortflag) break;
} }
} }
// also check against previous to-be-added atoms
if (!abortflag) {
for (auto & myaddatom : addatoms) {
for (int m = 0; m < twomol->natoms; m++) {
if (create_atoms[m][rxnID] == 1) {
delx = coords[m][0] - myaddatom.x[0];
dely = coords[m][1] - myaddatom.x[1];
delz = coords[m][2] - myaddatom.x[2];
domain->minimum_image(delx,dely,delz);
rsq = delx*delx + dely*dely + delz*delz;
if (rsq < overlapsq[rxnID]) {
abortflag = 1;
break;
}
}
}
if (abortflag) break;
}
}
MPI_Allreduce(MPI_IN_PLACE,&abortflag,1,MPI_INT,MPI_MAX,world); MPI_Allreduce(MPI_IN_PLACE,&abortflag,1,MPI_INT,MPI_MAX,world);
if (abortflag) { if (abortflag) {
memory->destroy(coords); memory->destroy(coords);
@ -3794,12 +3841,6 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
} }
} }
// clear ghost count and any ghost bonus data internal to AtomVec
// same logic as beginning of Comm::exchange()
// do it now b/c inserting atoms will overwrite ghost atoms
atom->nghost = 0;
atom->avec->clear_bonus();
// check if new atoms are in my sub-box or above it if I am highest proc // check if new atoms are in my sub-box or above it if I am highest proc
// if so, add atom to my list via create_atom() // if so, add atom to my list via create_atom()
// initialize additional info about the atoms // initialize additional info about the atoms
@ -3842,40 +3883,46 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
} }
int root = 0; int root = 0;
addatomtag++;
if (flag) { if (flag) {
struct AddAtom myaddatom;
root = comm->me; root = comm->me;
atom->avec->create_atom(twomol->type[m],coords[m]); myaddatom.type = twomol->type[m];
int n = atom->nlocal - 1; myaddatom.x[0] = coords[m][0];
atom->tag[n] = maxtag_all + add_count; myaddatom.x[1] = coords[m][1];
myaddatom.x[2] = coords[m][2];
myaddatom.tag = addatomtag;
// locally update mega_glove // locally update mega_glove
my_update_mega_glove[preID][iupdate] = atom->tag[n]; my_update_mega_glove[preID][iupdate] = myaddatom.tag;
// !! could do better job choosing mol ID for added atoms
if (atom->molecule_flag) { if (atom->molecule_flag) {
if (twomol->moleculeflag) { if (twomol->moleculeflag) {
atom->molecule[n] = maxmol_all + twomol->molecule[m]; myaddatom.molecule = maxmol_all + twomol->molecule[m];
} else { } else {
atom->molecule[n] = maxmol_all + 1; myaddatom.molecule = maxmol_all + 1;
} }
} }
atom->mask[n] = 1 | groupbit; myaddatom.mask = 1 | groupbit;
atom->image[n] = imageflags[m]; myaddatom.image = imageflags[m];
// guess a somewhat reasonable initial velocity based on reaction site // guess a somewhat reasonable initial velocity based on reaction site
// further control is possible using bond_react_MASTER_group // further control is possible using bond_react_MASTER_group
// compute |velocity| corresponding to a given temperature t, using specific atom's mass // compute |velocity| corresponding to a given temperature t, using specific atom's mass
double mymass = atom->rmass ? atom->rmass[n] : atom->mass[twomol->type[m]]; myaddatom.rmass = atom->rmass ? twomol->rmass[m] : atom->mass[twomol->type[m]];
double vtnorm = sqrt(t / (force->mvv2e / (dimension * force->boltz)) / mymass); double vtnorm = sqrt(t / (force->mvv2e / (dimension * force->boltz)) / myaddatom.rmass);
v[n][0] = random[rxnID]->uniform(); double myv[3];
v[n][1] = random[rxnID]->uniform(); myv[0] = random[rxnID]->uniform();
v[n][2] = random[rxnID]->uniform(); myv[1] = random[rxnID]->uniform();
double vnorm = sqrt(v[n][0]*v[n][0] + v[n][1]*v[n][1] + v[n][2]*v[n][2]); myv[2] = random[rxnID]->uniform();
v[n][0] = v[n][0]/vnorm*vtnorm; double vnorm = sqrt(myv[0]*myv[0] + myv[1]*myv[1] + myv[2]*myv[2]);
v[n][1] = v[n][1]/vnorm*vtnorm; myaddatom.v[0] = myv[0]/vnorm*vtnorm;
v[n][2] = v[n][2]/vnorm*vtnorm; myaddatom.v[1] = myv[1]/vnorm*vtnorm;
modify->create_attribute(n); myaddatom.v[2] = myv[2]/vnorm*vtnorm;
addatoms.push_back(myaddatom);
} }
// globally update mega_glove and equivalences // globally update mega_glove and equivalences
MPI_Allreduce(MPI_IN_PLACE,&root,1,MPI_INT,MPI_SUM,world); MPI_Allreduce(MPI_IN_PLACE,&root,1,MPI_INT,MPI_SUM,world);
@ -3888,12 +3935,11 @@ int FixBondReact::insert_atoms(tagint **my_update_mega_glove, int iupdate)
} }
// reset global natoms here // reset global natoms here
// reset atom map elsewhere, after all calls to 'insert_atoms' // reset atom map elsewhere, after all calls to 'insert_atoms_setup'
atom->natoms += add_count; atom->natoms += add_count;
if (atom->natoms < 0) if (atom->natoms < 0)
error->all(FLERR,"Too many total atoms"); error->all(FLERR,"Too many total atoms");
maxtag_all += add_count; if (addatomtag >= MAXTAGINT)
if (maxtag_all >= MAXTAGINT)
error->all(FLERR,"New atom IDs exceed maximum allowed ID"); error->all(FLERR,"New atom IDs exceed maximum allowed ID");
// atom creation successful // atom creation successful
memory->destroy(coords); memory->destroy(coords);
@ -3970,6 +4016,11 @@ void FixBondReact::read_map_file(int myrxn)
} else break; } else break;
} }
if (ncreate == 0 && onemol->natoms != twomol->natoms)
error->all(FLERR,"Fix bond/react: Reaction templates must contain the same number of atoms");
else if (ncreate > 0 && onemol->natoms + ncreate != twomol->natoms)
error->all(FLERR,"Fix bond/react: Incorrect number of created atoms");
// grab keyword and skip next line // grab keyword and skip next line
parse_keyword(0,line,keyword); parse_keyword(0,line,keyword);
@ -4012,6 +4063,13 @@ void FixBondReact::read_map_file(int myrxn)
} }
// error check
for (int i = 0; i < onemol->natoms; i++) {
int my_equiv = reverse_equiv[i][1][myrxn];
if (create_atoms[my_equiv-1][myrxn] == 1)
error->all(FLERR,"Fix bond/react: Created atoms cannot also be listed in Equivalences section\n");
}
// error check // error check
if (bondflag == 0 || equivflag == 0) if (bondflag == 0 || equivflag == 0)
error->all(FLERR,"Fix bond/react: Map file missing InitiatorIDs or Equivalences section\n"); error->all(FLERR,"Fix bond/react: Map file missing InitiatorIDs or Equivalences section\n");
@ -4071,6 +4129,8 @@ void FixBondReact::CreateAtoms(char *line, int myrxn)
readline(line); readline(line);
rv = sscanf(line,"%d",&tmp); rv = sscanf(line,"%d",&tmp);
if (rv != 1) error->one(FLERR, "CreateIDs section is incorrectly formatted"); if (rv != 1) error->one(FLERR, "CreateIDs section is incorrectly formatted");
if (tmp > twomol->natoms)
error->one(FLERR,"Fix bond/react: Invalid atom ID in CreateIDs section of map file");
create_atoms[tmp-1][myrxn] = 1; create_atoms[tmp-1][myrxn] = 1;
} }
if (twomol->xflag == 0) if (twomol->xflag == 0)
@ -4331,6 +4391,13 @@ void FixBondReact::post_integrate_respa(int ilevel, int /*iloop*/)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixBondReact::post_force(int /*vflag*/)
{
if (reset_mol_ids_flag) reset_mol_ids->reset();
}
/* ---------------------------------------------------------------------- */
int FixBondReact::pack_forward_comm(int n, int *list, double *buf, int FixBondReact::pack_forward_comm(int n, int *list, double *buf,
int /*pbc_flag*/, int * /*pbc*/) int /*pbc_flag*/, int * /*pbc*/)
{ {

View File

@ -46,6 +46,7 @@ class FixBondReact : public Fix {
void init_list(int, class NeighList *) override; void init_list(int, class NeighList *) override;
void post_integrate() override; void post_integrate() override;
void post_integrate_respa(int, int) override; void post_integrate_respa(int, int) override;
void post_force(int) override;
int pack_forward_comm(int, int *, double *, int, int *) override; int pack_forward_comm(int, int *, double *, int, int *) override;
void unpack_forward_comm(int, int, double *) override; void unpack_forward_comm(int, int, double *) override;
@ -62,7 +63,7 @@ class FixBondReact : public Fix {
int *iatomtype, *jatomtype; int *iatomtype, *jatomtype;
int *seed; int *seed;
double **cutsq, *fraction; double **cutsq, *fraction;
int *max_rxn, *nlocalskips, *nghostlyskips; int *max_rxn, *nlocalkeep, *nghostlykeep;
tagint lastcheck; tagint lastcheck;
int stabilization_flag; int stabilization_flag;
int reset_mol_ids_flag; int reset_mol_ids_flag;
@ -215,7 +216,7 @@ class FixBondReact : public Fix {
void glove_ghostcheck(); void glove_ghostcheck();
void ghost_glovecast(); void ghost_glovecast();
void update_everything(); void update_everything();
int insert_atoms(tagint **, int); int insert_atoms_setup(tagint **, int);
void unlimit_bond(); // removes atoms from stabilization, and other post-reaction every-step operations void unlimit_bond(); // removes atoms from stabilization, and other post-reaction every-step operations
void dedup_mega_gloves(int); //dedup global mega_glove void dedup_mega_gloves(int); //dedup global mega_glove
void write_restart(FILE *) override; void write_restart(FILE *) override;
@ -245,6 +246,15 @@ class FixBondReact : public Fix {
std::map<std::set<tagint>, int> atoms2bond; // maps atom pair to index of local bond array std::map<std::set<tagint>, int> atoms2bond; // maps atom pair to index of local bond array
std::vector<std::vector<Constraint>> constraints; std::vector<std::vector<Constraint>> constraints;
tagint addatomtag;
struct AddAtom {
tagint tag, molecule;
int type, mask;
imageint image;
double rmass, x[3], v[3];
};
std::vector<AddAtom> addatoms;
// DEBUG // DEBUG
void print_bb(); void print_bb();