Changeset 40a87fa in sasmodels for sasmodels/models/poly_gauss_coil.py
- Timestamp:
- Aug 8, 2016 11:24:11 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 2472141
- Parents:
- 2d65d51
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/poly_gauss_coil.py
r2c74c11 r40a87fa 2 2 #conversion of Poly_GaussCoil.py 3 3 #converted by Steve King, Mar 2016 4 r""" 5 This empirical model describes the scattering from *polydisperse* polymer 6 chains in theta solvents or polymer melts, assuming a Schulz-Zimm type 7 molecular weight distribution. 4 8 5 6 7 r""" 8 This empirical model describes the scattering from *polydisperse* polymer chains in theta solvents or polymer melts, assuming a Schulz-Zimm type molecular weight distribution. 9 10 To describe the scattering from *monodisperse* polymer chains, see the :ref:`mono_gauss_coil <mono-gauss-coil>` model. 9 To describe the scattering from *monodisperse* polymer chains, see the 10 :ref:`mono-gauss-coil` model. 11 11 12 12 Definition 13 13 ---------- 14 14 15 *I(q)* = *scale* |cdot| *I* \ :sub:`0` |cdot| *P(q)* + *background* 15 .. math:: 16 17 I(q) = \text{scale} \cdot I_0 \cdot P(q) + \text{background} 16 18 17 19 where 18 20 19 *I*\ :sub:`0` = |phi|\ :sub:`poly` |cdot| *V* |cdot| (|rho|\ :sub:`poly` - |rho|\ :sub:`solv`)\ :sup:`2` 21 .. math:: 20 22 21 *P(q)* = 2 [(1 + UZ)\ :sup:`-1/U` + Z - 1] / [(1 + U) Z\ :sup:`2`]23 I_0 &= \phi_\text{poly} \cdot V \cdot (\rho_\text{poly}-\rho_\text{solv})^2 22 24 23 *Z* = [(*q R*\ :sub:`g`)\ :sup:`2`] / (1 + 2U)25 P(q) &= 2 [(1 + UZ)^{-1/U} + Z - 1] / [(1 + U) Z^2] 24 26 25 *U* = (Mw / Mn) - 1 = (*polydispersity ratio*) - 127 Z &= [(q R_g)^2] / (1 + 2U) 26 28 27 and 29 U &= (Mw / Mn) - 1 = \text{polydispersity ratio} - 1 28 30 29 *V* = *M* / (*N*\ :sub:`A` |delta|)31 V &= M / (N_A \delta) 30 32 31 Here, |phi|\ :sub:`poly`, is the volume fraction of polymer, *V* is the volume of a polymer coil, *M* is the molecular weight of the polymer, *N*\ :sub:`A` is Avogadro's Number, |delta| is the bulk density of the polymer, |rho|\ :sub:`poly` is the sld of the polymer, |rho|\ :sub:`solv` is the sld of the solvent, and *R*\ :sub:`g` is the radius of gyration of the polymer coil. 33 Here, $\phi_\text{poly}$, is the volume fraction of polymer, $V$ is the 34 volume of a polymer coil, $M$ is the molecular weight of the polymer, 35 $N_A$ is Avogadro's Number, $\delta$ is the bulk density of the polymer, 36 $\rho_\text{poly}$ is the sld of the polymer, $\rho_\text{solv}$ is the 37 sld of the solvent, and $R_g$ is the radius of gyration of the polymer coil. 32 38 33 The 2D scattering intensity is calculated in the same way as the 1D, but where the *q* vector is redefined as 39 The 2D scattering intensity is calculated in the same way as the 1D, 40 but where the $q$ vector is redefined as 34 41 35 42 .. math:: … … 40 47 ---------- 41 48 42 O Glatter and O Kratky (editors), *Small Angle X-ray Scattering*, Academic Press, (1982)43 Page 404.49 O Glatter and O Kratky (editors), *Small Angle X-ray Scattering*, 50 Academic Press, (1982) Page 404. 44 51 45 J S Higgins, H C Benoit, *Polymers and Neutron Scattering*, Oxford Science Publications, (1996). 52 J S Higgins, H C Benoit, *Polymers and Neutron Scattering*, 53 Oxford Science Publications, (1996). 46 54 47 S M King, *Small Angle Neutron Scattering* in *Modern Techniques for Polymer Characterisation*, Wiley, (1999). 55 S M King, *Small Angle Neutron Scattering* in *Modern Techniques for 56 Polymer Characterisation*, Wiley, (1999). 48 57 49 58 http://www.ncnr.nist.gov/staff/hammouda/distance_learning/chapter_28.pdf … … 52 61 from numpy import inf, exp, power 53 62 54 name = 55 title = 63 name = "poly_gauss_coil" 64 title = "Scattering from polydisperse polymer coils" 56 65 57 description = 66 description = """ 58 67 Evaluates the scattering from 59 68 polydisperse polymer chains. 60 69 """ 61 category = 70 category = "shape-independent" 62 71 63 # ["name", "units", default, [lower, upper], "type", "description"], 64 parameters = [["i_zero", "1/cm", 70.0, [0.0, inf], "", "Intensity at q=0"], 65 ["radius_gyration", "Ang", 75.0, [0.0, inf], "", "Radius of gyration"], 66 ["polydispersity", "None", 2.0, [1.0, inf], "", "Polymer Mw/Mn"]] 72 # pylint: disable=bad-whitespace, line-too-long 73 # ["name", "units", default, [lower, upper], "type", "description"], 74 parameters = [ 75 ["i_zero", "1/cm", 70.0, [0.0, inf], "", "Intensity at q=0"], 76 ["radius_gyration", "Ang", 75.0, [0.0, inf], "", "Radius of gyration"], 77 ["polydispersity", "None", 2.0, [1.0, inf], "", "Polymer Mw/Mn"], 78 ] 79 # pylint: enable=bad-whitespace, line-too-long 67 80 68 81 # NB: Scale and Background are implicit parameters on every model … … 71 84 u = polydispersity - 1.0 72 85 z = (q*radius_gyration)**2 / (1.0 + 2.0*u) 73 # need to trap the case of the polydispersity being 1 (ie, monodispers ity!)86 # need to trap the case of the polydispersity being 1 (ie, monodisperse!) 74 87 if polydispersity == 1.0: 75 88 inten = i_zero * 2.0 * (exp(-z) + z - 1.0) … … 80 93 inten[index] /= z[index]**2 81 94 return inten 82 Iq.vectorized = 95 Iq.vectorized = True # Iq accepts an array of q values 83 96 84 demo = dict(scale =1.0,85 i_zero =70.0,86 radius_gyration =75.0,87 polydispersity =2.0,88 background =0.0)97 demo = dict(scale=1.0, 98 i_zero=70.0, 99 radius_gyration=75.0, 100 polydispersity=2.0, 101 background=0.0) 89 102 90 103 # these unit test values taken from SasView 3.1.2 91 tests = [ 92 [{'scale': 1.0, 'i_zero': 70.0, 'radius_gyration': 75.0, 'polydispersity': 2.0, 'background': 0.0}, 104 tests = [ 105 [{'scale': 1.0, 'i_zero': 70.0, 'radius_gyration': 75.0, 106 'polydispersity': 2.0, 'background': 0.0}, 93 107 [0.0106939, 0.469418], [57.6405, 0.169016]], 94 108 ]
Note: See TracChangeset
for help on using the changeset viewer.