Changeset b716cc6 in sasmodels for sasmodels/models/surface_fractal.c
- 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
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.