make ramp more flexible by defining lambda through a variable

This commit is contained in:
Axel Kohlmeyer
2023-02-27 16:01:17 -05:00
parent 83f936f31b
commit 446913f2f3
9 changed files with 122 additions and 76 deletions

View File

@ -8,17 +8,18 @@ Syntax
.. parsed-literal::
fix ID group-ID alchemy
fix ID group-ID alchemy v_name
* ID, group-ID are documented in :doc:`fix <fix>` command
* alchemy = style name of this fix command
* v_name = variable with name that determines the :math:`\lambda_p` value
Examples
""""""""
.. code-block:: LAMMPS
fix trans all alchemy
fix trans all alchemy v_ramp
Description
"""""""""""
@ -30,14 +31,17 @@ simulation between two topologies (i.e. the same number and positions of
atoms, but differences in atom parameters like type, charge, bonds,
angles and so on). For this a :ref:`multi-partition run <partition>` is
required with exactly two partitions. During the MD run, the fix will
will determine a factor :math:`\lambda_p` that will be linearly ramped
*down* from 1.0 to 0.0 for the *first* partition (*p=0*) and ramped *up*
from 0.0 to 1.0 for the *second* partition (*p=1*). The forces used for
the propagation of the atoms will be the sum of the forces of the two
systems combined and scaled with their respective :math:`\lambda_p`
factor. This allows to perform transformations that are not easily
possible with :doc:`pair style hybrid/scaled <pair_hybrid>`, :doc:`fix
adapt <fix_adapt>` or :doc:`fix adapt/fep <fix_adapt_fep>`.
will determine a factor, :math:`\lambda_p`, for each partition *p* that
will be taken from an equal style or equivalent :doc:`variable
<variable>`. Typically, this variable would be chose to linearly ramp
*down* from 1.0 to 0.0 for the *first* partition (*p=0*) and linearly
ramp *up* from 0.0 to 1.0 for the *second* partition (*p=1*). The
forces used for the propagation of the atoms will be the sum of the
forces of the two systems combined and scaled with their respective
:math:`\lambda_p` factor. This allows to perform transformations that
are not easily possible with :doc:`pair style hybrid/scaled
<pair_hybrid>`, :doc:`fix adapt <fix_adapt>` or :doc:`fix adapt/fep
<fix_adapt_fep>`.
Due to the specifics of the implementation, the initial geometry and
dimensions of the system must be exactly the same and the fix will
@ -56,6 +60,8 @@ copper/aluminum bronze.
.. code-block:: LAMMPS
variable name world pure alloy
create_box 2 box
create_atoms 1 box
pair_style eam/alloy
@ -66,6 +72,15 @@ copper/aluminum bronze.
if "${name} == alloy" then &
"set type 1 type/fraction 2 0.05 6745234"
# define ramp variable to combine the two different partitions
if "${name} == pure" then &
"variable ramp equal ramp(1.0,0.0)" &
else &
"variable ramp equal ramp(0.0,1.0)"
fix 2 all alchemy v_ramp
The ``examples/PACKAGES/alchemy`` folder contains complete example
inputs for this command.
@ -78,7 +93,7 @@ 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.
This fix stores a global scalar (the current value of :math:`\lambda_p`)
and a global vector or length 3 which contains the potential energy of
and a global vector of length 3 which contains the potential energy of
the first partition, the second partition and the combined value,
respectively. The global scalar is unitless and "intensive", the vector
is in :doc:`energy units <units>` and "extensive". These values can be
@ -86,14 +101,6 @@ used by any command that uses a global value from a fix as input. See
the :doc:`Howto output <Howto_output>` doc page for an overview of
LAMMPS output options.
The value of :math:`\lambda_p` is influenced by the *start/stop* keywords
of the :doc:`run <run>` command. Without them it will be ramped
linearly from 1.0 to 0.0 (partition 1) and 0.0 to 1.0 (partition 2)
during the steps of a run, with
*start/stop* keywords the ramp is from the *start* time step to the
*stop* timestep. This allows to break down a simulation over multiple
*run* commands or to continue transparently from a restart.
This fix is not invoked during :doc:`energy minimization <minimize>`.
Restrictions