def test_integrator_decorators(): integrator = integrators.HMCIntegrator(timestep=0.05 * unit.femtoseconds) testsystem = testsystems.IdealGas() nsteps = 25 context = openmm.Context(testsystem.system, integrator) context.setPositions(testsystem.positions) context.setVelocitiesToTemperature(300 * unit.kelvin) integrator.step(nsteps) assert integrator.n_accept == nsteps assert integrator.n_trials == nsteps assert integrator.acceptance_rate == 1.0
import openmmtools.testsystems from openmmtools import testsystems from pymbar import timeseries from functools import partial from openmmmcmc.mcmc import HMCMove, GHMCMove, LangevinDynamicsMove, MonteCarloBarostatMove import logging # Test various combinations of systems and MCMC schemes analytical_testsystems = [ ("HarmonicOscillator", testsystems.HarmonicOscillator(), [ GHMCMove(timestep=10.0*units.femtoseconds,nsteps=100) ]), ("HarmonicOscillator", testsystems.HarmonicOscillator(), { GHMCMove(timestep=10.0*units.femtoseconds,nsteps=100) : 0.5, HMCMove(timestep=10*units.femtosecond, nsteps=10) : 0.5 }), ("HarmonicOscillatorArray", testsystems.HarmonicOscillatorArray(N=4), [ LangevinDynamicsMove(timestep=10.0*units.femtoseconds,nsteps=100) ]), ("IdealGas", testsystems.IdealGas(nparticles=216), [ HMCMove(timestep=10*units.femtosecond, nsteps=10), MonteCarloBarostatMove() ]) ] NSIGMA_CUTOFF = 6.0 # cutoff for significance testing debug = False # set to True only for manual debugging of this nose test def test_minimizer_all_testsystems(): #testsystem_classes = testsystems.TestSystem.__subclasses__() testsystem_classes = [ testsystems.AlanineDipeptideVacuum ] for testsystem_class in testsystem_classes: class_name = testsystem_class.__name__ logging.info("Testing minimization with testsystem %s" % class_name) testsystem = testsystem_class()
# ============================================================================= # GLOBAL TEST CONSTANTS # ============================================================================= # Test various combinations of systems and MCMC schemes analytical_testsystems = [ ("HarmonicOscillator", testsystems.HarmonicOscillator(), GHMCMove(timestep=10.0 * unit.femtoseconds, n_steps=100)), ("HarmonicOscillator", testsystems.HarmonicOscillator(), WeightedMove([(GHMCMove(timestep=10.0 * unit.femtoseconds, n_steps=100), 0.5), (HMCMove(timestep=10 * unit.femtosecond, n_steps=10), 0.5)])), ("HarmonicOscillatorArray", testsystems.HarmonicOscillatorArray(N=4), LangevinDynamicsMove(timestep=10.0 * unit.femtoseconds, n_steps=100)), ("IdealGas", testsystems.IdealGas(nparticles=216), SequenceMove([ HMCMove(timestep=10 * unit.femtosecond, n_steps=10), MonteCarloBarostatMove() ])) ] NSIGMA_CUTOFF = 6.0 # cutoff for significance testing debug = True # set to True only for manual debugging of this nose test # ============================================================================= # TEST FUNCTIONS # =============================================================================
#!/usr/bin/env python # -*- coding: utf-8 -*- from simtk.openmm.app import * from simtk.openmm import * from simtk.unit import * from openmmtools import integrators, testsystems import os import sys from sys import stdout argon = testsystems.IdealGas() ######################################################################## # Datos a modificar para las simulaciones cutoff = 206.227 * 0.5 # en nm ensamble = "NVE" # tipos: NVE, NVT, NPT dt = 0.002 # picosegundos T = 298.0 # kelvin P = 1.0 # atmosferas intervaloBarost = 25 # frecuencia de activacion del barostato stepImp = 50 # frecuencia de impresion (adimensional) pasosTotales = 1000 # este valor por stepImp por dt da la longitud de la trayectoria VelocityVerlet = False # Solo para NVE ponerlo en True ######################################################################## system = argon.system if ensamble == "NVE": if VelocityVerlet == True: # utilizando openmmtools integrator = integrators.VelocityVerletIntegrator(dt * picoseconds) integrator.addConstrainPositions() integrator.addConstrainVelocities()