Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7abf851
fix(mta): implement ONIOM subtractive scheme for ML/MM boundary terms
HaoZeke Mar 20, 2026
8cdda86
fix(mta): always set PyTorch threads to ntomp (fixes thread-MPI blow-up)
HaoZeke Mar 22, 2026
e45f75e
feat(mta): add link-atoms and electrostatic-embedding MDP options
HaoZeke Mar 22, 2026
2314cd5
feat(mta): NNPot-style link atom replacement (correct ONIOM approach)
HaoZeke Mar 22, 2026
16ba984
fix(mta): correct threading comment, model-driven embedding, link docs
HaoZeke Mar 23, 2026
89616ec
fix(mta): provide requested charge inputs
HaoZeke May 5, 2026
dbb491e
merge: update metatomic base
HaoZeke May 6, 2026
4c2bc65
test(mta): align ONIOM topology expectations
HaoZeke May 6, 2026
0674569
test(threadmpi): wait on Windows thread handles
HaoZeke May 6, 2026
b21a99b
fix(mta): map link atoms by global atom index
HaoZeke May 6, 2026
2799a41
chore(mta): avoid shadowed model index
HaoZeke May 6, 2026
08b4864
fix(mta): support multiple link caps per boundary atom
HaoZeke May 6, 2026
5cafa17
fix(mta): use active link distance value
HaoZeke May 6, 2026
e4f532e
fix(mta): honor PBC shifts for link caps
HaoZeke May 6, 2026
42270f2
test(topology): cover shifted link force spread
HaoZeke May 6, 2026
eaae9b7
fix(mta): redistribute link cap output forces
HaoZeke May 6, 2026
cb7505c
test(topology): use tolerance for link force spread
HaoZeke May 6, 2026
8d92223
fix(mta): single-own link cap outputs
HaoZeke May 6, 2026
787a5f9
test(mta): require opt-in ONIOM preprocessing
HaoZeke May 6, 2026
ea93e8a
test(mta): fix ONIOM option test scaffolding
HaoZeke May 6, 2026
fa82917
feat(mta): make ONIOM preprocessing opt in
HaoZeke May 6, 2026
9ffa3fe
test(mta): update ONIOM option refdata
HaoZeke May 6, 2026
d905082
fix(mta): build model pairlist from all plain pairs
HaoZeke May 6, 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
53 changes: 53 additions & 0 deletions docs/reference-manual/special/metatomic.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.. _metatomic:

Metatomic potentials
====================

The Metatomic interface evaluates an exported atomistic model through the
applied-forces framework. The selected atoms are provided to the model as a
Metatomic ``System`` with positions, cell, periodic boundary conditions, atom
types, and engine-built neighbor lists.

By default, the Metatomic contribution is added on top of the unmodified
molecular-mechanics topology. This additive mode is useful as a control
calculation and for models that augment, rather than replace, force-field terms.

For embedded subsystem simulations where the Metatomic model replaces the
molecular-mechanics description of the selected atoms, :mdp:`metatomic-oniom`
enables the ONIOM-style subtractive scheme:

.. math::

E = E_\mathrm{MM}(\mathrm{full}) + E_\mathrm{ML}(\mathrm{embedded})
- E_\mathrm{MM}(\mathrm{embedded})

The subtractive term is applied through embedded-system topology preprocessing:
bonded and non-bonded molecular-mechanics terms represented by the model are
removed from the classical force-field contribution, while the model energy is
added through the Metatomic force provider. Boundary bonded terms involving
both Metatomic and MM atoms remain in the molecular-mechanics topology.

Boundary link atoms
-------------------

The :mdp:`metatomic-link-atoms` option enables hydrogen caps at bonds that cross
the Metatomic/MM boundary and requires :mdp:`metatomic-oniom`. Direct MM
neighbors bonded to selected Metatomic atoms are included in the embedded atom
set so the bonded terms at the boundary are handled consistently. During model
evaluation, these boundary atoms are represented as hydrogen link atoms placed
along the corresponding boundary bond. The link-atom position is part of the
automatic differentiation graph, so forces are propagated back to the real atoms
connected by the boundary bond.

This option requires a model trained for link-atom-capped boundary chemistry.
If the same boundary MM atom is bonded to multiple selected Metatomic atoms,
each cut bond is represented by a distinct hydrogen cap in the model input.

Model-requested charges
-----------------------

Metatomic models can declare additional inputs through their
``requested_inputs`` metadata. When a model requests ``charges`` or a
``charges/<variant>`` input, |Gromacs| provides a per-atom Metatomic
``TensorMap`` with ``quantity = charge`` and ``unit = e``. Charge inputs are
model-controlled; no :ref:`mdp` option enables or disables them.
Comment on lines +49 to +53

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also link the page where we give all additional inputs that we support.

2 changes: 1 addition & 1 deletion docs/reference-manual/special/special.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ the use of |Gromacs| for specific scientific problems.
colvars
plumed
nnpot
metatomic
fmm


28 changes: 28 additions & 0 deletions docs/user-guide/mdp-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3798,6 +3798,34 @@ interface implementation follow :ref:`nnpot`.
(0.1) [nm] Distance between link atom and the bonded MM atom.


.. _mdp-metatomic:

Metatomic simulations
^^^^^^^^^^^^^^^^^^^^^

The Metatomic interface evaluates exported atomistic models through the
applied-forces framework. Further details are described in :ref:`metatomic`.

.. mdp:: metatomic-oniom

(false) Enable the subtractive ONIOM topology preprocessing for the selected
Metatomic input group. When enabled, bonded and non-bonded
molecular-mechanics terms represented by the model are removed from the
classical force-field contribution and the Metatomic model contribution is
added through the applied-forces framework. When disabled, the Metatomic
contribution is added on top of the unmodified molecular-mechanics topology.

.. mdp:: metatomic-link-atoms

(false) Enable hydrogen link atoms at bonds crossing the Metatomic/MM
boundary. Direct MM neighbors bonded to selected Metatomic atoms are included
in the embedded atom set and represented as hydrogen caps during model
evaluation. This requires :mdp:`metatomic-oniom` and a model trained for
link-atom-capped boundary chemistry. If a boundary MM atom is bonded to
multiple selected Metatomic atoms, each cut bond is represented by a distinct
hydrogen cap in the model input.
Comment on lines +3809 to +3826

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the options exclusive?

I wonder why we can't always turn on the ONIOM option. And maybe we should add a link to some deeper infos what ONIOM is.



.. _mdp-fmm:

Fast Multipole Method (FMM) Interface
Expand Down
16 changes: 11 additions & 5 deletions src/external/thread_mpi/test/notmpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,25 @@ int main(int argc, char *argv[])
#elif defined(THREAD_WINDOWS)
/* Windows threads here */
{
DWORD *th;

th = (DWORD*)malloc(sizeof(DWORD)*n);
std::vector<HANDLE> threads(n);
std::vector<DWORD> threadIds(n);

for (i = 1; i < n; i++)
{
CreateThread(NULL, 0, thread_starter, (void*)(id_array+i), 0, th+i);
threads[i] =
CreateThread(NULL, 0, thread_starter, (void*)(id_array+i), 0, &threadIds[i]);
if (threads[i] == NULL)
{
fprintf(stderr, "CreateThread failed with error %lu\n", GetLastError());
exit(1);
}
}
thread_fn(id_array+0);

for (i = 1; i < n; i++)
{
WaitForSingleObject(th+i, INFINITE);
WaitForSingleObject(threads[i], INFINITE);
CloseHandle(threads[i]);
}
}
#endif
Expand Down
Loading
Loading