Changes in / [9b79f29:48438f9] in sasmodels
- Files:
-
- 1 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_shell_bicelle_elliptical.c
rf4f85b3 r44e8a93 1 double form_volume(double radius, double x_core, double thick_rim, double thick_face, double length);2 double Iq(double q,3 double radius,4 double x_core,5 double thick_rim,6 double thick_face,7 double length,8 double core_sld,9 double face_sld,10 double rim_sld,11 double solvent_sld);12 13 14 double Iqxy(double qx, double qy,15 double radius,16 double x_core,17 double thick_rim,18 double thick_face,19 double length,20 double core_sld,21 double face_sld,22 double rim_sld,23 double solvent_sld,24 double theta,25 double phi,26 double psi);27 28 1 // NOTE that "length" here is the full height of the core! 29 double form_volume(double radius, double x_core, double thick_rim, double thick_face, double length) 2 static double 3 form_volume(double r_minor, 4 double x_core, 5 double thick_rim, 6 double thick_face, 7 double length) 30 8 { 31 return M_PI*(r adius+thick_rim)*(radius*x_core+thick_rim)*(length+2.0*thick_face);9 return M_PI*(r_minor+thick_rim)*(r_minor*x_core+thick_rim)*(length+2.0*thick_face); 32 10 } 33 11 34 double Iq(double q, 35 double rad, 36 double x_core, 37 double radthick, 38 double facthick, 39 double length, 40 double rhoc, 41 double rhoh, 42 double rhor, 43 double rhosolv) 12 static double 13 Iq(double q, 14 double r_minor, 15 double x_core, 16 double thick_rim, 17 double thick_face, 18 double length, 19 double rhoc, 20 double rhoh, 21 double rhor, 22 double rhosolv) 44 23 { 45 24 double si1,si2,be1,be2; … … 54 33 //const double vbj=M_PI; 55 34 56 const double r adius_major = rad* x_core;57 const double rA = 0.5*(square(r adius_major) + square(rad));58 const double rB = 0.5*(square(r adius_major) - square(rad));59 const double dr1 = (rhoc-rhoh) *M_PI*r ad*radius_major*(2.0*halfheight);;60 const double dr2 = (rhor-rhosolv)*M_PI*(r ad+radthick)*(radius_major+radthick)*2.0*(halfheight+facthick);61 const double dr3 = (rhoh-rhor) *M_PI*r ad*radius_major*2.0*(halfheight+facthick);62 //const double vol1 = M_PI*r ad*radius_major*(2.0*halfheight);63 //const double vol2 = M_PI*(r ad+radthick)*(radius_major+radthick)*2.0*(halfheight+facthick);64 //const double vol3 = M_PI*r ad*radius_major*2.0*(halfheight+facthick);35 const double r_major = r_minor * x_core; 36 const double rA = 0.5*(square(r_major) + square(r_minor)); 37 const double rB = 0.5*(square(r_major) - square(r_minor)); 38 const double dr1 = (rhoc-rhoh) *M_PI*r_minor*r_major*(2.0*halfheight);; 39 const double dr2 = (rhor-rhosolv)*M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); 40 const double dr3 = (rhoh-rhor) *M_PI*r_minor*r_major*2.0*(halfheight+thick_face); 41 //const double vol1 = M_PI*r_minor*r_major*(2.0*halfheight); 42 //const double vol2 = M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); 43 //const double vol3 = M_PI*r_minor*r_major*2.0*(halfheight+thick_face); 65 44 66 45 //initialize integral … … 74 53 double inner_sum=0; 75 54 double sinarg1 = q*halfheight*cos_alpha; 76 double sinarg2 = q*(halfheight+ facthick)*cos_alpha;55 double sinarg2 = q*(halfheight+thick_face)*cos_alpha; 77 56 si1 = sas_sinx_x(sinarg1); 78 57 si2 = sas_sinx_x(sinarg2); … … 83 62 const double rr = sqrt(rA - rB*cos(beta)); 84 63 double besarg1 = q*rr*sin_alpha; 85 double besarg2 = q*(rr+ radthick)*sin_alpha;64 double besarg2 = q*(rr+thick_rim)*sin_alpha; 86 65 be1 = sas_2J1x_x(besarg1); 87 66 be2 = sas_2J1x_x(besarg2); … … 97 76 } 98 77 99 double 78 static double 100 79 Iqxy(double qx, double qy, 101 double r ad,80 double r_minor, 102 81 double x_core, 103 double radthick,104 double facthick,82 double thick_rim, 83 double thick_face, 105 84 double length, 106 85 double rhoc, … … 118 97 const double dr2 = rhor-rhosolv; 119 98 const double dr3 = rhoh-rhor; 120 const double r adius_major = rad*x_core;99 const double r_major = r_minor*x_core; 121 100 const double halfheight = 0.5*length; 122 const double vol1 = M_PI*r ad*radius_major*length;123 const double vol2 = M_PI*(r ad+radthick)*(radius_major+radthick)*2.0*(halfheight+facthick);124 const double vol3 = M_PI*r ad*radius_major*2.0*(halfheight+facthick);101 const double vol1 = M_PI*r_minor*r_major*length; 102 const double vol2 = M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); 103 const double vol3 = M_PI*r_minor*r_major*2.0*(halfheight+thick_face); 125 104 126 // Compute: r = sqrt((radius_major*zhat)^2 + (radius_minor*yhat)^2) 127 // Given: radius_major = r_ratio * radius_minor 128 // ASSUME the sin_alpha is included in the separate integration over orientation of rod angle 129 const double rad_minor = rad; 130 const double rad_major = rad*x_core; 131 const double r_hat = sqrt(square(rad_major*xhat) + square(rad_minor*yhat)); 132 const double rshell_hat = sqrt(square((rad_major+radthick)*xhat) 133 + square((rad_minor+radthick)*yhat)); 105 // Compute effective radius in rotated coordinates 106 const double r_hat = sqrt(square(r_major*xhat) + square(r_minor*yhat)); 107 const double rshell_hat = sqrt(square((r_major+thick_rim)*xhat) 108 + square((r_minor+thick_rim)*yhat)); 134 109 const double be1 = sas_2J1x_x( q*r_hat ); 135 110 const double be2 = sas_2J1x_x( q*rshell_hat ); 136 111 const double si1 = sas_sinx_x( q*halfheight*zhat ); 137 const double si2 = sas_sinx_x( q*(halfheight + facthick)*zhat );112 const double si2 = sas_sinx_x( q*(halfheight + thick_face)*zhat ); 138 113 const double Aq = square( vol1*dr1*si1*be1 + vol2*dr2*si2*be2 + vol3*dr3*si2*be1); 139 //const double vol = form_volume(radius_minor, r_ratio, length);140 114 return 1.0e-4 * Aq; 141 115 } -
sasmodels/models/parallelepiped.py
r9b79f29 r9b79f29 23 23 24 24 The edge of the solid used to have to satisfy the condition that $A < B < C$. 25 After some improvements to the effective radius calculation, used with an S(Q),26 it is beleived that this is no longer the case.25 After some improvements to the effective radius calculation, used with 26 an S(Q), it is beleived that this is no longer the case. 27 27 28 28 The 1D scattering intensity $I(q)$ is calculated as: … … 72 72 73 73 NB: The 2nd virial coefficient of the parallelepiped is calculated based on 74 the averaged effective radius, after appropriately 75 sorting the three dimensions, to give an oblate or prolate particle, $(=\sqrt{A B /\pi})$ and74 the averaged effective radius, after appropriately sorting the three 75 dimensions, to give an oblate or prolate particle, $(=\sqrt{AB/\pi})$ and 76 76 length $(= C)$ values, and used as the effective radius for 77 77 $S(q)$ when $P(q) \cdot S(q)$ is applied. … … 106 106 .. figure:: img/parallelepiped_angle_definition.png 107 107 108 Definition of the angles for oriented parallelepiped, shown with $A < B <C$.108 Definition of the angles for oriented parallelepiped, shown with $A<B<C$. 109 109 110 110 .. figure:: img/parallelepiped_angle_projection.png … … 167 167 ---------------------------- 168 168 169 * **Author:** This model is based on form factor calculations implemented in a c-library170 provided by the NIST Center for Neutron Research (Kline, 2006).169 * **Author:** This model is based on form factor calculations implemented 170 in a c-library provided by the NIST Center for Neutron Research (Kline, 2006). 171 171 * **Last Modified by:** Paul Kienzle **Date:** April 05, 2017 172 172 * **Last Reviewed by:** Richard Heenan **Date:** April 06, 2017 -
sasmodels/models/sc_paracrystal.py
r9b79f29 r9b79f29 85 85 .. figure:: img/parallelepiped_angle_definition.png 86 86 87 Orientation of the crystal with respect to the scattering plane, when 87 Orientation of the crystal with respect to the scattering plane, when 88 88 $\theta = \phi = 0$ the $c$ axis is along the beam direction (the $z$ axis). 89 89 -
sasmodels/models/stacked_disks.py
r9b79f29 r9b79f29 58 58 and $\sigma_d$ = the Gaussian standard deviation of the d-spacing (*sigma_d*). 59 59 Note that $D\cos(\alpha)$ is the component of $D$ parallel to $q$ and the last 60 term in the equation above is effectively a Debye-Waller factor term. 60 term in the equation above is effectively a Debye-Waller factor term. 61 61 62 62 .. note:: … … 158 158 tests = [ 159 159 # Accuracy tests based on content in test/utest_extra_models.py. 160 # Added 2 tests with n_stacked = 5 using SasView 3.1.2 - PDB; for which alas q=0.001 values seem closer to n_stacked=1 not 5, changed assuming my 4.1 code OK, RKH 160 # Added 2 tests with n_stacked = 5 using SasView 3.1.2 - PDB; 161 # for which alas q=0.001 values seem closer to n_stacked=1 not 5, 162 # changed assuming my 4.1 code OK, RKH 161 163 [{'thick_core': 10.0, 162 164 'thick_layer': 15.0, -
sasmodels/models/triaxial_ellipsoid.py
r9b79f29 r9b79f29 16 16 \frac{X^2}{R_a^2} + \frac{Y^2}{R_b^2} + \frac{Z^2}{R_c^2} = 1 17 17 18 the scattering for randomly oriented particles is defined by the average over all orientations $\Omega$ of: 18 the scattering for randomly oriented particles is defined by the average over 19 all orientations $\Omega$ of: 19 20 20 21 .. math:: 21 22 22 P(q) = \text{scale}(\Delta\rho)^2\frac{V}{4 \pi}\int_\Omega \Phi^2(qr) d\Omega + \text{background} 23 P(q) = \text{scale}(\Delta\rho)^2\frac{V}{4 \pi}\int_\Omega\Phi^2(qr)\,d\Omega 24 + \text{background} 23 25 24 26 where … … 38 40 .. math:: 39 41 40 \langle\Phi^2\rangle = \int_0^{2\pi} \int_{-\pi/2}^{\pi/2} \Phi^2(qr) \cos \gamma\,d\gamma d\phi 42 \langle\Phi^2\rangle = \int_0^{2\pi} \int_{-\pi/2}^{\pi/2} \Phi^2(qr) 43 \cos \gamma\,d\gamma d\phi 41 44 42 45 with $e = \cos\gamma \sin\phi$, $f = \cos\gamma \cos\phi$ and $g = \sin\gamma$. … … 69 72 .. figure:: img/elliptical_cylinder_angle_definition.png 70 73 71 Definition of angles for oriented triaxial ellipsoid, where radii shown here are $a < b << c$ 72 and angle $\Psi$ is a rotation around the axis of the particle. 74 Definition of angles for oriented triaxial ellipsoid, where radii shown 75 here are $a < b << c$ and angle $\Psi$ is a rotation around the axis 76 of the particle. 73 77 74 78 The angle $\psi$ is the rotational angle around its own $c$ axis … … 115 119 * **Last Reviewed by:** Paul Kienzle & Richard Heenan **Date:** April 4, 2017 116 120 117 """118 119 121 from numpy import inf, sin, cos, pi 120 122 … … 122 124 title = "Ellipsoid of uniform scattering length density with three independent axes." 123 125 124 description = """ \126 description = """ 125 127 Note: During fitting ensure that the inequality ra<rb<rc is not 126 128 violated. Otherwise the calculation will … … 157 159 from .ellipsoid import ER as ellipsoid_ER 158 160 159 # now that radii can be in any size order, radii need sorting a,b,c where a~b and c is either much smaller160 # or much larger161 # now that radii can be in any size order, radii need sorting a,b,c 162 # where a~b and c is either much smaller or much larger 161 163 radii = np.vstack((radius_equat_major, radius_equat_minor, radius_polar)) 162 164 radii = np.sort(radii, axis=0) … … 178 180 179 181 q = 0.1 180 # april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 182 # april 6 2017, rkh add unit tests 183 # NOT compared with any other calc method, assume correct! 181 184 # add 2d test after pull #890 182 185 qx = q*cos(pi/6.0)
Note: See TracChangeset
for help on using the changeset viewer.