Adding Steve's edits in documenation + associated changes in files

This commit is contained in:
Joel Thomas Clemmer
2021-12-03 16:12:31 -07:00
parent 7113334f99
commit 40258f8b9a
33 changed files with 745 additions and 732 deletions

View File

@ -33,6 +33,7 @@ OPT.
*
*
* :doc:`bpm/rotational <bond_bpm_rotational>`
* :doc:`bpm/spring <bond_bpm_spring>`
* :doc:`class2 (ko) <bond_class2>`
* :doc:`fene (iko) <bond_fene>`
* :doc:`fene/expand (o) <bond_fene_expand>`

View File

@ -1,81 +1,106 @@
Bonded particle models
===============
Bonded particle models are used to simulate mesoscale solids.
Solids are constructed as a collection of particles which each
represent a coarse-grained region of space much larger than the
atomistic scale. Particles within a solid region are then connected
by a network of bonds to provide solid elasticity.
The BPM package implements bonded particle models which can be used to
simulate mesoscale solids. Solids are constructed as a collection of
particles which each represent a coarse-grained region of space much
larger than the atomistic scale. Particles within a solid region are
then connected by a network of bonds to provide solid elasticity.
Unlike traditional bonds in molecular dynamics, the equilibrium
bond length can vary between bonds. Bonds store the reference state.
This includes setting the equilibrium length equal to the initial
distance between the two particles but can also include data on the
bond orientation for rotational models. This produces a stress free
initial state. Furthermore, bonds are allowed to break under large
strains producing fracture.
Unlike traditional bonds in molecular dynamics, the equilibrium bond
length can vary between bonds. Bonds store the reference state. This
includes setting the equilibrium length equal to the initial distance
between the two particles but can also include data on the bond
orientation for rotational models. This produces a stress free initial
state. Furthermore, bonds are allowed to break under large strains
producing fracture. The examples/bpm directory has sample input scripts
for simulations of the fragmentation of an impacted plate and the
pouring of extended, elastic bodies.
Bonds can be created using a :doc:`read data <read_data>`
or :doc:`create bond <create_bond>` command. Alternatively, a
----------
Bonds can be created using a :doc:`read data <read_data>` or
:doc:`create bond <create_bond>` command. Alternatively, a
:doc:`molecule <molecule>` template with bonds can be used with
:doc:`fix deposit <fix_deposit>` or :doc:`fix pour <fix_pour>` to
create solid grains.
In this implementation, bonds store their reference state when they
are first computed in the setup of a simulation run. Data is then
preserved across run commands and is written to :doc:`binary restart files <restart>`
such that restarting the system will not reset the reference state of a bond.
create solid grains.
As bonds can be broken between neighbor list builds, :doc:`special_bonds <special_bonds>`
work differently for BPM bond styles. There are two possible settings
which determine how pair interactions work between bonded
particles.
First, one can censor all pair interactions between bonded particles.
Unlike :doc:`bond quartic <bond_quartic>`, this is not done by subtracting
pair forces during the bond computation but rather by dynamically updating
the special bond list. This is the default behavior of BPM bond styles
and is done by updating the 1-2 special bond list as bonds break.
To do this, LAMMPS requires :doc:`newton <newton>` bond off such that all
In this implementation, bonds store their reference state when they are
first computed in the setup of the first simulation run. Data is then
preserved across run commands and is written to :doc:`binary restart
files <restart>` such that restarting the system will not reset the
reference state of a bond. Bonds that are created midway into a run,
such as those created by pouring grains using :doc:`fix pour
<fix_pour>`, are initialized on that timestep.
As bonds can be broken between neighbor list builds, the
:doc:`special_bonds <special_bonds>` command works differently for BPM
bond styles. There are two possible settings which determine how pair
interactions work between bonded particles. First, one can turn off
all pair interactions between bonded particles. Unlike :doc:`bond
quartic <bond_quartic>`, this is not done by subtracting pair forces
during the bond computation but rather by dynamically updating the
special bond list. This is the default behavior of BPM bond styles and
is done by updating the 1-2 special bond list as bonds break. To do
this, LAMMPS requires :doc:`newton <newton>` bond off such that all
processors containing an atom know when a bond breaks. Additionally,
one must use the following special bond settings
one must do either (A) or (B).
(A)
Use the following special bond settings
.. code-block:: LAMMPS
special_bonds lj 0 1 1 coul 1 1 1
These settings accomplish two goals. First, they turns off 1-3 and
1-4 special bond lists, which are not currently supported for BPMs. As BPMs often
have dense bond networks, generating 1-3 and 1-4 special bond lists is expensive.
By setting the lj weight for 1-2 bonds to zero, this censors pairwise interactions.
By setting a nonzero coul weight for 1-2 bonds ensures all bonded neighbors are
still included in the neighbor list in case bonds break between neighbor list builds.
These settings accomplish two goals. First, they turn off 1-3 and 1-4
special bond lists, which are not currently supported for BPMs. As
BPMs often have dense bond networks, generating 1-3 and 1-4 special
bond lists is expensive. By setting the lj weight for 1-2 bonds to
zero, this turns off pairwise interactions. Even though there are no
charges in BPM models, setting a nonzero coul weight for 1-2 bonds
ensures all bonded neighbors are still included in the neighbor list
in case bonds break between neighbor list builds.
(B)
Alternatively, one can simply overlay pair interactions such that all
bonded particles also feel pair interactions. This can be accomplished by
using the *overlay/pair* keyword in the bond settings and by
using the following special bond settings
bonded particles also feel pair interactions. This can be accomplished
by using the *overlay/pair* keyword present in all bpm bond styles and
by using the following special bond settings
.. code-block:: LAMMPS
special_bonds lj/coul 1 1 1
Currently there are two types of bonds included in this package. The first
bond style, :doc:`bond bpm/spring <bond_bpm_spring>`, only applies pairwise,
central body forces. Point particles must have :doc:`bond atom style <atom_style>`
and may be thought of as nodes in a spring network. Alternatively,
the second bond style, :doc:`bond bpm/rotational <bond_bpm_rotational>`,
resolves tangential forces and torques arising with the shearing, bending,
and twisting of the bond due to rotation or displacement of particles.
Particles are similar to those used in the :doc:`granular package <Howto_granular>`,
:doc:`atom style sphere <atom_style>`. However, they must also track the
current orientation of particles and therefore use a derived :doc:`atom style sphere/bpm <atom_style>`.
This also requires a unique integrator :doc:`fix nve/sphere/bpm <fix_nve_sphere_bpm>`
which numerically integrates orientation similar to :doc:`fix nve/asphere <fix_nve_asphere>`.
----------
Currently there are two types of bonds included in the BPM
package. The first bond style, :doc:`bond bpm/spring
<bond_bpm_spring>`, only applies pairwise, central body forces. Point
particles must have :doc:`bond atom style <atom_style>` and may be
thought of as nodes in a spring network. Alternatively, the second
bond style, :doc:`bond bpm/rotational <bond_bpm_rotational>`, resolves
tangential forces and torques arising with the shearing, bending, and
twisting of the bond due to rotation or displacement of particles.
Particles are similar to those used in the :doc:`granular package
<Howto_granular>`, :doc:`atom style sphere <atom_style>`. However,
they must also track the current orientation of particles and
therefore use a derived :doc:`atom style sphere/bpm <atom_style>`.
This also requires a unique integrator :doc:`fix nve/sphere/bpm
<fix_nve_sphere_bpm>` which numerically integrates orientation similar
to :doc:`fix nve/asphere <fix_nve_asphere>`.
To monitor the fracture of bonds in the system, all BPM bond styles
can be associated with an instance of :doc:`fix store/local <fix_store_local>`
to record all instances of bond breakage for output. Additionally, one can use
:doc:`compute nbond/atom <compute_nbond_atom>` to tally the current number of bonds per atom.
can be associated with an instance of :doc:`fix store/local
<fix_store_local>` to record all instances of bond breakage for
output. Additionally, one can use :doc:`compute nbond/atom
<compute_nbond_atom>` to tally the current number of bonds per atom.
In addition to bond styles, a new pair style :doc:`pair bpm/spring <pair_bpm_spring>` was added
to accompany the bpm/spring bond style. This pair style is simply a hookean repulsion with
similar velocity damping as its sister bond style.
In addition to bond styles, a new pair style :doc:`pair bpm/spring
<pair_bpm_spring>` was added to accompany the bpm/spring bond
style. This pair style is simply a hookean repulsion with similar
velocity damping as its sister bond style.

5
doc/src/Howto_broken_bonds.rst Executable file
View File

@ -0,0 +1,5 @@
Broken Bonds
===============

View File

@ -17,10 +17,12 @@ Syntax
*store/local* values = ID of associated fix store/local followed by one or more attributes
*id1, id2* = IDs of 2 atoms in the bond
*time* = the time the bond broke
*x, y, z* = the center of mass position of the 2 atoms when the bond broke
*x/ref, y/ref, z/ref* = the inintial center of mass position of the 2 atoms
*time* = the timestep the bond broke
*x, y, z* = the center of mass position of the 2 atoms when the bond broke (distance units)
*x/ref, y/ref, z/ref* = the initial center of mass position of the 2 atoms (distance units)
*overlay/pair* value = none
bonded particles will still interact with pair forces
Examples
""""""""
@ -38,11 +40,11 @@ Examples
Description
"""""""""""
The *bpm/rotational* bond style computes forces and torques based
on deviations from the initial reference state of the two atoms.
The reference state is stored by each bond when it is first computed
in the setup of a run. Data is then preserved across run commands and
is written to :doc:`binary restart files <restart>` such that restarting
The *bpm/rotational* bond style computes forces and torques based on
deviations from the initial reference state of the two atoms. The
reference state is stored by each bond when it is first computed in
the setup of a run. Data is then preserved across run commands and is
written to :doc:`binary restart files <restart>` such that restarting
the system will not reset the reference state of a bond.
Forces include a normal and tangential component. The base normal force
@ -56,13 +58,14 @@ where :math:`k_r` is a stiffness and :math:`r` is the current distance and
:math:`r_0` is the initial distance between the two particles.
A tangential force is applied perpendicular to the normal direction
which is proportional to the tangential shear displacement with a stiffness
of :math:`k_s`. This tangential force also induces a torque.
In addition, bending and twisting torques are also applied to particles
which are proportional to angular bending and twisting displacements with
stiffnesses of :math`k_b` and :math:`k_t`, respectively.
Details on the calculations of shear displacements and angular displacements
can be found in :ref:`(Wang) <Wang2009>` and :ref:`(Wang and Mora) <WangMora2009b>`.
which is proportional to the tangential shear displacement with a
stiffness of :math:`k_s`. This tangential force also induces a torque.
In addition, bending and twisting torques are also applied to
particles which are proportional to angular bending and twisting
displacements with stiffnesses of :math`k_b` and :math:`k_t',
respectively. Details on the calculations of shear displacements and
angular displacements can be found in :ref:`(Wang) <Wang2009>` and
:ref:`(Wang and Mora) <WangMora2009b>`.
Bonds will break under sufficient stress. A breaking criteria is calculated
@ -72,18 +75,18 @@ Bonds will break under sufficient stress. A breaking criteria is calculated
\frac{|\tau_b|}{\tau_{b,c}} + \frac{|\tau_t|}{\tau_{t,c}} \}
where :math:`|f_s|` is the magnitude of the shear force and
:math:`|\tau_b|` and :math:`|\tau_t|` are the magnitudes of the bending and
twisting forces, respectively. The corresponding variables :math:`f_{r,c}`
:math:`f_{s,c}`, :math:`\tau_{b,c}`, and :math:`\tau_{t,c}` are critical
limits to each force or torque.
If :math:`B` is ever equal to or exceeds one, the bond will break.
This is done by setting by setting its type to 0 such that forces and
:math:`|\tau_b|` and :math:`|\tau_t|` are the magnitudes of the
bending and twisting forces, respectively. The corresponding variables
:math:`f_{r,c}` :math:`f_{s,c}`, :math:`\tau_{b,c}`, and
:math:`\tau_{t,c}` are critical limits to each force or torque. If
:math:`B` is ever equal to or exceeds one, the bond will break. This
is done by setting by setting its type to 0 such that forces and
torques are no longer computed.
After computing the base magnitudes of the forces and torques, they are
all multiplied by an extra factor :math:`w` to smoothly interpolate
forces and torques to zero as the bond breaks. This term is calculated
as :math:`w = (1.0 - B^4)`.
After computing the base magnitudes of the forces and torques, they
are all multiplied by an extra factor :math:`w` to smoothly
interpolate forces and torques to zero as the bond breaks. This term
is calculated as :math:`w = (1.0 - B^4)`.
Finally, additional damping forces and torques are applied to the two
particles. A force is applied proportional to the difference in the
@ -97,11 +100,12 @@ dissipative particle dynamics (:ref:`(Groot) <Groot1>`):
where :math:`\gamma_n` is the damping strength, :math:`\hat{r}` is the
radial normal vector, and :math:`\vec{v}` is the velocity difference
between the two particles. Similarly, tangential forces are applied to
each atom proportional to the relative differences in sliding velocities
with a constant prefactor :math:`\gamma_s` (:ref:`(Wang et al.) <Wang2015>`)
along with their associated torques. The rolling and twisting components of
the relative angular velocities of the two atoms are also damped by applying
torques with prefactors of :math:`\gamma_r` and :math:`\gamma_t`, respectively.
each atom proportional to the relative differences in sliding
velocities with a constant prefactor :math:`\gamma_s` (:ref:`(Wang et
al.) <Wang2015>) along with their associated torques. The rolling and
twisting components of the relative angular velocities of the two
atoms are also damped by applying torques with prefactors of
:math:`\gamma_r` and :math:`\gamma_t`, respectively.
The following coefficients must be defined for each bond type via the
:doc:`bond_coeff <bond_coeff>` command as in the example above, or in
@ -122,14 +126,16 @@ or :doc:`read_restart <read_restart>` commands:
* :math:`\gamma_t` (distance*force/seconds/radians units)
By default, pair forces are not calculated between bonded particles.
Pair forces can alternatively be overlaid on top of bond forces
using the *overlay/pair* keyword. These settings require specific
:doc:`special_bonds <special_bonds>` settings described in the restrictions.
Further details can be found in the `:doc: how to <Howto_BPM>` page on BPMs.
Pair forces can alternatively be overlaid on top of bond forces using
the *overlay/pair* keyword. These settings require specific
:doc:`special_bonds <special_bonds>` settings described in the
restrictions. Further details can be found in the `:doc: how to
<Howto_BPM>` page on BPMs.
This bond style tracks broken bonds and can record them using an instance of
:doc:`fix store/local <fix_store_local>` if the *store/local* keyword is
used followed by the ID of the fix and then a series of bond attributes.
This bond style tracks broken bonds and can record them using an
instance of :doc:`fix store/local <fix_store_local>` if the
*store/local* keyword is used followed by the ID of the fix and then a
series of bond attributes.
Note that when bonds are dumped to a file via the :doc:`dump local <dump>`
command, bonds with type 0 (broken bonds) are not included. The
@ -148,24 +154,26 @@ Restart
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
This bond style writes the reference state of each bond to
:doc:`binary restart files <restart>`. Loading a restart
file will properly resume bonds.
:doc:`binary restart files <restart>`. Loading a restart file will
properly resume bonds.
Restrictions
""""""""""""
This bond style can only be used if LAMMPS was built with the BPM
package. See the :doc:`Build package <Build_package>` doc page for more
info.
package. See the :doc:`Build package <Build_package>` doc page for
more info.
By default if pair interactions are censored, this bond style requires setting
By default if pair interactions are to be disabled, this bond style
requires setting
.. code-block:: LAMMPS
special_bonds lj 0 1 1 coul 1 1 1
and :doc:`newton <newton>` must be set to bond off.
If the *overlay/pair* option is used, this bond style alternatively requires setting
and :doc:`newton <newton>` must be set to bond off. If the
*overlay/pair* option is used, this bond style alternatively requires
setting
.. code-block:: LAMMPS
@ -184,6 +192,7 @@ Default
none
----------
.. _Wang2009:
@ -203,4 +212,4 @@ p 117-127 (2009).
**(Wang et al, 2015)** Wang, Y., Alonso-Marroquin, F., & Guo,
W. W. (2015). Rolling and sliding in 3-D discrete element
models. Particuology, 23, 49-55.
models. Particuology, 23, 49-55.

View File

@ -17,10 +17,12 @@ Syntax
*store/local* values = ID of associated fix store/local followed by one or more attributes
*id1, id2* = IDs of 2 atoms in the bond
*time* = the time the bond broke
*x, y, z* = the center of mass position of the 2 atoms when the bond broke
*x/ref, y/ref, z/ref* = the inintial center of mass position of the 2 atoms
*time* = the timestep the bond broke
*x, y, z* = the center of mass position of the 2 atoms when the bond broke (distance units)
*x/ref, y/ref, z/ref* = the initial center of mass position of the 2 atoms (distance units)
*overlay/pair* value = none
bonded particles will still interact with pair forces
Examples
""""""""
@ -38,36 +40,35 @@ Examples
Description
"""""""""""
The *bpm/spring* bond style computes forces and torques based
on deviations from the initial reference state of the two atoms.
The reference state is stored by each bond when it is first computed
in the setup of a run. Data is then preserved across run commands and
is written to :doc:`binary restart files <restart>` such that restarting
The *bpm/spring* bond style computes forces and torques based on
deviations from the initial reference state of the two atoms. The
reference state is stored by each bond when it is first computed in
the setup of a run. Data is then preserved across run commands and is
written to :doc:`binary restart files <restart>` such that restarting
the system will not reset the reference state of a bond.
This bond style only applies central-body forces which conserve the translational
and rotational degrees of freedom of a bonded set of particles. The force
has a magnitude of
This bond style only applies central-body forces which conserve the
translational and rotational degrees of freedom of a bonded set of
particles. The force has a magnitude of
.. math::
F = k (r - r_0) w
where :math:`k_r` is a stiffness, :math:`r` is the current distance and
:math:`r_0` is the initial distance between the two particles, and :math:`w`
is a smoothing factor.
Bonds will break at a strain of :math:`\epsilon_c`.
This is done by setting by setting its type to 0 such that forces are
no longer computed.
The smoothing factor :math:`w` is constructed such that forces smoothly
go to zero, avoiding discontinuities, as bonds approach the critical strain
where :math:`k_r` is a stiffness, :math:`r` is the current distance
and :math:`r_0` is the initial distance between the two particles, and
:math:`w` is a smoothing factor. Bonds will break at a strain of
:math:`\epsilon_c`. This is done by setting by setting its type to 0
such that forces are no longer computed. The smoothing factor
:math:`w` is constructed such that forces smoothly go to zero,
avoiding discontinuities, as bonds approach the critical strain
.. math::
w = 1.0 - \left( \frac{r - r_0}{r_0 \epsilon_c} \right)^8 .
Finally, an additional damping force is applied to the bonded particles.
This forces is proportional to the difference in the
Finally, an additional damping force is applied to the bonded
particles. This forces is proportional to the difference in the
normal velocity of particles using a similar construction as
dissipative particle dynamics (:ref:`(Groot) <Groot1>`):
@ -81,34 +82,35 @@ between the two particles.
The following coefficients must be defined for each bond type via the
:doc:`bond_coeff <bond_coeff>` command as in the example above, or in
the data file or restart files read by the :doc:`read_data <read_data>`
or :doc:`read_restart <read_restart>` commands:
the data file or restart files read by the :doc:`read_data
<read_data>` or :doc:`read_restart <read_restart>` commands:
* :math:`k` (force/distance units)
* :math:`\epsilon_c` (unit less)
* :math:`\gamma` (force/velocity units)
By default, pair forces are not calculated between bonded particles.
Pair forces can alternatively be overlaid on top of bond forces
using the *overlay/pair* keyword. These settings require specific
:doc:`special_bonds <special_bonds>` settings described in the restrictions.
Further details can be found in the `:doc: how to <Howto_BPM>` page on BPMs.
Pair forces can alternatively be overlaid on top of bond forces using
the *overlay/pair* keyword. These settings require specific
:doc:`special_bonds <special_bonds>` settings described in the
restrictions. Further details can be found in the `:doc: how to
<Howto_BPM>` page on BPMs.
This bond style tracks broken bonds and can record them using an instance of
:doc:`fix store/local <fix_store_local>` if the *store/local* keyword is
used followed by the ID of the fix and then a series of bond attributes.
This bond style tracks broken bonds and can record them using an
instance of :doc:`fix store/local <fix_store_local>` if the
*store/local* keyword is used followed by the ID of the fix and then a
series of bond attributes.
Note that when bonds are dumped to a file via the :doc:`dump local <dump>`
command, bonds with type 0 (broken bonds) are not included. The
:doc:`delete_bonds <delete_bonds>` command can also be used to query the
status of broken bonds or permanently delete them, e.g.:
Note that when bonds are dumped to a file via the :doc:`dump local
<dump>` command, bonds with type 0 (broken bonds) are not included.
The :doc:`delete_bonds <delete_bonds>` command can also be used to
query the status of broken bonds or permanently delete them, e.g.:
.. code-block:: LAMMPS
delete_bonds all stats
delete_bonds all bond 0 remove
----------
Restart
@ -122,17 +124,19 @@ Restrictions
""""""""""""
This bond style can only be used if LAMMPS was built with the BPM
package. See the :doc:`Build package <Build_package>` doc page for more
info.
package. See the :doc:`Build package <Build_package>` doc page for
more info.
By default if pair interactions are censored, this bond style requires setting
By default if pair interactions are to be disabled, this bond style
requires setting
.. code-block:: LAMMPS
special_bonds lj 0 1 1 coul 1 1 1
and :doc:`newton <newton>` must be set to bond off.
If the *overlay/pair* option is used, this bond style alternatively requires setting
and :doc:`newton <newton>` must be set to bond off. If the
*overlay/pair* option is used, this bond style alternatively requires
setting
.. code-block:: LAMMPS
@ -149,6 +153,7 @@ Default
none
----------
.. _Groot1:

View File

@ -23,11 +23,11 @@ Examples
Description
"""""""""""
Define a computation that computes the number of bonds per-atom.
Bonds which are broken are not counted in the tally.
See :doc:`bond_style quartic <bond_quartic>` or the
:doc:`Howto bpm <Howto_bpm>` page. The number of bonds will be zero
for atoms not in the specified compute group.
Define a computation that computes the number of bonds each atom is
part of. Bonds which are broken are not counted in the tally. See
the :doc:`Howto broken bonds <Howto_bpm>` page for more information.
The number of bonds will be zero for atoms not in the specified
compute group. This compute does not depend on Newton bond settings.
Output info
"""""""""""
@ -40,9 +40,8 @@ LAMMPS output options.
Restrictions
""""""""""""
This fix can only be used if LAMMPS was built with the BPM
package. See the :doc:`Build package <Build_package>` doc page for more
info.
This fix can only be used if LAMMPS was built with the BPM package.
See the :doc:`Build package <Build_package>` doc page for more info.
Related commands
""""""""""""""""

View File

@ -285,7 +285,7 @@ accelerated styles exist.
* :doc:`nve/manifold/rattle <fix_nve_manifold_rattle>` -
* :doc:`nve/noforce <fix_nve_noforce>` - NVE without forces (v only)
* :doc:`nve/sphere <fix_nve_sphere>` - NVE for spherical particles
* :doc:`nve/sphere/bpm <fix_nve_sphere_bpm>` - NVE for spherical particles used in bonded particle models
* :doc:`nve/sphere/bpm <fix_nve_sphere_bpm>` - NVE for spherical particles used in the BPM package
* :doc:`nve/spin <fix_nve_spin>` - NVE for a spin or spin-lattice system
* :doc:`nve/tri <fix_nve_tri>` - NVE for triangles
* :doc:`nvk <fix_nvk>` - constant kinetic energy time integration

View File

@ -30,15 +30,18 @@ Examples
Description
"""""""""""
Perform constant NVE integration to update position, velocity, angular velocity,
and quaternion orientation for finite-size spherical particles in the group each
timestep. V is volume; E is energy. This creates a system trajectory
consistent with the microcanonical ensemble.
Perform constant NVE integration to update position, velocity, angular
velocity, and quaternion orientation for finite-size spherical
particles in the group each timestep. V is volume; E is energy. This
creates a system trajectory consistent with the microcanonical
ensemble.
This fix differs from the :doc:`fix nve <fix_nve>` command, which
assumes point particles and only updates their position and velocity.
It also differs from the :doc:`fix nve/sphere <fix_nve/sphere>` command, which
does not evaluate a particles orientation or quaternion.
It also differs from the :doc:`fix nve/sphere <fix_nve/sphere>`
command which assumes finite-size spheroid particles which do not
store a quaternion. It thus does not update a particle's orientation
or quaternion.
If the *disc* keyword is used, then each particle is treated as a 2d
disc (circle) instead of as a sphere. This is only possible for 2d
@ -51,21 +54,23 @@ moment of inertia, as used in the time integration.
Restart, fix_modify, output, run start/stop, minimize info
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
No information about this fix is written to :doc:`binary restart files <restart>`. None of the :doc:`fix_modify <fix_modify>` options
are relevant to this fix. No global or per-atom quantities are stored
by this fix for access by various :doc:`output commands <Howto_output>`.
No information about this fix is written to :doc:`binary restart files
<restart>`. None of the :doc:`fix_modify <fix_modify>` options are
relevant to this fix. No global or per-atom quantities are stored by
this fix for access by various :doc:`output commands <Howto_output>`.
No parameter of this fix can be used with the *start/stop* keywords of
the :doc:`run <run>` command. This fix is not invoked during :doc:`energy minimization <minimize>`.
the :doc:`run <run>` command. This fix is not invoked during
:doc:`energy minimization <minimize>`.
Restrictions
""""""""""""
This fix requires that atoms store torque, angular velocity (omega),
a radius, and a quaternion as defined by the :doc:`atom_style sphere/bpm <atom_style>`
command.
This fix requires that atoms store torque, angular velocity (omega), a
radius, and a quaternion as defined by the :doc:`atom_style sphere/bpm
<atom_style>` command.
All particles in the group must be finite-size spheres with quaternions. They cannot
be point particles.
All particles in the group must be finite-size spheres with
quaternions. They cannot be point particles.
Use of the *disc* keyword is only allowed for 2d simulations, as
defined by the :doc:`dimension <dimension>` keyword.

View File

@ -20,49 +20,69 @@ Examples
.. code-block:: LAMMPS
bond_style bpm/simple store/local 1 id1 id2
fix 1 all store/local 1000 2
dump 1 all local 1000 dump.local f_1[1] f_1[2]
dump_modify 1 write_header no
pair_style hybrid/overlay tracker 1 x y z lj/cut 2.5
fix 1 all store/local 1000 3
dump 1 all local 1000 dump.local f_1[1] f_1[2] f_1[3]
Description
"""""""""""
This fix provides the ability to store local data produced by
some LAMMPS commands including some pair and bond styles so it can be output.
Data is accumulated over a span of *N* timesteps before being deleted.
The number of datums generated, aggregated across all processors, depends on
the associated commands. Data is only included if it is generated from atoms
within the fix group-ID.
This fix provides the ability to store local data generated by another
LAMMPS command, including some pair and bond styles, so it can be
output. One examples, shown above, is the
:doc:`bpm/simple bondstyle <bond_bpm_simple>` which allows bonds to
break and passes information on the broken bonds to this fix. A
:doc:`dump local <dump_local>` command can then output the list of
broken bonds
This fix continuously accumulates local data over intervals of *N*
timesteps. At the end of each interval, all of the saved accumulated
data is deleted to make room for new data. Individual datum may
therefore persist anywhere between *1* to *N* timesteps depending on
when they are saved. This data can be accessed by a
:doc:`dump local <dump_local>` command. To ensure all data is output,
the dump frequency should correspond to the same interval of *N*
timesteps. A dump frequency of an integer multiple of *N* can be used
to regularly output a sample of the accumulated data.
----------
Restart, fix_modify, run start/stop, minimize info
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Accumulated local data is written to :doc:`binary restart files <restart>`.
None of the :doc:`fix_modify <fix_modify>` options are
relevant to this fix.
No parameter of this fix can be used with the *start/stop* keywords of
the :doc:`run <run>` command.
Accumulated local data is written to :doc:`binary restart files
<restart>`. None of the :doc:`fix_modify <fix_modify>` options are
relevant to this fix. No parameter of this fix can be used with the
*start/stop* keywords of the :doc:`run <run>` command.
Output info
"""""""""""
This compute calculates a local vector or local array depending on the
number of input values. The length of the vector or number of rows in
the array is the number of recorded, lost interactions. If a single input is
specified, a local vector is produced. If two or more inputs are
specified, a local array is produced where the number of columns = the
number of inputs. The vector or array can be accessed by any command
that uses local values from a compute as input. See the :doc:`Howto output <Howto_output>` page for an overview of LAMMPS output
options.
the array is the number of recorded, lost interactions. If a single
input is specified, a local vector is produced. If two or more inputs
are specified, a local array is produced where the number of columns =
the number of inputs. The vector or array can be accessed by any
command that uses local values from a compute as input. See the
:doc:`Howto output <Howto_output>` page for an overview of LAMMPS
output options.
The vector or array values will be doubles that correspond to the
specified attribute.
The vector or array will be floating point values that correspond to
the specified attribute.
Restrictions
""""""""""""
Must be used in conjunction with another LAMMPS class which outputs local data.
This fix must be used in conjunction with another LAMMPS command which
generates local data and passes it to this fix. See the related
commands below for examples of such commands.
Related commands
""""""""""""""""

View File

@ -48,12 +48,22 @@ given by
w = 1.0 - \left( \frac{r}{r_c} \right)^8 .
This pair style is designed for use in a spring-based bonded particle model.
It mirrors the construction of the :doc:`bpm/spring <bond_bpm_spring>` bond style.
This pair style is designed for use in a spring-based bonded particle
model. It mirrors the construction of the :doc:`bpm/spring
<bond_bpm_spring>` bond style.
This pair interaction is always applied to pairs of nonbonded particles
that are within the interaction distance. For pairs of bonded particles
that are within the interaction distance, there is the option to either
include this pair interaction and overlay the pair force over the bond
force or to exclude this pair interaction such that the two particles
only interact via the bond force. See discussion of the *overlay/pair*
option for BPM bond styles and the :doc:`special_bonds <special_bonds>`
command in the `:doc: how to <Howto_BPM>` page on BPMs for more details.
The following coefficients must be defined for each pair of atom types
via the :doc:`pair_coeff <pair_coeff>` command as in the examples above,
or in the data file or restart files read by the
via the :doc:`pair_coeff <pair_coeff>` command as in the examples
above, or in the data file or restart files read by the
:doc:`read_data <read_data>` or :doc:`read_restart <read_restart>`
commands, or by mixing as described below:
@ -79,8 +89,9 @@ shift option, since the pair interaction goes to 0.0 at the cutoff.
The :doc:`pair_modify <pair_modify>` table and tail options are not
relevant for this pair style.
This pair style writes its information to :doc:`binary restart files <restart>`, so pair_style and pair_coeff commands do not need
to be specified in an input script that reads a restart file.
This pair style writes its information to :doc:`binary restart files
<restart>`, so pair_style and pair_coeff commands do not need to be
specified in an input script that reads a restart file.
This pair style can only be used via the *pair* keyword of the
:doc:`run_style respa <run_style>` command. It does not support the

View File

@ -19,9 +19,9 @@ Syntax
*finite* value = none
pair style uses atomic diameters to identify contacts
*time/min* value = T
T = minimum interaction time
*type/include* value = arg1 arg2
arg = separate lists of types (see below)
T = minimum number of timesteps of interaction
*type/include* value = list1 list2
list1,list2 = separate lists of types (see below)
* one or more attributes may be appended
@ -33,22 +33,22 @@ Syntax
.. parsed-literal::
id1, id2 = IDs of the 2 atoms in each pair interaction
time/created = the time that the 2 atoms began interacting
time/broken = the time that the 2 atoms stopped interacting
time/total = the total time the 2 atoms interacted
r/min = the minimum radial distance between the 2 atoms during the interaction
r/ave = the average radial distance between the 2 atoms during the interaction
x, y, z = the center of mass position of the 2 atoms when they stopped interacting
time/created = the timestep that the 2 atoms began interacting
time/broken = the timestep that the 2 atoms stopped interacting
time/total = the total number of timesteps the 2 atoms interacted
r/min = the minimum radial distance between the 2 atoms during the interaction (distance units)
r/ave = the average radial distance between the 2 atoms during the interaction (distance units)
x, y, z = the center of mass position of the 2 atoms when they stopped interacting (distance units)
Examples
""""""""
.. code-block:: LAMMPS
pair_style hybrid/overlay tracker myfix id1 id2 type/include 1 * type/include 2 3,4
pair_style hybrid/overlay tracker myfix id1 id2 type/include 1 * type/include 2 3,4 lj/cut 2.5
pair_coeff 1 1 tracker 2.0
pair_style hybrid/overlay tracker myfix finite x y z time/min 100
pair_style hybrid/overlay tracker myfix finite x y z time/min 100 granular
pair_coeff * * tracker
fix myfix all store/local 1000 3
@ -58,59 +58,91 @@ Examples
Description
"""""""""""
Style *tracker* monitors information about pairwise interactions.
It does not calculate any forces on atoms.
:doc:`Pair hybrid/overlay <pair_hybrid>` can be used to combine this pair
style with another pair style. Style *tracker* must be used in conjunction
with :doc:`fix store/local <fix_store_local>` which contains
information on outputting data. Whenever two neighboring atoms move beyond
the interaction cutoffPairwise data is processed and transferred to the associated
instance of :doc:`fix store/local <fix_store_local>`. Additional filters can
be applied using the *time/min* or *type/include* keywords described below.
Style *tracker* monitors information about pairwise interactions. It
does not calculate any forces on atoms. :doc:`Pair hybrid/overlay
<pair_hybrid>` can be used to combine this pair style with any other
pair style, as shown in the examples above. Style *tracker* must also
be used in conjunction with the :doc:`fix store/local
<fix_store_local>` command which stores the pairise information so it
can be accessed as local data by other LAMMPS commands, e.g. by the
:doc:`dump local <dump>` command for output.
If the *finite* keyword is not defined, the following coefficients must be
defined for each pair of atom types via the :doc:`pair_coeff <pair_coeff>`
command as in the examples above, or in the data file or restart files
read by the :doc:`read_data <read_data>` or :doc:`read_restart <read_restart>`
commands, or by mixing as described below:
At each timestep, if two neighboring atoms move beyond the interaction
cutoff, pairwise data is processed and transferred to the associated
instance of :doc:`fix store/local <fix_store_local>`. Additional
filters can be applied using the *time/min* or *type/include* keywords
described below. Note that this is the interaction cutoff defined by
this pair style, not the short-range cutoff defined by the pair style
that is calculating forces on atoms.
Following any optional keyword/value arguments, a list of one or more
attributes is specified. These include the IDs of the two atoms in
the pair. The other attributes for the pair of atoms are for the
duration of time they were "interacting" or at the point in time they
started or stopped interacting. In this context, "interacting" means
the time window during which the two atoms were closer than the
interaction cutoff distance. The attributes for time/* refer to
timesteps.
----------
The following optional keywords may be used.
If the *finite* keyword is not used, the following coefficients must
be defined for each pair of atom types via the :doc:`pair_coeff
<pair_coeff>` command as in the examples above, or in the data file or
restart files read by the :doc:`read_data <read_data>` or
:doc:`read_restart <read_restart>` commands, or by mixing as described
below:
* cutoff (distance units)
If the *finite* keyword is defined, no coefficients may be defined.
Interaction cutoffs are alternatively calculated based on the
diameter of finite particles.
If the *finite* keyword is used, there are no additional coefficients
to set for each pair of atom types via the
:doc:`pair_coeff <pair_coeff>` command. Interaction cutoffs are
instead calculated based on the diameter of finite particles. However
you must still use the :doc:`pair_coeff <pair_coeff>` for all atom
types. For example the command
.. note::
.. code-block:: LAMMPS
For extremely long-lived interactions, the calculation of *r/ave* may not be
correct due to double overflow.
pair_coeff * *
The *time/min* keyword sets a minimum amount of time that an interaction must
persist to be included. This setting can be used to censor short-lived interactions.
The *type/include* keyword filters interactions based on the types of the two atoms.
Data is only saved for interactions between atoms with types in the two lists.
Each list consists of a series of type
ranges separated by commas. The range can be specified as a
single numeric value, or a wildcard asterisk can be used to specify a range
of values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For
example, if M = the number of atom types, then an asterisk with no numeric
values means all types from 1 to M. A leading asterisk means all types
from 1 to n (inclusive). A trailing asterisk means all types from n to M
(inclusive). A middle asterisk means all types from m to n (inclusive).
Multiple *type/include* keywords may be added.
should be used.
The *time/min* keyword sets a minimum amount of time that an
interaction must persist to be included. This setting can be used to
censor short-lived interactions.
The *type/include* keyword filters interactions based on the types of
the two atoms. Data is only saved for interactions between atoms
whose two atom types appear in *list1* and *list2*. Atom type 1 must
be in list1 and atom type 2 in list2. Or vice versa.
Each type list consists of a series of type ranges separated by
commas. Each range can be specified as a single numeric value, or a
wildcard asterisk can be used to specify a range of values. This
takes the form "\*" or "\*n" or "n\*" or "m\*n". For example, if M =
the number of atom types, then an asterisk with no numeric values
means all types from 1 to M. A leading asterisk means all types from
1 to n (inclusive). A trailing asterisk means all types from n to M
(inclusive). A middle asterisk means all types from m to n
(inclusive). Note that the *type/include* keyword can be specified
multiple times.
Mixing, shift, table, tail correction, restart, rRESPA info
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
For atom type pairs I,J and I != J, the cutoff coefficient and cutoff
distance for this pair style can be mixed. The cutoff is always mixed via a
*geometric* rule. The cutoff is mixed according to the pair_modify
mix value. The default mix value is *geometric*\ . See the
"pair_modify" command for details.
distance for this pair style can be mixed. The cutoff is always mixed
via a *geometric* rule. The cutoff is mixed according to the
pair_modify mix value. The default mix value is *geometric*\ . See
the "pair_modify" command for details.
This pair style writes its information to :doc:`binary restart files <restart>`, so
pair_style and pair_coeff commands do not need
to be specified in an input script that reads a restart file.
This pair style writes its information to :doc:`binary restart files
<restart>`, so pair_style and pair_coeff commands do not need to be
specified in an input script that reads a restart file.
The :doc:`pair_modify <pair_modify>` shift, table, and tail options
are not relevant for this pair style.
@ -120,19 +152,20 @@ are not relevant for this pair style.
Restrictions
""""""""""""
A corresponding :doc:`fix pair_tracker <fix_pair_tracker>` must be defined
to use this pair style.
This pair style is currently incompatible with granular pair styles that extend
beyond the contact (e.g. JKR and DMT).
This fix is part of the MISC package. It is only enabled if LAMMPS
was built with that package. See the :doc:`Build package <Build_package>` page for more info.
was built with that package. See the :doc:`Build package
<Build_package>` page for more info.
A corresponding :doc:`fix store_local <fix_store_local>` must be
defined to use this pair style.
This pair style is currently incompatible with granular pair styles
that extend beyond the contact (e.g. JKR and DMT).
Related commands
""""""""""""""""
:doc:`fix pair_tracker <fix_pair_tracker>`
:doc:`fix store_local <fix_store_local>`
Default
"""""""

View File

@ -112,7 +112,7 @@ void BondBPM::init_style()
if (id_fix_dummy) {
id_fix_update = utils::strdup("BPM_update_special_bonds");
fix_update_special_bonds = (FixUpdateSpecialBonds *) modify->replace_fix(id_fix_dummy,
fmt::format("{} all update/special/bonds", id_fix_update),1);
fmt::format("{} all UPDATE/SPECIAL/BONDS", id_fix_update),1);
delete [] id_fix_dummy;
id_fix_dummy = nullptr;
}

View File

@ -1,76 +1,76 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef BOND_CLASS
// clang-format off
BondStyle(bpm/rotational,BondBPMRotational)
// clang-format on
#else
#ifndef LMP_BOND_BPM_ROTATIONAL_H
#define LMP_BOND_BPM_ROTATIONAL_H
#include "bond_bpm.h"
namespace LAMMPS_NS {
class BondBPMRotational : public BondBPM {
public:
BondBPMRotational(class LAMMPS *);
virtual ~BondBPMRotational();
virtual void compute(int, int);
void coeff(int, char **);
void init_style();
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
double single(int, double, int, int, double &);
protected:
double *Kr, *Ks, *Kt, *Kb, *gnorm, *gslide, *groll, *gtwist;
double *Fcr, *Fcs, *Tct, *Tcb;
double acos_limit(double);
void allocate();
void store_data();
double store_bond(int, int, int);
};
} // namespace LAMMPS_NS
#endif
#endif
/* ERROR/WARNING messages:
E: Atom missing in BPM bond
Bonded atom cannot be found
E: Incorrect args for bond coefficients
Self-explanatory. Check the input script or data file.
E: Bond bpm/rotational requires atom style sphere/bpm
Self-explanatory.
E: Bond style bpm requires 1-3 and 1-4 special weights of 1.0
Self-explanatory.
W: Bond style bpm/rotational not intended for 2d use, may be inefficient
This bond style will perform a lot of unnecessary calculations in 2d
*/
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef BOND_CLASS
// clang-format off
BondStyle(bpm/rotational,BondBPMRotational)
// clang-format on
#else
#ifndef LMP_BOND_BPM_ROTATIONAL_H
#define LMP_BOND_BPM_ROTATIONAL_H
#include "bond_bpm.h"
namespace LAMMPS_NS {
class BondBPMRotational : public BondBPM {
public:
BondBPMRotational(class LAMMPS *);
virtual ~BondBPMRotational();
virtual void compute(int, int);
void coeff(int, char **);
void init_style();
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
double single(int, double, int, int, double &);
protected:
double *Kr, *Ks, *Kt, *Kb, *gnorm, *gslide, *groll, *gtwist;
double *Fcr, *Fcs, *Tct, *Tcb;
double acos_limit(double);
void allocate();
void store_data();
double store_bond(int, int, int);
};
} // namespace LAMMPS_NS
#endif
#endif
/* ERROR/WARNING messages:
E: Atom missing in BPM bond
Bonded atom cannot be found
E: Incorrect args for bond coefficients
Self-explanatory. Check the input script or data file.
E: Bond bpm/rotational requires atom style sphere/bpm
Self-explanatory.
E: Bond style bpm requires 1-3 and 1-4 special weights of 1.0
Self-explanatory.
W: Bond style bpm/rotational not intended for 2d use, may be inefficient
This bond style will perform a lot of unnecessary calculations in 2d
*/

View File

@ -134,7 +134,7 @@ void BondBPMSpring::compute(int eflag, int vflag)
store_data();
}
int i1,i2,m,n,type,itype,jtype;
int i1,i2,itmp,m,n,type,itype,jtype;
double delx, dely, delz, delvx, delvy, delvz;
double e, rsq, r, r0, rinv, smooth, fbond, ebond, dot;
@ -143,6 +143,7 @@ void BondBPMSpring::compute(int eflag, int vflag)
double **x = atom->x;
double **v = atom->v;
double **f = atom->f;
tagint *tag = atom->tag;
int **bondlist = neighbor->bondlist;
int nbondlist = neighbor->nbondlist;
int nlocal = atom->nlocal;
@ -160,6 +161,15 @@ void BondBPMSpring::compute(int eflag, int vflag)
type = bondlist[n][2];
r0 = bondstore[n][0];
// Ensure pair is always ordered to ensure numerical operations
// are identical to minimize the possibility that a bond straddling
// an mpi grid (newton off) doesn't break on one proc but not the other
if (tag[i2] < tag[i1]) {
itmp = i1;
i1 = i2;
i2 = itmp;
}
// If bond hasn't been set - should be initialized to zero
if (r0 < EPSILON || std::isnan(r0))
r0 = store_bond(n,i1,i2);

View File

@ -1,74 +1,74 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef BOND_CLASS
// clang-format off
BondStyle(bpm/spring,BondBPMSpring)
// clang-format on
#else
#ifndef LMP_BOND_BPM_SPRING_H
#define LMP_BOND_BPM_SPRING_H
#include "bond_bpm.h"
namespace LAMMPS_NS {
class BondBPMSpring : public BondBPM {
public:
BondBPMSpring(class LAMMPS *);
virtual ~BondBPMSpring();
virtual void compute(int, int);
void coeff(int, char **);
void init_style();
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
double single(int, double, int, int, double &);
protected:
double *k, *ecrit, *gamma;
void allocate();
void store_data();
double store_bond(int, int, int);
};
} // namespace LAMMPS_NS
#endif
#endif
/* ERROR/WARNING messages:
E: Atom missing in BPM bond
Bonded atom cannot be found
E: Incorrect args for bond coefficients
Self-explanatory. Check the input script or data file.
E: Bond bpm/rotational requires atom style sphere/bpm
Self-explanatory.
E: Bond style bpm requires 1-3 and 1-4 special weights of 1.0
Self-explanatory.
W: Bond style bpm/rotational not intended for 2d use, may be inefficient
This bond style will perform a lot of unnecessary calculations in 2d
*/
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef BOND_CLASS
// clang-format off
BondStyle(bpm/spring,BondBPMSpring)
// clang-format on
#else
#ifndef LMP_BOND_BPM_SPRING_H
#define LMP_BOND_BPM_SPRING_H
#include "bond_bpm.h"
namespace LAMMPS_NS {
class BondBPMSpring : public BondBPM {
public:
BondBPMSpring(class LAMMPS *);
virtual ~BondBPMSpring();
virtual void compute(int, int);
void coeff(int, char **);
void init_style();
void write_restart(FILE *);
void read_restart(FILE *);
void write_data(FILE *);
double single(int, double, int, int, double &);
protected:
double *k, *ecrit, *gamma;
void allocate();
void store_data();
double store_bond(int, int, int);
};
} // namespace LAMMPS_NS
#endif
#endif
/* ERROR/WARNING messages:
E: Atom missing in BPM bond
Bonded atom cannot be found
E: Incorrect args for bond coefficients
Self-explanatory. Check the input script or data file.
E: Bond bpm/rotational requires atom style sphere/bpm
Self-explanatory.
E: Bond style bpm requires 1-3 and 1-4 special weights of 1.0
Self-explanatory.
W: Bond style bpm/rotational not intended for 2d use, may be inefficient
This bond style will perform a lot of unnecessary calculations in 2d
*/

View File

@ -44,7 +44,7 @@ PairTracker::PairTracker(LAMMPS *lmp) :
neighprev = 0;
history = 1;
size_history = 4;
size_history = 3;
nondefault_history_transfer = 1;
finitecutflag = 0;
@ -96,7 +96,7 @@ PairTracker::~PairTracker()
void PairTracker::compute(int eflag, int vflag)
{
int i, j, ii, jj, inum, jnum, itype, jtype;
double xtmp, ytmp, ztmp, delx, dely, delz, time;
double xtmp, ytmp, ztmp, delx, dely, delz;
double radi, radj, radsum, rsq, r;
int *ilist, *jlist, *numneigh, **firstneigh;
int *touch, **firsttouch;
@ -152,23 +152,20 @@ void PairTracker::compute(int eflag, int vflag)
}
touch[jj] = 0;
data[0] = 0.0; // initial time
data[1] = 0.0; // initial timestep
data[2] = 0.0; // sum of r, may overflow
data[3] = 0.0; // min of r
data[0] = 0.0; // initial timestep
data[1] = 0.0; // sum of r, may be inaccurate over long times
data[2] = 0.0; // min of r
} else {
data = &alldata[size_history * jj];
if (touch[jj] == 0) {
time = update->atime + (update->ntimestep - update->atimestep) * update->dt;
data[0] = time;
data[1] = (double) update->ntimestep;
data[0] = (double) update->ntimestep;
data[1] = r;
data[2] = r;
data[3] = r;
} else if (updateflag) {
data[2] += r;
if (data[3] > r) data[3] = r;
data[1] += r;
if (data[2] > r) data[2] = r;
}
touch[jj] = 1;
}
@ -182,23 +179,20 @@ void PairTracker::compute(int eflag, int vflag)
}
touch[jj] = 0;
data[0] = 0.0; // initial time
data[1] = 0.0; // initial timestep
data[2] = 0.0; // sum of r, may overflow
data[3] = 0.0; // min of r
data[0] = 0.0; // initial timestep
data[1] = 0.0; // sum of r, may be inaccurate over long times
data[2] = 0.0; // min of r
} else {
data = &alldata[size_history * jj];
if (touch[jj] == 0) {
time = update->atime + (update->ntimestep - update->atimestep) * update->dt;
data[0] = time;
data[1] = (double) update->ntimestep;
data[0] = (double) update->ntimestep;
data[1] = r;
data[2] = r;
data[3] = r;
} else if (updateflag) {
data[2] += r;
if (data[3] > r) data[3] = r;
data[1] += r;
if (data[2] > r) data[2] = r;
}
touch[jj] = 1;
}
@ -570,9 +564,7 @@ double PairTracker::radii2cut(double r1, double r2)
void PairTracker::process_data(int i, int j, double * input_data)
{
double time = update->atime + (update->ntimestep - update->atimestep) * update->dt;
int time_initial = (int) input_data[0];
if ((time - time_initial) < tmin) return;
if ((update->ntimestep - input_data[0]) < tmin) return;
if (type_filter) {
int *type = atom->type;
@ -590,25 +582,21 @@ void PairTracker::process_data(int i, int j, double * input_data)
void PairTracker::pack_time_created(int n, int i, int j, double * data)
{
double time_initial = data[0];
output_data[n] = time_initial;
output_data[n] = data[0];
}
/* ---------------------------------------------------------------------- */
void PairTracker::pack_time_broken(int n, int i, int j, double * data)
{
double time = update->atime + (update->ntimestep - update->atimestep) * update->dt;
output_data[n] = time;
output_data[n] = update->ntimestep;
}
/* ---------------------------------------------------------------------- */
void PairTracker::pack_time_total(int n, int i, int j, double * data)
{
double time = update->atime + (update->ntimestep - update->atimestep) * update->dt;
double time_initial = data[0];
output_data[n] = time - time_initial;
output_data[n] = update->ntimestep - data[0];
}
/* ---------------------------------------------------------------------- */
@ -655,15 +643,12 @@ void PairTracker::pack_z(int n, int i, int j, double * data)
void PairTracker::pack_rmin(int n, int i, int j, double * data)
{
double rmin = data[3];
output_data[n] = rmin;
output_data[n] = data[2];
}
/* ---------------------------------------------------------------------- */
void PairTracker::pack_rave(int n, int i, int j, double * data)
{
double rsum = data[2];
double nstep_initial = data[1];
output_data[n] = rsum / (update->ntimestep - nstep_initial);
output_data[n] = data[1] / (update->ntimestep - data[0]);
}

View File

@ -40,6 +40,7 @@ class PairTracker : public Pair {
virtual double single(int, int, int, int, double, double, double, double &);
double atom2cut(int);
double radii2cut(double, double);
void transfer_history(double *, double *);
protected:
int sizeflag;
@ -75,8 +76,6 @@ class PairTracker : public Pair {
void pack_rmin(int, int, int, double *);
void pack_rave(int, int, int, double *);
void transfer_data(int, int);
void transfer_history(double *, double *);
void process_data(int, int, double *);
void allocate();
};

View File

@ -1,201 +1,126 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/ Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "fix_store_local.h"
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "memory.h"
#include "update.h"
using namespace LAMMPS_NS;
using namespace FixConst;
#define DELTA 1000
/* ---------------------------------------------------------------------- */
FixStoreLocal::FixStoreLocal(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), nvalues(0), vector(nullptr), array(nullptr)
{
if (narg != 5) error->all(FLERR, "Illegal fix store/local command");
local_flag = 1;
nevery = utils::inumeric(FLERR, arg[3], false, lmp);
if (nevery <= 0) error->all(FLERR, "Illegal fix store/local command");
local_freq = nevery;
nvalues = utils::inumeric(FLERR, arg[4], false, lmp);
if (nvalues <= 0) error->all(FLERR, "Illegal fix store/local command");
if (nvalues == 1)
size_local_cols = 0;
else
size_local_cols = nvalues;
size_local_rows = 0;
vector = nullptr;
array = nullptr;
nmax = 0;
ncount = 0;
}
/* ---------------------------------------------------------------------- */
FixStoreLocal::~FixStoreLocal()
{
memory->destroy(vector);
memory->destroy(array);
}
/* ---------------------------------------------------------------------- */
int FixStoreLocal::setmask()
{
int mask = 0;
mask |= POST_FORCE;
return mask;
}
/* ---------------------------------------------------------------------- */
void FixStoreLocal::add_data(double *input_data, int i, int j)
{
int *mask = atom->mask;
if (!(mask[i] & groupbit)) return;
if (!(mask[j] & groupbit)) return;
if (ncount >= nmax) reallocate(ncount);
// fill vector or array with local values
if (nvalues == 1) {
vector[ncount] = input_data[0];
} else {
for (int i = 0; i < nvalues; i++) array[ncount][i] = input_data[i];
}
ncount += 1;
}
/* ---------------------------------------------------------------------- */
void FixStoreLocal::post_force(int /*vflag*/)
{
if (update->ntimestep % nevery == 0) {
size_local_rows = ncount;
ncount = 0;
}
}
/* ---------------------------------------------------------------------- */
void FixStoreLocal::reallocate(int n)
{
// grow vector or array
while (nmax <= n) nmax += DELTA;
if (nvalues == 1) {
memory->grow(vector, nmax, "fix_store_local:vector");
vector_local = vector;
} else {
memory->grow(array, nmax, nvalues, "fix_store_local:array");
array_local = array;
}
}
/* ----------------------------------------------------------------------
write global array to restart file
------------------------------------------------------------------------- */
void FixStoreLocal::write_restart(FILE *fp)
{
// fill rbuf with size and vec/array values
rbuf[0] = nmax;
rbuf[1] = nvalues;
if (nvalues == 1) memcpy(&rbuf[2], vector, sizeof(double) * nmax);
else memcpy(&rbuf[2], &array[0][0], sizeof(double) * nmax * nvalues);
int n = nmax * nvalues + 2;
if (comm->me == 0) {
int size = n * sizeof(double);
fwrite(&size, sizeof(int), 1, fp);
fwrite(rbuf, sizeof(double), n, fp);
}
}
/* ----------------------------------------------------------------------
use global array from restart file to restart the Fix
------------------------------------------------------------------------- */
void FixStoreLocal::restart(char *buf)
{
// first 2 values in buf are vec/array sizes
double *dbuf = (double *) buf;
int nrow_restart = dbuf[0];
int ncol_restart = dbuf[1];
// if size of vec/array has changed,
// means the restart file is setting size of vec or array and doing init
// because caller did not know size at time this fix was instantiated
// reallocate vector or array accordingly
if (nmax != nrow_restart || nvalues != ncol_restart) {
memory->destroy(vector);
memory->destroy(array);
memory->destroy(rbuf);
vector = nullptr;
array = nullptr;
nmax = nrow_restart;
nvalues = ncol_restart;
if (nvalues == 1) memory->create(vector, nmax, "fix/store/local:vector");
else memory->create(array, nmax, nvalues, "fix/store/local:array");
memory->create(rbuf, nmax * nvalues + 2, "fix/store:rbuf");
}
int n = nmax*nvalues;
if (nvalues == 1) memcpy(vector, &dbuf[2], n * sizeof(double));
else memcpy(&array[0][0], &dbuf[2], n * sizeof(double));
}
/* ----------------------------------------------------------------------
maxsize of any atom's restart data
------------------------------------------------------------------------- */
int FixStoreLocal::maxsize_restart()
{
return nvalues + 1;
}
/* ----------------------------------------------------------------------
size of atom nlocal's restart data
------------------------------------------------------------------------- */
int FixStoreLocal::size_restart(int /*nlocal*/)
{
return nvalues + 1;
}
/* ----------------------------------------------------------------------
memory usage of local data
------------------------------------------------------------------------- */
double FixStoreLocal::memory_usage()
{
double bytes = (double) nmax * (double) nvalues * sizeof(double);
return bytes;
}
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/ Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#include "fix_store_local.h"
#include "atom.h"
#include "comm.h"
#include "error.h"
#include "memory.h"
#include "update.h"
using namespace LAMMPS_NS;
using namespace FixConst;
#define DELTA 1000
/* ---------------------------------------------------------------------- */
FixStoreLocal::FixStoreLocal(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), nvalues(0), vector(nullptr), array(nullptr)
{
if (narg != 5) error->all(FLERR, "Illegal fix store/local command");
local_flag = 1;
nevery = utils::inumeric(FLERR, arg[3], false, lmp);
if (nevery <= 0) error->all(FLERR, "Illegal fix store/local command");
local_freq = nevery;
nvalues = utils::inumeric(FLERR, arg[4], false, lmp);
if (nvalues <= 0) error->all(FLERR, "Illegal fix store/local command");
if (nvalues == 1)
size_local_cols = 0;
else
size_local_cols = nvalues;
size_local_rows = 0;
vector = nullptr;
array = nullptr;
nmax = 0;
ncount = 0;
}
/* ---------------------------------------------------------------------- */
FixStoreLocal::~FixStoreLocal()
{
memory->destroy(vector);
memory->destroy(array);
}
/* ---------------------------------------------------------------------- */
int FixStoreLocal::setmask()
{
int mask = 0;
mask |= POST_FORCE;
return mask;
}
/* ---------------------------------------------------------------------- */
void FixStoreLocal::add_data(double *input_data, int i, int j)
{
int *mask = atom->mask;
if (!(mask[i] & groupbit)) return;
if (!(mask[j] & groupbit)) return;
if (ncount >= nmax) reallocate(ncount);
// fill vector or array with local values
if (nvalues == 1) {
vector[ncount] = input_data[0];
} else {
for (int i = 0; i < nvalues; i++) array[ncount][i] = input_data[i];
}
ncount += 1;
}
/* ---------------------------------------------------------------------- */
void FixStoreLocal::post_force(int /*vflag*/)
{
if (update->ntimestep % nevery == 0) {
size_local_rows = ncount;
ncount = 0;
}
}
/* ---------------------------------------------------------------------- */
void FixStoreLocal::reallocate(int n)
{
// grow vector or array
while (nmax <= n) nmax += DELTA;
if (nvalues == 1) {
memory->grow(vector, nmax, "fix_store_local:vector");
vector_local = vector;
} else {
memory->grow(array, nmax, nvalues, "fix_store_local:array");
array_local = array;
}
}
/* ----------------------------------------------------------------------
memory usage of local data
------------------------------------------------------------------------- */
double FixStoreLocal::memory_usage()
{
double bytes = (double) nmax * (double) nvalues * sizeof(double);
return bytes;
}

View File

@ -1,75 +1,70 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/ Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
// clang-format off
FixStyle(store/local,FixStoreLocal);
// clang-format on
#else
#ifndef LMP_FIX_STORE_LOCAL_H
#define LMP_FIX_STORE_LOCAL_H
#include "fix.h"
namespace LAMMPS_NS {
class FixStoreLocal : public Fix {
public:
FixStoreLocal(class LAMMPS *, int, char **);
~FixStoreLocal();
int setmask();
void post_force(int);
void write_restart(FILE *);
void restart(char *);
int size_restart(int);
int maxsize_restart();
double memory_usage();
void add_data(double *, int, int);
int nvalues;
private:
int nmax;
double *vector;
double **array;
int ncount;
void reallocate(int);
double *rbuf; // restart buffer for GLOBAL vec/array
};
} // namespace LAMMPS_NS
#endif
#endif
/* ERROR/WARNING messages:
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Invalid keyword in fix store/local command
Self-explanatory.
E: Unused instance of fix store/local
Instance of fix store/local is not associated with any other LAMMPS
class such as a bond style, pair style, etc.
*/
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/ Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
// clang-format off
FixStyle(store/local,FixStoreLocal);
// clang-format on
#else
#ifndef LMP_FIX_STORE_LOCAL_H
#define LMP_FIX_STORE_LOCAL_H
#include "fix.h"
namespace LAMMPS_NS {
class FixStoreLocal : public Fix {
public:
FixStoreLocal(class LAMMPS *, int, char **);
~FixStoreLocal();
int setmask();
void post_force(int);
double memory_usage();
void add_data(double *, int, int);
int nvalues;
private:
int nmax;
double *vector;
double **array;
int ncount;
void reallocate(int);
};
} // namespace LAMMPS_NS
#endif
#endif
/* ERROR/WARNING messages:
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Invalid keyword in fix store/local command
Self-explanatory.
E: Unused instance of fix store/local
Instance of fix store/local is not associated with any other LAMMPS
class such as a bond style, pair style, etc.
*/

View File

@ -121,7 +121,6 @@ void NPairHalfSizeBinNewtoff::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}

View File

@ -124,7 +124,6 @@ void NPairHalfSizeBinNewton::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}
@ -160,7 +159,6 @@ void NPairHalfSizeBinNewton::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}

View File

@ -130,7 +130,6 @@ void NPairHalfSizeBinNewtonTri::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}

View File

@ -142,7 +142,6 @@ void NPairHalfSizeMultiNewtoff::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}

View File

@ -151,7 +151,6 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}
@ -196,7 +195,6 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}

View File

@ -154,7 +154,6 @@ void NPairHalfSizeMultiNewtonTri::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}

View File

@ -132,7 +132,6 @@ void NPairHalfSizeMultiOldNewtoff::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}

View File

@ -128,7 +128,6 @@ void NPairHalfSizeMultiOldNewton::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}
@ -171,7 +170,6 @@ void NPairHalfSizeMultiOldNewton::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = j;
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = j;
}
}

View File

@ -139,7 +139,6 @@ void NPairHalfSizeMultiOldNewtonTri::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}

View File

@ -120,7 +120,6 @@ void NPairHalfSizeNsqNewtoff::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}

View File

@ -138,7 +138,6 @@ void NPairHalfSizeNsqNewton::build(NeighList *list)
else if (domain->minimum_image_check(delx,dely,delz))
neighptr[n++] = jh;
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
} else neighptr[n++] = jh;
}
}