simulateCharmm.py 1.14 KB
Newer Older
1
2
3
from openmm.app import *
from openmm import *
from openmm.unit import *
Peter Eastman's avatar
Peter Eastman committed
4
from sys import stdout
5

6
# Read the PSF
Jason Swails's avatar
Jason Swails committed
7
psf = CharmmPsfFile('ala_ala_ala.psf')
8
9
10
11

# Get the coordinates from the PDB
pdb = PDBFile('ala_ala_ala.pdb')

12
13
14
15
16
17
18
19
20
# Load the parameter set.
params = CharmmParameterSet('charmm22.rtf', 'charmm22.par')

# NOTICE:
# -------
# The CHARMM 22 parameter set is out-of-date and NOT recommended for general
# use. It is included here as an illustrative example, but for production
# simulations you should download the latest versions of the force fields at
# http://mackerell.umaryland.edu/CHARMM_ff_params.html
21
22

# Instantiate the system
23
system = psf.createSystem(params, nonbondedMethod=NoCutoff, constraints=HBonds)
24
integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picoseconds)
25
26
27
simulation = Simulation(psf.topology, system, integrator)
simulation.context.setPositions(pdb.getPositions())
simulation.minimizeEnergy()
28
simulation.reporters.append(DCDReporter('output.dcd', 1000))
29
30
31
32
33
simulation.reporters.append(
        StateDataReporter(stdout, 1000, step=True, potentialEnergy=True,
                          temperature=True)
)
simulation.step(10000)