Changeset b716cc6 in sasmodels
- Timestamp:
- Oct 14, 2016 5:20:17 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3a48772
- Parents:
- 6831fa0
- Location:
- sasmodels/models
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/surface_fractal.c
ra807206 rb716cc6 1 // Don't need invalid test since fractal_dim_surf is not polydisperse 2 // #define INVALID(v) (v.fractal_dim_surf <= 1.0 || v.fractal_dim_surf >= 3.0) 3 1 4 double form_volume(double radius); 2 5 … … 11 14 double cutoff_length) 12 15 { 13 double pq, sq, mmo, result; 16 // calculate P(q) 17 const double pq = square(sph_j1c(q*radius)); 14 18 15 //Replaced the original formula with Taylor expansion near zero. 16 //pq = pow((3.0*(sin(q*radius) - q*radius*cos(q*radius))/pow((q*radius),3)),2); 19 // calculate S(q) 20 // Note: lim q->0 S(q) = -gamma(mmo) cutoff_length^mmo (mmo cutoff_length) 21 // however, the surface fractal formula is invalid outside the range 22 const double mmo = 5.0 - fractal_dim_surf; 23 const double sq = sas_gamma(mmo) * pow(cutoff_length, mmo) 24 * pow(1.0 + square(q*cutoff_length), -0.5*mmo) 25 * sin(-mmo * atan(q*cutoff_length)) / q; 17 26 18 pq = sph_j1c(q*radius); 19 pq = pq*pq; 27 // Empirically determined that the results are valid within this range. 28 // Above 1/r, the form starts to oscillate; below 29 //const double result = (q > 5./(3-fractal_dim_surf)/cutoff_length) && q < 1./radius 30 // ? pq * sq : 0.); 20 31 21 //calculate S(q) 22 mmo = 5.0 - fractal_dim_surf; 23 sq = sas_gamma(mmo)*sin(-(mmo)*atan(q*cutoff_length)); 24 sq *= pow(cutoff_length, mmo); 25 sq /= pow((1.0 + (q*cutoff_length)*(q*cutoff_length)),(mmo/2.0)); 26 sq /= q; 32 double result = pq * sq; 27 33 28 //combine and return 29 result = pq * sq; 30 31 return result; 34 // exclude negative results 35 return result > 0. ? result : 0.; 32 36 } 33 double form_volume(double radius) {34 35 return 1.333333333333333*M_PI*radius*radius*radius;37 double form_volume(double radius) 38 { 39 return M_4PI_3*cube(radius); 36 40 } 37 41 -
sasmodels/models/surface_fractal.py
ra807206 rb716cc6 10 10 .. math:: 11 11 12 I(q) = scale \times P(q)S(q) + background 13 14 .. math:: 15 16 P(q) = F(qR)^2 17 18 .. math:: 19 20 F(x) = \frac{3\left[sin(x)-xcos(x)\right]}{x^3} 21 22 .. math:: 23 24 S(q) = \frac{\Gamma(5-D_S)\zeta^{5-D_S}}{\left[1+(q\zeta)^2 25 \right]^{(5-D_S)/2}} 26 \frac{sin\left[(D_S - 5) tan^{-1}(q\zeta) \right]}{q} 27 28 .. math:: 29 30 scale = scale\_factor \times NV^2(\rho_{particle} - \rho_{solvent})^2 31 32 .. math:: 33 34 V = \frac{4}{3}\pi R^3 12 I(q) &= \text{scale} \times P(q)S(q) + \text{background} \\ 13 P(q) &= F(qR)^2 \\ 14 F(x) &= \frac{3\left[\sin(x)-x\cos(x)\right]}{x^3} \\ 15 S(q) &= \Gamma(5-D_S)\xi^{\,5-D_S}\left[1+(q\xi)^2 \right]^{-(5-D_S)/2} 16 \sin\left[-(5-D_S) \tan^{-1}(q\xi) \right] q^{-1} \\ 17 \text{scale} &= \phi N V^2(\rho_\text{particle} - \rho_\text{solvent})^2 \\ 18 V &= \frac{4}{3}\pi R^3 35 19 36 20 where $R$ is the radius of the building block, $D_S$ is the **surface** fractal 37 dimension, | \zeta\| is the cut-off length, $\rho_{solvent}$ is the scattering38 length density of the solvent, 39 and $\rho_{particle}$ is the scattering length density ofparticles.21 dimension, $\xi$ is the cut-off length, $\rho_\text{solvent}$ is the scattering 22 length density of the solvent, $\rho_\text{particle}$ is the scattering 23 length density of particles and $\phi$ is the volume fraction of the particles. 40 24 41 25 .. note:: 42 The surface fractal dimension $D_s$ is only valid if $1<surface\_dim<3$. 43 It is also only valid over a limited $q$ range (see the reference for 44 details) 26 27 The surface fractal dimension is only valid if $1<D_S<3$. The result is 28 only valid over a limited $q$ range, $\tfrac{5}{3-D_S}\xi^{\,-1} < q < R^{-1}$. 29 See the reference for details. 45 30 46 31 … … 89 74 source = ["lib/sph_j1c.c", "lib/sas_gamma.c", "surface_fractal.c"] 90 75 91 demo = dict(scale=1, background= 0,76 demo = dict(scale=1, background=1e-5, 92 77 radius=10, fractal_dim_surf=2.0, cutoff_length=500) 93 78
Note: See TracChangeset
for help on using the changeset viewer.