Commit 4829ef80 by Laurien

### Separated files main and output

parents 9dbb6960 f53c8c38
 ... ... @@ -24,3 +24,9 @@ weighting end-to-end length 06-05-2019 Adjusting total weights for PERM algorithm 08-05-2019 changes to PERM to shape according to theory retreiving more results 12-04-2019 optimizing computation time of algorithm
 ... ... @@ -13,4 +13,20 @@ TO DO: - expand for more polymers - write tests - plot observables for system - find error functions and plot errorbars \ No newline at end of file - find error functions and plot errorbars 29-04-2019 how do we enhance the not crossing --> solved add random offset 01-05-2019 Pruning enriching does not work properly --> needs to be solved 06-05-2019 do lines fit the theory how do we create two seperate polymers when enriching 08-05-2019 what else can we obtain from the system
Rosenbluthmain.py 0 → 100644
 ############################################### IMPORT MODULES ############################################### import numpy as np np.seterr(divide='ignore', invalid='ignore') import matplotlib.pyplot as plt #from anim import make_3d_animation import scipy as sci from scipy import integrate from scipy import optimize from scipy.optimize import curve_fit import math from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import cnames from matplotlib import animation from IPython.display import HTML import importlib import zerofunctions3 as z importlib.reload(z) import finalfunctions2 as f importlib.reload(f) ################################################# PARAMETERS & INITIALIZATION ############################################# N=1 # number of polymers L=250 # number of beads per polymer dim=2 # dimensions (2D) d=1 # distance between the beads k_b=1 # boltzmann constant T=25 # temperature eps=0.25 # value for epsilon in lennard jones sigma=0.8 # value for sigma in lennard jones Ntheta= 6 # number of divisions of theta alpha1= 1.2 # lower limit alpha2= 2.2 # upper limit ################################## BUILDING THE POLYMER ##################################### def rosenbluth(L): """ function: Builds a single polymer using the Rosenbluth algorithm input: L output: Single polymer configuration with L beads """ istop = L theta, pos_position, position, distance, radius, E_theta, w_l, sumW_l, w_lfinal, n, probability, e2e, w_ave, lowlimit, uplimit, W = z.zeromatrices(L, dim, Ntheta) position[0], position[1], theta=z.initialized(Ntheta, position, theta) PolWeight = 1 for i in range(2,L): pos_position= f.roulette(i, d, Ntheta, position, theta) E_theta = f.lennardjones(eps, sigma, Ntheta, pos_position, position[:i-1,:]) w_lfinal[i], sumW_l[i], position[i,:], n = f.extrabead(i, k_b, T, Ntheta, E_theta, sumW_l, w_lfinal, position, pos_position) PolWeight = PolWeight * w_lfinal[i] W[i] = PolWeight e2e[i] = f.endtoend(position, i) return position, e2e, W
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!