Course data lives in Course-MD-Data. Download it to COURSE_DIR/data by following the instructions in Setup.
The official OpenMM examples use input files you can download from the OpenMM repo.
Store them in COURSE_DIR/data/openmm-examples for the Episode 2 scripts (Running simulations).
mkdir -p "$COURSE_DIR/data/openmm-examples"
base="https://raw.githubusercontent.com/openmm/openmm/master/examples/python-examples"
for file in \
input.pdb input.inpcrd input.prmtop input.gro input.top \
ala_ala_ala.pdb ala_ala_ala.psf charmm22.rtf charmm22.par \
amoeba_solvated_phenol.xyz amoeba_phenol.prm amoebabio18.prm; do
curl -L -o "$COURSE_DIR/data/openmm-examples/$file" "$base/$file"
done
Note: the Gromacs example requires access to force field files (includeDir). If you do not have them installed, use only the PDB/AMBER/CHARMM/Tinker examples.
from openmm import app, unit
import openmm as mm
pdb = app.PDBFile('docs/data/alanine-dipeptide.pdb')
forcefield = app.ForceField('amber14-all.xml', 'amber14/tip3pfb.xml')
modeller = app.Modeller(pdb.topology, pdb.positions)
modeller.addHydrogens(forcefield)
system = forcefield.createSystem(
modeller.topology,
nonbondedMethod=app.NoCutoff,
constraints=app.HBonds
)
integrator = mm.LangevinIntegrator(
300 * unit.kelvin,
1.0 / unit.picosecond,
2.0 * unit.femtoseconds
)
simulation = app.Simulation(modeller.topology, system, integrator)
simulation.context.setPositions(modeller.positions)
simulation.minimizeEnergy(maxIterations=100)
simulation.context.setVelocitiesToTemperature(300 * unit.kelvin)
simulation.reporters.append(app.DCDReporter('docs/data/alanine-dipeptide.dcd', 10))
simulation.step(200)
print('Wrote docs/data/alanine-dipeptide.dcd')
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Script source: generate_example_dcd.py
Note: the command to generate the DCD is in Reference.