fescape 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. fescape-0.1.0/LICENSE +21 -0
  2. fescape-0.1.0/MANIFEST.in +3 -0
  3. fescape-0.1.0/PKG-INFO +396 -0
  4. fescape-0.1.0/README.md +361 -0
  5. fescape-0.1.0/docs/DESIGN.md +123 -0
  6. fescape-0.1.0/docs/sampling.md +139 -0
  7. fescape-0.1.0/environment-orb.yml +9 -0
  8. fescape-0.1.0/environment-uma.yml +10 -0
  9. fescape-0.1.0/environment.yml +10 -0
  10. fescape-0.1.0/example/README.md +32 -0
  11. fescape-0.1.0/example/ligand_active_site.yaml +45 -0
  12. fescape-0.1.0/example/mm_only.yaml +32 -0
  13. fescape-0.1.0/example/pocket_with_link_h.yaml +57 -0
  14. fescape-0.1.0/pyproject.toml +51 -0
  15. fescape-0.1.0/setup.cfg +4 -0
  16. fescape-0.1.0/src/fescape/__init__.py +13 -0
  17. fescape-0.1.0/src/fescape/_omm.py +302 -0
  18. fescape-0.1.0/src/fescape/_vendor/__init__.py +1 -0
  19. fescape-0.1.0/src/fescape/_vendor/openmmml/PROVENANCE.md +122 -0
  20. fescape-0.1.0/src/fescape/_vendor/openmmml/__init__.py +3 -0
  21. fescape-0.1.0/src/fescape/_vendor/openmmml/mechanicalembedding.py +201 -0
  22. fescape-0.1.0/src/fescape/_vendor/openmmml/utilities.py +587 -0
  23. fescape-0.1.0/src/fescape/_window.py +150 -0
  24. fescape-0.1.0/src/fescape/analysis.py +147 -0
  25. fescape-0.1.0/src/fescape/backends.py +382 -0
  26. fescape-0.1.0/src/fescape/cli.py +278 -0
  27. fescape-0.1.0/src/fescape/committor.py +315 -0
  28. fescape-0.1.0/src/fescape/config.py +408 -0
  29. fescape-0.1.0/src/fescape/cv.py +146 -0
  30. fescape-0.1.0/src/fescape/cvsetup.py +341 -0
  31. fescape-0.1.0/src/fescape/defaults.py +106 -0
  32. fescape-0.1.0/src/fescape/engine_defaults.py +142 -0
  33. fescape-0.1.0/src/fescape/engines/__init__.py +11 -0
  34. fescape-0.1.0/src/fescape/engines/base.py +99 -0
  35. fescape-0.1.0/src/fescape/engines/mock.py +144 -0
  36. fescape-0.1.0/src/fescape/engines/openmm_nnpmm.py +794 -0
  37. fescape-0.1.0/src/fescape/fe_core.py +229 -0
  38. fescape-0.1.0/src/fescape/fes.py +621 -0
  39. fescape-0.1.0/src/fescape/geometry.py +165 -0
  40. fescape-0.1.0/src/fescape/md.py +46 -0
  41. fescape-0.1.0/src/fescape/mlmm.py +471 -0
  42. fescape-0.1.0/src/fescape/openmmml_adapter.py +453 -0
  43. fescape-0.1.0/src/fescape/parallel.py +456 -0
  44. fescape-0.1.0/src/fescape/pipeline.py +366 -0
  45. fescape-0.1.0/src/fescape/recorder.py +128 -0
  46. fescape-0.1.0/src/fescape/render.py +13 -0
  47. fescape-0.1.0/src/fescape/resdata.py +63 -0
  48. fescape-0.1.0/src/fescape/rxnpath.py +98 -0
  49. fescape-0.1.0/src/fescape/smwst.py +244 -0
  50. fescape-0.1.0/src/fescape/stages/__init__.py +1 -0
  51. fescape-0.1.0/src/fescape/stages/equilibrate.py +95 -0
  52. fescape-0.1.0/src/fescape/stages/minimize.py +44 -0
  53. fescape-0.1.0/src/fescape/stages/prepared.py +34 -0
  54. fescape-0.1.0/src/fescape/stages/release.py +52 -0
  55. fescape-0.1.0/src/fescape/stages/swarm.py +152 -0
  56. fescape-0.1.0/src/fescape/stages/ts.py +331 -0
  57. fescape-0.1.0/src/fescape/stages/umbrella.py +219 -0
  58. fescape-0.1.0/src/fescape/string.py +136 -0
  59. fescape-0.1.0/src/fescape/swarm.py +70 -0
  60. fescape-0.1.0/src/fescape/tsextract.py +362 -0
  61. fescape-0.1.0/src/fescape.egg-info/PKG-INFO +396 -0
  62. fescape-0.1.0/src/fescape.egg-info/SOURCES.txt +96 -0
  63. fescape-0.1.0/src/fescape.egg-info/dependency_links.txt +1 -0
  64. fescape-0.1.0/src/fescape.egg-info/entry_points.txt +2 -0
  65. fescape-0.1.0/src/fescape.egg-info/requires.txt +25 -0
  66. fescape-0.1.0/src/fescape.egg-info/top_level.txt +1 -0
  67. fescape-0.1.0/tests/test_backend_smoke.py +125 -0
  68. fescape-0.1.0/tests/test_backends.py +316 -0
  69. fescape-0.1.0/tests/test_cli.py +76 -0
  70. fescape-0.1.0/tests/test_committor.py +213 -0
  71. fescape-0.1.0/tests/test_committor_ensemble.py +196 -0
  72. fescape-0.1.0/tests/test_committor_workflow.py +132 -0
  73. fescape-0.1.0/tests/test_config.py +366 -0
  74. fescape-0.1.0/tests/test_core_cv.py +91 -0
  75. fescape-0.1.0/tests/test_core_cvsetup.py +256 -0
  76. fescape-0.1.0/tests/test_core_fes.py +370 -0
  77. fescape-0.1.0/tests/test_core_recorder.py +106 -0
  78. fescape-0.1.0/tests/test_core_smwst.py +223 -0
  79. fescape-0.1.0/tests/test_core_string.py +61 -0
  80. fescape-0.1.0/tests/test_examples.py +40 -0
  81. fescape-0.1.0/tests/test_fes_blocks.py +209 -0
  82. fescape-0.1.0/tests/test_geometry.py +107 -0
  83. fescape-0.1.0/tests/test_md_modes.py +296 -0
  84. fescape-0.1.0/tests/test_mlmm.py +495 -0
  85. fescape-0.1.0/tests/test_omm.py +227 -0
  86. fescape-0.1.0/tests/test_oniom_adapter.py +168 -0
  87. fescape-0.1.0/tests/test_openmmml_adapter.py +397 -0
  88. fescape-0.1.0/tests/test_parallel.py +315 -0
  89. fescape-0.1.0/tests/test_pipeline.py +402 -0
  90. fescape-0.1.0/tests/test_platform_fallback.py +72 -0
  91. fescape-0.1.0/tests/test_rxnpath.py +78 -0
  92. fescape-0.1.0/tests/test_shooting_selection.py +192 -0
  93. fescape-0.1.0/tests/test_swarm.py +19 -0
  94. fescape-0.1.0/tests/test_text_encoding.py +22 -0
  95. fescape-0.1.0/tests/test_ts_stage.py +81 -0
  96. fescape-0.1.0/tests/test_tsextract.py +182 -0
  97. fescape-0.1.0/tests/test_umbrella_weights.py +141 -0
  98. fescape-0.1.0/tests/test_usability.py +197 -0
fescape-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Takuto Ohmura
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include environment.yml environment-uma.yml environment-orb.yml
2
+ recursive-include docs *.md
3
+ recursive-include example *.md *.yaml
fescape-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,396 @@
1
+ Metadata-Version: 2.4
2
+ Name: fescape
3
+ Version: 0.1.0
4
+ Summary: Molecular dynamics and reaction free-energy sampling with MM, ML, and ML/MM Hamiltonians
5
+ Author: Takuto Ohmura
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/t-0hmura/fescape
8
+ Keywords: molecular-dynamics,free-energy,string-method,ML/MM,enzyme,pipeline,PMF
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
11
+ Requires-Python: >=3.12
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: numpy>=2.0
15
+ Requires-Dist: scipy>=1.18.1
16
+ Requires-Dist: click>=8.5.0
17
+ Requires-Dist: pyyaml>=6.0.3
18
+ Requires-Dist: ase>=3.29.0
19
+ Provides-Extra: dev
20
+ Requires-Dist: pytest>=9.1.1; extra == "dev"
21
+ Provides-Extra: md
22
+ Requires-Dist: openmm>=8.6.1; extra == "md"
23
+ Requires-Dist: openmmml>=1.8; extra == "md"
24
+ Requires-Dist: parmed>=4.3.1; extra == "md"
25
+ Requires-Dist: pymbar>=4.0.3; extra == "md"
26
+ Requires-Dist: netCDF4>=1.7.4; extra == "md"
27
+ Requires-Dist: matplotlib>=3.11.2; extra == "md"
28
+ Provides-Extra: mace
29
+ Requires-Dist: mace-torch>=0.3.16; extra == "mace"
30
+ Provides-Extra: uma
31
+ Requires-Dist: fairchem-core>=2.23.0; extra == "uma"
32
+ Provides-Extra: orb
33
+ Requires-Dist: orb-models>=0.7.0; extra == "orb"
34
+ Dynamic: license-file
35
+
36
+ # FEScape
37
+
38
+ Molecular dynamics and reaction free-energy sampling with MM, ML, and ML/MM Hamiltonians.
39
+
40
+ `string` optimizes a path with swarms of trajectories; `umbrella` samples a fixed path. Both use
41
+ umbrella sampling and MBAR to produce a PMF and candidate barrier structures. `ts` measures
42
+ committors from unbiased trajectories. The [`committor` workflow guide](https://github.com/t-0hmura/fescape/blob/master/docs/sampling.md) explains
43
+ configuration selection, a preview of the shooting budget, resuming a run, and interpreting the results.
44
+
45
+ ## Pipeline
46
+
47
+ fescape runs optional **MM endpoint preparation** (`minimize → equilibrate → release`, OpenMM, full PME box) and then a reaction free-energy method. `string` and `umbrella` sample MBAR CVs at `sample_stride`, record TS
48
+ structures at `record_stride`, and leave costly energy readback off unless `energy_stride` is set.
49
+
50
+ | command | what it does |
51
+ |---|---|
52
+ | `fescape string` | SMwST optimizes the path, then umbrella/MBAR → PMF + TS. Optional `intermediates:` give an initial path through several structures (multi-step); `--phase prepare/window/collect` supports scheduler arrays. |
53
+ | `fescape umbrella` | PMF along a **fixed** reaction coordinate you define in CV space. `--phase prepare/window/collect` supports one scheduler-array task per window; default `full` is unchanged. |
54
+ | `fescape ts` | Pointwise committor estimates, confidence intervals and censoring diagnostics for candidate structures; `n_shot_points>1` samples a distribution. |
55
+
56
+ The MM preparation and the FES methods run on OpenMM, with the SMwST, umbrella/MBAR and committor
57
+ algorithms built in ([DESIGN.md](https://github.com/t-0hmura/fescape/blob/master/docs/DESIGN.md)).
58
+
59
+ > **Choosing `intermediates` / `reaction_path`.** The initial path passes through the given CV waypoints or
60
+ > intermediate structures (periodic CVs are handled). `string` intermediates should therefore be low-energy
61
+ > reaction intermediates on the **same topology**, and `umbrella` segments should follow a reasonable route in
62
+ > CV space. A high-energy or strained waypoint gives a strained initial path, and the chained equilibration
63
+ > can diverge; the error message names the failing image. For a two-state reaction without an intermediate,
64
+ > omit `intermediates` and let `string` build the direct path.
65
+
66
+ ## System preparation from a PDB
67
+
68
+ fescape starts from an **MD-ready** system and does not build boxes or assign force-field parameters.
69
+ A typical route from a raw PDB is:
70
+
71
+ 1. **Parameterize + solvate** the reactant complex (e.g. with AmberTools `tleap`): protein FF (ff14SB) + ligand FF (GAFF2 from an antechamber `mol2` + `frcmod`), a periodic
72
+ water box, and neutralizing ions → one `complex.parm7` + `reactant.rst7`.
73
+ 2. **Make the product endpoint on the *same* topology**: generate the product geometry (same atoms,
74
+ reacted coordinates) as `product.rst7` — e.g. remap the product structure onto the solvated box,
75
+ keeping the water/ions and swapping only the solute coordinates. **R and P must share `complex.parm7`.**
76
+ 3. **Pick the reaction coordinate**: the CV atom pairs whose distance changes most between R and P (a
77
+ forming bond shrinks, a breaking bond grows) and the ML region (the reactive atoms treated by the MLIP).
78
+
79
+ Then hand `complex.parm7`, `reactant.rst7`, `product.rst7` to fescape.
80
+
81
+ ## Install
82
+
83
+ FEScape requires Python 3.12 or later. Use a separate environment for each ML backend:
84
+
85
+ - `environment.yml` — **MACE** (its required e3nn version).
86
+ - `environment-uma.yml` — **UMA** (FAIR-Chem's supported NumPy/PyTorch versions; UMA weights need a HuggingFace token).
87
+ - `environment-orb.yml` — **ORB** (its required nvalchemi-toolkit-ops version).
88
+
89
+ MACE and UMA require different e3nn versions. Current UMA and ORB releases also require incompatible
90
+ nvalchemi-toolkit-ops versions. These files install the current supported dependencies through pip;
91
+ the backend's dependency constraints determine which transitive versions can coexist.
92
+
93
+ A pure-`mm` run works in any of these environments. The environment files install the checkout in
94
+ editable mode, so run them from a clone:
95
+
96
+ ```bash
97
+ conda env create -f environment.yml # or environment-uma.yml / environment-orb.yml
98
+ ```
99
+
100
+ Without a clone, install the CUDA OpenMM extra and then a local fescape wheel or sdist with the
101
+ extras you need (shown here for MACE):
102
+
103
+ ```bash
104
+ pip install "openmm[cuda13]>=8.6.1"
105
+ pip install "./fescape-0.1.0-py3-none-any.whl[md,mace]"
106
+ ```
107
+
108
+ The environment files select OpenMM's CUDA 13 plugin, matching the current PyTorch GPU stack.
109
+ Check that your NVIDIA driver supports that stack. For a CPU installation, use
110
+ `pip install ".[md]"`; for a different supported CUDA stack, install OpenMM's matching CUDA extra.
111
+ The plain OpenMM wheel provides OpenCL, CPU and Reference. Verify the chosen platform with
112
+ `python -m openmm.testInstallation`.
113
+
114
+ On Linux GPU environments, expose the pip-installed CUDA compiler libraries before starting OpenMM:
115
+
116
+ ```bash
117
+ export LD_LIBRARY_PATH="$(python -c 'import sysconfig; print(sysconfig.get_path("purelib"))')/nvidia/cu13/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
118
+ python -m openmm.testInstallation
119
+ ```
120
+
121
+ ## Usage
122
+
123
+ ```bash
124
+ fescape init -o system.yaml # write a template config (shows reaction_path / committor blocks)
125
+ # edit system.yaml: topology/reactant/product, ml_region, cvs, md/engine/...
126
+
127
+ fescape string -c system.yaml # MM prep -> SMwST -> umbrella/MBAR -> PMF + TS
128
+ fescape umbrella -c system.yaml # MM prep -> umbrella along your fixed reaction coordinate -> PMF + TS
129
+ fescape ts -c system.yaml # assess candidate TS ensembles (alias: fescape committor)
130
+
131
+ fescape status -c system.yaml # per-stage completion (fingerprint-aware: stale stages read pending)
132
+ fescape run -c system.yaml # same as fescape string; umbrella and ts are separate commands
133
+ ```
134
+
135
+ FES pipeline commands are **restart-safe** and **idempotent**: a stage is re-run only if its output is missing or
136
+ its fingerprint (the config that affects it + its inputs + its upstream stage) changed. Editing
137
+ `fes.window_steps`, a CV, an endpoint, or the topology therefore invalidates that stage and everything
138
+ downstream — including the other FES method and the committor, which share the MM prep. Per-stage commands
139
+ (`fescape minimize/equilibrate/release/swarm`) run one stage each and are idempotent unless `--force`.
140
+
141
+ For scheduler arrays, split either method into one serial preparation, independent zero-based window
142
+ tasks, and one collection pass. For `string`, preparation includes the SMwST path optimization:
143
+
144
+ ```bash
145
+ fescape umbrella -c system.yaml -w run --phase prepare
146
+ fescape umbrella -c system.yaml -w run --phase window --window "$WINDOW_INDEX"
147
+ fescape umbrella -c system.yaml -w run --phase collect
148
+
149
+ fescape string -c system.yaml -w run --phase prepare
150
+ fescape string -c system.yaml -w run --phase window --window "$WINDOW_INDEX"
151
+ fescape string -c system.yaml -w run --phase collect
152
+ ```
153
+
154
+ Each array task must receive exactly one scheduler-visible GPU through `CUDA_VISIBLE_DEVICES` or
155
+ `NVIDIA_VISIBLE_DEVICES`; use `fes.max_workers: 1` and omit `fes.gpu_ids` (or set `[0]`, the visible
156
+ logical device). A window publishes its generation-bound completion marker only after its requested
157
+ steps and payloads finish. Its marker also fingerprints that window's force/equilibration/stride
158
+ protocol, so changing `window_steps_by_index` for one index invalidates only that window while retaining
159
+ the preparation and unaffected windows; changing a global production setting invalidates every affected
160
+ marker. Collection rejects missing, stale, or partial array output. Analysis-only settings such as
161
+ `n_bins_s` reuse the samples. A single-node full run can instead set `fes.max_workers > 1` to fan
162
+ production windows across its visible GPUs.
163
+
164
+ ### Output
165
+
166
+ Stages write next to the config. The main result is the **PMF barrier** printed as
167
+ `[string]/[umbrella] PMF barrier = X kcal/mol` (also in `fes.npz`), and the artifacts are:
168
+
169
+ | path | what |
170
+ |---|---|
171
+ | `a_min/`, `b_eq/`, `c_release/` | MM-prep endpoint structures (`{R,P}/…rst7`); `md.preparation: input` copies the prepared inputs |
172
+ | `d_swarm/` (string) · `d_umbrella/` (umbrella) | `fes.npz` (PMF `F_s`, `dF_s`, CV grid, MBAR diagnostics), `string_final.npy`, `pmf.png`/`fes_2d.png`, `sampling.md`, `engine.json` (resolved model and settings), `<method>.nc`/`.npz` recordings when `record_stride > 0`, and candidate `ts.rst7` (single barrier) or `ts_1.rst7, ts_2.rst7 …` (multi-step) with `ts_meta.json`. String adds `convergence.png` and `smwst/`; umbrella adds `seed_diagnostics.npz` |
173
+ | `d_committor/` (`ts`) | `plan.json` (selected structures and shooting budget, also from `--dry-run`), `committor.json`, `committor.md`, `committor_<method>_<ts>.png`, `checkpoints/` |
174
+ | `.fescape/manifest.json` | stage fingerprints used by `status` |
175
+
176
+ `fescape status -c system.yaml` prints per-stage completion. The template defaults are production-scale:
177
+
178
+ | Stage | Maximum MD steps | Aggregate time at 0.5 fs |
179
+ |---|---:|---:|
180
+ | String swarm | `60 × 16 × (2000 + 20 × (2000 + 20)) = 40,704,000` | 20.35 ns |
181
+ | Stationary umbrella windows | `16 × (20,000 + 200,000) = 3,520,000` | 1.76 ns |
182
+
183
+ String seed initialization adds `16 × (2000 + 2000) = 64,000` steps (0.032 ns).
184
+ Both methods print their MD-step plan at start; early convergence can stop the string stage sooner.
185
+ For a functional check, reduce `smwst.n_iterations`, `swarm.*` and `fes.window_steps` explicitly.
186
+ Check convergence with the sampling support and block estimates in `sampling.md`.
187
+
188
+ ### Config (`system.yaml`)
189
+
190
+ | key | meaning |
191
+ |---|---|
192
+ | `topology` / `reactant` / `product` | MD-ready `parm7` + the two endpoint `rst7` (same topology) |
193
+ | `ml_region` | the reactive region (treated by the MLIP); omit for a pure-`mm` run. A list of 0-based indices, or a selector: `{amber_mask}` / `{residues}` / `{ligand: true}` (the substrate) / `{resname: [...]}` / `{within: X, of: <selector>}` (pocket) / `{model_pdb: ml.pdb}`. Add `exclude_backbone: true` to keep only side chains — see **ML region** below |
194
+ | `cvs` | collective variables (`distance` / `distance_difference` / `torsion`) |
195
+ | `restraint_force_k` | string/swarm and finite-temperature seed-preparation restraint (kcal/mol per CV-unit²) |
196
+ | `md.*` | MM prep — `minimize` / `equilibrate` (NVT→NPT descending restraints) / `release` |
197
+ | `md.freeze_ml_region` | freeze the reactive region (mass 0) through **all** of MM prep so only the solvent relaxes (default `true`); pure-MM prep would otherwise collapse a not-yet-formed bond to the MM equilibrium length. `false` uses a soft `md.ml_restraint_k` restraint instead |
198
+ | `md.restraints` | optional distance restraints during MM prep — `[{atoms: [i,j], k, r0?}]`; `r0` defaults to each endpoint's own input distance |
199
+ | `engine` | `mlip` (`mace`\|`uma`\|`orb`\|`mm`), `method` (`oniom`\|`qmmm`), `embedding` (`mechanical`), `ml_model`, `charge`/`spin` (ML-region total), `precision`, `mlip_compile`, `md_precision`, `platform`, `temperature_K` — see **Backends** below |
200
+ | `engine.constraints` / `engine.rigid_water` | ML/MM production defaults to `constraints: None` and `rigid_water: auto` (= `false` for ML/MM and ML); all water is flexible at the default 0.5 fs timestep. `auto` keeps rigid water in pure MM. Explicit values are honored, recorded in `engine.json`, and warn in ML/MM. MM endpoint prep (`md.*`) uses SHAKE and rigid water at 2 fs by default. String/umbrella results sampled under the former rigid-water default must be rerun before shooting with the new default |
201
+ | `swarm.initialize_method` | seed preparation; default `steered_md`, while `minimize` is an explicit alternative |
202
+ | `swarm.equil_steps` / `n_swarm` | restrained equilibration per starting configuration and trajectories per image; each trajectory equilibrates its own configuration before release, totaling `(n_swarm + 1) * equil_steps` restrained steps per image per iteration |
203
+ | `swarm.steer_steps` / `steer_stages` | finite-temperature target ramp before exact-center seed equilibration |
204
+ | `swarm.seed_check_stride` / `seed_max_spacing_fraction` | achieved-CV measurement cadence and maximum error as a fraction of local window spacing |
205
+ | `fes.window_force` | production umbrella force constant; calibrated separately from seed preparation |
206
+ | `fes.window_force_by_index` | optional `{window_index: scalar_or_CV_vector}` bias overrides, shared by sampling and MBAR |
207
+ | `fes.window_steps_by_index` | optional `{window_index: steps}` overrides for extending only deficient windows |
208
+ | `fes.decorrelate` / `min_effective_samples` | discard equilibration/correlation and require independent support per window |
209
+ | `fes.min_neighbor_overlap` | minimum of both directions of each first off-diagonal MBAR overlap pair |
210
+ | `fes.require_internal_maximum` | require every reaction segment's PMF to turn over before its sampled endpoint |
211
+ | `smwst` / `swarm` / `fes` | remaining string-method / swarm / umbrella-MBAR sampling parameters |
212
+ | `reaction_path.segments` | `umbrella`: fixed CV-space path (`from_cv`/`to_cv`/`n_windows`) |
213
+ | `intermediates` | `string`: optional initial-path structures (same topology) |
214
+ | `committor.basin_R/basin_P` | `ts`: CV-space basin predicates + `n_shots` / `n_shot_points` / `max_steps` |
215
+
216
+ The `engine`/`smwst`/`swarm`/`fes` blocks are the engine's own parameters; `md.*`, `reaction_path`,
217
+ `committor`, `intermediates` are fescape's. The MBAR analysis temperature follows `engine.temperature_K`.
218
+ The bias is `0.5 k (q - q0)^2` for distance and distance-difference CVs (k in kcal/mol/Ų), and
219
+ `k (1 - cos(θ - θ0))` for torsions (k in kcal/mol, curvature k at the minimum). MBAR uses the same expressions.
220
+
221
+ ### Backends
222
+
223
+ Every ML backend is built as an energy+forces ASE calculator and driven inside the periodic OpenMM box
224
+ through fescape's own per-step `openmm.PythonForce`. The model families are the **OMol25-domain** foundation MLIPs, so a
225
+ charged active site (e.g. the −2 chorismate or +1 SAM) is *in domain* — set `engine.charge`/`engine.spin`
226
+ to the ML region's total charge and multiplicity (the model reads them each step via `atoms.info`).
227
+
228
+ The default `method: oniom, embedding: mechanical` is evaluated through symbolic MM cancellation, avoiding
229
+ the large intermediate `MM(real) − MM(model)` forces of literal subtractive ONIOM. `method: qmmm` exposes the
230
+ upstream link-H mechanical embedding. Both support fixed/scaled links; mechanical embedding is the only supported embedding mode.
231
+
232
+ | `mlip` | library | default `ml_model` (selectable) | default `precision` |
233
+ |---|---|---|---|
234
+ | `mace` | mace-torch | `MACE-OMOL-0` (also `off:small…`, `mp:medium`, a local `.model`) | `fp32` |
235
+ | `uma` (default) | fairchem-core | `uma-s-1p2` (also `uma-s-1p1`, `uma-m-1p1`) — needs a HuggingFace token | `fp32` |
236
+ | `orb` | orb-models | `orb_v3_conservative_omol` (conservative models only) | `fp32` |
237
+ | `mm` | — (pure MM) | — | — |
238
+
239
+ When `engine.mlip` is omitted, fescape uses `uma` (`uma-s-1p2`).
240
+
241
+ - **`precision`** (MLIP model precision): `auto` \| `fp32` \| `fp64`. **`auto` = `fp32` for every backend.**
242
+ The MLIP forward pass dominates the per-step cost (the PythonForce bridge and the MM box take about 5–9 %
243
+ of a step). **fp32 runs the forward pass about 1.6× (MACE-OMOL) to 2.3× (ORB) faster** than fp64, with
244
+ force errors of 0.002 % (MACE) and 0.045 % (ORB) of the maximum force. fescape computes no
245
+ finite-difference Hessian, so fp32 is the MD default; set `engine.precision: fp64` for a higher-precision
246
+ forward pass. In both cases **keep `engine.md_precision: auto` (= double)**: the model precision and the
247
+ OpenMM integrator precision are independent, and double-precision integration prevents NaN in ML/MM MD.
248
+ - **`md_precision`** (OpenMM *platform* precision, separate from the model precision): `auto` \| `double` \|
249
+ `mixed` \| `single`. `auto` = `double` for an ML/MM run (mixed and single precision produce NaN in ML/MM
250
+ MD) and `mixed` for a pure `mm` run.
251
+ - **`mlip: mm`** runs the whole box at the AMBER (MM) level — no ML region, no ML env needed — for a system
252
+ too large for an ML region or a purely conformational free energy along the CVs. The MM topology is fixed,
253
+ so an `mm` run **cannot make or break a bond**.
254
+
255
+ ### ML region
256
+
257
+ `ml_region` is the set of atoms the MLIP treats. Give it explicit 0-based indices, or let fescape resolve a
258
+ selector against the topology and endpoint geometries (their fixed sorted union):
259
+
260
+ | `ml_region` | selects |
261
+ |---|---|
262
+ | `[12, 13, 40, ...]` | those exact 0-based atoms |
263
+ | `{amber_mask: ":352"}` / `{residues: [8, 9]}` | a ParmEd mask / 1-based **sequential** residue positions |
264
+ | `{ligand: true}` | the substrate — every residue that is not a standard amino acid / ion / water |
265
+ | `{resname: [SAM, GPP]}` | residues by name |
266
+ | `{within: 3.0, of: {ligand: true}}` | whole residues with any atom within 3 Å of the center (`of` = any selector above; default `{ligand: true}`) |
267
+ | `{model_pdb: ml.pdb}` | atoms matching a carved ML-region PDB, by coordinate proximity to the reactant |
268
+
269
+ Add **`exclude_backbone: true`** to drop protein main-chain atoms so only side chains are ML (PRO/HYP keep
270
+ their ring). Each protein cut then moves from a polar peptide C–N bond to a **Cα–Cβ** C–C bond, capped for
271
+ the ML potential by a **link-H** (fixed by default, or scaled; forces are
272
+ propagated to both real parents). `engine.charge`/`spin` describe the ML region **including** each link-H (one added electron
273
+ apiece — an odd cut count flips the spin parity, checked at load). Boundary bonds are checked: a non-C–C cut
274
+ **warns** (it runs, but is poorer QM/MM practice), a cut through a bond to H **errors**. ML-region selections containing MM virtual sites are rejected by the CLI; MM-region virtual sites remain supported.
275
+
276
+ ### Running across GPUs / drivers / CPU
277
+
278
+ The MM box (OpenMM) and the MLIP (torch) choose their device **independently**, so the box can run
279
+ on the OpenMM OpenCL platform while the MLIP runs on torch-CUDA on the same GPU. `engine.platform: auto`
280
+ (the default) tries CUDA → OpenCL → CPU and **probes one force evaluation** on each, so a GPU whose driver
281
+ is older than the CUDA toolkit (the OpenMM `CUDA_ERROR_UNSUPPORTED_PTX_VERSION`, which surfaces at the first
282
+ kernel launch, not at context creation) falls back to OpenCL automatically instead of crashing. The probe
283
+ evaluates forces only. OpenMM's energy minimizer loads an additional kernel module, so on some nodes with
284
+ old drivers the MM-prep `minimize` can still fail with the PTX error after the probe passes. Set
285
+ `engine.platform: OpenCL` on such nodes; OpenCL compiles kernels for each device and has no PTX-version issue.
286
+
287
+ | node | GPU / driver | OpenMM platform | `engine` |
288
+ |---|---|---|---|
289
+ | new-driver GPU | driver supports the installed CUDA 13 runtime from `openmm[cuda13]` | CUDA | `platform: auto` |
290
+ | old-driver GPU | driver predates the CUDA 13 runtime, e.g. a CUDA 12 driver; `CUDA_ERROR_UNSUPPORTED_PTX_VERSION` | OpenCL | **pin `platform: OpenCL`** (auto-fallback may not catch the minimize kernel); `md_precision: auto` (= double) |
291
+ | Blackwell (sm 120) | compatible CUDA driver and a torch build with sm_120 kernels (else "no kernel image" — fescape warns) | CUDA | `platform: auto` |
292
+ | no GPU / laptop | — | CPU | defaults fall to CPU; to force CPU on a GPU box set `engine: {platform: CPU, device: cpu}` |
293
+
294
+ Check [NVIDIA's driver/runtime compatibility requirements](https://docs.nvidia.com/deploy/cuda-compatibility/minor-version-compatibility.html)
295
+ and the installed runtime; PTX kernel requirements can be stricter than minor-version compatibility.
296
+
297
+ If a stage is interrupted (e.g. by a transient OpenCL crash), run the same command again; the fingerprint
298
+ manifest skips completed stages.
299
+
300
+ MLIP dynamics use the selected accelerator. MBAR/PMF uses CPU by default (`fes.mbar_device: auto`) because
301
+ the solve is small and this avoids CUDA-driver and MLIP-VRAM contention at finalization. Set
302
+ `fes.mbar_device: gpu` only on a validated CUDA/JAX stack; XLA preallocation is disabled for that opt-in
303
+ path.
304
+
305
+ MBAR finalization is fail-closed. It writes no `fes.npz` or TS artifact when any window has too few
306
+ decorrelated samples, either direction of a neighboring overlap pair is below the configured threshold,
307
+ the populated PMF contains an internal hole, or a declared reaction segment still peaks at its endpoint.
308
+ Extend or refine the failing windows or path and collect again; do not relax these checks to obtain a barrier.
309
+
310
+ ## Physical modes
311
+
312
+ | `engine.mode` | Hamiltonian | Input |
313
+ |---|---|---|
314
+ | `mm` | AMBER force field with PME | Parameter topology and periodic coordinates |
315
+ | `ml` | ML calculator for every physical atom, with the current periodic cell | PDB/mmCIF or topology plus coordinates; explicit total charge |
316
+ | `mlmm` | Mechanical embedding of a fixed ML subset in AMBER/PME | Parameter topology, coordinates and `ml_region` |
317
+
318
+ `mode: auto` selects MM for `mlip: mm`, otherwise ML/MM. Pure ML adds no MM nonbonded terms,
319
+ MM constraints or MM virtual sites. An input containing extra-point particles must be converted to
320
+ physical atoms with corresponding CV indices before selecting pure ML.
321
+
322
+ For ML/MM, both `method: oniom` (default) and `method: qmmm` support
323
+ `link_mode: fixed` (default) and `link_mode: scaled`.
324
+ Fixed placement retains the upstream ML–H distance; scaled placement uses a constant fraction
325
+ of the ML–MM displacement. Link-capable development
326
+ installations use native link-site construction; stable OpenMM-ML installations use the included
327
+ upstream backport. Both modes use OpenMM virtual sites for cap placement and force propagation.
328
+ `oniom` retains all boundary-crossing MM bonded terms; `qmmm` uses the upstream cap-based
329
+ removal rules. Their boundary and periodic conventions are described in [DESIGN.md](https://github.com/t-0hmura/fescape/blob/master/docs/DESIGN.md).
330
+
331
+ Spatial CVs, bias forces and geometric selections use the simulation cell. Bonded molecules are
332
+ made whole before MM evaluation, and isolated ML components are co-imaged. Periodic ML receives
333
+ the current cell on every evaluation. Molecular imaging does not change normal MM bonded-force flags.
334
+
335
+ ```yaml
336
+ engine:
337
+ mode: mlmm
338
+ method: oniom # oniom | qmmm
339
+ link_mode: fixed # fixed | scaled
340
+ ```
341
+
342
+ For `qmmm`, scaled placement uses `g = (R_ML + R_H)/(R_ML + R_MM)` from the pinned
343
+ upstream radius table, with `r_H = (1-g) r_ML + g r_MM`. OpenMM propagates forces using
344
+ the same weights. `oniom` uses the same scaled virtual-site implementation with ASE covalent
345
+ radii. Fixed distances use the upstream radius table in both modes; for a carbon parent the
346
+ default C–H distance is 1.07 Å. The selected mode and per-link distances/scales are recorded
347
+ in calculation provenance. Low-level MM models do not contain link H or require cap parameters.
348
+
349
+ `engine.ensemble` selects `nvt` (default) or `npt`; NPT uses OpenMM's Monte Carlo barostat.
350
+ Reactive ML dynamics defaults to 0.5 fs and Langevin friction 1 ps⁻¹. Validate timestep and ensemble
351
+ for the chosen potential and system.
352
+
353
+ For ML-only sampling, `md.preparation: auto` imports prepared endpoints without MM preparation.
354
+ Use `fescape md` to minimize/equilibrate them with ML. MM and ML/MM default to MM endpoint prep;
355
+ only ML/MM holds the reactive region during that prep. `md.preparation: input` accepts prepared
356
+ endpoints for any mode.
357
+
358
+ ```yaml
359
+ reactant: solvated.pdb
360
+ engine:
361
+ mode: ml
362
+ mlip: uma
363
+ ml_model: uma-s-1p2
364
+ charge: 0 # complete-system integer charge
365
+ spin: 1 # spin multiplicity
366
+ ensemble: nvt
367
+ timestep_fs: 0.5
368
+ ```
369
+
370
+ ```bash
371
+ fescape md -c md.yaml -w md_run --steps 10000 --minimize
372
+ ```
373
+
374
+ `md` accepts omitted product/CVs and writes a trajectory, final restart and model provenance.
375
+ FES commands require endpoints and CVs. Coordinate outputs retain the original input atom order;
376
+ link-H virtual sites are internal to OpenMM.
377
+
378
+ ## Interpreting barriers and transition states
379
+
380
+ A PMF maximum is a **candidate** at the specified CV projection and ensemble. Gradient alignment
381
+ with the string tangent is a path condition; it is not a transition-state test. SMwST reports
382
+ image-displacement convergence and perpendicular drift separately. All-rejected swarms cannot
383
+ establish convergence.
384
+
385
+ Committor shooting restores the candidate frame's positions and cell, removes CV bias, and
386
+ resamples velocities. Report pointwise probabilities and their uncertainty, censoring, and the
387
+ spread between configurations. Neither a pooled mean near 0.5 nor an interval containing 0.5
388
+ alone proves a transition-state ensemble.
389
+
390
+ The full-enzyme [eSEN-omol study by Gao et al.](https://arxiv.org/html/2609.09293v1) motivates
391
+ pure-ML periodic sampling and window-specific bias strengths. It uses umbrella/BayesWHAM and enhanced
392
+ sampling, without committor validation. FEScape retains decorrelation-aware MBAR and overlap checks.
393
+
394
+ ## License
395
+
396
+ MIT. The OpenMM-ML backport retains its upstream license and [source provenance](https://github.com/t-0hmura/fescape/blob/master/src/fescape/_vendor/openmmml/PROVENANCE.md).