Changeset deb7ee0 in sasmodels for sasmodels/models/parallelepiped.c
- Timestamp:
- Feb 26, 2016 2:15:38 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 44bd2be
- Parents:
- 94bd809
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/parallelepiped.c
rc5b7d07 rdeb7ee0 9 9 double argA,argB,argC,tmp1,tmp2,tmp3; 10 10 //handle arg=0 separately, as sin(t)/t -> 1 as t->0 11 argA = a*ala/2.0;12 argB = b*alb/2.0;13 argC = c*alc/2.0;11 argA = 0.5*a*ala; 12 argB = 0.5*b*alb; 13 argC = 0.5*c*alc; 14 14 if(argA==0.0) { 15 15 tmp1 = 1.0; … … 31 31 } 32 32 33 33 34 double form_volume(double a_side, double b_side, double c_side) 34 35 { 35 36 return a_side * b_side * c_side; 36 37 } 38 37 39 38 40 double Iq(double q, … … 43 45 double c_side) 44 46 { 45 double tmp1, tmp2 , yyy;47 double tmp1, tmp2; 46 48 47 49 double mu = q * b_side; … … 50 52 double a_scaled = a_side / b_side; 51 53 double c_scaled = c_side / b_side; 52 53 // outer integral (with 76 gauss points), integration limits = 0, 1 54 55 //Order of integration 56 int nordi=76; 57 int nordj=76; 58 59 // outer integral (with nordi gauss points), integration limits = 0, 1 54 60 double summ = 0; //initialize integral 55 61 56 for( int i=0; i< 76; i++) {62 for( int i=0; i<nordi; i++) { 57 63 58 // inner integral (with 76gauss points), integration limits = 0, 164 // inner integral (with nordj gauss points), integration limits = 0, 1 59 65 60 66 double summj = 0.0; 61 double sigma = 0.5 * ( Gauss76Z[i] + 1.0 );67 double sigma = 0.5 * ( Gauss76Z[i] + 1.0 ); 62 68 63 for(int j=0; j<76; j++) {69 for(int j=0; j<nordj; j++) { 64 70 65 71 double uu = 0.5 * ( Gauss76Z[j] + 1.0 ); 66 72 double mudum = mu * sqrt(1.0-sigma*sigma); 67 double arg1 = 0.5 * mudum * cos(0.5*M_PI*uu);68 double arg2 = 0.5 * mudum * a_scaled * sin(0.5*M_PI*uu);73 double arg1 = 0.5 * mudum * cos(0.5*M_PI*uu); 74 double arg2 = 0.5 * mudum * a_scaled * sin(0.5*M_PI*uu); 69 75 if(arg1==0.0) { 70 76 tmp1 = 1.0; … … 77 83 tmp2 = sin(arg2)*sin(arg2)/arg2/arg2; 78 84 } 79 yyy = Gauss76Wt[j] * tmp1 * tmp2;80 85 81 summj += yyy;86 summj += Gauss76Wt[j] * tmp1 * tmp2; 82 87 } 83 88 … … 92 97 } 93 98 94 // sum of outer integral 95 yyy = Gauss76Wt[i] * answer; 96 summ += yyy; 99 // sum of outer integral 100 summ += Gauss76Wt[i] * answer; 97 101 98 102 } 99 103 100 104 const double vd = (sld-solvent_sld) * form_volume(a_side, b_side, c_side); 105 106 // convert from [1e-12 A-1] to [cm-1] and 0.5 factor for outer integral 101 107 return 1.0e-4 * 0.5 * vd * vd * summ; 102 108
Note: See TracChangeset
for help on using the changeset viewer.