Skip to content

Run EMLE in OpenMM without Sire - #39

Closed
JMorado wants to merge 1 commit into
mainfrom
feature/emle-torch
Closed

JMorado wants to merge 1 commit into
mainfrom
feature/emle-torch

Conversation

@JMorado

@JMorado JMorado commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

EMLEPotential no longer uses Sire. It is one openmm-torch TorchForce (TorchScript), replayed from a CUDA graph, so no Python runs at each step.

The energy is E(lambda) = E_MM[ML charges (1 - lambda) q] + lambda * E_EMLE. NonbondedForce offsets scale the ML charges, so lambda = 0 is the MM System with PME, and lambda = 1 has EMLE for all ML-MM electrostatics. With periodic boundary conditions, EMLE uses PME by default (electrostatics="pme", from chemle/emle-engine#133). lambda is a global parameter, so EMLE windows can share one Context.

Speed, ethanol in 1000 waters, 1 fs, RTX 4090: MM 0.11 ms/step; MM + EMLE (PME) 1.35 ms/step (64 ns/day). The old Sire path did not finish the example smoke test in 25 minutes.

Tests: unit tests against emle-engine's model evaluated directly (PME, cutoff, vacuum) and against MM Systems built by hand with scaled charges; GPU tests for lambda = 0, shared Contexts, lambda taken from MLInterpolation, and the CUDA graph.

Needs: emle-engine with PME. environment.yaml pins the head of chemle/emle-engine#133 until it is merged.

Changelog:

  • Changed: EMLEPotential runs as a TorchForce with PME, without Sire.
  • Changed: EMLE lambda is a global parameter (lambda_emle, or lambda_interpolate when it comes from MLInterpolation).
  • Removed: EMLE options of the Sire path, the lambda levers, emle_plus, and the strategy inputs that only EMLE used.

EMLEPotential is now one openmm-torch TorchForce (TorchScript), replayed
from a CUDA graph on CUDA devices. The MM charges of the ML atoms are
scaled by 1 - lambda with NonbondedForce offsets, and the force adds
lambda * E_EMLE. With periodic boundary conditions, EMLE sums the ML-MM
electrostatics with PME by default. lambda is a global parameter, so
windows with EMLE can share one Context.

The Sire EMLE path, the lambda levers and the strategy inputs that only
EMLE used are removed.
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
/home/runner/micromamba/envs/gha-test-env/lib/python3.12/site-packages/fes_ml
   _optional.py11373%34–36
   analysis.py1587254%48, 52, 72, 76, 80, 83–86, 90, 105–110, 134, 137, 139–143, 157, 159, 163, 186, 189, 191, 193, 211, 216, 218–222, 233–244, 255–277, 281
   checkpoint.py51296%86, 95
   cli.py521277%37, 55, 58, 65–71, 75–76, 80
   fes.py3562693%145–146, 150–153, 168, 331, 351, 365, 536, 538, 584, 589, 630–633, 669–672, 675, 717, 759, 765, 830
   log.py31584%47, 91–92, 95–96
   mts.py621379%63, 65, 68, 70, 111–117, 120, 146
   output.py61493%92–93, 96–97
   protocol.py3695585%142–143, 147–148, 177, 198, 224, 227, 275, 284, 295–296, 301, 303, 333, 348, 355, 367, 372–373, 376, 380, 389–390, 396, 403–404, 413, 415, 422, 425, 429, 431, 448, 461–463, 465, 488–489, 527, 547, 557, 589–593, 598–606
   provenance.py1221191%73, 78, 84, 110, 148–151, 229, 234, 241
   sampling.py49296%49–50
   utils.py481569%92–112
/home/runner/micromamba/envs/gha-test-env/lib/python3.12/site-packages/fes_ml/_compat
   openff.py13130%9–33
/home/runner/micromamba/envs/gha-test-env/lib/python3.12/site-packages/fes_ml/alchemical
   alchemical_factory.py35683%58, 64–67, 90
   alchemical_state.py31681%64, 66, 68, 70, 72, 74
   alchemist.py2301394%103, 107–120, 124, 135, 139, 198, 319, 358
   groups.py31294%56–57
/home/runner/micromamba/envs/gha-test-env/lib/python3.12/site-packages/fes_ml/alchemical/modifications
   _emle_torch.py35350%7–73
   base_modification.py1171488%165, 197, 204–207, 217, 222, 227, 250, 274–277, 317
   charge_scaling.py42490%26, 86, 88–89
   charge_transfer.py674730%35, 74–92, 132–193
   custom_lj.py462839%41, 99–168
   emle_potential.py1082478%48, 147, 149, 154, 160–169, 171, 176, 213–226, 236
   intramolecular.py1721293%26, 41, 56, 146–152, 178, 270
   lj_softcore.py98496%27, 97, 128, 181
   ml_base_modification.py46198%92
   ml_correction.py321456%34, 82–102
   ml_interpolation.py31197%34
   ml_potential.py30293%32, 96
/home/runner/micromamba/envs/gha-test-env/lib/python3.12/site-packages/fes_ml/alchemical/strategies
   __init__.py9367%22–24
   base_strategy.py162796%65, 107, 169, 194–195, 207, 327
   openff_strategy.py2152150%3–638
   sire_strategy.py61789%51, 57, 66–70
TOTAL299367877% 
Tests Skipped Failures Errors Time
303 4 💤 10 ❌ 0 🔥 2m 46s ⏱️

@JMorado

JMorado commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator Author

Replaced by #40 and #41, with a clean history.

@JMorado JMorado closed this Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant