def test_step(self): potent = pot.OneD.harmonicOscillatorPotential() integrator = self.integrator_class() sys = system.system(potential=potent, sampler=integrator) old_pos, oldForce = sys._currentPosition, sys._currentForce newPos, _, posShift = integrator.step(system=sys) self.assertNotEqual(old_pos, newPos, msg="Nothing happened here!")
def test_twoD_simulation_ana_plot(self): # settings sim_steps = 100 pot2D = harmonicOscillatorPotential2D() sampler = metropolisMonteCarloIntegrator() sys = system(potential=pot2D, sampler=sampler, start_position=[0, 0]) # simulate cur_state = sys.simulate(sim_steps, withdraw_traj=True) plotSimulations.twoD_simulation_analysis_plot(system=sys)
def test_integrate(self): potent = pot.OneD.harmonicOscillatorPotential() integrator = self.integrator_class() steps = 42 sys = system.system(potential=potent, sampler=integrator) old_pos, oldForce = sys._currentPosition, sys._currentForce integrator.integrate(system=sys, steps=steps) new_pos, new_Force = sys._currentPosition, sys._currentForce self.assertEqual(steps + 1, len(sys.trajectory), msg="The simulation did not run or was too short!") self.assertNotEqual(old_pos, new_pos, msg="Nothing happened here!") self.assertNotEqual(oldForce, new_Force, msg="Nothing happened here!")
from ensembler.samplers.stochastic import langevinIntegrator from ensembler.system import system from ensembler.visualisation.plotSimulations import oneD_simulation_analysis_plot ##Simulation Setup V = fourWellPotential(Vmax=4, a=1.5, b=4.0, c=7.0, d=9.0, ah=2., bh=0., ch=0.5, dh=1.) sampler = langevinIntegrator(dt=0.1, gamma=10) sys = system(potential=V, sampler=sampler, start_position=4, temperature=1) ##Simulate sys.simulate(steps=1000) ##Visualize positions = np.linspace(start=0, stop=10, num=1000) #phase space to be visualized oneD_simulation_analysis_plot(system=sys, title="Langevin Simulation", limits_coordinate_space=positions) #Local elevation/metadynamics simulation: ##Imports from ensembler.potentials.OneD import fourWellPotential, metadynamicsPotential from ensembler.samplers.stochastic import langevinIntegrator
def test_1D_animation(self): sim = system(potential=harmonicOscillatorPotential(), sampler=metropolisMonteCarloIntegrator()) sim.simulate(100) animationSimulation.animation_trajectory(simulated_system=sim)
def test_static_sim_plots(self): sim = system(potential=harmonicOscillatorPotential(), sampler=metropolisMonteCarloIntegrator()) sim.simulate(100) plotSimulations.oneD_simulation_analysis_plot(sim)