Alchemical free-energy simulations with hybrid machine-learning / molecular-mechanics (ML/MM) potentials on OpenMM: decoupling, MM → ML interpolation, Δ-learning corrections and EMLE electrostatic embedding, combined freely in one λ schedule and applied to any number of alchemical groups.
Documentation: https://michellab.github.io/fes-ml (source in docs/)
micromamba env create -f environment.yaml
micromamba activate fes-ml
pip install -e .The core needs only OpenMM, NumPy and networkx. Sire, OpenFF, the ML packages and EMLE are optional
extras (pip install -e ".[openff,ml]"); see Installation.
from fes_ml import FES, config_logger
config_logger()
lambda_schedule = {
"LJSoftCore": [1.0, 0.8, 0.6, 0.4, 0.2, 0.0, 0.0, 0.0, 0.0],
"ChargeScaling": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.66, 0.33, 0.0],
}
fes = FES(output_prefix="benzene_water")
fes.create_alchemical_states(
lambda_schedule=lambda_schedule,
alchemical_atoms=list(range(12)), # benzene is the first molecule: atoms 0 to 11
smiles_ligand="c1ccccc1",
smiles_solvent="O",
)
fes.minimize(max_iterations=1000)
fes.equilibrate(100_000)
fes.run_production_batch(1000, 1000) # writes benzene_water_window_<k>.h5Then compute the free energy with MBAR:
fes-ml-analyse benzene_water_window_*.h5 --decorrelateMore in the user guide:
λ schedules and modifications,
running simulations (one window per job, restarts),
Sire and OpenFF strategies, EMLE,
alchemical groups,
writing a modification,
logging.
Examples are in examples/.
See CONTRIBUTING.md and CHANGELOG.md.