Skip to content

About

Automated reaction discovery and pathway refinement for atomistic trajectories

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

ReactionFlow banner with its two modes on model energy landscapes. In MD a trajectory crosses a barrier, the bond change is detected, and the refined path runs over the saddle. In EON mode, saddle searches and kinetic Monte Carlo steps lead from the starting well to the deepest one

ReactionFlow finds reactions in molecular dynamics and computes their pathways. As a trajectory runs, ReactionFlow watches its bonds; when a bond forms or breaks and persists, the trajectory pauses at an exact checkpoint, refines the minimum-energy path with NEB and climbing-image NEB, and resumes from the same state. A barrier is recorded only when the band's highest image is a validated saddle with one negative-curvature mode connecting both ends. Dynamics and refinement use the same machine-learned interatomic potential (MLIP), from four built-in model families or any ASE calculator.

For reactions too rare to observe in MD, ReactionFlow also runs adaptive kinetic Monte Carlo with EON, searching for saddles out of each state and stepping between states by their harmonic transition-state rates.

Install

git clone https://github.com/Austin243/ReactionFlow.git
cd ReactionFlow
python -m pip install .

ReactionFlow needs Python 3.12 or newer. The core package depends only on ASE, NumPy, and NetworkX, and each model backend is installed separately (see Models).

Try it on a laptop

examples/xtb runs 20 ps of malonaldehyde with two water molecules at 500 K, with GFN2-xTB as the potential. It needs no GPU and no model download, and it finishes in a few minutes on one CPU core.

python -m pip install . tblite==0.7.0
OMP_NUM_THREADS=1 reactionflow run examples/xtb/campaign.json
reactionflow status examples/xtb/campaign.json

Each time a proton moves between oxygens, the run pauses, refines that step, and continues. status then lists the proton transfer as one reaction class, with every occurrence saddle_validated and barriers near 0.15 eV.

Run your own system

reactionflow init campaign.json                 # write a campaign by answering questions
reactionflow validate campaign.json             # check it without loading the model
reactionflow prepare campaign.json --install    # install the model's backend, download its weights
reactionflow run campaign.json                  # run the trajectory; rerun the same command to resume
reactionflow status campaign.json               # trajectories, reaction classes, and barriers

A campaign is a single JSON file specifying the starting structure, model profiles, and trajectories (temperature_K, pressure_GPa, length, and seed). Run one trajectory locally with run --index N, or run an array under Slurm with srun reactionflow run campaign.json (one task and GPU per trajectory; answer "no" to GPUs in init for CPU runs). Setting pressure_GPa to a number runs NPT and refines enthalpy barriers with variable-cell SSNEB; null runs NVT with ordinary NEB.

Each trajectory stores its frames, detected occurrences, refinements, and reactions.sqlite3 index under output_root/<trajectory-id>/. Published results are never overwritten, and resubmitted jobs resume from the last exact checkpoint. Set "refine_after_md": true to queue events until MD finishes (when barriers are refined); individual refinements stop after max_hours_per_barrier hours (default 4, recording time_limit) so one slow band cannot stall a trajectory (time limit per barrier).

Additional commands for standalone refinement and analysis:

  • reactionflow band — refine one known reactant–product pair without MD at any chosen --pressure (refining a known step).
  • reactionflow check — run the saddle curvature and connectivity check on any band from ReactionFlow or another code and report residual forces (CLI reference).
  • reactionflow scan — replay saved frames offline through bond detection with the run's settings or new ones to tabulate bond changes and species (offline scan).
  • reactionflow export-electrace — export a refined band as VASP frame folders and an ElecTrace configuration for electronic-structure analysis (electronic analysis).

Models

MACE, UMA, AIMNet2, and ANI-1xnr are built in. reactionflow models lists their models, heads, and tasks, and reactionflow prepare --install installs the backend a campaign names and downloads its weights. Some backends pin conflicting versions of e3nn or Torch and need separate environments (models guide).

Any other model with an ASE calculator runs through the generic adapter, with a profile like this one. The models guide has tested profiles for ORB, MatterSim, CHGNet, SevenNet, and NEP89.

"my-model": {
  "factory": "reactionflow.adapters.ase:create_adapter",
  "options": {
    "calculator_factory": "my_package.calculators:MyCalculator",
    "calculator_kwargs": {"model_path": "/abs/path/model.pt", "device": "cuda"},
    "model_files": ["/abs/path/model.pt"],
    "torch_device": "cuda"
  }
}

ReactionFlow calls calculator_factory with calculator_kwargs and records a hash of every file in model_files in each checkpoint. torch_device turns on deterministic Torch inference, so that a restarted trajectory continues exactly; leave it out for a model that does not use Torch.

Rare events with EON

An EON campaign sets "mode": "eon" and takes the same model profiles. EON runs on Linux x86_64. This example uses an analytic two-atom potential and runs in seconds.

python -m pip install '.[eon]'
PYTHONPATH=examples/eon reactionflow run examples/eon/campaign.json
reactionflow status examples/eon/campaign.json

With "guide": {"form": ["C-N"], "break": ["C-H"]}, each search pushes one pair of the named element types together or apart instead of moving atoms at random, and pairs can also be named by atom ID. See the EON guide.

Documentation

License

BSD 3-Clause. See LICENSE and NOTICE.

About

Automated reaction discovery and pathway refinement for atomistic trajectories

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages