def run_exit_times(statePair, runs): np.random.seed() asympot = potentials.asym3Dpotential(scalefactor=2.0) r1 = np.array(np.zeros(3)) p1 = mrd.particle(r1, 1.0) sphereboundary = mrd.reflectiveSphere(4.) integrator = integrators.brownianDynamicsSp(asympot, sphereboundary, p1, 0.001, 1.0) sim = mrd.simulation(integrator) exitTimes = [] exitPositions = [] fpts = [] exits = 0 run = 0 totalRuns = 0 while run < runs: integrator.pa.position = np.array(minima[statePair[0]]) integrator.clock = 0. totalRuns += 1 while True: sim.integrator.integrate() if np.linalg.norm(minima[statePair[1]] - integrator.pa.position) < 0.2: fpts.append(integrator.clock) run += 1 break elif np.linalg.norm(integrator.pa.position) > R: exits += 1 exitTimes.append(integrator.clock) exitPositions.append(integrator.pa.position) break print str(statePair[0]) + ' to ' + str(statePair[1]) return [np.array(fpts), totalRuns, exitTimes, exitPositions]
def run_mfpts_to_bath(state, runs, scalef, dt, runbound): global MFPTS, minima np.random.seed() asympot3D = potentials.asym3Dpotential(scalefactor = scalef) p1 = mrd.particle(np.zeros(3), 1.0) sphereboundary = mrd.reflectiveSphere(4.0) integrator = integrators.brownianDynamicsSp(asympot3D, sphereboundary, p1, dt, 1.0) sim = mrd.simulation(integrator) fpts = [] for run in range(runs): integrator.pa.position = np.array(minima[state]) fpts.append(sim.run_mfpt(runbound)) print 'state '+str(state)+' done' return np.array(fpts)
def run_mfpts_from_bath(bathRad, numpoints, scalefactor, dt): np.random.seed() asympot3D = potentials.asym3Dpotential(scalefactor=scalefactor) p1 = mrd.particle(np.zeros(3), 1.0) sphereboundary = mrd.reflectiveSphere(bathRad) integrator = integrators.brownianDynamicsSp(asympot3D, sphereboundary, p1, dt, 1.0) sim = mrd.simulation(integrator) startpoints = get_startpoints(numpoints, bathRad - radiusThreshold) fpts = [] for startpoint in startpoints: integrator.pa.position = startpoint integrator.clock = 0. fpts.append(sim.run_mfpt_points(np.array(minima), 0.2)) print 'bath to ' + str(bathRad) return np.array(fpts)