list post_constructor methods and modernize description
This commit is contained in:
@ -1,19 +1,21 @@
|
|||||||
Compute styles
|
Compute styles
|
||||||
==============
|
==============
|
||||||
|
|
||||||
Classes that compute scalar and vector quantities like temperature
|
Classes that compute scalar and vector quantities like temperature and
|
||||||
and the pressure tensor, as well as classes that compute per-atom
|
the pressure tensor, as well as classes that compute per-atom quantities
|
||||||
quantities like kinetic energy and the centro-symmetry parameter
|
like kinetic energy and the centro-symmetry parameter are derived from
|
||||||
are derived from the Compute class. New styles can be created
|
the Compute class. New styles can be created to add new calculations to
|
||||||
to add new calculations to LAMMPS.
|
LAMMPS.
|
||||||
|
|
||||||
Compute_temp.cpp is a simple example of computing a scalar
|
The ``src/compute_temp.cpp`` file is a simple example of computing a
|
||||||
temperature. Compute_ke_atom.cpp is a simple example of computing
|
scalar temperature. The ``src/compute_ke_atom.cpp`` file is a simple
|
||||||
per-atom kinetic energy.
|
example of computing per-atom kinetic energy.
|
||||||
|
|
||||||
Here is a brief description of methods you define in your new derived
|
Here is a brief description of methods you define in your new derived
|
||||||
class. See compute.h for details.
|
class. See ``src/compute.h`` for additional details.
|
||||||
|
|
||||||
|
+-----------------------+------------------------------------------------------------------+
|
||||||
|
| post_constructor | perform tasks that cannot be run in the constructor (optional) |
|
||||||
+-----------------------+------------------------------------------------------------------+
|
+-----------------------+------------------------------------------------------------------+
|
||||||
| init | perform one time setup (required) |
|
| init | perform one time setup (required) |
|
||||||
+-----------------------+------------------------------------------------------------------+
|
+-----------------------+------------------------------------------------------------------+
|
||||||
@ -50,10 +52,11 @@ class. See compute.h for details.
|
|||||||
| memory_usage | tally memory usage (optional) |
|
| memory_usage | tally memory usage (optional) |
|
||||||
+-----------------------+------------------------------------------------------------------+
|
+-----------------------+------------------------------------------------------------------+
|
||||||
|
|
||||||
Tally-style computes are a special case, as their computation is done
|
Tally-style computes are a special case, as their computation is done in
|
||||||
in two stages: the callback function is registered with the pair style
|
two stages: the callback function is registered with the pair style and
|
||||||
and then called from the Pair::ev_tally() function, which is called for
|
then called from the Pair::ev_tally() function, which is called for each
|
||||||
each pair after force and energy has been computed for this pair. Then
|
pair after force and energy has been computed for this pair. Then the
|
||||||
the tallied values are retrieved with the standard compute_scalar or
|
tallied values are retrieved with the standard compute_scalar or
|
||||||
compute_vector or compute_peratom methods. The :doc:`compute styles in the TALLY package <compute_tally>`
|
compute_vector or compute_peratom methods. The :doc:`compute styles in
|
||||||
provide *examples* for utilizing this mechanism.
|
the TALLY package <compute_tally>` provide *examples* for utilizing this
|
||||||
|
mechanism.
|
||||||
|
|||||||
@ -1,23 +1,25 @@
|
|||||||
Fix styles
|
Fix styles
|
||||||
==========
|
==========
|
||||||
|
|
||||||
In LAMMPS, a "fix" is any operation that is computed during
|
In LAMMPS, a "fix" is any operation that is computed during timestepping
|
||||||
timestepping that alters some property of the system. Essentially
|
that alters some property of the system. Essentially everything that
|
||||||
everything that happens during a simulation besides force computation,
|
happens during a simulation besides force computation, neighbor list
|
||||||
neighbor list construction, and output, is a "fix". This includes
|
construction, and output, is a "fix". This includes time integration
|
||||||
time integration (update of coordinates and velocities), force
|
(update of coordinates and velocities), force constraints or boundary
|
||||||
constraints or boundary conditions (SHAKE or walls), and diagnostics
|
conditions (SHAKE or walls), and diagnostics (compute a diffusion
|
||||||
(compute a diffusion coefficient). New styles can be created to add
|
coefficient). New styles can be created to add new options to LAMMPS.
|
||||||
new options to LAMMPS.
|
|
||||||
|
|
||||||
Fix_setforce.cpp is a simple example of setting forces on atoms to
|
The file ``src/fix_setforce.cpp`` is a simple example of setting forces
|
||||||
prescribed values. There are dozens of fix options already in LAMMPS;
|
on atoms to prescribed values. There are dozens of fix options already
|
||||||
choose one as a template that is similar to what you want to
|
in LAMMPS; choose one as a template that is similar to what you want to
|
||||||
implement.
|
implement. There also is a detailed discussion of :doc:`how to write
|
||||||
|
new fix styles <Developer_write_fix>` in LAMMPS.
|
||||||
|
|
||||||
Here is a brief description of methods you can define in your new
|
Here is a brief description of methods you can define in your new
|
||||||
derived class. See fix.h for details.
|
derived class. See ``src/fix.h`` for additional details.
|
||||||
|
|
||||||
|
+---------------------------+--------------------------------------------------------------------------------------------+
|
||||||
|
| post_constructor | perform tasks that cannot be run in the constructor (optional) |
|
||||||
+---------------------------+--------------------------------------------------------------------------------------------+
|
+---------------------------+--------------------------------------------------------------------------------------------+
|
||||||
| setmask | determines when the fix is called during the timestep (required) |
|
| setmask | determines when the fix is called during the timestep (required) |
|
||||||
+---------------------------+--------------------------------------------------------------------------------------------+
|
+---------------------------+--------------------------------------------------------------------------------------------+
|
||||||
@ -130,10 +132,11 @@ derived class. See fix.h for details.
|
|||||||
|
|
||||||
Typically, only a small fraction of these methods are defined for a
|
Typically, only a small fraction of these methods are defined for a
|
||||||
particular fix. Setmask is mandatory, as it determines when the fix
|
particular fix. Setmask is mandatory, as it determines when the fix
|
||||||
will be invoked during the timestep. Fixes that perform time
|
will be invoked during :doc:`the evolution of a timestep
|
||||||
integration (\ *nve*, *nvt*, *npt*\ ) implement initial_integrate() and
|
<Developer_flow>`. Fixes that perform time integration (\ *nve*, *nvt*,
|
||||||
final_integrate() to perform velocity Verlet updates. Fixes that
|
*npt*\ ) implement initial_integrate() and final_integrate() to perform
|
||||||
constrain forces implement post_force().
|
velocity Verlet updates. Fixes that constrain forces implement
|
||||||
|
post_force().
|
||||||
|
|
||||||
Fixes that perform diagnostics typically implement end_of_step(). For
|
Fixes that perform diagnostics typically implement end_of_step(). For
|
||||||
an end_of_step fix, one of your fix arguments must be the variable
|
an end_of_step fix, one of your fix arguments must be the variable
|
||||||
@ -143,13 +146,13 @@ is the first argument the fix defines (after the ID, group-ID, style).
|
|||||||
|
|
||||||
If the fix needs to store information for each atom that persists from
|
If the fix needs to store information for each atom that persists from
|
||||||
timestep to timestep, it can manage that memory and migrate the info
|
timestep to timestep, it can manage that memory and migrate the info
|
||||||
with the atoms as they move from processors to processor by
|
with the atoms as they move from processors to processor by implementing
|
||||||
implementing the grow_arrays, copy_arrays, pack_exchange, and
|
the grow_arrays, copy_arrays, pack_exchange, and unpack_exchange
|
||||||
unpack_exchange methods. Similarly, the pack_restart and
|
methods. Similarly, the pack_restart and unpack_restart methods can be
|
||||||
unpack_restart methods can be implemented to store information about
|
implemented to store information about the fix in restart files. If you
|
||||||
the fix in restart files. If you wish an integrator or force
|
wish an integrator or force constraint fix to work with rRESPA (see the
|
||||||
constraint fix to work with rRESPA (see the :doc:`run_style <run_style>`
|
:doc:`run_style <run_style>` command), the initial_integrate,
|
||||||
command), the initial_integrate, post_force_integrate, and
|
post_force_integrate, and final_integrate_respa methods can be
|
||||||
final_integrate_respa methods can be implemented. The thermo method
|
implemented. The thermo method enables a fix to contribute values to
|
||||||
enables a fix to contribute values to thermodynamic output, as printed
|
thermodynamic output, as printed quantities and/or to be summed to the
|
||||||
quantities and/or to be summed to the potential energy of the system.
|
potential energy of the system.
|
||||||
|
|||||||
Reference in New Issue
Block a user