def setup(self): pes = toys.HarmonicOscillator(A=[1.0], omega=[1.0], x0=[0.0]) topology = toys.Topology(n_spatial=1, masses=[1.0], pes=pes) integrator = toys.LeapfrogVerletIntegrator(0.1) options = { 'integ': integrator, 'n_frames_max': 100000, 'n_steps_per_frame': 2 } self.engine = toys.Engine(options=options, topology=topology) self.snap0 = toys.Snapshot(coordinates=np.array([[0.0]]), velocities=np.array([[1.0]]), engine=self.engine) cv = paths.FunctionCV("Id", lambda snap : snap.coordinates[0][0]) self.cv = cv self.center = paths.CVDefinedVolume(cv, -0.2, 0.2) self.interface = paths.CVDefinedVolume(cv, -0.3, 0.3) self.outside = paths.CVDefinedVolume(cv, 0.6, 0.9) self.extra = paths.CVDefinedVolume(cv, -1.5, -0.9) self.flux_pairs = [(self.center, self.interface)] self.sim = DirectSimulation(storage=None, engine=self.engine, states=[self.center, self.outside], flux_pairs=self.flux_pairs, initial_snapshot=self.snap0)
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])