Introduction#

Here we present an overview of the workflow for calculating free energies in OpenFE in the broadest strokes possible. This workflow is reflected in both the Python API and in the command line interface, and so we have a section for each.

Workflow overview#

The overall workflow of OpenFE involves three stages:

  1. Simulation setup: Defining the simulation campaign you are going to run.

  2. Execution: Running and performing initial analysis of your simulation campaign.

  3. Gather results: Assembling the results from the simulation campaign for further analysis.

In many use cases, these stages may be done on different machines. For example, you are likely to make use of HPC or cloud computing resources to run the simulation campaign. Because of this, each stage has a defined output which is then the input for the next stage:

The output of the simulation setup stage is an AlchemicalNetwork. This contains all the information about what is being simulated (e.g., what ligands, host proteins, solvation details, etc.) and the information about how to perform the simulation (the Protocol).

The output of the execution stage is the basic results from each edge. This can depend of the specific analysis intended, but will either involve a ProtocolResult representing the calculated \(\Delta G\) for each edge or the ProtocolDAGResult linked to the data needed to calculate that \(\Delta G\).

The gather results stage aggregates the individual results for further analysis. For example, the CLI’s gather command will create a table of the \(\Delta G\) for each leg.

For more workflow details, see Under the Hood.

CLI Workflow#

We have separate CLI commands for each stage of setup, execution, and gathering results. With the CLI, the Python objects of AlchemicalNetwork and ProtocolResult are stored to disk in an intermediate representation between the commands.

The commands used to generate an AlchemicalNetwork using the CLI are:

Note

To ensure a consistent set of partial charges are used for each molecule across different transformations, the CLI network planners will now automatically generate charges ahead of planning the network. The partial charge generation scheme can be configured using the YAML settings. We also provide tooling to generate the partial charges as a separate CLI step which can be run before network planning, see the tutorial for more details.

For example, you can create a relative binding free energy (RBFE) network using

$ openfe plan-rbfe-network -p protein.pdb -M dir_with_sdfs/

This will save the alchemical network represented as a JSON file for each edge of the AlchemicalNetwork (i.e., each leg of the alchemical cycle).

To run a given transformation, use the quickrun command; for example:

$ openfe quickrun mytransformation.json -d dir_for_files -o output.json

In many cases, you will want to create a job script for a queuing system (e.g., SLURM) that wraps that command. You can do this for all JSON files from the network planning command with something like this:

Finally, assuming all results (and only results) are in the results/ directory, use the gather command to generate a summary table:

$ openfe gather ./results/ -o final_results.tsv

This will output a tab-separated file with the ligand pair, the estimated \(\Delta G\) and the uncertainty in that estimate.

The CLI provides a very straightforward user experience that works with the most simple use cases. For use cases that need more workflow customization, the Python API makes it relatively straightforward to define exactly the simulation you want to run. The next sections of this user guide will illustrate how to customize the behavior to your needs.