Commit 3610c510 by Luuk Balkenende

### Adjusted code to PEP8 rules

parent 414c7675
 ... ... @@ -3,11 +3,17 @@ import sys def add_bead(pos, n, T_dim, j, w_jl, w_l): phi_1 = np.linspace(0, 2 * np.pi - (2 / n) * np.pi, n) # Standard phi, KAN NAAR MAIN.PY phi_0 = np.linspace(0, 2 * np.pi - (2 / n) * np.pi, n) # Preallocate arrays E = np.zeros(n) # Calculate energy of different angles. DEZE FOR LOOP KAN WEG. for i in range(n): phi = phi_1 + (1-2*np.random.rand(n))*np.pi/n phi = phi_0 + (1-2*np.random.rand(n))*np.pi/n pos_new = np.zeros(2) pos_new[0] = pos[j-1, 0] + np.cos(phi[i]) pos_new[1] = pos[j-1, 1] + np.sin(phi[i]) ... ...
 # Import libaries/functions import numpy as np from matplotlib import pyplot as plt import time from functions import add_bead # Simulation constants # Simulation parameters n_beads = 100 #number of beads n = 6 #number of angles # Initialization n = 6 # number of phis n_beads = 100 T_dim = 1 # Physical parameters T_dim = 0.1 #T * (Kb / eps) # Non-dimensional temperature # Preallocate arrays pos = np.zeros([n_beads, 2]) pos[1] = np.array([1, 0]) w_jl = 1 w_l = 1 # Initialization pos[1] = np.array([1, 0]) #bead 1: pos[0, 0]. bead 2: pos[1, 0] w_jl = 1 #start value of weight w_j w_l = 1 #start value of weight W # Make polymer of lenght n_beads for j in range(2,n_beads): pos, w_jl, w_l = add_bead(pos, n, T_dim, j, w_jl, w_l) P = w_jl/w_l plt.plot(pos[:,0], pos[:,1], marker= ".", markersize=20, color="k" ) P = w_jl/w_l #Weight per polymer # Plot polymer plt.plot(pos[:,0], pos[:,1], marker= ".", markersize=20, color="k" ) 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!