p0.step(HowManySteps,0.01,0.008) return p0 print("Something is in here") ########################################################################### if __name__ == '__main__': steps = range(900,1000) start = time() print("NAIVE----------------") P = [] for i in steps: p0 = RCLPolymer(100, 3, 0.2, 5) p0.step(i,0.01,0.008) P.append(p0) print("For time : ",time()-start) start = time() print("PARALLEL--------------") # res = Parallel(n_jobs=2)(delayed(sample)(i) for i in steps) pool = mp.Pool(4) res = pool.map(sample, steps) print("Paralel time : ",time()-start) else: print(__name__) print("Something is happening here")
def sample(HowManySteps): p0 = RCLPolymer(100, 3, 0.2, 5) p0.step(HowManySteps,0.01,0.008) return p0
excludedVolumeCutOff=0, # excludedVolumeSpringConstant = 0.6, waitingSteps=2000, encounterDistance=0.10, genomicDistance=10, Nb=2, Nc_inDamageFoci=0, # times2sample = [1,500,1000,5000,10000] # A1 = 10, # B1 = 80 ) numSteps = 24000 D = 0.008 dt = 0.005 p0 = RCLPolymer(**polymerParams) d = np.zeros((numSteps, 6)) mc = Experiment(p0, {}, simulationParams, "break") for i in range(numSteps): p0.step(1, dt, D) d[i] = p0.interBreakDistance()[0] realtime = np.arange(numSteps) * dt import matplotlib.pyplot as plt plt.figure() plt.plot(realtime, d, lw=1) plt.hlines(0.1, 0, realtime[-1])