Commit 0ace1a1f authored by Pieter van Velde's avatar Pieter van Velde

Cleaned code and added docstrings to functions in functions.py

parent 8f21d227
This diff is collapsed.
......@@ -7,7 +7,7 @@ from functions import add_bead, limits, prune, enrich, maxsize, stack_init, exp_
# Simulation parameters
n_beads = 250 # number of beads
n = 6 # number of angles
n_pol = 1000 # number of polymers
n_pol = 10 # number of polymers
alfa_up = 2 # alfa to compute upper limit
alfa_low = 1 # alfa to compute lwoer limit
cst_dep = 1 / (0.75 * n) # multiplication constant for L dependence perm
......@@ -15,16 +15,8 @@ cst_dep = 1 / (0.75 * n) # multiplication constant for L dependence perm
# Physical parameters
T_dim = 10 # T * (Kb / eps) # Non-dimensional temperature
m = np.arange(0, 2 * n_pol, 2)
pos_stack = np.zeros([n_beads, n_pol * 2])
pos_stack[1, m] = 1
# print(pos_stack)
polweight_stack = np.zeros([n_beads, n_pol])
polweight_stack[0:2, :] = 1
polweight_array = np.zeros([n_beads])
end_end_stack = np.zeros([n_beads, n_pol])
end_end_array = np.zeros([n_beads, 1])
pos_array = np.zeros([n_beads, 2])
pos_stack, polweight_stack, end_end_stack, pos_array, polweight_array, end_end_array = stack_init(n_beads, n_pol)
enrich1 = 0
prune1 = 0
......@@ -35,11 +27,8 @@ j = 2
m = 0
while flag == 1:
k = 0
flag2 = 1
while flag2 == 1:
#print('end =', end_end_stack)
#print(k)
#print('prune = ', prune1)
while k < polweight_stack.shape[1]:
pos_stack[:, 2 * k:2 * k + 2], polweight_stack[j, k], end_end_stack[j, k], fails = add_bead(
pos_stack[:, 2 * k:2 * k + 2], n, T_dim, polweight_stack[j - 1, k], fails, cst_dep, j)
......@@ -52,13 +41,8 @@ while flag == 1:
elif polweight_stack[j, k] > uplim:
enrich1 = enrich1 + 1
polweight_stack, pos_stack, end_end_stack, k = enrich(polweight_stack, pos_stack, end_end_stack, k)
k = k + 1
if k >= int(pos_stack.shape[1] / 2):
flag2 = 0
#print('shape = ', pos_stack.shape[1]/2)
#print('shape = ', polweight_stack.shape[1] / 2)
#print('k = ', k)
#print('enrich = ', enrich1)
if pos_stack.size == 0 or j == n_beads - 1:
flag = 0
......@@ -91,5 +75,5 @@ plt.ylim(1, 10000)
plt.xlim(1, 250)
print(polweight_stack.shape)
print('enrich = ', enrich1)
print('prune = ', prune1)
plt.show()
\ No newline at end of file
print('prune = ', prune1/2)
plt.show()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment