Episode 3 - Preparing and editing the system in OpenMM¶

Simple track: alanine preparation¶

In this notebook you prepare a simple system in OpenMM with Modeller. You will generate the solvated alanine system ready for simulation.

Table of contents¶

  • Simple track: alanine preparation
  • Simple track: alanine preparation
  • Step 1
  • Step 2

This notebook demonstrates how Modeller and solvent building create the alanine system ready for simulation.

Step 1¶

In [1]:
#!/usr/bin/env python3
import os
from pathlib import Path

from openmm import unit
from openmm.app import PDBFile, Modeller, ForceField

COURSE_DIR = Path(os.environ.get("COURSE_DIR", str(Path.home() / "Concepcion26"))).expanduser()
DATA_DIR = COURSE_DIR / "data"
PDB_IN = DATA_DIR / "alanine-dipeptide.pdb"
OUT_DIR = COURSE_DIR / "results" / "02-preparacion-sistema" / "simple"
OUT_DIR.mkdir(parents=True, exist_ok=True)
OUTPUT = OUT_DIR / "alanine_solvated.pdb"

pdb = PDBFile(str(PDB_IN))
forcefield = ForceField("amber14-all.xml", "amber14/tip3pfb.xml")

modeller = Modeller(pdb.topology, pdb.positions)
modeller.addHydrogens(forcefield)
modeller.addSolvent(
    forcefield,
    model="tip3p",
    padding=1.0 * unit.nanometer,
)

with OUTPUT.open("w") as outfile:
    PDBFile.writeFile(modeller.topology, modeller.positions, outfile)

print("Written", OUTPUT)
Written /Users/jordivilla/Concepcion26/results/02-preparacion-sistema/simple/alanine_solvated.pdb

Step 2¶

In [ ]: