[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71CKP5B3JVJ9W0F9TMND82C":3,"skill-same:01M71CKP5B3JVJ9W0F9TMND82C":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":52,"install":53,"resources":66},"01M71CKP5B3JVJ9W0F9TMND82C","molecular-dynamics",null,"Run and analyze molecular dynamics simulations with OpenMM and MDAnalysis. Set up protein\u002Fsmall 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.","strmt7\u002Fai_skills_collection_benchmarked","strmt7","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F28989754?v=4","01M71929P914SWKQ7QJV24NBBY","Stratos","01M71929Q9VGKQ7PWYR95VSQQQ",1,"MIT","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Fscience-research-data-analysis\u002Flatest-release-community\u002Fmolecular-dynamics\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"molecular dynamics","dynamics","molecular","structural biology","Simulations","Protein","energy","openmm","for","biology","free","structural","run","force fields","biophysics","surfaces","maps","up","analyze","SET","2026-11-10 10:12:30",false,"---\nname: molecular-dynamics\ndescription: Run and analyze molecular dynamics simulations with OpenMM and MDAnalysis. Set up protein\u002Fsmall 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.\nlicense: MIT\nmetadata:\n    skill-author: Kuan-lin Huang\n---\n\n# Molecular Dynamics\n\n## Overview\n\nMolecular dynamics (MD) simulation computationally models the time evolution of molecular systems by integrating Newton's equations of motion. This skill covers two complementary tools:\n\n- **OpenMM** (https:\u002F\u002Fopenmm.org\u002F): High-performance MD simulation engine with GPU support, Python API, and flexible force field support\n- **MDAnalysis** (https:\u002F\u002Fmdanalysis.org\u002F): Python library for reading, writing, and analyzing MD trajectories from all major simulation packages\n\n**Installation:**\n```bash\nconda install -c conda-forge openmm mdanalysis nglview\n# or\npip install openmm mdanalysis\n```\n\n## When to Use This Skill\n\nUse molecular dynamics when:\n\n- **Protein stability analysis**: How does a mutation affect protein dynamics?\n- **Drug binding simulations**: Characterize binding mode and residence time of a ligand\n- **Conformational sampling**: Explore protein flexibility and conformational changes\n- **Protein-protein interaction**: Model interface dynamics and binding energetics\n- **RMSD\u002FRMSF analysis**: Quantify structural fluctuations from a reference structure\n- **Free energy estimation**: Compute binding free energy or conformational free energy\n- **Membrane simulations**: Model proteins in lipid bilayers\n- **Intrinsically disordered proteins**: Study IDR conformational ensembles\n\n## Core Workflow: OpenMM Simulation\n\n### 1. System Preparation\n\n```python\nfrom openmm.app import *\nfrom openmm import *\nfrom openmm.unit import *\nimport sys\n\ndef prepare_system_from_pdb(pdb_file, forcefield_name=\"amber14-all.xml\",\n                              water_model=\"amber14\u002Ftip3pfb.xml\"):\n    \"\"\"\n    Prepare an OpenMM system from a PDB file.\n\n    Args:\n        pdb_file: Path to cleaned PDB file (use PDBFixer for raw PDB files)\n        forcefield_name: Force field XML file\n        water_model: Water model XML file\n\n    Returns:\n        pdb, forcefield, system, topology\n    \"\"\"\n    # Load PDB\n    pdb = PDBFile(pdb_file)\n\n    # Load force field\n    forcefield = ForceField(forcefield_name, water_model)\n\n    # Add hydrogens and solvate\n    modeller = Modeller(pdb.topology, pdb.positions)\n    modeller.addHydrogens(forcefield)\n\n    # Add solvent box (10 Å padding, 150 mM NaCl)\n    modeller.addSolvent(\n        forcefield,\n        model='tip3p',\n        padding=10*angstroms,\n        ionicStrength=0.15*molar\n    )\n\n    print(f\"System: {modeller.topology.getNumAtoms()} atoms, \"\n          f\"{modeller.topology.getNumResidues()} residues\")\n\n    # Create system\n    system = forcefield.createSystem(\n        modeller.topology,\n        nonbondedMethod=PME,         # Particle Mesh Ewald for long-range electrostatics\n        nonbondedCutoff=1.0*nanometer,\n        constraints=HBonds,           # Constrain hydrogen bonds (allows 2 fs timestep)\n        rigidWater=True,\n        ewaldErrorTolerance=0.0005\n    )\n\n    return modeller, system\n```\n\n### 2. Energy Minimization\n\n```python\nfrom openmm.app import *\nfrom openmm import *\nfrom openmm.unit import *\n\ndef minimize_energy(modeller, system, output_pdb=\"minimized.pdb\",\n                     max_iterations=1000, tolerance=10.0):\n    \"\"\"\n    Energy minimize the system to remove steric clashes.\n\n    Args:\n        modeller: Modeller object with topology and positions\n        system: OpenMM System\n        output_pdb: Path to save minimized structure\n        max_iterations: Maximum minimization steps\n        tolerance: Convergence criterion in kJ\u002Fmol\u002Fnm\n\n    Returns:\n        simulation object with minimized positions\n    \"\"\"\n    # Set up integrator (doesn't matter for minimization)\n    integrator = LangevinMiddleIntegrator(300*kelvin, 1\u002Fpicosecond, 0.004*picoseconds)\n\n    # Create simulation\n    # Use GPU if available (CUDA or OpenCL), fall back to CPU\n    try:\n        platform = Platform.getPlatformByName('CUDA')\n        properties = {'DeviceIndex': '0', 'Precision': 'mixed'}\n    except Exception:\n        try:\n            platform = Platform.getPlatformByName('OpenCL')\n            properties = {}\n        except Exception:\n            platform = Platform.getPlatformByName('CPU')\n            properties = {}\n\n    simulation = Simulation(\n        modeller.topology, system, integrator,\n        platform, properties\n    )\n    simulation.context.setPositions(modeller.positions)\n\n    # Check initial energy\n    state = simulation.context.getState(getEnergy=True)\n    print(f\"Initial energy: {state.getPotentialEnergy()}\")\n\n    # Minimize\n    simulation.minimizeEnergy(\n        tolerance=tolerance*kilojoules_per_mole\u002Fnanometer,\n        maxIterations=max_iterations\n    )\n\n    state = simulation.context.getState(getEnergy=True, getPositions=True)\n    print(f\"Minimized energy: {state.getPotentialEnergy()}\")\n\n    # Save minimized structure\n    with open(output_pdb, 'w') as f:\n        PDBFile.writeFile(simulation.topology, state.getPositions(), f)\n\n    return simulation\n```\n\n### 3. NVT Equilibration\n\n```python\nfrom openmm.app import *\nfrom openmm import *\nfrom openmm.unit import *\n\ndef run_nvt_equilibration(simulation, n_steps=50000, temperature=300,\n                            report_interval=1000, output_prefix=\"nvt\"):\n    \"\"\"\n    NVT equilibration: constant N, V, T.\n    Equilibrate velocities to target temperature.\n\n    Args:\n        simulation: OpenMM Simulation (after minimization)\n        n_steps: Number of MD steps (50000 × 2fs = 100 ps)\n        temperature: Temperature in Kelvin\n        report_interval: Steps between data reports\n        output_prefix: File prefix for trajectory and log\n    \"\"\"\n    # Add position restraints for backbone during NVT\n    # (Optional: restraint heavy atoms)\n\n    # Set temperature\n    simulation.context.setVelocitiesToTemperature(temperature*kelvin)\n\n    # Add reporters\n    simulation.reporters = []\n\n    # Log file\n    simulation.reporters.append(\n        StateDataReporter(\n            f\"{output_prefix}_log.txt\",\n            report_interval,\n            step=True,\n            potentialEnergy=True,\n            kineticEnergy=True,\n            temperature=True,\n            volume=True,\n            speed=True\n        )\n    )\n\n    # DCD trajectory (compact binary format)\n    simulation.reporters.append(\n        DCDReporter(f\"{output_prefix}_traj.dcd\", report_interval)\n    )\n\n    print(f\"Running NVT equilibration: {n_steps} steps ({n_steps*2\u002F1000:.1f} ps)\")\n    simulation.step(n_steps)\n    print(\"NVT equilibration complete\")\n\n    return simulation\n```\n\n### 4. NPT Equilibration and Production\n\n```python\ndef run_npt_production(simulation, n_steps=500000, temperature=300, pressure=1.0,\n                        report_interval=5000, output_prefix=\"npt\"):\n    \"\"\"\n    NPT production run: constant N, P, T.\n\n    Args:\n        n_steps: Production steps (500000 × 2fs = 1 ns)\n        temperature: Temperature in Kelvin\n        pressure: Pressure in bar\n        report_interval: Steps between reports\n    \"\"\"\n    # Add Monte Carlo barostat for pressure control\n    system = simulation.context.getSystem()\n    system.addForce(MonteCarloBarostat(pressure*bar, temperature*kelvin, 25))\n    simulation.context.reinitialize(preserveState=True)\n\n    # Update reporters\n    simulation.reporters = []\n    simulation.reporters.append(\n        StateDataReporter(\n            f\"{output_prefix}_log.txt\",\n            report_interval,\n            step=True,\n            potentialEnergy=True,\n            temperature=True,\n            density=True,\n            speed=True\n        )\n    )\n    simulation.reporters.append(\n        DCDReporter(f\"{output_prefix}_traj.dcd\", report_interval)\n    )\n\n    # Save checkpoints\n    simulation.reporters.append(\n        CheckpointReporter(f\"{output_prefix}_checkpoint.chk\", 50000)\n    )\n\n    print(f\"Running NPT production: {n_steps} steps ({n_steps*2\u002F1000000:.2f} ns)\")\n    simulation.step(n_steps)\n    print(\"Production MD complete\")\n    return simulation\n```\n\n## Trajectory Analysis with MDAnalysis\n\n### 1. Load Trajectory\n\n```python\nimport MDAnalysis as mda\nfrom MDAnalysis.analysis import rms, align, contacts\nimport numpy as np\nimport matplotlib.pyplot as plt\n\ndef load_trajectory(topology_file, trajectory_file):\n    \"\"\"\n    Load an MD trajectory with MDAnalysis.\n\n    Args:\n        topology_file: PDB, PSF, or other topology file\n        trajectory_file: DCD, XTC, TRR, or other trajectory\n    \"\"\"\n    u = mda.Universe(topology_file, trajectory_file)\n    print(f\"Universe: {u.atoms.n_atoms} atoms, {u.trajectory.n_frames} frames\")\n    print(f\"Time range: 0 to {u.trajectory.totaltime:.0f} ps\")\n    return u\n```\n\n### 2. RMSD Analysis\n\n```python\ndef compute_rmsd(u, selection=\"backbone\", reference_frame=0):\n    \"\"\"\n    Compute RMSD of selected atoms relative to reference frame.\n\n    Args:\n        u: MDAnalysis Universe\n        selection: Atom selection string (MDAnalysis syntax)\n        reference_frame: Frame index for reference structure\n\n    Returns:\n        numpy array of (time, rmsd) values\n    \"\"\"\n    # Align trajectory to minimize RMSD\n    aligner = align.AlignTraj(u, u, select=selection, in_memory=True)\n    aligner.run()\n\n    # Compute RMSD\n    R = rms.RMSD(u, select=selection, ref_frame=reference_frame)\n    R.run()\n\n    rmsd_data = R.results.rmsd  # columns: frame, time, RMSD\n    return rmsd_data\n\ndef plot_rmsd(rmsd_data, title=\"RMSD over time\", output_file=\"rmsd.png\"):\n    \"\"\"Plot RMSD over simulation time.\"\"\"\n    fig, ax = plt.subplots(figsize=(10, 4))\n    ax.plot(rmsd_data[:, 1] \u002F 1000, rmsd_data[:, 2], 'b-', linewidth=0.5)\n    ax.set_xlabel(\"Time (ns)\")\n    ax.set_ylabel(\"RMSD (Å)\")\n    ax.set_title(title)\n    ax.axhline(rmsd_data[:, 2].mean(), color='r', linestyle='--',\n               label=f'Mean: {rmsd_data[:, 2].mean():.2f} Å')\n    ax.legend()\n    plt.tight_layout()\n    plt.savefig(output_file, dpi=150)\n    return fig\n```\n\n### 3. RMSF Analysis (Per-Residue Flexibility)\n\n```python\ndef compute_rmsf(u, selection=\"backbone\", start_frame=0):\n    \"\"\"\n    Compute per-residue RMSF (flexibility).\n\n    Returns:\n        resids, rmsf_values arrays\n    \"\"\"\n    # Select atoms\n    atoms = u.select_atoms(selection)\n\n    # Compute RMSF\n    R = rms.RMSF(atoms)\n    R.run(start=start_frame)\n\n    # Average by residue\n    resids = []\n    rmsf_per_res = []\n    for res in u.select_atoms(selection).residues:\n        res_atoms = res.atoms.intersection(atoms)\n        if len(res_atoms) > 0:\n            resids.append(res.resid)\n            rmsf_per_res.append(R.results.rmsf[res_atoms.indices].mean())\n\n    return np.array(resids), np.array(rmsf_per_res)\n```\n\n### 4. Protein-Ligand Contacts\n\n```python\ndef analyze_contacts(u, protein_sel=\"protein\", ligand_sel=\"resname LIG\",\n                      radius=4.5, start_frame=0):\n    \"\"\"\n    Track protein-ligand contacts over trajectory.\n\n    Args:\n        radius: Contact distance cutoff in Angstroms\n    \"\"\"\n    protein = u.select_atoms(protein_sel)\n    ligand = u.select_atoms(ligand_sel)\n\n    contact_frames = []\n    for ts in u.trajectory[start_frame:]:\n        # Find protein atoms within radius of ligand\n        distances = contacts.contact_matrix(\n            protein.positions, ligand.positions, radius\n        )\n        contact_residues = set()\n        for i in range(distances.shape[0]):\n            if distances[i].any():\n                contact_residues.add(protein.atoms[i].resid)\n        contact_frames.append(contact_residues)\n\n    return contact_frames\n```\n\n## Force Field Selection Guide\n\n| System | Recommended Force Field | Water Model |\n|--------|------------------------|-------------|\n| Standard proteins | AMBER14 (`amber14-all.xml`) | TIP3P-FB |\n| Proteins + small molecules | AMBER14 + GAFF2 | TIP3P-FB |\n| Membrane proteins | CHARMM36m | TIP3P |\n| Nucleic acids | AMBER99-bsc1 or AMBER14 | TIP3P |\n| Disordered proteins | ff19SB or CHARMM36m | TIP3P |\n\n## System Preparation Tools\n\n### PDBFixer (for raw PDB files)\n\n```python\nfrom pdbfixer import PDBFixer\nfrom openmm.app import PDBFile\n\ndef fix_pdb(input_pdb, output_pdb, ph=7.0):\n    \"\"\"Fix common PDB issues: missing residues, atoms, add H, standardize.\"\"\"\n    fixer = PDBFixer(filename=input_pdb)\n    fixer.findMissingResidues()\n    fixer.findNonstandardResidues()\n    fixer.replaceNonstandardResidues()\n    fixer.removeHeterogens(True)    # Remove water\u002Fligands\n    fixer.findMissingAtoms()\n    fixer.addMissingAtoms()\n    fixer.addMissingHydrogens(ph)\n\n    with open(output_pdb, 'w') as f:\n        PDBFile.writeFile(fixer.topology, fixer.positions, f)\n\n    return output_pdb\n```\n\n### GAFF2 for Small Molecules (via OpenFF Toolkit)\n\n```python\n# For ligand parameterization, use OpenFF toolkit or ACPYPE\n# pip install openff-toolkit\nfrom openff.toolkit import Molecule, ForceField as OFFForceField\nfrom openff.interchange import Interchange\n\ndef parameterize_ligand(smiles, ff_name=\"openff-2.0.0.offxml\"):\n    \"\"\"Generate GAFF2\u002FOpenFF parameters for a small molecule.\"\"\"\n    mol = Molecule.from_smiles(smiles)\n    mol.generate_conformers(n_conformers=1)\n\n    off_ff = OFFForceField(ff_name)\n    interchange = off_ff.create_interchange(mol.to_topology())\n    return interchange\n```\n\n## Best Practices\n\n- **Always minimize before MD**: Raw PDB structures have steric clashes\n- **Equilibrate before production**: NVT (50–100 ps) → NPT (100–500 ps) → Production\n- **Use GPU**: Simulations are 10–100× faster on GPU (CUDA\u002FOpenCL)\n- **2 fs timestep with HBonds constraints**: Standard; use 4 fs with HMR (hydrogen mass repartitioning)\n- **Analyze only equilibrated trajectory**: Discard first 20–50% as equilibration\n- **Save checkpoints**: MD runs can fail; checkpoints allow restart\n- **Periodic boundary conditions**: Required for solvated systems\n- **PME for electrostatics**: More accurate than cutoff methods for charged systems\n\n## Additional Resources\n\n- **OpenMM documentation**: https:\u002F\u002Fopenmm.org\u002Fdocumentation.html\n- **MDAnalysis user guide**: https:\u002F\u002Fdocs.mdanalysis.org\u002F\n- **GROMACS** (alternative MD engine): https:\u002F\u002Fmanual.gromacs.org\u002F\n- **NAMD** (alternative): https:\u002F\u002Fwww.ks.uiuc.edu\u002FResearch\u002Fnamd\u002F\n- **CHARMM-GUI** (web-based system builder): https:\u002F\u002Fcharmm-gui.org\u002F\n- **AmberTools** (free Amber tools): https:\u002F\u002Fambermd.org\u002FAmberTools.php\n- **OpenMM paper**: Eastman P et al. (2017) PLOS Computational Biology. PMID: 28278240\n- **MDAnalysis paper**: Michaud-Agrawal N et al. (2011) J Computational Chemistry. PMID: 21500218\n","# Molecular Dynamics\n\n## Overview\n\nMolecular dynamics (MD) simulation computationally models the time evolution of molecular systems by integrating Newton's equations of motion. This skill covers two complementary tools:\n\n- **OpenMM** (https:\u002F\u002Fopenmm.org\u002F): High-performance MD simulation engine with GPU support, Python API, and flexible force field support\n- **MDAnalysis** (https:\u002F\u002Fmdanalysis.org\u002F): Python library for reading, writing, and analyzing MD trajectories from all major simulation packages\n\n**Installation:**\n```bash\nconda install -c conda-forge openmm mdanalysis nglview\n# or\npip install openmm mdanalysis\n```\n\n## When to Use This Skill\n\nUse molecular dynamics when:\n\n- **Protein stability analysis**: How does a mutation affect protein dynamics?\n- **Drug binding simulations**: Characterize binding mode and residence time of a ligand\n- **Conformational sampling**: Explore protein flexibility and conformational changes\n- **Protein-protein interaction**: Model interface dynamics and binding energetics\n- **RMSD\u002FRMSF analysis**: Quantify structural fluctuations from a reference structure\n- **Free energy estimation**: Compute binding free energy or conformational free energy\n- **Membrane simulations**: Model proteins in lipid bilayers\n- **Intrinsically disordered proteins**: Study IDR conformational ensembles\n\n## Core Workflow: OpenMM Simulation\n\n### 1. System Preparation\n\n```python\nfrom openmm.app import *\nfrom openmm import *\nfrom openmm.unit import *\nimport sys\n\ndef prepare_system_from_pdb(pdb_file, forcefield_name=\"amber14-all.xml\",\n                              water_model=\"amber14\u002Ftip3pfb.xml\"):\n    \"\"\"\n    Prepare an OpenMM system from a PDB file.\n\n    Args:\n        pdb_file: Path to cleaned PDB file (use PDBFixer for raw PDB files)\n        forcefield_name: Force field XML file\n        water_model: Water model XML file\n\n    Returns:\n        pdb, forcefield, system, topology\n    \"\"\"\n    # Load PDB\n    pdb = PDBFile(pdb_file)\n\n    # Load force field\n    forcefield = ForceField(forcefield_name, water_model)\n\n    # Add hydrogens and solvate\n    modeller = Modeller(pdb.topology, pdb.positions)\n    modeller.addHydrogens(forcefield)\n\n    # Add solvent box (10 Å padding, 150 mM NaCl)\n    modeller.addSolvent(\n        forcefield,\n        model='tip3p',\n        padding=10*angstroms,\n        ionicStrength=0.15*molar\n    )\n\n    print(f\"System: {modeller.topology.getNumAtoms()} atoms, \"\n          f\"{modeller.topology.getNumResidues()} residues\")\n\n    # Create system\n    system = forcefield.createSystem(\n        modeller.topology,\n        nonbondedMethod=PME,         # Particle Mesh Ewald for long-range electrostatics\n        nonbondedCutoff=1.0*nanometer,\n        constraints=HBonds,           # Constrain hydrogen bonds (allows 2 fs timestep)\n        rigidWater=True,\n        ewaldErrorTolerance=0.0005\n    )\n\n    return modeller, system\n```\n\n### 2. Energy Minimization\n\n```python\nfrom openmm.app import *\nfrom openmm import *\nfrom openmm.unit import *\n\ndef minimize_energy(modeller, system, output_pdb=\"minimized.pdb\",\n                     max_iterations=1000, tolerance=10.0):\n    \"\"\"\n    Energy minimize the system to remove steric clashes.\n\n    Args:\n        modeller: Modeller object with topology and positions\n        system: OpenMM System\n        output_pdb: Path to save minimized structure\n        max_iterations: Maximum minimization steps\n        tolerance: Convergence criterion in kJ\u002Fmol\u002Fnm\n\n    Returns:\n        simulation object with minimized positions\n    \"\"\"\n    # Set up integrator (doesn't matter for minimization)\n    integrator = LangevinMiddleIntegrator(300*kelvin, 1\u002Fpicosecond, 0.004*picoseconds)\n\n    # Create simulation\n    # Use GPU if available (CUDA or OpenCL), fall back to CPU\n    try:\n        platform = Platform.getPlatformByName('CUDA')\n        properties = {'DeviceIndex': '0', 'Precision': 'mixed'}\n    except Exception:\n        try:\n            platform = Platform.getPlatformByName('OpenCL')\n            properties = {}\n        except Exception:\n            platform = Platform.getPlatformByName('CPU')\n            properties = {}\n\n    simulation = Simulation(\n        modeller.topology, system, integrator,\n        platform, properties\n    )\n    simulation.context.setPositions(modeller.positions)\n\n    # Check initial energy\n    state = simulation.context.getState(getEnergy=True)\n    print(f\"Initial energy: {state.getPotentialEnergy()}\")\n\n    # Minimize\n    simulation.minimizeEnergy(\n        tolerance=tolerance*kilojoules_per_mole\u002Fnanometer,\n        maxIterations=max_iterations\n    )\n\n    state = simulation.context.getState(getEnergy=True, getPositions=True)\n    print(f\"Minimized energy: {state.getPotentialEnergy()}\")\n\n    # Save minimized structure\n    with open(output_pdb, 'w') as f:\n        PDBFile.writeFile(simulation.topology, state.getPositions(), f)\n\n    return simulation\n```\n\n### 3. NVT Equilibration\n\n```python\nfrom openmm.app import *\nfrom openmm import *\nfrom openmm.unit import *\n\ndef run_nvt_equilibration(simulation, n_steps=50000, temperature=300,\n                            report_interval=1000, output_prefix=\"nvt\"):\n    \"\"\"\n    NVT equilibration: constant N, V, T.\n    Equilibrate velocities to target temperature.\n\n    Args:\n        simulation: OpenMM Simulation (after minimization)\n        n_steps: Number of MD steps (50000 × 2fs = 100 ps)\n        temperature: Temperature in Kelvin\n        report_interval: Steps between data reports\n        output_prefix: File prefix for trajectory and log\n    \"\"\"\n    # Add position restraints for backbone during NVT\n    # (Optional: restraint heavy atoms)\n\n    # Set temperature\n    simulation.context.setVelocitiesToTemperature(temperature*kelvin)\n\n    # Add reporters\n    simulation.reporters = []\n\n    # Log file\n    simulation.reporters.append(\n        StateDataReporter(\n            f\"{output_prefix}_log.txt\",\n            report_interval,\n            step=True,\n            potentialEnergy=True,\n            kineticEnergy=True,\n            temperature=True,\n            volume=True,\n            speed=True\n        )\n    )\n\n    # DCD trajectory (compact binary format)\n    simulation.reporters.append(\n        DCDReporter(f\"{output_prefix}_traj.dcd\", report_interval)\n    )\n\n    print(f\"Running NVT equilibration: {n_steps} steps ({n_steps*2\u002F1000:.1f} ps)\")\n    simulation.step(n_steps)\n    print(\"NVT equilibration complete\")\n\n    return simulation\n```\n\n### 4. NPT Equilibration and Production\n\n```python\ndef run_npt_production(simulation, n_steps=500000, temperature=300, pressure=1.0,\n                        report_interval=5000, output_prefix=\"npt\"):\n    \"\"\"\n    NPT production run: constant N, P, T.\n\n    Args:\n        n_steps: Production steps (500000 × 2fs = 1 ns)\n        temperature: Temperature in Kelvin\n        pressure: Pressure in bar\n        report_interval: Steps between reports\n    \"\"\"\n    # Add Monte Carlo barostat for pressure control\n    system = simulation.context.getSystem()\n    system.addForce(MonteCarloBarostat(pressure*bar, temperature*kelvin, 25))\n    simulation.context.reinitialize(preserveState=True)\n\n    # Update reporters\n    simulation.reporters = []\n    simulation.reporters.append(\n        StateDataReporter(\n            f\"{output_prefix}_log.txt\",\n            report_interval,\n            step=True,\n            potentialEnergy=True,\n            temperature=True,\n            density=True,\n            speed=True\n        )\n    )\n    simulation.reporters.append(\n        DCDReporter(f\"{output_prefix}_traj.dcd\", report_interval)\n    )\n\n    # Save checkpoints\n    simulation.reporters.append(\n        CheckpointReporter(f\"{output_prefix}_checkpoint.chk\", 50000)\n    )\n\n    print(f\"Running NPT production: {n_steps} steps ({n_steps*2\u002F1000000:.2f} ns)\")\n    simulation.step(n_steps)\n    print(\"Production MD complete\")\n    return simulation\n```\n\n## Trajectory Analysis with MDAnalysis\n\n### 1. Load Trajectory\n\n```python\nimport MDAnalysis as mda\nfrom MDAnalysis.analysis import rms, align, contacts\nimport numpy as np\nimport matplotlib.pyplot as plt\n\ndef load_trajectory(topology_file, trajectory_file):\n    \"\"\"\n    Load an MD trajectory with MDAnalysis.\n\n    Args:\n        topology_file: PDB, PSF, or other topology file\n        trajectory_file: DCD, XTC, TRR, or other trajectory\n    \"\"\"\n    u = mda.Universe(topology_file, trajectory_file)\n    print(f\"Universe: {u.atoms.n_atoms} atoms, {u.trajectory.n_frames} frames\")\n    print(f\"Time range: 0 to {u.trajectory.totaltime:.0f} ps\")\n    return u\n```\n\n### 2. RMSD Analysis\n\n```python\ndef compute_rmsd(u, selection=\"backbone\", reference_frame=0):\n    \"\"\"\n    Compute RMSD of selected atoms relative to reference frame.\n\n    Args:\n        u: MDAnalysis Universe\n        selection: Atom selection string (MDAnalysis syntax)\n        reference_frame: Frame index for reference structure\n\n    Returns:\n        numpy array of (time, rmsd) values\n    \"\"\"\n    # Align trajectory to minimize RMSD\n    aligner = align.AlignTraj(u, u, select=selection, in_memory=True)\n    aligner.run()\n\n    # Compute RMSD\n    R = rms.RMSD(u, select=selection, ref_frame=reference_frame)\n    R.run()\n\n    rmsd_data = R.results.rmsd  # columns: frame, time, RMSD\n    return rmsd_data\n\ndef plot_rmsd(rmsd_data, title=\"RMSD over time\", output_file=\"rmsd.png\"):\n    \"\"\"Plot RMSD over simulation time.\"\"\"\n    fig, ax = plt.subplots(figsize=(10, 4))\n    ax.plot(rmsd_data[:, 1] \u002F 1000, rmsd_data[:, 2], 'b-', linewidth=0.5)\n    ax.set_xlabel(\"Time (ns)\")\n    ax.set_ylabel(\"RMSD (Å)\")\n    ax.set_title(title)\n    ax.axhline(rmsd_data[:, 2].mean(), color='r', linestyle='--',\n               label=f'Mean: {rmsd_data[:, 2].mean():.2f} Å')\n    ax.legend()\n    plt.tight_layout()\n    plt.savefig(output_file, dpi=150)\n    return fig\n```\n\n### 3. RMSF Analysis (Per-Residue Flexibility)\n\n```python\ndef compute_rmsf(u, selection=\"backbone\", start_frame=0):\n    \"\"\"\n    Compute per-residue RMSF (flexibility).\n\n    Returns:\n        resids, rmsf_values arrays\n    \"\"\"\n    # Select atoms\n    atoms = u.select_atoms(selection)\n\n    # Compute RMSF\n    R = rms.RMSF(atoms)\n    R.run(start=start_frame)\n\n    # Average by residue\n    resids = []\n    rmsf_per_res = []\n    for res in u.select_atoms(selection).residues:\n        res_atoms = res.atoms.intersection(atoms)\n        if len(res_atoms) > 0:\n            resids.append(res.resid)\n            rmsf_per_res.append(R.results.rmsf[res_atoms.indices].mean())\n\n    return np.array(resids), np.array(rmsf_per_res)\n```\n\n### 4. Protein-Ligand Contacts\n\n```python\ndef analyze_contacts(u, protein_sel=\"protein\", ligand_sel=\"resname LIG\",\n                      radius=4.5, start_frame=0):\n    \"\"\"\n    Track protein-ligand contacts over trajectory.\n\n    Args:\n        radius: Contact distance cutoff in Angstroms\n    \"\"\"\n    protein = u.select_atoms(protein_sel)\n    ligand = u.select_atoms(ligand_sel)\n\n    contact_frames = []\n    for ts in u.trajectory[start_frame:]:\n        # Find protein atoms within radius of ligand\n        distances = contacts.contact_matrix(\n            protein.positions, ligand.positions, radius\n        )\n        contact_residues = set()\n        for i in range(distances.shape[0]):\n            if distances[i].any():\n                contact_residues.add(protein.atoms[i].resid)\n        contact_frames.append(contact_residues)\n\n    return contact_frames\n```\n\n## Force Field Selection Guide\n\n| System | Recommended Force Field | Water Model |\n|--------|------------------------|-------------|\n| Standard proteins | AMBER14 (`amber14-all.xml`) | TIP3P-FB |\n| Proteins + small molecules | AMBER14 + GAFF2 | TIP3P-FB |\n| Membrane proteins | CHARMM36m | TIP3P |\n| Nucleic acids | AMBER99-bsc1 or AMBER14 | TIP3P |\n| Disordered proteins | ff19SB or CHARMM36m | TIP3P |\n\n## System Preparation Tools\n\n### PDBFixer (for raw PDB files)\n\n```python\nfrom pdbfixer import PDBFixer\nfrom openmm.app import PDBFile\n\ndef fix_pdb(input_pdb, output_pdb, ph=7.0):\n    \"\"\"Fix common PDB issues: missing residues, atoms, add H, standardize.\"\"\"\n    fixer = PDBFixer(filename=input_pdb)\n    fixer.findMissingResidues()\n    fixer.findNonstandardResidues()\n    fixer.replaceNonstandardResidues()\n    fixer.removeHeterogens(True)    # Remove water\u002Fligands\n    fixer.findMissingAtoms()\n    fixer.addMissingAtoms()\n    fixer.addMissingHydrogens(ph)\n\n    with open(output_pdb, 'w') as f:\n        PDBFile.writeFile(fixer.topology, fixer.positions, f)\n\n    return output_pdb\n```\n\n### GAFF2 for Small Molecules (via OpenFF Toolkit)\n\n```python\n# For ligand parameterization, use OpenFF toolkit or ACPYPE\n# pip install openff-toolkit\nfrom openff.toolkit import Molecule, ForceField as OFFForceField\nfrom openff.interchange import Interchange\n\ndef parameterize_ligand(smiles, ff_name=\"openff-2.0.0.offxml\"):\n    \"\"\"Generate GAFF2\u002FOpenFF parameters for a small molecule.\"\"\"\n    mol = Molecule.from_smiles(smiles)\n    mol.generate_conformers(n_conformers=1)\n\n    off_ff = OFFForceField(ff_name)\n    interchange = off_ff.create_interchange(mol.to_topology())\n    return interchange\n```\n\n## Best Practices\n\n- **Always minimize before MD**: Raw PDB structures have steric clashes\n- **Equilibrate before production**: NVT (50–100 ps) → NPT (100–500 ps) → Production\n- **Use GPU**: Simulations are 10–100× faster on GPU (CUDA\u002FOpenCL)\n- **2 fs timestep with HBonds constraints**: Standard; use 4 fs with HMR (hydrogen mass repartitioning)\n- **Analyze only equilibrated trajectory**: Discard first 20–50% as equilibration\n- **Save checkpoints**: MD runs can fail; checkpoints allow restart\n- **Periodic boundary conditions**: Required for solvated systems\n- **PME for electrostatics**: More accurate than cutoff methods for charged systems\n\n## Additional Resources\n\n- **OpenMM documentation**: https:\u002F\u002Fopenmm.org\u002Fdocumentation.html\n- **MDAnalysis user guide**: https:\u002F\u002Fdocs.mdanalysis.org\u002F\n- **GROMACS** (alternative MD engine): https:\u002F\u002Fmanual.gromacs.org\u002F\n- **NAMD** (alternative): https:\u002F\u002Fwww.ks.uiuc.edu\u002FResearch\u002Fnamd\u002F\n- **CHARMM-GUI** (web-based system builder): https:\u002F\u002Fcharmm-gui.org\u002F\n- **AmberTools** (free Amber tools): https:\u002F\u002Fambermd.org\u002FAmberTools.php\n- **OpenMM paper**: Eastman P et al. (2017) PLOS Computational Biology. PMID: 28278240\n- **MDAnalysis paper**: Michaud-Agrawal N et al. (2011) J Computational Chemistry. PMID: 21500218\n",{"name":5,"license":15,"metadata":44,"description":7},{"skill-author":45},"Kuan-lin Huang","main","5c95bcac4646c5aed06bd9aed5235cfc7985aafc","included\u002Fskills\u002Fby-category\u002Fscience-research-data-analysis\u002Flatest-release-community\u002Fmolecular-dynamics",0,"https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked","https:\u002F\u002Fgithub.com\u002Fstrmt7","2026-11-15 03:31:57",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add strmt7\u002Fai_skills_collection_benchmarked --skill molecular-dynamics",{"tool":59,"command":60},"bunx","bunx skills add strmt7\u002Fai_skills_collection_benchmarked --skill molecular-dynamics",{"tool":62,"command":63},"pnpm","pnpm dlx skills add strmt7\u002Fai_skills_collection_benchmarked --skill molecular-dynamics","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Fscience-research-data-analysis\u002Flatest-release-community\u002Fmolecular-dynamics\u002FSKILL.md",true,[67],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Fmdanalysis_analysis.md","REFERENCE","参考文档",5643,"https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Fscience-research-data-analysis\u002Flatest-release-community\u002Fmolecular-dynamics\u002Freferences\u002Fmdanalysis_analysis.md",[74,107,136,161,187,215],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":79,"sourceHtmlUrl":80,"categories":81,"keywords":90,"publishedAt":39},"01M71D4H3T6M57DFKN8HENAWRV","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Ftesting-qa-benchmarking\u002Fofficial-reference\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Ftesting-qa-benchmarking\u002Fofficial-reference\u002Fwebapp-testing\u002FSKILL.md",[82,87],{"categoryNo":83,"categoryName":84,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",{"categoryNo":88,"categoryName":89,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000009","前端开发",[91,92,93,27,94,95,96,97,98,99,100,101,102,103,104,105,106],"webapp","testing","webapp testing","applications","local","frontend","debugging","toolkit","logs","browser","with","playwright","web","behavior","ui","screenshots",{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":111,"sourceHtmlUrl":112,"categories":113,"keywords":117,"publishedAt":39},"01M71D4CQR2A2TB7GASCR5ZBG3","skill-creator","Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Ftesting-qa-benchmarking\u002Fofficial-reference\u002Fskill-creator-anthropics\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Ftesting-qa-benchmarking\u002Fofficial-reference\u002Fskill-creator-anthropics\u002FSKILL.md",[114],{"categoryNo":115,"categoryName":116,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000023","Skill与智能体开发",[118,119,120,121,122,123,124,125,126,127,128,31,129,130,131,132,133,134,27,135],"skill creator","creator","performance","improve","run evals","new","when","analysis","create","optimize","variance analysis","edit","benchmark","a skill","existing skill","evals","modify","accuracy",{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":144,"publishedAt":39},"01M71D488XHEZVXXSXFYP8ENMH","playwright-skill","Complete browser automation with Playwright. Auto-detects dev servers, writes reusable test scripts, and supports screenshots, responsive checks, UX validation, login flows, link checks, and arbitrary browser automation. Use when the user wants to test a website, automate browser interactions, validate web functionality, or perform browser-based testing.","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Ftesting-qa-benchmarking\u002Flatest-release-browser-automation\u002Fplaywright-skill\u002FSKILL.md",[142,143],{"categoryNo":83,"categoryName":84,"taxonomyType":85,"taxonomyTypeDesc":86},{"categoryNo":115,"categoryName":116,"taxonomyType":85,"taxonomyTypeDesc":86},[102,145,146,147,92,148,149,124,150,100,151,152,153,154,155,156,157,158,159,160],"playwright skill","browser automation","flows","auto","access","Bash","website","ux","login","scripts","read","write","node","install","network","responsive",{"skillNo":162,"name":163,"nameZh":6,"description":164,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":165,"sourceHtmlUrl":166,"categories":167,"keywords":169,"publishedAt":39},"01M71CY25GM939M6RES91QSG3T","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Fsearch-retrieval-web-automation\u002Fofficial-reference\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Fsearch-retrieval-web-automation\u002Fofficial-reference\u002Fweb-artifacts-builder\u002FSKILL.md",[168],{"categoryNo":88,"categoryName":89,"taxonomyType":85,"taxonomyTypeDesc":86},[170,171,172,103,173,174,175,27,176,177,96,178,179,180,181,182,183,184,185,186],"builder","artifacts builder","artifacts","web artifacts builder","single-file","css","Tailwind","ui components","single","use","file","components","react","multi","state","routing","state management",{"skillNo":188,"name":189,"nameZh":6,"description":190,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":78,"licenseFileUrl":191,"sourceHtmlUrl":192,"categories":193,"keywords":203,"publishedAt":39},"01M71CXZB60QJJ1H4S3NN94WMZ","frontend-design","Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML\u002FCSS layouts, or when styling\u002Fbeautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Fsearch-retrieval-web-automation\u002Fofficial-reference\u002Ffrontend-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Fsearch-retrieval-web-automation\u002Fofficial-reference\u002Ffrontend-design\u002FSKILL.md",[194,195,198],{"categoryNo":88,"categoryName":89,"taxonomyType":85,"taxonomyTypeDesc":86},{"categoryNo":196,"categoryName":197,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":199,"categoryName":200,"taxonomyType":201,"taxonomyTypeDesc":202},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[96,204,205,175,206,207,208,94,209,210,179,124,172,211,181,212,182,213,214,101],"design","frontend design","ui design","generic","aesthetics","landing","pages","code","web ui","react components","examples",{"skillNo":216,"name":217,"nameZh":6,"description":218,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":219,"categories":220,"keywords":221,"publishedAt":39},"01M71CVZ54WFBTVA7R16PFY1ZE","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Fskills\u002Fby-category\u002Fscience-research-data-analysis\u002Flatest-release-community\u002Fzarr-python\u002FSKILL.md",[],[222,223,224,225,226,227,228,229,230,27,231,232,233,234,235,236,237,238],"zarr python","python","zarr","arrays","Cloud Storage","scientific","storage","parallel","dask","numpy","gcs","s3","integration","scientific computing","cloud","scale","pipelines"]