def make_mistis_engine():
    pes = (
        toys.OuterWalls([1.0, 1.0], [0.0, 0.0])
        + toys.Gaussian(-1.0, [12.0, 12.0], [-0.5, 0.5])
        + toys.Gaussian(-1.0, [12.0, 12.0], [-0.5, -0.5])
        + toys.Gaussian(-1.0, [12.0, 12.0], [0.5, -0.5])
    )

    topology=toys.Topology(n_spatial=2,
                           masses=[1.0, 1.0],
                           pes=pes)

    integ = toys.LangevinBAOABIntegrator(dt=0.02, temperature=0.1, gamma=2.5)

    options = {
        'integ': integ,
        'n_frames_max': 5000,
        'n_steps_per_frame': 1
    }

    toy_eng = toys.Engine(
        options=options,
        topology=topology
    ).named('engine')
    return toy_eng
def make_mstis_engine():
    pes = (
        toys.OuterWalls([1.0, 1.0], [0.0, 0.0])
        + toys.Gaussian(-0.7, [12.0, 12.0], [0.0, 0.4])
        + toys.Gaussian(-0.7, [12.0, 12.0], [-0.5, -0.5])
        + toys.Gaussian(-0.7, [12.0, 12.0], [0.5, -0.5])
    )

    topology=toys.Topology(
        n_spatial=2,
        masses=[1.0, 1.0],
        pes=pes
    )

    integ = toys.LangevinBAOABIntegrator(dt=0.02, temperature=0.1, gamma=2.5)

    options={
        'integ': integ,
        'n_frames_max': 5000,
        'n_steps_per_frame': 1
    }

    toy_eng = toys.Engine(
        options=options,
        topology=topology
    ).named('toy_engine')

    template = toys.Snapshot(
        coordinates=np.array([[-0.5, -0.5]]),
        velocities=np.array([[0.0,0.0]]),
        engine=toy_eng
    )

    toy_eng.current_snapshot = template
    return toy_eng
def setup_module():
    # set up globals
    global gaussian, linear, outer, harmonic
    gaussian = toy.Gaussian(6.0, [2.5, 40.0], [0.8, 0.5])
    outer = toy.OuterWalls([1.12, 2.0], [0.2, -0.25])
    linear = toy.LinearSlope([1.5, 0.75], 0.5)
    harmonic = toy.HarmonicOscillator([1.5, 2.0], [0.5, 3.0], [0.25, 0.75])
    global init_pos, init_vel, sys_mass
    init_pos = np.array([0.7, 0.65])
    init_vel = np.array([0.6, 0.5])
    sys_mass = np.array([1.5, 1.5])
예제 #4
0
import openpathsampling.engines.toy as toys
import numpy as np

import argparse

def make_parser():
    parser = argparse.ArgumentParser()
    parser.add_argument('--nsteps', type=int, default=10000)
    return parser

parser = make_parser()
opts = parser.parse_args()
n_steps = opts.nsteps

pes = (toys.OuterWalls([1.0,1.0], [0.0,0.0])
       + toys.Gaussian(-0.7, [30.0, 0.5], [-0.6, 0.0])
       + toys.Gaussian(-0.7, [30.0, 0.5], [0.6, 0.0])
       + toys.Gaussian(0.5, [85.0, 70.0], [0.1, 0.0]))
topology = toys.Topology(n_spatial=2, masses=[1.0, 1.0], pes=pes)
engine = toys.Engine(
    {'integ': toys.LangevinBAOABIntegrator(dt=0.02,
                                           temperature=0.1,
                                           gamma=2.5),
     'n_frames_max': 5000,
     'n_steps_per_frame': 10}, topology)
template = toys.Snapshot(coordinates=np.array([[0.0, 0.0]]),
                         velocities=np.array([[0.0, 0.0]]),
                         engine=engine)

def val(snapshot, index):
    return snapshot.xyz[0][index]