Changeset 71b751d in sasmodels for sasmodels/models/hollow_rectangular_prism_thin_walls.c
- Timestamp:
- Aug 14, 2018 12:09:34 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:
- 86aa992
- Parents:
- 2f8cbb9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/hollow_rectangular_prism_thin_walls.c
rd86f0fc r71b751d 8 8 } 9 9 10 static double 11 Iq(double q, 10 static void 11 Fq(double q, 12 double *F1, 13 double *F2, 12 14 double sld, 13 15 double solvent_sld, … … 28 30 const double v2b = M_PI_2; //phi integration limits 29 31 30 double outer_sum = 0.0; 32 double outer_sum_F1 = 0.0; 33 double outer_sum_F2 = 0.0; 31 34 for(int i=0; i<GAUSS_N; i++) { 32 35 const double theta = 0.5 * ( GAUSS_Z[i]*(v1b-v1a) + v1a + v1b ); … … 41 44 const double termAT_theta = 8.0 * sin_c / (q*q*sin_theta*cos_theta); 42 45 43 double inner_sum = 0.0; 46 double inner_sum_F1 = 0.0; 47 double inner_sum_F2 = 0.0; 44 48 for(int j=0; j<GAUSS_N; j++) { 45 49 const double phi = 0.5 * ( GAUSS_Z[j]*(v2b-v2a) + v2a + v2b ); … … 60 64 * ( cos_a*sin_b/cos_phi + cos_b*sin_a/sin_phi ); 61 65 62 inner_sum += GAUSS_W[j] * square(AL+AT); 66 inner_sum_F1 += GAUSS_W[j] * (AL+AT); 67 inner_sum_F2 += GAUSS_W[j] * square(AL+AT); 63 68 } 64 69 65 inner_sum *= 0.5 * (v2b-v2a); 66 outer_sum += GAUSS_W[i] * inner_sum * sin_theta; 70 inner_sum_F1 *= 0.5 * (v2b-v2a); 71 inner_sum_F2 *= 0.5 * (v2b-v2a); 72 outer_sum_F1 += GAUSS_W[i] * inner_sum_F1 * sin_theta; 73 outer_sum_F2 += GAUSS_W[i] * inner_sum_F2 * sin_theta; 67 74 } 68 75 69 outer_sum *= 0.5*(v1b-v1a); 76 outer_sum_F1 *= 0.5*(v1b-v1a); 77 outer_sum_F2 *= 0.5*(v1b-v1a); 70 78 71 79 // Normalize as in Eqn. (15) without the volume factor (as cancels with (V*DelRho)^2 normalization) 72 80 // The factor 2 is due to the different theta integration limit (pi/2 instead of pi) 73 double answer = outer_sum/M_PI_2; 81 const double form_avg = outer_sum_F1/M_PI_2; 82 const double form_squared_avg = outer_sum_F2/M_PI_2; 74 83 75 84 // Multiply by contrast^2. Factor corresponding to volume^2 cancels with previous normalization. 76 answer *= square(sld-solvent_sld);85 const double contrast = sld - solvent_sld; 77 86 78 87 // Convert from [1e-12 A-1] to [cm-1] 79 answer *= 1.0e-4; 80 81 return answer; 88 *F1 = 1e-2 * contrast * form_avg; 89 *F2 = 1e-4 * contrast * contrast * form_squared_avg; 82 90 }
Note: See TracChangeset
for help on using the changeset viewer.