Example #1
0
copolymer = []
for i in range(40):
    copolymer.append('a')
for i in range(720):
    copolymer.append('b')
for i in range(40):
    copolymer.append('a')

total_time = 0
for i in range(num_walks):
    t0 = time.time()
    box.randomwalk(size,
                   rw_kval,
                   rw_cutoff,
                   rw_epsilon,
                   rw_sigma,
                   bead_sequence=copolymer,
                   initial_failures=10000,
                   walk_failures=10000,
                   soften=True,
                   termination="soften")
    t1 = time.time()
    total_time += t1 - t0
    print(
        f"Walk {i} completed in {t1-t0} seconds. Total time elapsed: {total_time}"
    )

total_time += t1 - t0
print(f"Walks complete. Total time: {total_time} seconds")

t0 = time.time()
box.simulation.structure("test_structure.in")
Example #2
0
cl_cutoff = 1.1 * rw_cutoff

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.randomwalk(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.randomwalk(size,
               0.9 * rw_kval,
               rw_cutoff,
               rw_epsilon,
               rw_sigma,
               bead_sequence=['b', 'c'],
Example #3
0
for i in range(1500):
    copolymer.append('a')
for i in range(1500):
    copolymer.append('b')


random_copolymer = []

total_time = 0
for i in range(2):
    t0 = time.time()
    box.randomwalk(size,
                    rw_kval,
                    rw_cutoff,
                    rw_epsilon,
                    rw_sigma,
                    bead_sequence = ['a'],
                    initial_failures= 10000,
                    walk_failures = 10000,
                    soften=True,
                    termination="soften")
    t1 = time.time()
    total_time+= t1-t0
    print(f"Walk {box.num_walks} completed in {t1-t0} seconds. Total time elapsed: {total_time}")
    
for i in range(2):
    low_density = box.find_low_density(region=2, quals=1)
    print(low_density)
    low_density_cell = low_density[0]
    t0 = time.time()
    box.randomwalk(size,
                    rw_kval,
Example #4
0
size = 100  # size of the chain
rw_kval = 30.0
rw_cutoff = 3.5
rw_epsilon = 0.05
rw_sigma = 0.3
graft_spacing = 20
graft_size = 10
graft_num = 1

total_time = 0
t0 = time.time()

box.randomwalk(size,
               rw_kval,
               rw_cutoff,
               rw_epsilon,
               rw_sigma,
               bead_sequence=['a', 'b'],
               starting_pos=[5.0, 5.0, 5.0],
               termination="retract")
print("Random walk completed.")

for i in range(1, size, graft_spacing):
    for j in range(graft_num):
        box.graft_chain([1, i],
                        graft_size,
                        rw_kval,
                        rw_cutoff,
                        rw_epsilon,
                        rw_sigma,
                        bead_sequence=['c'])
    print(f"Graft {i} completed.")
Example #5
0
# Running random walk
# -------------------------------------------------------------------------
num_walks = 225
rw_kval = 30
rw_cutoff = 1.5
rw_epsilon = 1.0
rw_sigma = 1.0
a
print("Starting walks.")
for i in range(num_walks):
    print(f"Walk {i}")
    box.randomwalk(500,
                   rw_kval,
                   rw_cutoff,
                   rw_epsilon,
                   rw_sigma,
                   bead_sequence = ['mainbead', 'subbead'],
                   initial_failures= 10000,
                   walk_failures = 10000,
                   soften=True,
                   termination="soften")

print("Walks complete.")

# -------------------------------------------------------------------------
# Modifying interactions mid simulation
# -------------------------------------------------------------------------

box.interactions.modify_sigma('mainbead', 'mainbead', 1.0)
box.interactions.modify_sigma('subbead', 'subbead', 1.0)
box.interactions.modify_sigma('mainbead', 'subbead', 1.0)
Example #6
0
copolymer = []
for i in range(10):
    copolymer.append('a')
for i in range(10):
    copolymer.append('b')

random_copolymer = []    

for i in range(numwalks):
    box.randomwalk(size,
                   rw_kval,
                   rw_cutoff,
                   rw_epsilon,
                   rw_sigma,
                   copolymer,
                   mini=1.1,
                   suppress = False,
                   termination='retract',
                   sequence_range=3,
                   srate=0.9,
                   danger = 1.0, 
                   initial_failures = 100,
                   walk_failures = 50)

    print(f"{i+1} random walked")

print(f"Walk completed in {t1-t0} seconds")
print(f"Number of retractions: {box.retractions}")

# for i in box.walk_data():
#     print(i, box.mdsim.global_bead_num(i))