Changes in / [5befedd:3040843] in sasmodels
- Files:
-
- 11 added
- 15 deleted
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r946cdc8e r61ba623 9 9 /doc/api/ 10 10 /doc/model/ 11 /doc/ref/models 11 12 .mplconfig -
doc/Makefile
r19dcb933 r61ba623 32 32 MODELS_RST = $(patsubst ../sasmodels/models/%.py,model/%.rst,$(MODELS_PY)) 33 33 34 model/img/%: ../sasmodels/models/img/%35 $(COPY) $< $@36 37 model/%.rst: ../sasmodels/models/%.py38 $(PYTHON) genmodel.py $< $@39 40 .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest build41 42 34 help: 43 35 @echo "Please use \`make <target>' where <target> is one of" … … 53 45 @echo " doctest to run all doctests embedded in the documentation (if enabled)" 54 46 47 model/img/%: ../sasmodels/models/img/% 48 $(COPY) $< $@ 49 50 model/%.rst: ../sasmodels/models/%.py 51 $(PYTHON) genmodel.py $< $@ 52 53 ref/models/index.rst: gentoc.py $(MODELS_PY) 54 $(PYTHON) gentoc.py $(MODELS_PY) 55 56 .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest build 57 55 58 api: genapi.py 56 59 $(RMDIR) api … … 61 64 $(MKDIR) model/img 62 65 63 build: model $(MODELS_RST) $(IMG_DEST) api 66 build: model $(MODELS_RST) $(IMG_DEST) api ref/models/index.rst 64 67 #cd ../.. && python setup.py build 65 68 -
doc/genmodel.py
rcb6ecf4 r61ba623 3 3 sys.path.insert(0,'..') 4 4 5 # Convert ../sasmodels/models .name.py to sasmodels.models.name5 # Convert ../sasmodels/models/name.py to sasmodels.models.name 6 6 module_name = sys.argv[1][3:-3].replace('/','.').replace('\\','.') 7 7 print module_name -
doc/index.rst
r19dcb933 r61ba623 15 15 16 16 guide/index.rst 17 models/index.rst17 ref/index.rst 18 18 api/index.rst 19 19 -
sasmodels/generate.py
r6137124 ra5d0d00 210 210 RST_UNITS = { 211 211 "Ang": "|Ang|", 212 "1/Ang": "|Ang^-1|", 212 213 "1/Ang^2": "|Ang^-2|", 213 214 "1e-6/Ang^2": "|1e-6Ang^-2|", -
sasmodels/models/barbell.py
r0706431 ra5d0d00 16 16 The barbell geometry is defined as 17 17 18 .. image:: img/ image105.jpg18 .. image:: img/barbell_geometry.jpg 19 19 20 20 where *r* is the radius of the cylinder. All other parameters are as defined in the diagram. … … 71 71 **The requirement that** *R* >= *r* **is not enforced in the model!** It is up to you to restrict this during analysis. 72 72 73 This example dataset is produced by running the Macro PlotBarbell(), using 200 data points, *qmin* = 0.001 |Ang^-1|, 74 *qmax* = 0.7 |Ang^-1| and the following default values 73 This example dataset is produced by running the Macro PlotBarbell(), 74 using 200 data points, *qmin* = 0.001 |Ang^-1|, *qmax* = 0.7 |Ang^-1|, 75 *sld* = 4e-6 |Ang^-2| and the default model values. 75 76 76 ============== ======== ============= 77 Parameter name Units Default value 78 ============== ======== ============= 79 scale None 1.0 80 len_bar |Ang| 400.0 81 rad_bar |Ang| 20.0 82 rad_bell |Ang| 40.0 83 sld_barbell |Ang^-2| 1.0e-006 84 sld_solv |Ang^-2| 6.3e-006 85 background |cm^-1| 0 86 ============== ======== ============= 87 88 .. image:: img/image110.jpg 77 .. image:: img/barbell_1d.jpg 89 78 90 79 *Figure. 1D plot using the default values (w/256 data point).* … … 93 82 |theta| = 45 deg and |phi| = 0 deg with default values for other parameters 94 83 95 .. image:: img/ image111.jpg84 .. image:: img/barbell_2d.jpg 96 85 97 86 *Figure. 2D plot (w/(256X265) data points).* … … 106 95 107 96 REFERENCE 97 --------- 108 98 109 99 H Kaya, *J. Appl. Cryst.*, 37 (2004) 37 223-230 … … 122 112 It must be that rad_bar <(=) rad_bell. 123 113 """ 114 category = "shape:cylinder" 124 115 125 116 parameters = [ -
sasmodels/models/bcc.py
re166cb9 ra5d0d00 3 3 #note - calculation requires double precision 4 4 """ 5 Calculates the scattering from a **body-centered cubic lattice** with paracrystalline distortion. Thermal vibrations 6 are considered to be negligible, and the size of the paracrystal is infinitely large. Paracrystalline distortion is 7 assumed to be isotropic and characterized by a Gaussian distribution. 5 Calculates the scattering from a **body-centered cubic lattice** with 6 paracrystalline distortion. Thermal vibrations are considered to be negligible, 7 and the size of the paracrystal is infinitely large. Paracrystalline distortion 8 is assumed to be isotropic and characterized by a Gaussian distribution. 8 9 9 10 The returned value is scaled to units of |cm^-1|\ |sr^-1|, absolute scale. … … 12 13 ---------- 13 14 14 The scattering intensity *I(q)*is calculated as15 The scattering intensity $I(q)$ is calculated as 15 16 16 .. image:: img/image167.jpg17 .. math: 17 18 18 where *scale* is the volume fraction of spheres, *Vp* is the volume of the primary particle, *V(lattice)* is a volume 19 correction for the crystal structure, *P(q)* is the form factor of the sphere (normalized), and *Z(q)* is the 20 paracrystalline structure factor for a body-centered cubic structure. 19 I(q) = \frac{\text{scale}}{V_P} V_\text{lattice} P(q) Z(q) 21 20 22 Equation (1) of the 1990 reference is used to calculate *Z(q)*, using equations (29)-(31) from the 1987 paper for23 *Z1*\ , *Z2*\ , and *Z3*\ .24 21 25 The lattice correction (the occupied volume of the lattice) for a body-centered cubic structure of particles of radius 26 *R* and nearest neighbor separation *D* is 22 where *scale* is the volume fraction of spheres, *Vp* is the volume of the 23 primary particle, *V(lattice)* is a volume correction for the crystal 24 structure, $P(q)$ is the form factor of the sphere (normalized), and $Z(q)$ 25 is the paracrystalline structure factor for a body-centered cubic structure. 27 26 28 .. image:: img/image159.jpg 27 Equation (1) of the 1990 reference is used to calculate $Z(q)$, using 28 equations (29)-(31) from the 1987 paper for *Z1*\ , *Z2*\ , and *Z3*\ . 29 29 30 The distortion factor (one standard deviation) of the paracrystal is included in the calculation of *Z(q)* 30 The lattice correction (the occupied volume of the lattice) for a 31 body-centered cubic structure of particles of radius $R$ and nearest neighbor 32 separation $D$ is 31 33 32 .. image:: img/image160.jpg34 .. math: 33 35 34 where *g* is a fractional distortion based on the nearest neighbor distance. 36 V_\text{lattice} = \frac{16\pi}{3} \frac{R^3}{\left(D\sqrt{2}\right)^3} 37 38 39 The distortion factor (one standard deviation) of the paracrystal is included 40 in the calculation of $Z(q)$ 41 42 .. math: 43 44 \Delta a = g D 45 46 where $g$ is a fractional distortion based on the nearest neighbor distance. 35 47 36 48 The body-centered cubic lattice is 37 49 38 .. image:: img/ image168.jpg50 .. image:: img/bcc_lattice.jpg 39 51 40 52 For a crystal, diffraction peaks appear at reduced q-values given by 41 53 42 .. image:: img/image162.jpg54 .. math: 43 55 44 where for a body-centered cubic lattice, only reflections where (\ *h* + *k* + *l*\ ) = even are allowed and 45 reflections where (\ *h* + *k* + *l*\ ) = odd are forbidden. Thus the peak positions correspond to (just the first 5) 56 \frac{qD}{2\pi} = \sqrt{h^2 + k^2 + l^2} 46 57 47 .. image:: img/image169.jpg 58 where for a body-centered cubic lattice, only reflections where 59 $(h + k + l) = \text{even}$ are allowed and reflections where 60 $(h + k + l) = \text{odd}$ are forbidden. Thus the peak positions 61 correspond to (just the first 5) 48 62 49 **NB: The calculation of** *Z(q)* **is a double numerical integral that must be carried out with a high density of** 50 **points to properly capture the sharp peaks of the paracrystalline scattering.** So be warned that the calculation is 51 SLOW. Go get some coffee. Fitting of any experimental data must be resolution smeared for any meaningful fit. This 52 makes a triple integral. Very, very slow. Go get lunch! 63 .. math: 53 64 54 This example dataset is produced using 200 data points, *qmin* = 0.001 |Ang^-1|, *qmax* = 0.1 |Ang^-1| and the above 55 default values. 65 \begin{eqnarray} 66 &q/q_o&&\quad 1&& \ \sqrt{2} && \ \sqrt{3} && \ \sqrt{4} && \ \sqrt{5} \\ 67 &\text{Indices}&& (110) && (200) && (211) && (220) && (310) 68 \end{eqnarray} 56 69 57 .. image:: img/image170.jpg 70 **NB: The calculation of $Z(q)$ is a double numerical integral that must 71 be carried out with a high density of points to properly capture the sharp 72 peaks of the paracrystalline scattering.** So be warned that the calculation 73 is SLOW. Go get some coffee. Fitting of any experimental data must be 74 resolution smeared for any meaningful fit. This makes a triple integral. 75 Very, very slow. Go get lunch! 76 77 This example dataset is produced using 200 data points, 78 *qmin* = 0.001 |Ang^-1|, *qmax* = 0.1 |Ang^-1| and the above default values. 79 80 .. image:: img/bcc_1d.jpg 58 81 59 82 *Figure. 1D plot in the linear scale using the default values (w/200 data point).* 60 83 61 The 2D (Anisotropic model) is based on the reference below where *I(q)* is approximated for 1d scattering. Thus the 62 scattering pattern for 2D may not be accurate. Note that we are not responsible for any incorrectness of the 2D model 63 computation. 84 The 2D (Anisotropic model) is based on the reference below where $I(q)$ is 85 approximated for 1d scattering. Thus the scattering pattern for 2D may not 86 be accurate. Note that we are not responsible for any incorrectness of the 2D 87 model computation. 64 88 65 .. image:: img/ image165.gif89 .. image:: img/bcc_orientation.gif 66 90 67 .. image:: img/ image171.jpg91 .. image:: img/bcc_2d.jpg 68 92 69 93 *Figure. 2D plot using the default values (w/200X200 pixels).* 70 94 71 95 REFERENCE 96 --------- 72 97 73 98 Hideki Matsuoka et. al. *Physical Review B*, 36 (1987) 1754-1765 … … 87 112 assumed to be isotropic and characterized by a Gaussian distribution. 88 113 """ 114 category="shape:paracrystal" 89 115 90 116 parameters = [ -
sasmodels/models/broad_peak.py
rf734e7d ra5d0d00 30 30 q = \sqrt{q_x^2 + q_y^2} 31 31 32 ===================== ========= =============33 Parameter name Units Default value34 ===================== ========= =============35 lorentz_scale(=C) None 1036 porod_scale (=A) None 1e-0537 lorentz_length (= |xi| ) |Ang| 5038 peak_pos (=Q0) |Ang^-1| 0.139 porod_exp (=n) None 240 lorentz_exp (=m) None 341 Background (=B) |cm^-1| 0.142 ================== ======== =============43 32 44 33 .. image:: img/image175.jpg … … 47 36 48 37 REFERENCE 38 --------- 49 39 50 40 None. … … 71 61 lorentz_exp = Lorentzian exponent 72 62 background = Incoherent background""" 63 category="shape-independent" 73 64 74 65 parameters = [ -
sasmodels/models/capped_cylinder.py
ra503bfd ra5d0d00 130 130 solvent_sld: SLD of the solvent. 131 131 """ 132 category = "shape:cylinder" 132 133 133 134 parameters = [ -
sasmodels/models/core_shell_cylinder.py
ra503bfd ra5d0d00 133 133 phi: the axis_phi of the cylinder 134 134 """ 135 category = "shape:cylinder" 135 136 136 137 parameters = [ -
sasmodels/models/cylinder.py
r43bdddc ra5d0d00 128 128 f(q,alpha)^(2)*sin(alpha)*dalpha + background 129 129 """ 130 category = "shape:cylinder" 130 131 131 132 parameters = [ -
sasmodels/models/dab.py
r80768fc ra5d0d00 44 44 45 45 """ 46 category = "shape-independent" 46 47 47 48 parameters = [ -
sasmodels/models/ellipsoid.py
ra503bfd ra5d0d00 136 136 Re: equatorial radius of the ellipsoid 137 137 """ 138 category = "shape:ellipsoid" 138 139 139 140 parameters = [ -
sasmodels/models/fcc.py
re7b3d7b ra5d0d00 87 87 assumed to be isotropic and characterized by a Gaussian distribution. 88 88 """ 89 category = "shape:paracrystal" 89 90 90 91 parameters = [ -
sasmodels/models/gaussian_peak.py
r6ea6902 ra5d0d00 16 16 17 17 REFERENCE 18 --------- 18 19 19 20 None. … … 28 29 Provide F(q) = scale*exp( -1/2 *[(q-q0)/B]^2 )+ background 29 30 """ 31 category = "shape-independent" 30 32 31 33 parameters = [ 32 34 # [ "name", "units", default, [lower, upper], "type", 33 35 # "description" ], 34 [ "q0", " Ang^-1", 0.05, [-inf,inf], "",36 [ "q0", "1/Ang", 0.05, [-inf,inf], "", 35 37 "Peak position" ], 36 [ "sigma", " Ang^-1", 0.005, [-inf,inf], "",38 [ "sigma", "1/Ang", 0.005, [-inf,inf], "", 37 39 "Peak width (standard deviation)" ], 38 40 ] -
sasmodels/models/hardsphere.py
r301e096 ra5d0d00 1 1 # Note: model title and parameter table are inserted automatically 2 r"""This calculates the interparticle structure factor for monodisperse spherical particles interacting through hard 3 sphere (excluded volume) interactions. 2 r"""Calculate the interparticle structure factor for monodisperse 3 spherical particles interacting through hard sphere (excluded volume) 4 interactions. 4 5 5 The calculation uses the Percus-Yevick closure where the interparticle potential is 6 The calculation uses the Percus-Yevick closure where the interparticle 7 potential is 6 8 7 .. image:: img/HardSphere_223.PNG 9 .. math: 10 11 U(r) = \begin{cases} 12 \infty & r < 2R \\ 13 0 & r \geq 2R 14 \end{cases} 8 15 9 16 where *r* is the distance from the center of the sphere of a radius *R*. … … 13 20 .. math:: 14 21 15 Q = \sqrt{Q_x^2 + Q_y^2}22 q = \sqrt{q_x^2 + q_y^2} 16 23 17 24 18 ============== ======== ============= 19 Parameter name Units Default value 20 ============== ======== ============= 21 effect_radius |Ang| 50.0 22 volfraction None 0.2 23 ============== ======== ============= 24 25 .. image:: img/HardSphere_224.jpg 25 .. image:: img/HardSphere_1d.jpg 26 26 27 27 *Figure. 1D plot using the default values (in linear scale).* … … 39 39 [Hard sphere structure factor, with Percus-Yevick closure] 40 40 Interparticle S(Q) for random, non-interacting spheres. 41 42 41 May be a reasonable approximation for other shapes of 42 particles that freely rotate, and for moderately polydisperse 43 43 systems. Though strictly the maths needs to be modified - 44 45 46 44 which sasview does not do yet. 45 effect_radius is the hard sphere radius 46 volfraction is the volume fraction occupied by the spheres. 47 47 """ 48 category = "structure-factor" 48 49 49 50 parameters = [ … … 96 97 Iqxy = """ 97 98 // never called since no orientation or magnetic parameters. 98 return -1.0;99 return Iq(sqrt(qx*qx+qy*qy), IQ_PARAMETERS); 99 100 """ 100 101 -
sasmodels/models/lamellar.py
ra503bfd ra5d0d00 61 61 scale = scale factor 62 62 """ 63 category = "shape:lamellae" 63 64 64 65 parameters = [ -
sasmodels/models/lamellarCaille.py
rdc02af0 ra5d0d00 1 1 # Note: model title and parameter table are inserted automatically 2 2 r""" 3 This model provides the scattering intensity, *I(q)* = *P(q)* \* *S(q)*, for a lamellar phase where a random 4 distribution in solution are assumed. Here a Caille S(Q) is used for the lamellar stacks. 3 This model provides the scattering intensity, $I(q) = P(q) S(q)$, for a 4 lamellar phase where a random distribution in solution are assumed. 5 Here a Caille $S(Q)$ is used for the lamellar stacks. 5 6 6 The scattering intensity *I(q)*is7 The scattering intensity $I(q)$ is 7 8 8 .. image:: img/lamellarCaille_139.PNG 9 .. math: 10 11 I(q) = 2\pi \frac{P(q)S(q)}{\delta q^2} 9 12 10 13 The form factor is 11 14 12 .. image:: img/lamellarCaille_134.PNG 15 .. math: 16 17 P(q) = \frac{2\Delta\rho^2}{q^2}\left(1-\cos q\delta \right) 13 18 14 19 and the structure factor is 15 20 16 .. image:: img/lamellarCaille_.PNG 21 .. math: 22 23 S(q) = 1 + 2 \sum_1^{N-1}\left(1-\frac{n}{N}\right) 24 \cos(qdn)\exp\left(-\frac{2q^2d^2\alpha(n)}{2}\right) 17 25 18 26 where 19 27 20 .. image:: img/lamellarCaille_.PNG28 .. math: 21 29 22 Here *d* = (repeat) spacing, |delta| = bilayer thickness, the contrast |drho| = SLD(headgroup) - SLD(solvent), 23 K = smectic bending elasticity, B = compression modulus, and N = number of lamellar plates (*n_plates*). 30 \begin{eqnarray} 31 \alpha(n) &=& \frac{\eta_{cp}}{4\pi^2} \left(\ln(\pi n)+\gamma_E\right) \\ 32 \gamma_E &=& 0.5772156649 && \text{Euler's constant} \\ 33 \eta_{cp} &=& \frac{q_o^2k_B T}{8\pi\sqrt{K\overline{B}}} && \text{Caille constant} 34 \end{eqnarray} 24 35 25 NB: **When the Caille parameter is greater than approximately 0.8 to 1.0, the assumptions of the model are incorrect.** 26 And due to a complication of the model function, users are responsible for making sure that all the assumptions are 27 handled accurately (see the original reference below for more details). 36 Here $d$ = (repeat) spacing, $\delta$ = bilayer thickness, 37 the contrast $\Delta\rho$ = SLD(headgroup) - SLD(solvent), 38 $K$ = smectic bending elasticity, $B$ = compression modulus, and 39 $N$ = number of lamellar plates (*n_plates*). 28 40 29 Non-integer numbers of stacks are calculated as a linear combination of results for the next lower and higher values. 41 NB: **When the Caille parameter is greater than approximately 0.8 to 1.0, the 42 assumptions of the model are incorrect.** And due to a complication of the 43 model function, users are responsible for making sure that all the assumptions 44 are handled accurately (see the original reference below for more details). 30 45 31 The 2D scattering intensity is calculated in the same way as 1D, where the *q* vector is defined as 46 Non-integer numbers of stacks are calculated as a linear combination of 47 results for the next lower and higher values. 48 49 The 2D scattering intensity is calculated in the same way as 1D, where the 50 $q$ vector is defined as 32 51 33 52 .. math:: 34 53 35 Q = \sqrt{Q_x^2 + Q_y^2}54 q = \sqrt{q_x^2 + q_y^2} 36 55 37 56 The returned value is in units of |cm^-1|, on absolute scale. 38 57 39 ============== ======== ============= 40 Parameter name Units Default value 41 ============== ======== ============= 42 background |cm^-1| 0.0 43 contrast |Ang^-2| 5e-06 44 scale None 1 45 delta |Ang| 30 46 n_plates None 20 47 spacing |Ang| 400 48 caille |Ang^-2| 0.1 49 ============== ======== ============= 50 51 .. image:: img/lamellarPS_142.jpg 58 .. image:: img/lamellarCaille_1d.jpg 52 59 53 60 *Figure. 1D plot using the default values (w/6000 data point).* 54 61 55 Our model uses the form factor calculations implemented in a c-library provided by the NIST Center for Neutron Research56 (Kline, 2006).62 Our model uses the form factor calculations as implemented in a c library 63 provided by the NIST Center for Neutron Research (Kline, 2006). 57 64 58 65 REFERENCE 66 --------- 59 67 60 68 F Nallet, R Laversanne, and D Roux, J. Phys. II France, 3, (1993) 487-502 … … 75 83 scale = scale factor 76 84 """ 85 category = "shape:lamellae" 77 86 78 87 parameters = [ … … 85 94 [ "spacing", "Ang", 400., [0.0,inf], "volume", 86 95 "d-spacing of Caille S(Q)" ], 87 [ "Caille_parameter", " Ang^-2", 0.1, [0.0,0.8], "",96 [ "Caille_parameter", "1/Ang^2", 0.1, [0.0,0.8], "", 88 97 "Caille parameter" ], 89 98 [ "sld", "1e-6/Ang^2", 6.3, [-inf,inf], "", -
sasmodels/models/lamellarCailleHG.py
rcd55ac3 ra5d0d00 82 82 scale = scale factor 83 83 """ 84 category = "shape:lamellae" 84 85 85 86 parameters = [ -
sasmodels/models/lamellarFFHG.py
rdc02af0 ra5d0d00 71 71 scale = scale factor 72 72 """ 73 category = "shape:lamellae" 73 74 74 75 parameters = [ -
sasmodels/models/lamellarPC.py
rf734e7d ra5d0d00 71 71 scale = scale factor 72 72 """ 73 category = "shape:lamellae" 73 74 74 75 parameters = [ -
sasmodels/models/parallelepiped.py
rc5b7d07 ra5d0d00 114 114 mu = q*B 115 115 """ 116 category = "shape:parallelpiped" 116 117 117 118 parameters = [ 118 119 # [ "name", "units", default, [lower, upper], "type", 119 120 # "description" ], 120 [ "sld", " 6e-6/Ang^2", 4, [-inf,inf], "",121 [ "sld", "1e-6/Ang^2", 4, [-inf,inf], "", 121 122 "Parallelepiped scattering length density" ], 122 123 [ "solvent_sld", "1e-6/Ang^2", 1, [-inf,inf], "", -
sasmodels/models/sphere.py
ra503bfd ra5d0d00 70 70 solvent_sld: the SLD of the solvent 71 71 """ 72 category = "shape:sphere" 72 73 73 74 parameters = [ -
sasmodels/models/spherepy.py
ra503bfd ra5d0d00 71 71 solvent_sld: the SLD of the solvent 72 72 """ 73 category = "shape:sphere" 73 74 74 75 parameters = [ -
sasmodels/models/stickyhardsphere.py
r9cb1415 ra5d0d00 70 70 parameters used in P(Q). 71 71 """ 72 category = "structure-factor" 72 73 73 74 parameters = [ -
sasmodels/models/triaxial_ellipsoid.py
ra503bfd ra5d0d00 100 100 not be correct. 101 101 """ 102 category = "shape:ellipsoid" 102 103 103 104 parameters = [
Note: See TracChangeset
for help on using the changeset viewer.