Protocol files¶
A protocol file describes a complete run in YAML: the system, the alchemical groups, the
modifications, the lambda schedule, the dynamics, the sampling and the output. The fes-ml
command (install the protocol extra, or PyYAML) checks and runs it:
fes-ml validate protocol.yaml # check the file, and show a summary
fes-ml validate protocol.yaml --resolved # show the file with every default
fes-ml run protocol.yaml # run all windows, then MBAR
fes-ml run protocol.yaml --window 3 # run one window (one job per window)
fes-ml analyse protocol.yaml # MBAR on the windows that ran
fes-ml validate reports every problem at once, with its place in the file, for example
dynamics.temprature: unknown key. Did you mean 'temperature'?. Run it before you submit jobs.
The Python API stays as it is. A protocol file is another way to give the same arguments, and
fes_ml.protocol.load(path).create_kwargs() shows the arguments of create_alchemical_states
that a file gives.
Example¶
examples/protocol/benzene_hydration.yaml:
schema_version: 1
name: benzene_hydration
system:
strategy: openff
ligand: {smiles: "c1ccccc1"}
solvent: {smiles: "O", count: 1000}
alchemical_groups:
ligand:
atoms: "0-11"
modifications:
LJSoftCore:ligand: {include_attraction: true, include_repulsion: true}
lambda_schedule:
windows: 11
ChargeScaling:ligand: [1.0, 0.66, 0.33, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
LJSoftCore:ligand: [1.0, 1.0, 1.0, 1.0, 0.85, 0.7, 0.55, 0.4, 0.25, 0.1, 0.0]
dynamics:
temperature: 298.15 K
pressure: 1 atm
timestep: 2 fs
sampling:
equilibration: {steps: 50_000}
production: {iterations: 1000, steps_per_iteration: 500}
output: {directory: results}
Sections¶
Quantities are text with a unit: 298.15 K; 1 fs or 0.002 ps; 10 A or 1 nm; 1 atm or
1 bar; 1 /ps. Paths are relative to the directory of the protocol file.
| Key | Default | Meaning |
|---|---|---|
schema_version |
1 |
The version of the format. |
name |
fes |
Names the output files. |
system.strategy |
openff |
openff or sire. |
system.topology, system.coordinates |
Sire: Amber (or other Sire-readable) files. | |
system.ligand |
OpenFF: {smiles: ...} or {sdf: path}. |
|
system.solvent |
none (vacuum) | OpenFF: {smiles: ..., count: n} or {sdf: path, count: n}. |
system.force_fields |
strategy default | OpenFF force field files. |
system.options |
{} |
Other options of the strategy, passed as they are (see strategies). |
alchemical_groups.<name>.atoms |
required | Atom indices: a list, or text such as "0-11, 20". A single group named default gives a plain list of atoms. |
modifications.<Name[:group]> |
{} |
Options of a modification (see schedules). |
lambda_schedule.<Name[:group]> |
required | One lambda value (or null) per window. All rows have the same length. |
lambda_schedule.windows |
The number of windows. If given, fes-ml checks the rows against it. | |
dynamics.temperature |
required | Temperature of the Langevin integrator. |
dynamics.pressure |
null |
Pressure of the barostat. null gives NVT. |
dynamics.timestep, dynamics.friction |
1 fs, 1 /ps |
Of the LangevinMiddleIntegrator. |
dynamics.constraints |
h-bonds |
none or h-bonds. |
dynamics.nonbonded.method |
pme |
pme, reaction-field or none (no periodic boundaries). |
dynamics.nonbonded.cutoff |
10 A |
With OpenFF, the LJ switch starts 1 A before the cutoff. |
dynamics.nonbonded.dispersion_correction |
strategy default | Sire only. |
dynamics.platform |
fastest | Sire only, for example cuda. With OpenFF, choose the GPU with CUDA_VISIBLE_DEVICES. |
dynamics.shared_context |
false |
Run all windows in one Context (see running). |
sampling.minimisation.max_iterations |
1000 |
0 minimises until it converges. |
sampling.equilibration.steps |
0 |
Steps of equilibration of each window. |
sampling.production.iterations |
required | Samples per window. |
sampling.production.steps_per_iteration |
required | Steps between samples. |
execution.windows |
all |
The windows that fes-ml run runs: all, or a list. |
checkpoint.every |
10 |
Iterations between checkpoints. 0 turns them off. |
checkpoint.restart |
true |
Continue windows from their checkpoints, and skip complete windows. |
output.directory |
. |
Where the run writes its files. |
output.trajectory_every |
0 |
Steps between trajectory frames. 0 writes no trajectory. |
analysis.discard, analysis.decorrelate |
0, true |
Sample selection for MBAR (see analysis). |
Lambda schedule presets, random seeds, multiple time stepping, HREMD, non-equilibrium switching and atom selections are not supported in protocol files yet. fes-ml gives an error if a file uses them.
Output¶
fes-ml run writes:
resolved.yaml: the protocol with every default, and the fes-ml version;window_<k>/: one directory for each window, with its checkpoint (<name>.pickle), its OpenMM state, its window output file (<name>_window_<k>.h5), its provenance and its trajectory;result.json: the MBAR result, when all windows are complete.
Each window has its own directory, so you can run windows as separate jobs at the same time, for example with a Slurm array:
#SBATCH --array=0-10
fes-ml run protocol.yaml --window $SLURM_ARRAY_TASK_ID
Then run fes-ml analyse protocol.yaml. A rerun continues each window from its checkpoint, and
skips the windows that are complete.