molecular-dynamics – skill Dữ liệu & Khoa học cho agent AI
Chạy và phân tích mô phỏng động lực học phân tử bằng OpenMM và MDAnalysis. Thiết lập hệ protein/phân tử nhỏ, định nghĩa force field, chạy tối thiểu hóa năng lượng và MD sản xuất, phân tích quỹ đạo (RMSD, RMSF, contact map, bề mặt năng lượng tự do). Dùng cho sinh học cấu trúc, liên kết thuốc và lý sinh học.
Cài skill molecular-dynamics bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/molecular-dynamics-dfc51.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /molecular-dynamics – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/molecular-dynamics-dfc51.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $molecular-dynamics – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/molecular-dynamics-dfc51.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /molecular-dynamics – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/molecular-dynamics-dfc51.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /molecular-dynamics – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
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
Reviewed versions: OpenMM 8.6.1 and MDAnalysis 2.10.0. Reference-platform
smoke checks use small synthetic systems; GPU performance and scientific convergence
are not established by them. OpenMM latest API pages identify a development build,
so the installed 8.6.1 API is the executable reference.
Installation into a dedicated environment:
uv venv --python 3.12 .venv-md
uv pip install --python .venv-md/bin/python "openmm==8.6.1" "MDAnalysis==2.10.0" matplotlib pandas
# Windows: use .venv-md/Scripts/python.exe insteadWhen 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
Examples require system-specific preparation and validation. Review biological
assembly, alternate locations, missing loops, termini, protonation, disulfides,
ligands and cofactors before parameterization. An MD trajectory alone does not
establish binding free energy or residence time.
The functions below form one Python module: execute their import blocks together.
Use a new output prefix for every stage to avoid overwriting earlier results.
1. System Preparation
from openmm.app import *
from openmm import *
from openmm.unit import *
def prepare_system_from_pdb(pdb_file, forcefield_name="amber14-all.xml",
water_model="amber14/tip3pfb.xml", ph=7.0):
"""
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:
modeller, system
"""
# Load PDB
pdb = PDBFile(pdb_file)
# Load force field
forcefield = ForceField(forcefield_name, water_model)
# Add hydrogens and solvate
modeller = Modeller(pdb.topology, pdb.positions)
modeller.addHydrogens(forcefield, pH=ph)
# TIP3P geometry also serves TIP3P-FB; XML supplies the parameters.
# 10 Å padding; added salt excludes neutralizing counterions.
modeller.addSolvent(
forcefield,
model='tip3p',
padding=10*angstroms,
ionicStrength=0.15*molar, neutralize=True
)
print(f"System: {modeller.topology.getNumAtoms()} atoms, "
f"{modeller.topology.getNumResidues()} residues")
# Create system
system = forcefield.createSystem(
modeller.topology,
nonbondedMethod=PME, # Particle Mesh Ewald for long-range electrostatics
nonbondedCutoff=1.0*nanometer,
constraints=HBonds, # Constrain bonds involving H (not intermolecular H-bonds)
rigidWater=True,
ewaldErrorTolerance=0.0005
)
return modeller, system2. Energy Minimization
from openmm.app import *
from openmm import *
from openmm.unit import *
def minimize_energy(modeller, system, output_pdb="minimized.pdb",
max_iterations=1000, tolerance=10.0, platform_name=None):
"""
Energy minimize the system to remove steric clashes.
Args:
modeller: Modeller object with topology and positions
system: OpenMM System
output_pdb: Path to save minimized structure
max_iterations: Maximum minimization steps
tolerance: Convergence criterion in kJ/mol/nm
Returns:
simulation object with minimized positions
"""
# Keep the integrator at 2 fs for the subsequent NVT/NPT examples.
integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.002*picoseconds)
# Automatic platform selection, or an explicit tested platform (e.g. CPU).
# A registered GPU plugin does not prove a working device or driver.
platform = Platform.getPlatformByName(platform_name) if platform_name else None
simulation = Simulation(modeller.topology, system, integrator, platform)
simulation.context.setPositions(modeller.positions)
# Check initial energy
state = simulation.context.getState(getEnergy=True)
print(f"Initial energy: {state.getPotentialEnergy()}")
# Minimize
simulation.minimizeEnergy(
tolerance=tolerance*kilojoules_per_mole/nanometer,
maxIterations=max_iterations
)
state = simulation.context.getState(getEnergy=True, getPositions=True)
print(f"Minimized energy: {state.getPotentialEnergy()}")
# Save minimized structure
with open(output_pdb, 'w') as f:
PDBFile.writeFile(simulation.topology, state.getPositions(), f)
return simulation3. NVT Equilibration
from openmm.app import *
from openmm import *
from openmm.unit import *
def run_nvt_equilibration(simulation, n_steps=50000, temperature=300,
report_interval=1000, output_prefix="nvt"):
"""
NVT equilibration: constant N, V, T.
Equilibrate velocities to target temperature.
Args:
simulation: OpenMM Simulation (after minimization)
n_steps: Number of MD steps (50000 × 2fs = 100 ps)
temperature: Temperature in Kelvin
report_interval: Steps between data reports
output_prefix: File prefix for trajectory and log
"""
# This example is unrestrained; add validated restraints before Context creation.
if any("Barostat" in type(f).__name__ and f.getFrequency() > 0
for f in simulation.system.getForces()):
raise ValueError("NVT requires all barostats disabled or absent")
# Set both the thermostat target and initial velocities.
simulation.integrator.setTemperature(temperature*kelvin)
simulation.context.setVelocitiesToTemperature(temperature*kelvin)
# Add reporters
simulation.reporters = []
# Log file
simulation.reporters.append(
StateDataReporter(
f"{output_prefix}_log.txt",
report_interval,
step=True,
potentialEnergy=True,
kineticEnergy=True,
temperature=True,
volume=True,
speed=True
)
)
# DCD trajectory (compact binary format)
simulation.reporters.append(
DCDReporter(f"{output_prefix}_traj.dcd", report_interval)
)
duration = (n_steps * simulation.integrator.getStepSize()).value_in_unit(picoseconds)
print(f"Running NVT equilibration: {n_steps} steps ({duration:.1f} ps)")
simulation.step(n_steps)
print("NVT equilibration complete")
return simulation4. NPT Equilibration and Production
Call this function first with a dedicated NPT equilibration prefix. Inspect density,
energy, structure and replicate stability before a separate production call; the
default duration is an example, not an equilibration or convergence criterion.
def run_npt_production(simulation, n_steps=500000, temperature=300, pressure=1.0,
report_interval=5000, output_prefix="npt"):
"""
NPT production run: constant N, P, T.
Args:
n_steps: Production steps (500000 × 2fs = 1 ns)
temperature: Temperature in Kelvin
pressure: Pressure in bar
report_interval: Steps between reports
"""
# Keep the Langevin thermostat and barostat at the same temperature.
simulation.integrator.setTemperature(temperature*kelvin)
system = simulation.system
barostats = [f for f in system.getForces() if "Barostat" in type(f).__name__]
if not system.usesPeriodicBoundaryConditions():
raise ValueError("NPT requires a periodic system")
if not barostats:
system.addForce(MonteCarloBarostat(pressure*bar, temperature*kelvin, 25))
simulation.context.reinitialize(preserveState=True)
elif len(barostats) != 1 or not isinstance(barostats[0], MonteCarloBarostat):
raise ValueError("This example supports one isotropic MonteCarloBarostat")
else:
barostats[0].setDefaultPressure(pressure*bar)
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- ml-pipeline-workflow – Xây dựng pipeline MLOps đầu cuối, từ chuẩn bị dữ liệu, huấn luyện mô hình, kiểm định đến…
- molfeat – Trích xuất đặc trưng phân tử nhỏ bằng Molfeat cho QSAR/QSPR, độ tương đồng hóa học, sàng…
- neurokit2 – Xây dựng và kiểm tra quy trình nghiên cứu NeuroKit2 có thể tái lập cho tiền xử lý chuỗi…
- hyperliquid – Dữ liệu thị trường Hyperliquid, lịch sử tài khoản, đánh giá giao dịch.
- neuropixels-analysis – Phân tích toàn bộ quy trình dữ liệu ghi điện ngoại bào Neuropixels với SpikeInterface…
- data-quality-auditor – Kiểm tra dữ liệu về độ đầy đủ, tính nhất quán, độ chính xác và tính hợp lệ. Lập hồ sơ…
- database-designer – Dùng khi người dùng yêu cầu thiết kế schema cơ sở dữ liệu, lập kế hoạch migration dữ…
- database-schema-designer – Dùng khi người dùng yêu cầu tạo sơ đồ ERD, chuẩn hóa schema cơ sở dữ liệu, thiết kế quan…