Changeset 01c8d9e in sasmodels for sasmodels/models
- Timestamp:
- Aug 7, 2018 12:32:18 PM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- c11d09f
- Parents:
- 707cbdb
- Location:
- sasmodels/models
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/ellipsoid.c
r108e70e r01c8d9e 20 20 // i(h) = int_0^1 Phi^2(h a sqrt(1 + u^2(v^2-1)) du 21 21 const double v_square_minus_one = square(radius_polar/radius_equatorial) - 1.0; 22 22 23 23 // translate a point in [-1,1] to a point in [0, 1] 24 24 // const double u = GAUSS_Z[i]*(upper-lower)/2 + (upper+lower)/2; … … 36 36 const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); 37 37 return 1.0e-4 * s * s * form; 38 } 39 40 static void 41 Fq(double q, 42 double *F1, 43 double *F2, 44 double sld, 45 double sld_solvent, 46 double radius_polar, 47 double radius_equatorial) 48 { 49 // Using ratio v = Rp/Re, we can implement the form given in Guinier (1955) 50 // i(h) = int_0^pi/2 Phi^2(h a sqrt(cos^2 + v^2 sin^2) cos dT 51 // = int_0^pi/2 Phi^2(h a sqrt((1-sin^2) + v^2 sin^2) cos dT 52 // = int_0^pi/2 Phi^2(h a sqrt(1 + sin^2(v^2-1)) cos dT 53 // u-substitution of 54 // u = sin, du = cos dT 55 // i(h) = int_0^1 Phi^2(h a sqrt(1 + u^2(v^2-1)) du 56 const double v_square_minus_one = square(radius_polar/radius_equatorial) - 1.0; 57 // translate a point in [-1,1] to a point in [0, 1] 58 // const double u = GAUSS_Z[i]*(upper-lower)/2 + (upper+lower)/2; 59 const double zm = 0.5; 60 const double zb = 0.5; 61 double total_F2 = 0.0; 62 double total_F1 = 0.0; 63 for (int i=0;i<GAUSS_N;i++) { 64 const double u = GAUSS_Z[i]*zm + zb; 65 const double r = radius_equatorial*sqrt(1.0 + u*u*v_square_minus_one); 66 const double f = sas_3j1x_x(q*r); 67 total_F2 += GAUSS_W[i] * f * f; 68 total_F1 += GAUSS_W[i] * f; 69 } 70 // translate dx in [-1,1] to dx in [lower,upper] 71 const double form_squared_avg = total_F2*zm; 72 const double form_avg = total_F1*zm; 73 const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); 74 *F2 = 1e-4 * s * s * form_squared_avg; 75 *F1 = 1e-2 * s * form_avg; 38 76 } 77 78 79 80 81 39 82 40 83 static double -
sasmodels/models/lib/sphere_form.c
r925ad6e r01c8d9e 13 13 return 1.0e-4*square(contrast * fq); 14 14 } 15 -
sasmodels/models/sphere.py
ref07e95 r01c8d9e 67 67 ] 68 68 69 source = ["lib/sas_3j1x_x.c", "lib/sphere_form.c" ]69 source = ["lib/sas_3j1x_x.c", "lib/sphere_form.c", "sphere.c"] 70 70 71 # No volume normalization despite having a volume parameter72 # This should perhaps be volume normalized?73 form_volume = """74 return sphere_volume(radius);75 """76 77 Iq = """78 return sphere_form(q, radius, sld, sld_solvent);79 """80 71 81 72 def ER(radius):
Note: See TracChangeset
for help on using the changeset viewer.