예제 #1
0
def test_hmc(timestep, steps_per_hmc):
    timestep = timestep * u.femtoseconds
    integrator = hmc_integrators.HMCIntegrator(temperature, steps_per_hmc, timestep)
    context = mm.Context(system, integrator, platform)
    context.setPositions(positions)
    context.setVelocitiesToTemperature(temperature)
    integrator.step(n_steps)
    return integrator.acceptance_rate
예제 #2
0
import pandas as pd
import simtk.openmm.app as app
import numpy as np
import simtk.openmm as mm
from simtk import unit as u
from openmmtools import hmc_integrators, testsystems

precision = "mixed"

sysname = "switchedaccuratewater"

system, positions, groups, temperature, timestep, langevin_timestep, testsystem = lb_loader.load(
    sysname)

integrator = hmc_integrators.HMCIntegrator(temperature,
                                           steps_per_hmc=25,
                                           timestep=timestep)
context = lb_loader.build(system, integrator, positions, temperature)
mm.LocalEnergyMinimizer.minimize(context)
integrator.step(40000)
positions = context.getState(getPositions=True).getPositions()
print(integrator.acceptance_rate)

collision_rate = 1.0 / u.picoseconds
n_steps = 25
Neff_cutoff = 1E5

itype = "HMCIntegrator"

integrator = hmc_integrators.HMCIntegrator(temperature,
                                           steps_per_hmc=25,
예제 #3
0
    return xyz, n


n = 4 * (2**3)

xyz, box = build_lattice(n)

traj = generate_dummy_trajectory(xyz, box)
traj.save("./out.pdb")
len(xyz)

x = np.linspace(0, 16, 5000)
y = np.array([f(xi) for xi in x])
plot(x, y)

testsystem = LennardJonesFluid(nparticles=1000, hcp=True)

system, positions = testsystem.system, testsystem.positions
temperature = 25 * u.kelvin

integrator = hmc_integrators.HMCIntegrator(temperature,
                                           steps_per_hmc=25,
                                           timestep=1.0 * u.femtoseconds)
context = lb_loader.build(system, integrator, positions, temperature)
context.getState(getEnergies=True).getPotentialEnergy()
mm.LocalEnergyMinimizer.minimize(context)
context.getState(getEnergies=True).getPotentialEnergy()
integrator.step(400)
context.getState(getEnergies=True).getPotentialEnergy()