Skip to content

Instantly share code, notes, and snippets.

@kyleabeauchamp
Created May 5, 2015 17:37
Show Gist options
  • Save kyleabeauchamp/f65254af875e1d3cd7ec to your computer and use it in GitHub Desktop.
Save kyleabeauchamp/f65254af875e1d3cd7ec to your computer and use it in GitHub Desktop.
broken_hmc.py
import simtk.openmm.app as app
import numpy as np
import simtk.openmm as mm
from simtk import unit as u
from openmmtools import integrators, testsystems
temperature = 300 * u.kelvin
testsystem = testsystems.WaterBox()
integrator = mm.LangevinIntegrator(temperature, 1.0 / u.picoseconds, 0.25 * u.femtoseconds)
context = mm.Context(testsystem.system, integrator)
context.setPositions(testsystem.positions)
context.setVelocitiesToTemperature(temperature)
positions = context.getState(getPositions=True).getPositions()
timestep = 10.0 * u.femtoseconds
integrator = integrators.HMCIntegrator(temperature, nsteps=10, timestep=timestep)
context = mm.Context(testsystem.system, integrator)
context.setPositions(positions)
context.setVelocitiesToTemperature(temperature)
integrator.step(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment