Introduction to Molly.jl
Outline
My scientific history
Molecular dynamics (MD)
Molecular dynamics successes
From Lindorff-Larsen et al. 2011
Molecular dynamics failures
From Robustelli et al. 2018
Where does molecular dynamics work well?
AlphaFold database model of TrbA from E. coli
MD useful for working out how this region behaves
Force field problem
Sampling problem
Correct functional form?
Correct parameters?
QM / MM / coarse-grained
Ordered/disordered proteins
Ligand parameters
The problems with molecular dynamics for biomolecules
From Robustelli et al. 2018
Barnase-barstar complex
Dissociation time ~1 day
~1019 simulation steps!
Recent developments in MD
From Mu et al. 2021
Machine learning interaction potentials (MLIPs)
From Musaelian et al. 2023
Software for molecular simulation
Foldit1 (PDB ID 6MRR) simulated with Molly.jl in the a99SB-ILDN force field with explicit solvent (not shown).
Molly.jl
Features
Features continued
Missing features
Advantages
Disadvantages
Can define components individually
Foldit1 (PDB ID 6MRR) simulated with Molly.jl in the a99SB-ILDN force field with explicit solvent (not shown).
Can setup like OpenMM, but runs in one language
Demonstration of useful Julia packages
Three types of interactions in Molly
Custom interactions
Custom simulators and couplers
Custom loggers
Examples
Peptide (shown with VMD)
Training to reproduce a familiar logo
Diatomic gas
Solar system
Making and breaking bonds
Plotting potential energies
Ongoing and planned work - contributions welcome!
Introduction to PyMOL
Jobs
Acknowledgements
Molly exercise
Coding and implementing with Molly.jl
Outline
Barostat example
ACEpotentials.jl example
Force from AD example
Time correlation logger
CUDA kernels
Automatic differentiation (AD)
Differentiable programming
Learns to stabilise native structure
See Greener and Jones, PLoS ONE 16(9): e0256990 (2021)
Differentiable molecular simulation
Automatic differentiation over thousands of steps
Method | Description | Advantages | Disadvantages |
Reverse mode | Record computation graph, compute chain rule backwards from final state | Compute time independent of parameter number (hence most deep learning uses this) | Memory scales linearly with model depth, limiting MD steps (though can use checkpointing) |
Forward mode | Pass value and gradient together, compute chain rule forwards from initial state | Memory independent of model depth | Compute time scales linearly with parameter number, finite differencing may be faster |
Adjoint sensitivity | Solve an augmented ODE of the adjoint back in time | Memory independent of model depth, fast for reversible models (MD can be reversible) | Limited guidance, gradients can be inaccurate |
More in “Automatic differentiation in machine learning: a survey”, Baydin et al. arXiv 2015
and “Neural Ordinary Differential Equations”, Chen et al. NeurIPS 2018
The variety of possible loss functions
Radius of gyration
Radial distribution function
Protein-ligand binding
Protein-protein
interaction
Phase change
Flexibility
Fit to experimental data
Supramolecular geometry
Software for differentiable simulations
Foldit1 (PDB ID 6MRR) simulated with Molly.jl in the a99SB-ILDN force field with explicit solvent (not shown).
Differentiability in Molly.jl
Differentiable simulation in Molly.jl
Sample gradients after 1 ns (106 steps), loss is RMSD to starting structure
atom_N_σ
0.01064
atom_H_mass 0.0007533
inter_CO_coulomb_const 7.475e-7
inter_LJ_weight_14 0.001836
inter_PT_C/N/CT/C_k_1 -2.017e-5
GPU memory requirements
Exploding gradients
From Ingraham et al. 2019
Algorithmic challenges
Differentiable examples
Implicit solvent
Advantages
Disadvantages
Implicit solvent
Learning a better implicit solvent force field
Parameters changed
Common atom types only
Lennard-Jones σ/ε: 32
LJ/Coulomb 1-4 weighting: 2
Proper torsion ks: 36
GB-Neck2 element-dependent and general parameters: 27
Total: 97
Training set
Peptide/protein | Number of residues |
Ala5 | 5 |
Chignolin β-turn | 10 |
(AAQAA)3 | 15 |
Trp-cage | 20 |
Htt19 | 19 |
Histatin-5 | 24 |
BBA | 28 |
GTT | 35 |
NTL9 | 39 |
ACTR_Nterm | 36 |
ACTR_Cterm | 35 |
Learning a better implicit solvent force field
DMS for all-atom force fields
From Mu et al. 2021
Jobs
Acknowledgements