How ale94mleon/bindflow works
Purpose and entry points
BindFlow is a Python/Snakemake workflow package for absolute binding free-energy (ABFE) calculations using GROMACS, with RDKit-backed molecular handling. The user-facing entry is the CLI in src/bindflow/cli.py; example execution scripts provide practical programmatic launch points, e.g. examples/A2A/executor-fep.py and examples/A2A/executor-mmpbsa.py.
Workflow construction and dispatch
src/bindflow/orchestration/flow_builder.py assembles a run from user configuration and selected calculation mode. src/bindflow/orchestration/generate_scheduler.py generates scheduler-facing execution setup, while src/bindflow/runners.py launches workflow execution. This layer separates configuration-driven planning from execution on local or scheduled compute resources.
Snakemake DAGs: the execution core
The packaged rule trees define the actual dependency graphs and file-producing stages:
• Equilibration: src/bindflow/rules/equi/Snakefile
• ABFE/FEP: src/bindflow/rules/fep/Snakefile
• MM/PBSA: src/bindflow/rules/mmpbsa/Snakefile
• End-to-end orchestration: src/bindflow/rules/super_flow/Snakefile
FEP branches separate ligand and complex legs, with distinct soluble versus membrane system rules, such as src/bindflow/rules/fep/ligand/simulation.smk and src/bindflow/rules/fep/complex/membrane/simulation.smk.
System preparation boundary
Preparation converts receptor, ligand, force-field, solvent, and optional membrane inputs into simulation-ready systems. src/bindflow/preparation/system_builder.py is the core builder; src/bindflow/preparation/solvent.py handles solvent-related setup; and src/bindflow/preparation/boresch.py supports Boresch restraint preparation. Inputs and generated topology/coordinate artifacts form the boundary between chemistry/system construction and MD execution.
Simulation parameter generation
src/bindflow/mdp/mdp.py materializes GROMACS MDP parameters from packaged templates, with path handling in src/bindflow/mdp/_path_handler.py. Templates encode protocol variants across equilibration, FEP decoupling stages, production, environment, and system type—for example src/bindflow/mdp/templates/complex/soluble/fep and src/bindflow/mdp/templates/ligand/fep.
Free-energy and MM/PBSA analysis
Post-simulation analysis is implemented in src/bindflow/free_energy/fep_analysis.py, src/bindflow/free_energy/mmxbsa_analysis.py, and src/bindflow/free_energy/gather_results.py. FEP rules run analysis for complex and ligand legs then gather receptor-level results (src/bindflow/rules/fep/calculate_result.smk); MM/PBSA has its own setup, simulation, analysis, and aggregation path (src/bindflow/rules/mmpbsa/ana.smk).
Packaged scientific assets and runtime dependencies
The runtime requires Python, Snakemake, GROMACS, and RDKit; scheduler integration is a material deployment concern. Packaged assets provide force fields and water-model definitions: src/bindflow/data/gmx_ff, src/bindflow/data/gmx_water_models/water_models.yml, and src/bindflow/mmpbsa_in/templates. Example configurations demonstrate amber/charmm and soluble/membrane variants under examples/configs.
Main entry points: system_builder.py System builder · fep/Snakefile ABFE / FEP · super_flow/Snakefile End-to-end flow · mdp.py MDP generator
Components 22
Entry & Planning
- BindFlow CLI · User-facing run entry point.
src/bindflow/cli.py - Example executors · Programmatic A2A launch examples.
examples/A2A/executor-fep.py - Flow builder · Builds a run from configuration and calculation mode.
src/bindflow/orchestration/flow_builder.py - Scheduler setup · Generates scheduled execution setup.
src/bindflow/orchestration/generate_scheduler.py - Workflow runner · Launches local or scheduled workflow execution.
src/bindflow/runners.py
Snakemake Workflows
- End-to-end flow · Top-level orchestration DAG.
src/bindflow/rules/super_flow/Snakefile - Equilibration
src/bindflow/rules/equi/Snakefile - ABFE / FEP · Branches into ligand and complex free-energy legs.
src/bindflow/rules/fep/Snakefile - Ligand FEP leg
src/bindflow/rules/fep/ligand/simulation.smk - Complex membrane leg · Membrane-specific complex simulation branch.
src/bindflow/rules/fep/complex/membrane/simulation.smk - MM/PBSA · Dedicated setup, simulation, analysis, and aggregation path.
src/bindflow/rules/mmpbsa/Snakefile
System Preparation
- System builder · Creates simulation-ready topology and coordinates.
src/bindflow/preparation/system_builder.py - Solvent setup
src/bindflow/preparation/solvent.py - Boresch restraints
src/bindflow/preparation/boresch.py - MDP generator · Materializes GROMACS parameters from templates.
src/bindflow/mdp/mdp.py
Analysis
- FEP analysis · Analyzes complex and ligand legs.
src/bindflow/free_energy/fep_analysis.py - Result gathering · Gathers receptor-level free-energy results.
src/bindflow/free_energy/gather_results.py - MM/PBSA analysis
src/bindflow/free_energy/mmxbsa_analysis.py
Scientific Assets & Runtime
- MDP templates · Protocol variants by environment and system type.
src/bindflow/mdp/templates/complex/soluble/fep - Force fields
src/bindflow/data/gmx_ff - Water models
src/bindflow/data/gmx_water_models/water_models.yml - Scientific runtime · Scheduler integration supports deployed execution.
Connections 27
- BindFlow CLI → Flow builder: configures
- Example executors → Flow builder: launches
- Flow builder → Scheduler setup: plans scheduled runs
- Flow builder → Workflow runner: selects execution
- Scheduler setup → Workflow runner: execution setup
- Workflow runner → End-to-end flow: runs
- End-to-end flow → Equilibration: equilibrates
- End-to-end flow → ABFE / FEP: ABFE mode
- End-to-end flow → MM/PBSA: MM/PBSA mode
- System builder → Equilibration: simulation-ready systems
- System builder → ABFE / FEP: topology and coordinates
- System builder → MM/PBSA: prepared system
- Solvent setup → System builder: solvation
- Boresch restraints → System builder: restraints
- Force fields → System builder: parameters
- Water models → Solvent setup: definitions
- MDP templates → MDP generator: protocol inputs
- MDP generator → Equilibration: GROMACS parameters
- MDP generator → ABFE / FEP: GROMACS parameters
- MDP generator → MM/PBSA: GROMACS parameters
- ABFE / FEP → Ligand FEP leg: ligand branch
- ABFE / FEP → Complex membrane leg: complex branch
- Ligand FEP leg → FEP analysis: trajectories
- Complex membrane leg → FEP analysis: trajectories
- FEP analysis → Result gathering: leg estimates
- MM/PBSA → MM/PBSA analysis: simulation outputs
- Scientific runtime → Workflow runner: executes with