@pikaa-ai/pikaa 0.3.22 → 0.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/assets/brand/orbit-logo-option4-whale.jpg +0 -0
  2. package/assets/brand/orbit-logo.jpg +0 -0
  3. package/assets/brand/orbit-logo.png +0 -0
  4. package/assets/brand/orbit-logo.svg +3 -0
  5. package/dist/cli.js +448 -181
  6. package/dist/index.js +22 -2
  7. package/package.json +1 -2
  8. package/skills/adaptyv/SKILL.md +0 -240
  9. package/skills/aeon/SKILL.md +0 -402
  10. package/skills/analytical-method-validation/SKILL.md +0 -299
  11. package/skills/anndata/SKILL.md +0 -431
  12. package/skills/arbor/SKILL.md +0 -152
  13. package/skills/arboreto/SKILL.md +0 -267
  14. package/skills/astropy/SKILL.md +0 -353
  15. package/skills/autoskill/SKILL.md +0 -233
  16. package/skills/benchling-integration/SKILL.md +0 -229
  17. package/skills/bgpt-paper-search/SKILL.md +0 -75
  18. package/skills/bids/SKILL.md +0 -237
  19. package/skills/biopython/SKILL.md +0 -472
  20. package/skills/bioservices/SKILL.md +0 -399
  21. package/skills/bulk-rnaseq/SKILL.md +0 -198
  22. package/skills/cellxgene-census/SKILL.md +0 -283
  23. package/skills/cirq/SKILL.md +0 -370
  24. package/skills/citation-management/SKILL.md +0 -329
  25. package/skills/clinical-decision-support/SKILL.md +0 -238
  26. package/skills/clinical-decision-support/references/README.md +0 -62
  27. package/skills/clinical-reports/SKILL.md +0 -248
  28. package/skills/clinical-reports/references/README.md +0 -34
  29. package/skills/cobrapy/SKILL.md +0 -496
  30. package/skills/consciousness-council/SKILL.md +0 -151
  31. package/skills/dask/SKILL.md +0 -482
  32. package/skills/database-lookup/SKILL.md +0 -386
  33. package/skills/datamol/SKILL.md +0 -200
  34. package/skills/deepchem/SKILL.md +0 -244
  35. package/skills/deepspot-m/SKILL.md +0 -175
  36. package/skills/deeptools/SKILL.md +0 -412
  37. package/skills/depmap/SKILL.md +0 -301
  38. package/skills/dhdna-profiler/SKILL.md +0 -184
  39. package/skills/diffdock/SKILL.md +0 -488
  40. package/skills/dnanexus-integration/SKILL.md +0 -325
  41. package/skills/docx/SKILL.md +0 -99
  42. package/skills/esm/SKILL.md +0 -334
  43. package/skills/etetoolkit/SKILL.md +0 -327
  44. package/skills/exa-search/SKILL.md +0 -102
  45. package/skills/executing-plans/SKILL.md +0 -14
  46. package/skills/experimental-design/SKILL.md +0 -234
  47. package/skills/exploratory-data-analysis/SKILL.md +0 -280
  48. package/skills/flowio/SKILL.md +0 -310
  49. package/skills/fluidsim/SKILL.md +0 -279
  50. package/skills/frontend-design/SKILL.md +0 -100
  51. package/skills/generate-image/SKILL.md +0 -304
  52. package/skills/geniml/SKILL.md +0 -310
  53. package/skills/genomic-coordinates/SKILL.md +0 -189
  54. package/skills/genomic-intelligence/SKILL.md +0 -243
  55. package/skills/geomaster/README.md +0 -105
  56. package/skills/geomaster/SKILL.md +0 -366
  57. package/skills/geopandas/SKILL.md +0 -250
  58. package/skills/get-available-resources/SKILL.md +0 -260
  59. package/skills/gget/SKILL.md +0 -153
  60. package/skills/ginkgo-cloud-lab/SKILL.md +0 -106
  61. package/skills/glycoengineering/SKILL.md +0 -339
  62. package/skills/gtars/SKILL.md +0 -282
  63. package/skills/guardian-rails/SKILL.md +0 -54
  64. package/skills/histolab/SKILL.md +0 -243
  65. package/skills/hugging-science/SKILL.md +0 -132
  66. package/skills/hypogenic/SKILL.md +0 -290
  67. package/skills/hypothesis-generation/SKILL.md +0 -264
  68. package/skills/imaging-data-commons/SKILL.md +0 -496
  69. package/skills/infographics/SKILL.md +0 -315
  70. package/skills/iso-standards-readiness/SKILL.md +0 -352
  71. package/skills/lab-hardware-cad/SKILL.md +0 -372
  72. package/skills/labarchive-integration/SKILL.md +0 -216
  73. package/skills/lamindb/SKILL.md +0 -408
  74. package/skills/latchbio-integration/SKILL.md +0 -227
  75. package/skills/latex-posters/SKILL.md +0 -369
  76. package/skills/latex-posters/references/README.md +0 -439
  77. package/skills/liteparse/SKILL.md +0 -295
  78. package/skills/literature-review/SKILL.md +0 -263
  79. package/skills/markdown-mermaid-writing/SKILL.md +0 -322
  80. package/skills/market-research-reports/SKILL.md +0 -337
  81. package/skills/markitdown/SKILL.md +0 -264
  82. package/skills/matchms/SKILL.md +0 -276
  83. package/skills/matlab/SKILL.md +0 -274
  84. package/skills/matplotlib/SKILL.md +0 -378
  85. package/skills/medchem/SKILL.md +0 -321
  86. package/skills/modal/SKILL.md +0 -468
  87. package/skills/molecular-dynamics/SKILL.md +0 -458
  88. package/skills/molfeat/SKILL.md +0 -348
  89. package/skills/ncats-arax/SKILL.md +0 -178
  90. package/skills/networkx/SKILL.md +0 -440
  91. package/skills/neurokit2/SKILL.md +0 -323
  92. package/skills/neuropixels-analysis/SKILL.md +0 -412
  93. package/skills/nextflow/SKILL.md +0 -195
  94. package/skills/omero-integration/SKILL.md +0 -222
  95. package/skills/onekgpd/SKILL.md +0 -371
  96. package/skills/ontology-term-resolution/SKILL.md +0 -147
  97. package/skills/open-notebook/SKILL.md +0 -297
  98. package/skills/openpiv/SKILL.md +0 -469
  99. package/skills/opentrons-integration/SKILL.md +0 -322
  100. package/skills/optimize-for-gpu/SKILL.md +0 -176
  101. package/skills/owasp-top10/SKILL.md +0 -48
  102. package/skills/pacsomatic/LICENSE +0 -21
  103. package/skills/pacsomatic/SKILL.md +0 -150
  104. package/skills/paper-lookup/SKILL.md +0 -263
  105. package/skills/paperclip/SKILL.md +0 -413
  106. package/skills/paperzilla/SKILL.md +0 -159
  107. package/skills/parallel-web/SKILL.md +0 -128
  108. package/skills/pathml/SKILL.md +0 -222
  109. package/skills/pathogen-variant-surveillance/SKILL.md +0 -208
  110. package/skills/pathway-enrichment/SKILL.md +0 -194
  111. package/skills/pdf/SKILL.md +0 -322
  112. package/skills/peer-review/SKILL.md +0 -288
  113. package/skills/penetration-testing/SKILL.md +0 -31
  114. package/skills/pennylane/SKILL.md +0 -240
  115. package/skills/phylogenetics/SKILL.md +0 -409
  116. package/skills/pi-agent/SKILL.md +0 -83
  117. package/skills/pkpd-modeling/SKILL.md +0 -381
  118. package/skills/polars/SKILL.md +0 -393
  119. package/skills/polars-bio/SKILL.md +0 -379
  120. package/skills/ponytail/SKILL.md +0 -31
  121. package/skills/ponytail-audit/SKILL.md +0 -18
  122. package/skills/pptx/SKILL.md +0 -246
  123. package/skills/pptx-posters/SKILL.md +0 -258
  124. package/skills/primekg/SKILL.md +0 -99
  125. package/skills/protocolsio-integration/SKILL.md +0 -236
  126. package/skills/pufferlib/SKILL.md +0 -328
  127. package/skills/pydeseq2/SKILL.md +0 -369
  128. package/skills/pydicom/SKILL.md +0 -381
  129. package/skills/pyhealth/SKILL.md +0 -124
  130. package/skills/pylabrobot/SKILL.md +0 -216
  131. package/skills/pymatgen/SKILL.md +0 -404
  132. package/skills/pymc/SKILL.md +0 -310
  133. package/skills/pymoo/SKILL.md +0 -276
  134. package/skills/pyopenms/SKILL.md +0 -179
  135. package/skills/pysam/SKILL.md +0 -330
  136. package/skills/pytdc/SKILL.md +0 -297
  137. package/skills/pytorch-lightning/SKILL.md +0 -191
  138. package/skills/pyzotero/SKILL.md +0 -137
  139. package/skills/qiskit/SKILL.md +0 -259
  140. package/skills/qutip/SKILL.md +0 -317
  141. package/skills/rdkit/SKILL.md +0 -94
  142. package/skills/relsa-severity-assessment/SKILL.md +0 -354
  143. package/skills/research-grants/SKILL.md +0 -296
  144. package/skills/research-grants/references/README.md +0 -287
  145. package/skills/research-lookup/README.md +0 -106
  146. package/skills/research-lookup/SKILL.md +0 -338
  147. package/skills/rowan/SKILL.md +0 -398
  148. package/skills/scanpy/SKILL.md +0 -303
  149. package/skills/scholar-evaluation/SKILL.md +0 -296
  150. package/skills/scientific-brainstorming/SKILL.md +0 -282
  151. package/skills/scientific-critical-thinking/SKILL.md +0 -180
  152. package/skills/scientific-schematics/SKILL.md +0 -370
  153. package/skills/scientific-slides/SKILL.md +0 -379
  154. package/skills/scientific-visualization/SKILL.md +0 -285
  155. package/skills/scientific-writing/SKILL.md +0 -356
  156. package/skills/scikit-bio/SKILL.md +0 -470
  157. package/skills/scikit-learn/SKILL.md +0 -324
  158. package/skills/scikit-survival/SKILL.md +0 -313
  159. package/skills/scvelo/SKILL.md +0 -328
  160. package/skills/scvi-tools/SKILL.md +0 -201
  161. package/skills/seaborn/SKILL.md +0 -254
  162. package/skills/security-auditor/SKILL.md +0 -37
  163. package/skills/shap/SKILL.md +0 -282
  164. package/skills/simpy/SKILL.md +0 -283
  165. package/skills/stable-baselines3/SKILL.md +0 -325
  166. package/skills/statistical-analysis/SKILL.md +0 -446
  167. package/skills/statistical-power/SKILL.md +0 -200
  168. package/skills/statsmodels/SKILL.md +0 -238
  169. package/skills/sympy/SKILL.md +0 -354
  170. package/skills/systematic-debugging/SKILL.md +0 -35
  171. package/skills/tamarind/SKILL.md +0 -285
  172. package/skills/tdd/SKILL.md +0 -26
  173. package/skills/tiledbvcf/SKILL.md +0 -456
  174. package/skills/timesfm-forecasting/SKILL.md +0 -408
  175. package/skills/timesfm-forecasting/examples/global-temperature/README.md +0 -178
  176. package/skills/torch-geometric/SKILL.md +0 -458
  177. package/skills/torchdrug/SKILL.md +0 -241
  178. package/skills/transformers/SKILL.md +0 -195
  179. package/skills/treatment-plans/SKILL.md +0 -174
  180. package/skills/treatment-plans/references/README.md +0 -19
  181. package/skills/umap-learn/SKILL.md +0 -488
  182. package/skills/uncertainty-and-units/SKILL.md +0 -384
  183. package/skills/usfiscaldata/SKILL.md +0 -171
  184. package/skills/vaex/SKILL.md +0 -204
  185. package/skills/venue-templates/SKILL.md +0 -269
  186. package/skills/verification-before-completion/SKILL.md +0 -22
  187. package/skills/waypoint-bio/SKILL.md +0 -273
  188. package/skills/what-if-oracle/SKILL.md +0 -184
  189. package/skills/writing-plans/SKILL.md +0 -15
  190. package/skills/xlsx/SKILL.md +0 -110
  191. package/skills/zarr-python/SKILL.md +0 -241
@@ -1,458 +0,0 @@
1
- ---
2
- name: molecular-dynamics
3
- 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.
4
- license: MIT
5
- metadata:
6
- version: "1.1"
7
- skill-author: Kuan-lin Huang
8
- ---
9
-
10
- # Molecular Dynamics
11
-
12
- ## Overview
13
-
14
- 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:
15
-
16
- - **OpenMM** (https://openmm.org/): High-performance MD simulation engine with GPU support, Python API, and flexible force field support
17
- - **MDAnalysis** (https://mdanalysis.org/): Python library for reading, writing, and analyzing MD trajectories from all major simulation packages
18
-
19
- **Installation:**
20
- ```bash
21
- conda install -c conda-forge openmm mdanalysis nglview
22
- # or
23
- uv pip install openmm mdanalysis
24
- ```
25
-
26
- ## When to Use This Skill
27
-
28
- Use molecular dynamics when:
29
-
30
- - **Protein stability analysis**: How does a mutation affect protein dynamics?
31
- - **Drug binding simulations**: Characterize binding mode and residence time of a ligand
32
- - **Conformational sampling**: Explore protein flexibility and conformational changes
33
- - **Protein-protein interaction**: Model interface dynamics and binding energetics
34
- - **RMSD/RMSF analysis**: Quantify structural fluctuations from a reference structure
35
- - **Free energy estimation**: Compute binding free energy or conformational free energy
36
- - **Membrane simulations**: Model proteins in lipid bilayers
37
- - **Intrinsically disordered proteins**: Study IDR conformational ensembles
38
-
39
- ## Core Workflow: OpenMM Simulation
40
-
41
- ### 1. System Preparation
42
-
43
- ```python
44
- from openmm.app import *
45
- from openmm import *
46
- from openmm.unit import *
47
- import sys
48
-
49
- def prepare_system_from_pdb(pdb_file, forcefield_name="amber14-all.xml",
50
- water_model="amber14/tip3pfb.xml"):
51
- """
52
- Prepare an OpenMM system from a PDB file.
53
-
54
- Args:
55
- pdb_file: Path to cleaned PDB file (use PDBFixer for raw PDB files)
56
- forcefield_name: Force field XML file
57
- water_model: Water model XML file
58
-
59
- Returns:
60
- pdb, forcefield, system, topology
61
- """
62
- # Load PDB
63
- pdb = PDBFile(pdb_file)
64
-
65
- # Load force field
66
- forcefield = ForceField(forcefield_name, water_model)
67
-
68
- # Add hydrogens and solvate
69
- modeller = Modeller(pdb.topology, pdb.positions)
70
- modeller.addHydrogens(forcefield)
71
-
72
- # Add solvent box (10 Å padding, 150 mM NaCl)
73
- modeller.addSolvent(
74
- forcefield,
75
- model='tip3p',
76
- padding=10*angstroms,
77
- ionicStrength=0.15*molar
78
- )
79
-
80
- print(f"System: {modeller.topology.getNumAtoms()} atoms, "
81
- f"{modeller.topology.getNumResidues()} residues")
82
-
83
- # Create system
84
- system = forcefield.createSystem(
85
- modeller.topology,
86
- nonbondedMethod=PME, # Particle Mesh Ewald for long-range electrostatics
87
- nonbondedCutoff=1.0*nanometer,
88
- constraints=HBonds, # Constrain hydrogen bonds (allows 2 fs timestep)
89
- rigidWater=True,
90
- ewaldErrorTolerance=0.0005
91
- )
92
-
93
- return modeller, system
94
- ```
95
-
96
- ### 2. Energy Minimization
97
-
98
- ```python
99
- from openmm.app import *
100
- from openmm import *
101
- from openmm.unit import *
102
-
103
- def minimize_energy(modeller, system, output_pdb="minimized.pdb",
104
- max_iterations=1000, tolerance=10.0):
105
- """
106
- Energy minimize the system to remove steric clashes.
107
-
108
- Args:
109
- modeller: Modeller object with topology and positions
110
- system: OpenMM System
111
- output_pdb: Path to save minimized structure
112
- max_iterations: Maximum minimization steps
113
- tolerance: Convergence criterion in kJ/mol/nm
114
-
115
- Returns:
116
- simulation object with minimized positions
117
- """
118
- # Set up integrator (doesn't matter for minimization)
119
- integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picoseconds)
120
-
121
- # Create simulation
122
- # Use GPU if available (CUDA or OpenCL), fall back to CPU
123
- try:
124
- platform = Platform.getPlatformByName('CUDA')
125
- properties = {'DeviceIndex': '0', 'Precision': 'mixed'}
126
- except Exception:
127
- try:
128
- platform = Platform.getPlatformByName('OpenCL')
129
- properties = {}
130
- except Exception:
131
- platform = Platform.getPlatformByName('CPU')
132
- properties = {}
133
-
134
- simulation = Simulation(
135
- modeller.topology, system, integrator,
136
- platform, properties
137
- )
138
- simulation.context.setPositions(modeller.positions)
139
-
140
- # Check initial energy
141
- state = simulation.context.getState(getEnergy=True)
142
- print(f"Initial energy: {state.getPotentialEnergy()}")
143
-
144
- # Minimize
145
- simulation.minimizeEnergy(
146
- tolerance=tolerance*kilojoules_per_mole/nanometer,
147
- maxIterations=max_iterations
148
- )
149
-
150
- state = simulation.context.getState(getEnergy=True, getPositions=True)
151
- print(f"Minimized energy: {state.getPotentialEnergy()}")
152
-
153
- # Save minimized structure
154
- with open(output_pdb, 'w') as f:
155
- PDBFile.writeFile(simulation.topology, state.getPositions(), f)
156
-
157
- return simulation
158
- ```
159
-
160
- ### 3. NVT Equilibration
161
-
162
- ```python
163
- from openmm.app import *
164
- from openmm import *
165
- from openmm.unit import *
166
-
167
- def run_nvt_equilibration(simulation, n_steps=50000, temperature=300,
168
- report_interval=1000, output_prefix="nvt"):
169
- """
170
- NVT equilibration: constant N, V, T.
171
- Equilibrate velocities to target temperature.
172
-
173
- Args:
174
- simulation: OpenMM Simulation (after minimization)
175
- n_steps: Number of MD steps (50000 × 2fs = 100 ps)
176
- temperature: Temperature in Kelvin
177
- report_interval: Steps between data reports
178
- output_prefix: File prefix for trajectory and log
179
- """
180
- # Add position restraints for backbone during NVT
181
- # (Optional: restraint heavy atoms)
182
-
183
- # Set temperature
184
- simulation.context.setVelocitiesToTemperature(temperature*kelvin)
185
-
186
- # Add reporters
187
- simulation.reporters = []
188
-
189
- # Log file
190
- simulation.reporters.append(
191
- StateDataReporter(
192
- f"{output_prefix}_log.txt",
193
- report_interval,
194
- step=True,
195
- potentialEnergy=True,
196
- kineticEnergy=True,
197
- temperature=True,
198
- volume=True,
199
- speed=True
200
- )
201
- )
202
-
203
- # DCD trajectory (compact binary format)
204
- simulation.reporters.append(
205
- DCDReporter(f"{output_prefix}_traj.dcd", report_interval)
206
- )
207
-
208
- print(f"Running NVT equilibration: {n_steps} steps ({n_steps*2/1000:.1f} ps)")
209
- simulation.step(n_steps)
210
- print("NVT equilibration complete")
211
-
212
- return simulation
213
- ```
214
-
215
- ### 4. NPT Equilibration and Production
216
-
217
- ```python
218
- def run_npt_production(simulation, n_steps=500000, temperature=300, pressure=1.0,
219
- report_interval=5000, output_prefix="npt"):
220
- """
221
- NPT production run: constant N, P, T.
222
-
223
- Args:
224
- n_steps: Production steps (500000 × 2fs = 1 ns)
225
- temperature: Temperature in Kelvin
226
- pressure: Pressure in bar
227
- report_interval: Steps between reports
228
- """
229
- # Add Monte Carlo barostat for pressure control
230
- system = simulation.context.getSystem()
231
- system.addForce(MonteCarloBarostat(pressure*bar, temperature*kelvin, 25))
232
- simulation.context.reinitialize(preserveState=True)
233
-
234
- # Update reporters
235
- simulation.reporters = []
236
- simulation.reporters.append(
237
- StateDataReporter(
238
- f"{output_prefix}_log.txt",
239
- report_interval,
240
- step=True,
241
- potentialEnergy=True,
242
- temperature=True,
243
- density=True,
244
- speed=True
245
- )
246
- )
247
- simulation.reporters.append(
248
- DCDReporter(f"{output_prefix}_traj.dcd", report_interval)
249
- )
250
-
251
- # Save checkpoints
252
- simulation.reporters.append(
253
- CheckpointReporter(f"{output_prefix}_checkpoint.chk", 50000)
254
- )
255
-
256
- print(f"Running NPT production: {n_steps} steps ({n_steps*2/1000000:.2f} ns)")
257
- simulation.step(n_steps)
258
- print("Production MD complete")
259
- return simulation
260
- ```
261
-
262
- ## Trajectory Analysis with MDAnalysis
263
-
264
- ### 1. Load Trajectory
265
-
266
- ```python
267
- import MDAnalysis as mda
268
- from MDAnalysis.analysis import rms, align, contacts
269
- import numpy as np
270
- import matplotlib.pyplot as plt
271
-
272
- def load_trajectory(topology_file, trajectory_file):
273
- """
274
- Load an MD trajectory with MDAnalysis.
275
-
276
- Args:
277
- topology_file: PDB, PSF, or other topology file
278
- trajectory_file: DCD, XTC, TRR, or other trajectory
279
- """
280
- u = mda.Universe(topology_file, trajectory_file)
281
- print(f"Universe: {u.atoms.n_atoms} atoms, {u.trajectory.n_frames} frames")
282
- print(f"Time range: 0 to {u.trajectory.totaltime:.0f} ps")
283
- return u
284
- ```
285
-
286
- ### 2. RMSD Analysis
287
-
288
- ```python
289
- def compute_rmsd(u, selection="backbone", reference_frame=0):
290
- """
291
- Compute RMSD of selected atoms relative to reference frame.
292
-
293
- Args:
294
- u: MDAnalysis Universe
295
- selection: Atom selection string (MDAnalysis syntax)
296
- reference_frame: Frame index for reference structure
297
-
298
- Returns:
299
- numpy array of (time, rmsd) values
300
- """
301
- # Align trajectory to minimize RMSD
302
- aligner = align.AlignTraj(u, u, select=selection, in_memory=True)
303
- aligner.run()
304
-
305
- # Compute RMSD
306
- R = rms.RMSD(u, select=selection, ref_frame=reference_frame)
307
- R.run()
308
-
309
- rmsd_data = R.results.rmsd # columns: frame, time, RMSD
310
- return rmsd_data
311
-
312
- def plot_rmsd(rmsd_data, title="RMSD over time", output_file="rmsd.png"):
313
- """Plot RMSD over simulation time."""
314
- fig, ax = plt.subplots(figsize=(10, 4))
315
- ax.plot(rmsd_data[:, 1] / 1000, rmsd_data[:, 2], 'b-', linewidth=0.5)
316
- ax.set_xlabel("Time (ns)")
317
- ax.set_ylabel("RMSD (Å)")
318
- ax.set_title(title)
319
- ax.axhline(rmsd_data[:, 2].mean(), color='r', linestyle='--',
320
- label=f'Mean: {rmsd_data[:, 2].mean():.2f} Å')
321
- ax.legend()
322
- plt.tight_layout()
323
- plt.savefig(output_file, dpi=150)
324
- return fig
325
- ```
326
-
327
- ### 3. RMSF Analysis (Per-Residue Flexibility)
328
-
329
- ```python
330
- def compute_rmsf(u, selection="backbone", start_frame=0):
331
- """
332
- Compute per-residue RMSF (flexibility).
333
-
334
- Returns:
335
- resids, rmsf_values arrays
336
- """
337
- # Select atoms
338
- atoms = u.select_atoms(selection)
339
-
340
- # Compute RMSF
341
- R = rms.RMSF(atoms)
342
- R.run(start=start_frame)
343
-
344
- # Average by residue
345
- resids = []
346
- rmsf_per_res = []
347
- for res in u.select_atoms(selection).residues:
348
- res_atoms = res.atoms.intersection(atoms)
349
- if len(res_atoms) > 0:
350
- resids.append(res.resid)
351
- rmsf_per_res.append(R.results.rmsf[res_atoms.indices].mean())
352
-
353
- return np.array(resids), np.array(rmsf_per_res)
354
- ```
355
-
356
- ### 4. Protein-Ligand Contacts
357
-
358
- ```python
359
- def analyze_contacts(u, protein_sel="protein", ligand_sel="resname LIG",
360
- radius=4.5, start_frame=0):
361
- """
362
- Track protein-ligand contacts over trajectory.
363
-
364
- Args:
365
- radius: Contact distance cutoff in Angstroms
366
- """
367
- protein = u.select_atoms(protein_sel)
368
- ligand = u.select_atoms(ligand_sel)
369
-
370
- contact_frames = []
371
- for ts in u.trajectory[start_frame:]:
372
- # Find protein atoms within radius of ligand
373
- distances = contacts.contact_matrix(
374
- protein.positions, ligand.positions, radius
375
- )
376
- contact_residues = set()
377
- for i in range(distances.shape[0]):
378
- if distances[i].any():
379
- contact_residues.add(protein.atoms[i].resid)
380
- contact_frames.append(contact_residues)
381
-
382
- return contact_frames
383
- ```
384
-
385
- ## Force Field Selection Guide
386
-
387
- | System | Recommended Force Field | Water Model |
388
- |--------|------------------------|-------------|
389
- | Standard proteins | AMBER14 (`amber14-all.xml`) | TIP3P-FB |
390
- | Proteins + small molecules | AMBER14 + GAFF2 | TIP3P-FB |
391
- | Membrane proteins | CHARMM36m | TIP3P |
392
- | Nucleic acids | AMBER99-bsc1 or AMBER14 | TIP3P |
393
- | Disordered proteins | ff19SB or CHARMM36m | TIP3P |
394
-
395
- ## System Preparation Tools
396
-
397
- ### PDBFixer (for raw PDB files)
398
-
399
- ```python
400
- from pdbfixer import PDBFixer
401
- from openmm.app import PDBFile
402
-
403
- def fix_pdb(input_pdb, output_pdb, ph=7.0):
404
- """Fix common PDB issues: missing residues, atoms, add H, standardize."""
405
- fixer = PDBFixer(filename=input_pdb)
406
- fixer.findMissingResidues()
407
- fixer.findNonstandardResidues()
408
- fixer.replaceNonstandardResidues()
409
- fixer.removeHeterogens(True) # Remove water/ligands
410
- fixer.findMissingAtoms()
411
- fixer.addMissingAtoms()
412
- fixer.addMissingHydrogens(ph)
413
-
414
- with open(output_pdb, 'w') as f:
415
- PDBFile.writeFile(fixer.topology, fixer.positions, f)
416
-
417
- return output_pdb
418
- ```
419
-
420
- ### GAFF2 for Small Molecules (via OpenFF Toolkit)
421
-
422
- ```python
423
- # For ligand parameterization, use OpenFF toolkit or ACPYPE
424
- # uv pip install openff-toolkit
425
- from openff.toolkit import Molecule, ForceField as OFFForceField
426
- from openff.interchange import Interchange
427
-
428
- def parameterize_ligand(smiles, ff_name="openff-2.0.0.offxml"):
429
- """Generate GAFF2/OpenFF parameters for a small molecule."""
430
- mol = Molecule.from_smiles(smiles)
431
- mol.generate_conformers(n_conformers=1)
432
-
433
- off_ff = OFFForceField(ff_name)
434
- interchange = off_ff.create_interchange(mol.to_topology())
435
- return interchange
436
- ```
437
-
438
- ## Best Practices
439
-
440
- - **Always minimize before MD**: Raw PDB structures have steric clashes
441
- - **Equilibrate before production**: NVT (50–100 ps) → NPT (100–500 ps) → Production
442
- - **Use GPU**: Simulations are 10–100× faster on GPU (CUDA/OpenCL)
443
- - **2 fs timestep with HBonds constraints**: Standard; use 4 fs with HMR (hydrogen mass repartitioning)
444
- - **Analyze only equilibrated trajectory**: Discard first 20–50% as equilibration
445
- - **Save checkpoints**: MD runs can fail; checkpoints allow restart
446
- - **Periodic boundary conditions**: Required for solvated systems
447
- - **PME for electrostatics**: More accurate than cutoff methods for charged systems
448
-
449
- ## Additional Resources
450
-
451
- - **OpenMM documentation**: https://openmm.org/documentation.html
452
- - **MDAnalysis user guide**: https://docs.mdanalysis.org/
453
- - **GROMACS** (alternative MD engine): https://manual.gromacs.org/
454
- - **NAMD** (alternative): https://www.ks.uiuc.edu/Research/namd/
455
- - **CHARMM-GUI** (web-based system builder): https://charmm-gui.org/
456
- - **AmberTools** (free Amber tools): https://ambermd.org/AmberTools.php
457
- - **OpenMM paper**: Eastman P et al. (2017) PLOS Computational Biology. PMID: 28278240
458
- - **MDAnalysis paper**: Michaud-Agrawal N et al. (2011) J Computational Chemistry. PMID: 21500218