Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
6df663b
Add atomistic variables for local averages in APIP.
d-immel Aug 11, 2025
1aab367
Add lambda_la as flag to force pair styles.
d-immel Aug 14, 2025
285074a
Add local averaging csp fix and pair style.
d-immel Aug 14, 2025
b67c993
Fix some names.
d-immel Aug 14, 2025
be3dc51
Cleanup old code.
d-immel Aug 15, 2025
2074b30
Make constant csp pairs default for fix lambda/la/csp/apip.
d-immel Aug 15, 2025
e2e0b83
Add example for local averaging of the CSP with APIP.
d-immel Aug 15, 2025
8eb8719
Rebuild atom map for fix lambda/la/csp/apip if required.
d-immel Aug 18, 2025
bbb3ff5
Update fix name.
d-immel Aug 19, 2025
7a176a4
Improve logmessages of APIP package.
d-immel Aug 22, 2025
4e27584
Add lambda_non_group option for local CSP averaging of APIP.
d-immel Sep 16, 2025
8d3980b
Update conservative APIP example.
d-immel Jan 19, 2026
de70267
Fix memory leaks of fix lambda/la/csp/apip.
d-immel Jan 19, 2026
a2571de
Add cumulative scalar as output to detect changed CSP-pairs in non-co…
d-immel Jan 20, 2026
22ac037
Add restart functionality to the conservative APIP potential.
d-immel Jan 21, 2026
2cc83c7
Init vflag_either in Fix::v_setup().
d-immel Jan 27, 2026
e8e26c1
Calculate force in fix lambda/la/csp/apip instead of own pair style.
d-immel Jan 27, 2026
db2d001
Update energies directly without ev_tally_full.
d-immel Jan 27, 2026
b5b4d75
Cleanup.
d-immel Jan 28, 2026
0e84fd5
Add load-balancing example for conservative APIP.
d-immel Jan 29, 2026
f0f6022
Make csp_cut optional for conservative APIP fix.
d-immel Jan 29, 2026
fc6d293
Use load-balancing in APIP example.
d-immel Jan 29, 2026
c2317f9
Update APIP documentation.
d-immel Jan 29, 2026
9482ed5
Merge branch 'develop' into apip_local_average
d-immel Jan 29, 2026
65212db
Add missing override.
d-immel Jan 30, 2026
4c8da07
Update APIP documentation.
d-immel Jan 30, 2026
1b56d05
Address some issues flagged by code analysis.
d-immel Jan 30, 2026
865a934
Update new APIP example logs.
d-immel Jan 30, 2026
603f553
document default value
d-immel Jan 30, 2026
ba8d08d
Apply clang-format.
d-immel Jan 30, 2026
fa2d7e4
Apply suggestion from @Copilot
d-immel Feb 2, 2026
a0300f3
fix typo
d-immel Feb 2, 2026
0ca2cd6
Remove atom style apip/la and extend apip.
d-immel Feb 2, 2026
94c97c5
Apply clang-format.
d-immel Feb 2, 2026
49da757
Remove debug code.
d-immel Feb 2, 2026
03dd914
Add version changed/added in doc.
d-immel Feb 3, 2026
99a8653
Merge branch 'develop' into apip_local_average
akohlmey Feb 3, 2026
e499ffe
Use FixStoreAtom instead of new global per-atom apip variables.
d-immel Feb 13, 2026
b6d2e3d
Use peratom_freq as argument for fix lambda/la/csp/apip.
d-immel Feb 17, 2026
b690e81
Update APIP logs.
d-immel Feb 18, 2026
f9db085
Revert "Init vflag_either in Fix::v_setup()."
d-immel Feb 18, 2026
0a54731
Prevent usage of uninitialised vflag_either.
d-immel Feb 18, 2026
a98aeff
apply clang-format
d-immel Feb 18, 2026
004d2a4
Update APIP documentation.
d-immel Feb 18, 2026
7f23160
Merge branch 'apip_local_average' of github into apip_local_average.
d-immel Feb 18, 2026
db3ee96
Merge branch 'develop' into apip_local_average
akohlmey Feb 19, 2026
bfd2b85
correct some minor style and spelling issues and reformat blocks
akohlmey Feb 19, 2026
c10bd59
add missing include statement
akohlmey Feb 19, 2026
b75dfcc
Merge pull request #4869 from d-immel/apip_local_average
akohlmey Feb 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/src/Commands_fix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ OPT.
* :doc:`indent <fix_indent>`
* :doc:`ipi <fix_ipi>`
* :doc:`lambda/apip <fix_lambda_apip>`
* :doc:`lambda/la/csp/apip <fix_lambda_la_csp_apip>`
* :doc:`lambda_thermostat/apip <fix_lambda_thermostat_apip>`
* :doc:`langevin (k) <fix_langevin>`
* :doc:`langevin/drude <fix_langevin_drude>`
Expand Down
94 changes: 87 additions & 7 deletions doc/src/Howto_apip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ Adaptive-precision interatomic potentials (APIP)
================================================

The :ref:`PKG-APIP <PKG-APIP>` enables use of adaptive-precision potentials
as described in :ref:`(Immel) <Immel2025_1>`.
as described in :ref:`(Immel2025) <Immel2025_1>` and
:ref:`(Immel2026) <Immel2026_2>`.
In the context of this package, precision refers to the accuracy of an interatomic
potential.

Expand All @@ -29,13 +30,13 @@ kept constant as explained below.

The potential energy :math:`E_i` of an atom :math:`i` described by an
adaptive-precision
interatomic potential is given by :ref:`(Immel) <Immel2025_1>`
interatomic potential is given by :ref:`(Immel2025) <Immel2025_1>`

.. math::

E_i = \lambda_i E_i^\text{(fast)} + (1-\lambda_i) E_i^\text{(precise)},

whereas :math:`E_i^\text{(fast)}` is the potential energy of atom :math:`i`
where :math:`E_i^\text{(fast)}` is the potential energy of atom :math:`i`
according to a fast interatomic potential,
:math:`E_i^\text{(precise)}` is the potential energy according to a precise
interatomic potential and :math:`\lambda_i\in[0,1]` is the
Expand Down Expand Up @@ -65,14 +66,41 @@ potential is explained in :ref:`here <implementing_new_apip_styles>`.
The switching parameter :math:`\lambda_i` that combines the two potentials
can be dynamically calculated during a
simulation.
There are two ways to calculate dynamic switching parameters.

1. according to :ref:`(Immel2026) <Immel2026_2>` with a differentiable
switching parameter that results in a conservative potential.
Energy and momentum are (in the absence of external forces) conserved
by design.

2. according to :ref:`(Immel2025) <Immel2025_1>` with a non-differentiable
switching parameter. In this case, the implementation can be optimized for
performance by using the switching parameters of the previous timestep.
Thereby, one can perform most of the switching-parameter calculation within
the force-calculation routine and include this calculations in the load-
balancing. The potential is not conservative and energy- and
momentum-conservation are achieved through a local correction.

Alternatively, one can set a constant switching parameter before the start
of a simulation.
Using constant switching parameters results in a conservative potential.

To run a simulation with an adaptive-precision potential, one needs the
following components:

.. tabs::

.. tab:: dynamic switching parameter
.. tab:: conservative dynamic switching parameter

#. :doc:`atom_style apip conservative <atom_style>` so that the switching parameter :math:`\lambda_i` can be stored.
#. A fast potential: :doc:`eam/apip <pair_eam_apip>` or :doc:`pace/fast/apip <pair_pace_apip>`.
#. A precise potential: :doc:`pace/precise/apip <pair_pace_apip>`.
#. :doc:`fix lambda/la/csp/apip <fix_lambda_la_csp_apip>` to calculate a differentiable switching parameter :math:`\lambda_i`.
#. :doc:`pair_style hybrid/overlay <pair_hybrid>` to combine the previously mentioned pair_styles.
#. :doc:`fix atom_weight/apip <fix_atom_weight_apip>` to approximate the load caused by every atom, as the computations of the pair_styles are only required for a subset of atoms.
#. :doc:`fix balance <fix_balance>` to perform dynamic load balancing with the calculated load.

.. tab:: dynamic switching parameter with correction

#. :doc:`atom_style apip <atom_style>` so that the switching parameter :math:`\lambda_i` can be stored.
#. A fast potential: :doc:`eam/apip <pair_eam_apip>` or :doc:`pace/fast/apip <pair_pace_apip>`.
Expand Down Expand Up @@ -102,12 +130,60 @@ Example
.. note::

How to select the values of the parameters of an adaptive-precision
interatomic potential is discussed in detail in :ref:`(Immel) <Immel2025_1>`.
interatomic potential is discussed in detail in :ref:`(Immel2025) <Immel2025_1>`
and :ref:`(Immel2026) <Immel2026_2>`.


.. tabs::

.. tab:: dynamic switching parameter
.. tab:: conservative dynamic switching parameter

Lines like these would appear in the input script:

.. code-block:: LAMMPS

atom_style apip conservative
comm_style tiled

pair_style hybrid/overlay eam/fs/apip pace/precise/apip
pair_coeff * * eam/fs/apip Cu.eam.fs Cu
pair_coeff * * pace/precise/apip Cu.yace Cu

# calculate a differentiable switching parameter to obtain
# a conservative potential
fix 2 all lambda/la/csp/apip 0.24 1.5 11.0 12.0 bcc

fix 4 all atom_weight/apip 100 eam ace 0 0 all

variable myweight atom f_4

fix 5 all balance 100 1.1 rcb weight var myweight

First, the :doc:`atom_style apip conservative <atom_style>` and the communication style are set.

.. note::
Note, that :doc:`comm_style <comm_style>` *tiled* is required for the style *rcb* of
:doc:`fix balance <fix_balance>`, but not for APIP.
However, the flexibility offered by the balancing style *rcb*, compared to the
balancing style *shift*, is advantageous for APIP.

A conservative adaptive-precision EAM-ACE potential is defined based on
the differentiable switching parameter calculated by
:doc:`fix lambda/la/csp/apip <fix_lambda_la_csp_apip>`, i.e.,
:math:`\lambda` is calculated from the locally averaged CSP.
The :doc:`pair_style hybrid/overlay <pair_hybrid>` combines the fast EAM
and the precise ACE potential, interpolated by the corresponding
switching parameter.
Furthermore, the :doc:`fix lambda/la/csp/apip <fix_lambda_la_csp_apip>`
calculates the forces caused by the differentiation of the switching
parameter. Thereby, one obtains a conservative potential
(:math:`\pmb{F}_i = -\nabla_i \sum_k E_k`) that by design conserves
energy and momentum in the absence of external forces.

The fix 4 calculates the computational weight that is used by fix 5 to
balance the load between different processors.

.. tab:: dynamic switching parameter with correction

Lines like these would appear in the input script:

Expand Down Expand Up @@ -222,4 +298,8 @@ of new adaptive-precision potentials.

.. _Immel2025_1:

**(Immel)** Immel, Drautz and Sutmann, J Chem Phys, 162, 114119 (2025)
**(Immel2025)** Immel, Drautz and Sutmann, J Chem Phys, 162, 114119 (2025)

.. _Immel2026_2:

**(Immel2026)** Immel, Drautz and Sutmann, arXiv:2512.07693
6 changes: 6 additions & 0 deletions doc/src/Packages_details.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ D. Immel, R. Drautz and G. Sutmann, "Adaptive-precision potentials for
large-scale atomistic simulations", J. Chem. Phys. 162, 114119 (2025)
`link <immel2025_doi_>`_

D. Immel, R. Drautz and G. Sutmann, "Conservative adaptive-precision
interatomic potentials", arXiv:2512.07693
`link <immel2026_doi_>`_

Adaptive-precision means, that a fast interatomic potential, such as EAM,
is coupled to a precise interatomic potential, such as ACE.
This package provides the required pair_styles and fixes to run an efficient,
Expand All @@ -209,6 +213,7 @@ In the context of this package, precision refers to the accuracy of an interatom
potential.

.. _immel2025_doi: https://doi.org/10.1063/5.0245877
.. _immel2026_doi: https://doi.org/10.48550/arXiv.2512.07693

**Authors:**

Expand All @@ -232,6 +237,7 @@ The APIP package requires also the installation of ML-PACE, which has
* ``examples/PACKAGES/apip``
* :doc:`fix atom_weight/apip <fix_atom_weight_apip>`
* :doc:`fix lambda/apip <fix_lambda_apip>`
* :doc:`fix lambda/la/csp/apip <fix_lambda_la_csp_apip>`
* :doc:`fix lambda_thermostat/apip <fix_lambda_thermostat_apip>`
* :doc:`pair_style eam/apip <pair_eam_apip>`
* :doc:`pair_style lambda/zone/apip <pair_lambda_zone_apip>`
Expand Down
19 changes: 17 additions & 2 deletions doc/src/atom_style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Syntax
.. parsed-literal::

args = none for any style except the following
*apip* arg = *conservative*/*thermostat* (optional) for conservative APIP/lambda thermostat APIP
*body* args = bstyle bstyle-args
bstyle = style of body particles
bstyle-args = additional arguments specific to the bstyle
Expand Down Expand Up @@ -117,10 +118,14 @@ the Additional Information section below.
- *bond* + "angle data"
- :ref:`MOLECULE <PKG-MOLECULE>`
- bead-spring polymers with stiffness
* - *apip*
* - *apip thermostat*
- *atomic* + apip_lambda, apip_lambda_required, apip_lambda_input, apip_lambda_const, apip_lambda_input_ta, apip_e_fast, apip_e_precise, apip_f_const_lambda, apip_f_dyn_lambda
- :ref:`APIP <PKG-APIP>`
- adaptive-precision interatomic potentials(APIP), see :doc:`APIP howto <Howto_apip>`
- adaptive-precision interatomic potentials(APIP) with a :doc:`lambda thermostat <fix_lambda_thermostat_apip>`, see :doc:`APIP howto <Howto_apip>`
* - *apip conservative*
- *atomic* + apip_lambda, apip_lambda_required, apip_e_fast, apip_e_precise
- :ref:`APIP <PKG-APIP>`
- conservative adaptive-precision interatomic potentials(APIP), see :doc:`APIP howto <Howto_apip>`
* - *atomic*
- tag, type, x, v, f, image, mask
-
Expand Down Expand Up @@ -273,6 +278,14 @@ with both flavors of mass.
Additional information about specific atom styles
"""""""""""""""""""""""""""""""""""""""""""""""""

.. versionchanged:: TBD

For the *apip* style, one can choose between the style for
conservative potentials and the style for the
:doc:`lambda thermostat <fix_lambda_thermostat_apip>`.
The :doc:`Howto apip <Howto_apip>` describes the differences between
both use cases.

For the *body* style, the particles are arbitrary bodies with internal
attributes defined by the "style" of the bodies, which is specified by
the *bstyle* argument. Body particles can represent complex entities,
Expand Down Expand Up @@ -485,6 +498,8 @@ Default

The default atom style is *atomic*. If atom_style *sphere* or
*bpm/sphere* is used, its default argument is 0.
If atom_style *apip* is used, its default argument is
'thermostat'.

----------

Expand Down
23 changes: 18 additions & 5 deletions doc/src/compute_property_atom.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ Syntax
vfrac, s0, espin, eradius, ervel, erforce,
rho, drho, e, de, cv, buckling,
apip_lambda, apip_lambda_input, apip_e_fast,
apip_e_precise
apip_e_precise, apip_la_inp, apip_la_avg,
apip_la_norm

.. parsed-literal::

Expand Down Expand Up @@ -78,6 +79,9 @@ Syntax
*apip_lambda* = switching parameter
*apip_lambda_input* = input used to calculate the switching parameter
*apip_e_fast,apip_e_precise* = potential energies mixed by the adaptive-precision potential
*apip_la_inp* = input used for the local averaging of the descriptor
*apip_la_norm* = locally averaged radial weighting function used for normalization
*apip_la_avg* = locally averaged descriptor used to calculate the switching parameter

.. parsed-literal::

Expand Down Expand Up @@ -173,10 +177,19 @@ triangular particles and define the corner points of each triangle.

The accessible quantities from the :doc:`APIP package <Howto_apip>` are
explained in the doc pages of this package in detail.
In short: *apip_lambda* is the switching parameter :math:`\lambda\in[0,1]`,
that is calculated from *apip_lambda_input* and that mixes the energies
of a fast (*apip_e_fast*) and a precise (*apip_e_precise*) potential
into an adaptive-precision energy.
In short: *apip_lambda* is the switching parameter :math:`\lambda\in[0,1]`.
The switching parameter can be calculated from *apip_lambda_input* and mixes
the energies of a
fast (*apip_e_fast*) and a precise (*apip_e_precise*) potential into an
adaptive-precision energy.

.. versionchanged:: TBD

Alternatively, the switching parameter can be calculated from a
locally averaged descriptor (*apip_la_avg*) to obtain a conservative
potential.
The descriptor is calculated from an atomic property (*apip_la_inp*) and
normalized with a locally averaged weighting function (*apip_la_norm*).

.. note::

Expand Down
1 change: 1 addition & 0 deletions doc/src/fix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ accelerated styles exist.
* :doc:`indent <fix_indent>` - impose force due to an indenter
* :doc:`ipi <fix_ipi>` - enable LAMMPS to run as a client for i-PI path-integral simulations
* :doc:`lambda/apip <fix_lambda_apip>` - compute switching parameter, that controls the precision of an :doc:`APIP potential <Howto_apip>`
* :doc:`lambda/la/csp/apip <fix_lambda_la_csp_apip>` - compute a conservative switching parameter, that controls the precision of an :doc:`APIP potential <Howto_apip>`
* :doc:`langevin <fix_langevin>` - Langevin temperature control
* :doc:`langevin/drude <fix_langevin_drude>` - Langevin temperature control of Drude oscillators
* :doc:`langevin/eff <fix_langevin_eff>` - Langevin temperature control for the electron force field model
Expand Down
2 changes: 1 addition & 1 deletion doc/src/fix_lambda_apip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Restart, fix_modify, output, run start/stop, minimize info
The saved history of the switching parameter :math:`\lambda_i`
and the saved history of
:math:`\lambda_i^\text{input}` are written to
:doc:`binary restart files <restart>` allow a smooth restart of a simulation.
:doc:`binary restart files <restart>` to allow a smooth restart of a simulation.
None of the :doc:`fix_modify <fix_modify>` options are relevant to this fix.

If the *store_atomic_stats* argument is used, basic statistics is provided as
Expand Down
Loading