Skip to content

λ schedules and modifications

A λ schedule maps modification names to one value per window. All rows must have the same length.

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],
}

This first turns off the Lennard-Jones interactions of the alchemical atoms with their environment in steps of 0.2, then their charges in steps of a third. λ = 1 is the fully interacting end state.

The schedule is checked before any state is built. Empty schedules, rows of different lengths, values that are not finite numbers, and windows where every value is None raise ValueError; values outside [0, 1] give a warning. None in a window leaves that modification out of that window.

Modifications

Name λ = 1 λ = 0 Needs
LJSoftCore LJ 12-6 with the environment no LJ with the environment (Beutler softcore in between) —
ChargeScaling full charges zero charges (intermolecular electrostatics only) —
MLInterpolation ML potential for the alchemical region MM potential ml extra
MLCorrection MM + (ML − MM) Δ-learning correction MM ml extra
EMLEPotential electrostatic embedding mechanical embedding emle extra
CustomLJ optimised LJ parameters (from an offxml) original LJ parameters openff extra
ChargeTransfer short-ranged charge-transfer term on off openff extra

Intramolecular interactions of the alchemical region are kept: decoupling removes only its interactions with the rest of the system. Modifications such as IntraMolecularNonBondedForces, which these need, are added automatically; you do not list them in the schedule.

Options of a modification go in modifications_kwargs, keyed by its name:

fes.create_alchemical_states(
    lambda_schedule=lambda_schedule,
    alchemical_atoms=ligand,
    modifications_kwargs={
        "LJSoftCore": {"include_attraction": True, "include_repulsion": True},
        "MLPotential": {"name": "ani2x"},
    },
    ...,
)

The options of each modification are the keyword arguments of its apply method; see the modification reference.

λ as OpenMM global parameters

LJSoftCore, ChargeScaling, ChargeTransfer, MLInterpolation and MLCorrection keep λ in an OpenMM global parameter, so an existing Context can be moved to another λ with context.setParameter(...):

Modification Parameter
LJSoftCore lambda_sterics
ChargeScaling lambda_electrostatics (NonbondedForce parameter offsets)
ChargeTransfer lambda_charge_transfer
MLInterpolation, MLCorrection lambda_interpolate

For a named group, the name gets the suffix _<group>, for example lambda_sterics_ligand. CustomLJ and EMLEPotential build their λ into the System.

{"ChargeScaling": {"use_global_parameter": False}} writes the scaled charges into the System instead. The two forms agree exactly on the Reference platform. On CUDA, OpenMM's PME takes a different code path when parameter offsets exist, which shifts energies by about 4e-4 kJ/mol (double precision, 5,000 atoms); CUDA itself differs from the Reference platform by 1e-2 to 6e-2 kJ/mol on the same system.