3 # Copyright (C) 2012 W. Trevor King <wking@tremily.us>
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 """Freely rotating chain (FRC) following Livadaru et al. [1].
20 [1]: http://pubs.acs.org/doi/abs/10.1021/ma020751g
23 import numpy as _numpy
24 import matplotlib.pyplot as _pyplot
25 try: # SciPy >= 0.10.0
26 from scipy.constants import Boltzmann as _kB
27 except ImportError: # SciPy < 0.10.0
28 from scipy.constants import Bolzmann as _kB
30 from crunch import inverse_frc
34 figure = _pyplot.figure()
35 axes = figure.add_subplot(1, 1, 1)
36 axes.set_xscale('log')
37 axes.set_yscale('log')
39 Fs = 10**_numpy.linspace(-4, 2.2, 100)
40 for gamma_degrees in [1, 5, 10, 20, 30, 50, 70]:
41 gamma = gamma_degrees * _numpy.pi / 180
42 xs = _numpy.array([inverse_frc(F, gamma) for F in Fs])
43 axes.plot(Fs, 1/(1-xs))
44 axes.axis([Fs.min(), Fs.max(), 0.9, 500])
45 axes.set_title('FRC force extension')
46 axes.set_xlabel(r'$\frac{fb}{k_B T}$')
47 axes.set_ylabel(r'$\left(1-\frac{R_z}{L}\right)^{-1}$')
48 figure.subplots_adjust(bottom=0.13)
52 if __name__ == '__main__':
54 figure.savefig('figure-14.png')