# Molecular Dynamics

Run and analyze molecular dynamics simulations with OpenMM and MDAnalysis.

- Repository: https://github.com/LeonChaoX/qinyan-academic-skills (996 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-07-20
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add LeonChaoX/qinyan-academic-skills --skill molecular-dynamics -g -a claude-code -y`
Codex: `npx skills add LeonChaoX/qinyan-academic-skills --skill molecular-dynamics -g -a codex -y`
Cursor: `npx skills add LeonChaoX/qinyan-academic-skills --skill molecular-dynamics -g -a cursor -y`
Gemini CLI: `npx skills add LeonChaoX/qinyan-academic-skills --skill molecular-dynamics -g -a gemini-cli -y`

## Description

Run and analyze molecular dynamics simulations with OpenMM and MDAnalysis. Set up protein/small molecule systems, define force fields, run energy minimization and production MD, analyze trajectories (RMSD, RMSF, contact maps, free energy surfaces). For structural biology, drug binding, and biophysics.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Molecular Dynamics

## Overview

Molecular dynamics (MD) simulation computationally models the time evolution of molecular systems by integrating Newton's equations of motion. This skill covers two complementary tools:

- **OpenMM** (https://openmm.org/): High-performance MD simulation engine with GPU support, Python API, and flexible force field support
- **MDAnalysis** (https://mdanalysis.org/): Python library for reading, writing, and analyzing MD trajectories from all major simulation packages

**Installation:**
```bash
conda install -c conda-forge openmm mdanalysis nglview
# or
pip install openmm mdanalysis
```

## When to Use This Skill

Use molecular dynamics when:

- **Protein stability analysis**: How does a mutation affect protein dynamics?
- **Drug binding simulations**: Characterize binding mode and residence time of a ligand
- **Conformational sampling**: Explore protein flexibility and conformational changes
- **Protein-protein interaction**: Model interface dynamics and binding energetics
- **RMSD/RMSF analysis**: Quantify structural fluctuations from a reference structure
- **Free energy estimation**: Compute binding free energy or conformational free energy
- **Membrane simulations**: Model proteins in lipid bilayers
- **Intrinsically disordered proteins**: Study IDR conformational ensembles

## Core Workflow: OpenMM Simulation

### 1. System Preparation

```python
from openmm.app import *
from openmm import *
from openmm.unit import *
import sys

def prepare_system_from_pdb(pdb_file, forcefield_name="amber14-all.xml",
                              water_model="amber14/tip3pfb.xml"):
    """
    Prepare an OpenMM system from a PDB file.

    Args:
        pdb_file: Path to cleaned PDB file (use PDBFixer for raw PDB files)
        forcefield_name: Force field XML file
        water_model: Water model XML file

    Returns:
        pdb, forcefield, system, topology
    """
    # Load PDB
    pdb = PDBFile(pdb_file)

The rest: https://github.com/LeonChaoX/qinyan-academic-skills/blob/HEAD/skills/06-化学信息与药物发现/molecular-dynamics/SKILL.md
