Commit 16caf8fe authored by Gilliam van Oudenaren's avatar Gilliam van Oudenaren
Browse files

added histogram of bead numbers

parent fad6dc40
......@@ -6,4 +6,5 @@ plt.close("all")
beads, lengths, chains = functions.data(storechains = True, flipping = True)
plots.lengthplot(chains)
plots.chainplot(beads, chains, np.arange(10))
\ No newline at end of file
plots.beadhist(beads)
#plots.chainplot(beads, chains, np.arange(10))
\ No newline at end of file
import numpy as np
#Physical constants
kbT = 1e+8
kbT = 1e+0
epsilon = 0.25
sigma = 0.8
......@@ -9,7 +9,7 @@ n = 6
theta = 2*np.pi/n*np.arange(n)
#Max chain length
N = 256
N = 350
#iterations
k = 1000
\ No newline at end of file
......@@ -20,15 +20,20 @@ def lengthplot(chains):
exp = int(np.log10(kbT))
plt.figure()
plt.title("kbT = 10^%d" % exp)
plt.loglog(N, y, c = 'r', linestyle = '--')
plt.loglog(N, y, c = 'r', linestyle = '--', label = 'a = %.2f' % a)
plt.xlim((2, 2*max(N)))
plt.ylim((1, 2*max(R2mean)))
plt.errorbar(N, R2mean, R2std,
linestyle = '', marker = 'o', markersize = 1, capsize = 2)
plt.ylabel("<R²>")
plt.xlabel("Polymer beads")
plt.legend()
plt.show()
string = "fit1e"+str(exp)+"K.pdf"
plt.savefig(string)
def chainplot(beads, chains, interval):
"""
Inputs:
......@@ -44,4 +49,21 @@ def chainplot(beads, chains, interval):
txtstr = [str(i+1) for i in range(beads[i])]
for j in range(beads[i]):
plt.text(chains[i, j, 0], chains[i, j, 1], txtstr[j])
def beadhist(beads):
"""
Inputs:
- Array with number of beads per chain
Generates a plot showing the frequency of chains of different lengths
occuring.
"""
exp = int(np.log10(kbT))
plt.figure()
plt.title("kbT = 10^%d" % exp)
plt.hist(beads, bins = int(max(beads)/10), normed = True)
plt.xlabel("Number of beads")
plt.ylabel("Probability")
plt.show()
string = "hist1e"+str(exp)+"K.pdf"
plt.savefig(string)
Supports Markdown
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