Changeset 71b751d in sasmodels for sasmodels/models/hollow_rectangular_prism.c
- Timestamp:
- Aug 14, 2018 10:09:34 AM (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:
- 86aa992
- Parents:
- 2f8cbb9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/hollow_rectangular_prism.c
rd86f0fc r71b751d 13 13 } 14 14 15 static double 16 Iq(double q, 15 static void 16 Fq(double q, 17 double *F1, 18 double *F2, 17 19 double sld, 18 20 double solvent_sld, … … 36 38 const double v2b = M_PI_2; //phi integration limits 37 39 38 double outer_sum = 0.0; 40 double outer_sum_F1 = 0.0; 41 double outer_sum_F2 = 0.0; 39 42 for(int i=0; i<GAUSS_N; i++) { 40 43 … … 46 49 const double termC2 = sas_sinx_x(q * (c_half-thickness)*cos(theta)); 47 50 48 double inner_sum = 0.0; 51 double inner_sum_F1 = 0.0; 52 double inner_sum_F2 = 0.0; 49 53 for(int j=0; j<GAUSS_N; j++) { 50 54 … … 64 68 const double AP2 = vol_core * termA2 * termB2 * termC2; 65 69 66 inner_sum += GAUSS_W[j] * square(AP1-AP2); 70 inner_sum_F1 += GAUSS_W[j] * (AP1-AP2); 71 inner_sum_F2 += GAUSS_W[j] * square(AP1-AP2); 67 72 } 68 inner_sum *= 0.5 * (v2b-v2a); 73 inner_sum_F1 *= 0.5 * (v2b-v2a); 74 inner_sum_F2 *= 0.5 * (v2b-v2a); 69 75 70 outer_sum += GAUSS_W[i] * inner_sum * sin(theta); 76 outer_sum_F1 += GAUSS_W[i] * inner_sum_F1 * sin(theta); 77 outer_sum_F2 += GAUSS_W[i] * inner_sum_F2 * sin(theta); 71 78 } 72 outer_sum *= 0.5*(v1b-v1a); 79 outer_sum_F1 *= 0.5*(v1b-v1a); 80 outer_sum_F2 *= 0.5*(v1b-v1a); 73 81 74 82 // Normalize as in Eqn. (15) without the volume factor (as cancels with (V*DelRho)^2 normalization) 75 83 // The factor 2 is due to the different theta integration limit (pi/2 instead of pi) 76 const double form = outer_sum/M_PI_2; 84 const double form_avg = outer_sum_F1/M_PI_2; 85 const double form_squared_avg = outer_sum_F2/M_PI_2; 77 86 78 87 // Multiply by contrast^2. Factor corresponding to volume^2 cancels with previous normalization. 79 const double delrho= sld - solvent_sld;88 const double contrast = sld - solvent_sld; 80 89 81 90 // Convert from [1e-12 A-1] to [cm-1] 82 return 1.0e-4 * delrho * delrho * form; 91 *F1 = 1.0e-2 * contrast * form_avg; 92 *F2 = 1.0e-4 * contrast * contrast * form_squared_avg; 83 93 } 84 94
Note: See TracChangeset
for help on using the changeset viewer.