types = {1: 1.0, 2: 1.0, 3: 1.0} nums = 2 # number of random walks size = 10 # size of the chain rw_kval = 30.0 rw_cutoff = 3.5 rw_epsilon = 0.05 rw_sigma = 0.5 total_time = 0 for i in range(nums): t0 = time.time() box.random_walk(size, rw_kval, rw_cutoff, rw_epsilon, rw_sigma, bead_types=types, termination="retract") t1 = time.time() total_time += t1 - t0 print(f"Random walks: attempt {i+1} successful. Time taken: {t1 - t0}") print(f"Total time taken for random walk configuration: {total_time}") num_links = 1 # number of crosslinks mass = 3.0 # mass of crosslinker bead cl_kval = rw_kval cl_epsilon = rw_epsilon cl_sigma = rw_sigma
) print(f" SAMPLE NUMBER: {sample}") print( "--------------------------------------------------------------------------------------" ) box = PolyLattice(celllen, cellnums, pair_cutoff, pair_sigma, pair_epsilon) t0 = time.time() for j in range(num_walks): current_walks = box.num_walks while True: try: box.random_walk(j, size, rw_kval, rw_cutoff, rw_epsilon, rw_sigma, bead_types=types) if box.num_walks == current_walks + 1: print( f"Simulation {i}_{sample}: Random walk {j} complete" ) break except: print("Oooops! Random walk crashed!") for cell in box.Cells: cell.beads = [ bead for bead in cell.beads if bead[0] != j ]
cl_kval, cl_cutoff, cl_epsilon, cl_sigma, allowed_types=None, style='fene', prob=0.8, ibonds=2) for i in range(nums): t0 = time.time() # use cell_num to control where walk starts box.random_walk(size, rw_kval, rw_cutoff, rw_epsilon, rw_sigma, bead_types=types, termination="retract", allowed_failures=50000) t1 = time.time() total_time += t1 - t0 print(f"Random walks: attempt {i+1} successful. Time taken: {t1 - t0}") print(f"Total time taken for random walk configuration: {total_time}") box.unbonded_crosslinks(50, mass, cl_kval, cl_cutoff, cl_epsilon, cl_sigma,
allowed=['a', 'b']) copolymer = [] for i in range(copolymer_frac): copolymer.append('a') for i in range(copolymer_frac): copolymer.append('b') random_copolymer = [] total_time = 0 t0 = time.time() box.random_walk(size, rw_kval, rw_cutoff, rw_epsilon, rw_sigma, bead_sequence=copolymer, termination="retract") t1 = time.time() total_time += t1 - t0 print(f"Walk completed in {t1-t0} seconds") t0 = time.time() box.random_walk(size, 0.9 * rw_kval, rw_cutoff, rw_epsilon, rw_sigma, bead_sequence=['b', 'c'],