def run_mfpts_from_bath(startPosition, bathRad, dt): np.random.seed() p1 = mrd.particle(np.zeros(3), D_CO) msm = mrd.MSM(T, minima) msm.exitStates = [] boundary = mrd.reflectiveSphere(bathRad) integrator = integrators.MSMRDtruncTrajs3D(msm, bathRad, p1, dt, interactionRadius, boundary, model) sim = mrd.simulation(integrator) integrator.particle.position = startPosition integrator.clock = 0. integrator.transition = False integrator.MSM.state = -1 integrator.MSMactive = False integrator.MSM.exit = False return sim.run_mfpt_state(boundState)
def run_mfpts_to_bath(state, runs, dt = 0.1): p1 = mrd.particle(np.zeros(3), D_CO) msm = mrd.MSM(T, minima) msm.exitStates = [] boundary = mrd.reflectiveSphere(2.*interactionRadius) integrator = integrators.MSMRDtruncTrajs3D(msm, 2.*interactionRadius, p1, dt, interactionRadius, boundary, model) sim = mrd.simulation(integrator) fpts = [] for run in range(runs): integrator.particle.position = np.zeros(3) integrator.clock = 0. integrator.MSM.state = state integrator.lastState = state integrator.lastStateTime = 0 integrator.transition = True integrator.MSMactive = True integrator.MSM.exit = False fpts.append(sim.run_mfpt(40.)) print str(state)+' to bath' return np.array(fpts)
def run_mfpts_to_bath(state, runs, dt=0.001): p1 = mrd.particle(np.zeros(2), 1.0) msm = mrd.MSM(T, minima) msm.exitStates = [] boundary = mrd.reflectiveSphere(4.) integrator = integrators.MSMRDtruncTrajs(msm, 4.0, p1, 0.001, model, 2.5) sim = mrd.simulation(integrator) fpts = [] for run in range(runs): integrator.p.position = np.zeros(2) integrator.clock = 0. integrator.MSM.state = state integrator.lastState = state integrator.lastStateTime = 0 integrator.transition = True integrator.MSMactive = True integrator.MSM.exit = False fpts.append(sim.run_mfpt(2.7)) print str(state) + ' to bath' return np.array(fpts)
def run_mfpts_from_bath(bathRad, numpoints, dt): np.random.seed() p1 = mrd.particle(np.zeros(2), 1.0) msm = mrd.MSM(T, minima) msm.exitStates = [] boundary = mrd.reflectiveSphere(bathRad) integrator = integrators.MSMRDtruncTrajs(msm, bathRad, p1, 0.001, model, 2.5) sim = mrd.simulation(integrator) fpts = [] startpoints = get_startpoints(numpoints, bathRad - radiusThreshold) for startpoint in startpoints: integrator.p.position = startpoint integrator.clock = 0. integrator.transition = False integrator.MSM.state = -1 integrator.MSMactive = False integrator.MSM.exit = False fpts.append(sim.run_mfpt_states()) print 'bath to ' + str(bathRad) return np.array(fpts)
def run_exit_times(statePair, runs): np.random.seed() r1 = np.array(np.zeros(3)) p1 = mrd.particle(r1, 1.0) msm = mrd.MSM(T, minima) msm.exitStates = [] boundary = mrd.reflectiveSphere(4.) integrator = integrators.MSMRDtruncTrajs3D(msm, 4.0, p1, 0.001, 2.5, boundary, model) sim = mrd.simulation(integrator) exitTimes = [] exitPositions = [] fpts = [] exits = 0 run = 0 totalRuns = 0 while run < runs: integrator.particle.position = np.array(np.zeros(3)) integrator.clock = 0. integrator.MSM.state = statePair[0] integrator.lastState = statePair[0] integrator.transition = True integrator.MSMactive = True totalRuns += 1 while True: sim.integrator.integrate() if integrator.MSM.state == statePair[1]: fpts.append(integrator.clock) run += 1 break elif not integrator.MSMactive: exits += 1 exitTimes.append(integrator.clock) exitPositions.append(integrator.particle.position) break print str(statePair[0])+' to ' + str(statePair[1]) return [np.array(fpts), totalRuns, exitTimes, exitPositions]