Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Molecular dynamics simulation setup, execution, and trajectory analysis
.claude/skills/brycewang-stanford-molecular-dynamics-guide/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 37% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 27% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 106% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 141% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 133% | 0% |
A skill for setting up, running, and analyzing molecular dynamics (MD) simulations. Covers force field selection, system preparation, simulation protocols, trajectory analysis, and free energy calculations using GROMACS, OpenMM, and MDAnalysis.
The standard workflow for preparing an MD simulation:
1. Obtain structure (PDB, homology model, or docking pose)
2. Clean structure (add missing atoms, fix protonation states)
3. Assign force field parameters
4. Solvate in explicit water box
5. Add counterions to neutralize charge
6. Energy minimize
7. Equilibrate (NVT then NPT)
8. Production runbash# 1. Generate topology from PDB gmx pdb2gmx -f protein.pdb -o processed.gro -water tip3p -ff amber99sb-ildn # 2. Define simulation box (dodecahedron, 1.0 nm buffer) gmx editconf -f processed.gro -o boxed.gro -c -d 1.0 -bt dodecahedron # 3. Solvate gmx solvate -cp boxed.gro -cs spc216.gro -o solvated.gro -p topol.top # 4. Add ions to neutralize and set ionic strength (0.15 M NaCl) gmx grompp -f ions.mdp -c solvated.gro -p topol.top -o ions.tpr gmx genion -s ions.tpr -o ionized.gro -p topol.top -pname NA -nname CL -neutral -conc 0.15 # 5. Energy minimization gmx grompp -f minim.mdp -c ionized.gro -p topol.top -o em.tpr gmx mdrun -deffnm em # 6. NVT equilibration (100 ps, 300 K) gmx grompp -f nvt.mdp -c em.gro -r em.gro -p topol.top -o nvt.tpr gmx mdrun -deffnm nvt # 7. NPT equilibration (100 ps, 300 K, 1 bar) gmx grompp -f npt.mdp -c nvt.gro -r nvt.gro -t nvt.cpt -p topol.top -o npt.tpr gmx mdrun -deffnm npt # 8. Production MD (100 ns) gmx grompp -f md.mdp -c npt.gro -t npt.cpt -p topol.top -o md.tpr gmx mdrun -deffnm md
| Force Field | Strengths | Typical Use | |-------------|-----------|------------| | AMBER ff14SB | Protein structure, dynamics | Protein simulations | | AMBER ff19SB | Improved backbone dihedrals | Latest protein simulations | | CHARMM36m | Proteins, lipids, carbohydrates | Membrane systems | | OPLS-AA/M | Small molecules, organic liquids | Drug-like molecules | | GAFF2 | General small molecules | Ligand parameterization | | CGenFF | CHARMM-compatible small molecules | Ligands in CHARMM systems |
pythonfrom openmm.app import PDBFile, ForceField, Modeller, Simulation from openmm.app import PME, HBonds, NoCutoff from openmm import LangevinMiddleIntegrator, MonteCarloBarostat from openmm.unit import kelvin, atmospheres, nanometers, picoseconds def setup_openmm_simulation(pdb_path: str, temperature: float = 300, pressure: float = 1.0, timestep: float = 0.002) -> Simulation: """ Set up an OpenMM molecular dynamics simulation. pdb_path: path to prepared PDB file temperature: simulation temperature in Kelvin pressure: pressure in atmospheres timestep: integration timestep in picoseconds """ pdb = PDBFile(pdb_path) forcefield = ForceField("amber14-all.xml", "amber14/tip3pfb.xml") modeller = Modeller(pdb.topology, pdb.positions) modeller.addSolvent(forcefield, padding=1.0 * nanometers, ionicStrength=0.15) system = forcefield.createSystem( modeller.topology, nonbondedMethod=PME, nonbondedCutoff=1.0 * nanometers, constraints=HBonds, ) # Barostat for NPT ensemble system.addForce( MonteCarloBarostat(pressure * atmospheres, temperature * kelvin) ) integrator = LangevinMiddleIntegrator( temperature * kelvin, 1.0 / picoseconds, timestep * picoseconds, ) simulation = Simulation(modeller.topology, system, integrator) simulation.context.setPositions(modeller.positions) # Energy minimization simulation.minimizeEnergy() return simulation
pythonimport MDAnalysis as mda from MDAnalysis.analysis import rms, align, diffusionmap import numpy as np def analyze_trajectory(topology: str, trajectory: str) -> dict: """ Comprehensive trajectory analysis: RMSD, RMSF, radius of gyration. topology: topology file (GRO, PDB, PSF) trajectory: trajectory file (XTC, TRR, DCD) """ u = mda.Universe(topology, trajectory) protein = u.select_atoms("protein and name CA") # RMSD over time (C-alpha atoms) ref = mda.Universe(topology) rmsd_analysis = rms.RMSD(u, ref, select="protein and name CA") rmsd_analysis.run() rmsd_data = rmsd_analysis.results.rmsd # shape: (n_frames, 3) # RMSF per residue align.AlignTraj(u, ref, select="protein and name CA", in_memory=True).run() rmsf = rms.RMSF(protein).run() # Radius of gyration rg_values = [] for ts in u.trajectory: rg_values.append(protein.radius_of_gyration()) return { "n_frames": len(u.trajectory), "rmsd_mean_nm": np.mean(rmsd_data[:, 2]) / 10, # A to nm "rmsd_final_nm": rmsd_data[-1, 2] / 10, "rmsf_mean_nm": np.mean(rmsf.results.rmsf) / 10, "rg_mean_nm": np.mean(rg_values) / 10, "rg_std_nm": np.std(rg_values) / 10, "simulation_time_ns": u.trajectory[-1].time / 1000, }
pythonfrom MDAnalysis.analysis.hydrogenbonds import HydrogenBondAnalysis def analyze_hbonds(universe: mda.Universe, donor_sel: str = "protein", acceptor_sel: str = "protein") -> dict: """Analyze hydrogen bonds over the trajectory.""" hbonds = HydrogenBondAnalysis( universe, donors_sel=f"({donor_sel}) and (name N* or name O*)", acceptors_sel=f"({acceptor_sel}) and (name O* or name N*)", d_a_cutoff=3.5, d_h_a_angle_cutoff=150, ) hbonds.run() return { "total_hbonds_detected": len(hbonds.results.hbonds), "mean_per_frame": len(hbonds.results.hbonds) / hbonds.n_frames, "unique_pairs": len(set( (int(r[1]), int(r[3])) for r in hbonds.results.hbonds )), }
Umbrella sampling computes the potential of mean force (PMF) along a reaction coordinate:
Used for computing binding free energies and solvation free energies:
Lambda schedule: 0.0, 0.1, 0.2, ..., 0.9, 1.0
At lambda=0: full interaction (bound state)
At lambda=1: no interaction (unbound state)
Each lambda window: independent MD simulation
Analysis: MBAR or TI to combine lambda windows| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 16,202 | 33,771 | +108% | 1 | 1 | 0% | 3,433 | 4,700 | +37% | 0 | 0 | — |
case-02 | fail→pass | 20,326 | 16,842 | -17% | 1 | 1 | 0% | 4,372 | 5,550 | +27% | 0 | 0 | — |
case-03 | pass→pass | 6,892 | 4,186 | -39% | 1 | 1 | 0% | 1,253 | 3,017 | +141% | 0 | 0 | — |
case-04 | pass→pass | 9,089 | 7,228 | -20% | 1 | 1 | 0% | 1,470 | 3,428 | +133% | 0 | 0 | — |
case-05 | pass→pass | 6,019 | 4,086 | -32% | 1 | 1 | 0% | 1,063 | 2,911 | +174% | 0 | 0 | — |
case-06 | pass→pass | 13,641 | 6,152 | -55% | 1 | 1 | 0% | 2,417 | 3,188 | +32% | 0 | 0 | — |
case-07 | pass→pass | 13,683 | 11,956 | -13% | 1 | 1 | 0% | 2,292 | 4,474 | +95% | 0 | 0 | — |
case-18 | fail→fail | 17,330 | 15,142 | -13% | 1 | 1 | 0% | 3,100 | 4,914 | +59% | 0 | 0 | — |
case-08 | pass→pass | 12,514 | 6,491 | -48% | 1 | 1 | 0% | 816 | 3,211 | +294% | 0 | 0 | — |
case-09 | pass→pass | 13,656 | 8,493 | -38% | 1 | 1 | 0% | 2,069 | 3,525 | +70% | 0 | 0 | — |
case-10 | pass→pass | 6,630 | 8,177 | +23% | 1 | 1 | 0% | 855 | 3,475 | +306% | 0 | 0 | — |
case-11 | pass→pass | 9,323 | 8,574 | -8% | 1 | 1 | 0% | 1,532 | 3,541 | +131% | 0 | 0 | — |
case-12 | pass→pass | 11,650 | 4,671 | -60% | 1 | 1 | 0% | 1,787 | 2,891 | +62% | 0 | 0 | — |
case-13 | pass→pass | 5,464 | 3,662 | -33% | 1 | 1 | 0% | 875 | 2,789 | +219% | 0 | 0 | — |
case-14 | pass→pass | 7,079 | 4,072 | -42% | 1 | 1 | 0% | 1,149 | 2,861 | +149% | 0 | 0 | — |
case-15 | fail→pass | 12,407 | 12,124 | -2% | 1 | 1 | 0% | 2,160 | 4,452 | +106% | 0 | 0 | — |
case-16 | pass→pass | 19,191 | 19,215 | +0% | 1 | 1 | 0% | 3,294 | 5,425 | +65% | 0 | 0 | — |
case-17 | fail→fail | 20,627 | 27,465 | +33% | 1 | 1 | 0% | 3,296 | 6,719 | +104% | 0 | 0 | — |
case-19 | pass→pass | 8,004 | 6,359 | -21% | 1 | 1 | 0% | 1,415 | 3,326 | +135% | 0 | 0 | — |
case-20 | fail→fail | 18,544 | 26,195 | +41% | 1 | 1 | 0% | 3,077 | 6,791 | +121% | 0 | 0 | — |
case-21 | fail→fail | 21,605 | 20,787 | -4% | 1 | 1 | 0% | 3,470 | 5,707 | +64% | 0 | 0 | — |
case-22 | fail→fail | 17,041 | 15,582 | -9% | 1 | 1 | 0% | 2,822 | 5,039 | +79% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.