Running Examples
Overview
The repository includes a complete training workflow for multisite λ-dynamics bias coefficient optimization. The main example demonstrates the end-to-end pipeline from combination generation through training and simulation execution.
For architectural details, see Contextual Bandit Setup. For workflow configuration options, see Workflow System.
Main Training Workflow
The primary example is examples/run_workflow_deepset.py, which implements the
complete training pipeline using pretrained DeepSet embeddings.
Quick Start
cd examples
python run_workflow_deepset.py workflow_14benz.yaml
Generate combinations from the 14benz system
Split into train/val/test sets (70/15/15)
Train for 50 epochs with SLURM job submission
Save checkpoints every 5 epochs
Write outputs to
training_output/
Configuration
Edit examples/workflow_14benz.yaml to customize paths and basic settings:
system:
solvent_state: solv
create_combos:
input_dir: /path/to/site_sub_fragments
out_dir: /path/to/generated_combos
split:
train_frac: 0.70
val_frac: 0.15
training:
num_epochs: 50
output:
base_dir: /path/to/training_output
save_checkpoints: true
checkpoint_freq: 5
See Workflow System for complete configuration options including curriculum learning, pretraining, archiving, and reward function tuning.
Pretraining Example
To pretrain from existing simulations:
# Organize existing simulation data
mkdir -p pretraining
cp -r previous_runs/good_combos/* pretraining/
# Run pretraining
python run_deepset_pretraining.py --pretraining-dir pretraining --output-dir models --steps all
# Use pretrained model in main training
python run_workflow_deepset.py workflow_14benz.yaml
See Workflow System for detailed pretraining configuration, data organization, and benefits.
Example System: 14benz
The examples/14benz/ directory contains:
site1_sub1_pres.rtfthroughsite1_sub5_pres.rtf: Site 1 substituentssite2_sub1_pres.rtfthroughsite2_sub6_pres.rtf: Site 2 substituentsmsld_flat.py: CHARMM/pyCHARMM simulation scriptprep/: Pre-equilibrated structures
With 5 substituents at site 1 and 6 at site 2, the rotating anchor strategy generates:
75 within-site combinations for site 1 (5 anchors × 15 each)
186 within-site combinations for site 2 (6 anchors × 31 each)
13,950 cross-site combinations (75 × 186)
Total: 14,211 unique combinations
SLURM Job Submission
For production training on a cluster:
cd examples/
sbatch training_test.sh
The training script:
Activates the conda environment
Runs
python -u run_workflow_deepset.py workflow_14benz.yamlSubmits MSLD simulations as separate SLURM jobs
Manages up to 30 concurrent simulation jobs
Writes progress to
training_status.out
The -u flag enables unbuffered output for real-time monitoring:
tail -f training_status.out
Resume Capability
Training automatically resumes from the latest checkpoint if interrupted:
sbatch training_test.sh # Automatically detects and resumes
See Workflow System for checkpoint configuration and resume details.
Customizing the Workflow
To adapt for your system:
Prepare fragments: Create
siteN_subM_pres.rtffiles for your sites/substituentsUpdate config: Edit
workflow_14benz.yamlwith your paths andsystem.solvent_state(seeworkflow_deepset.yamlfor an alternate template)Modify simulation script: Adapt
msld_flat.pyfor your force field and protocolRun training: Execute
python run_workflow_deepset.py your_config.yaml
See Workflow System for configuration options and Contextual Bandit Setup for architecture details.
Tips
Start with fewer epochs (e.g., 5) to test the full pipeline
Use
max_concurrent_jobsto control cluster loadMonitor
training_status.outfor real-time progressCheck
training_output/epoch_NNN/for per-epoch resultsVerify checkpoint files are saved at
checkpoint_freqintervals
Reward Function Tuning
Epoch checkpoints enable testing different reward configurations without re-running simulations:
python examples/test_reward_configs.py training_output/epoch_005 \
--configs reward_configs_example.yaml
See Workflow System for reward function details and experimentation workflow.
See Also
File Handling - File format documentation and parsers
Workflow System - Complete workflow system documentation
Contextual Bandit Setup - Contextual bandit architecture details
AtomBondGNN Pretraining - DeepSet pretraining for node embeddings
CB Behavior Cloning - Behavior cloning from expert coefficients
mllf API - API reference for workflow modules