[fcb33e4] | 1 | // NOTE that "length" here is the full height of the core! |
---|
[44e8a93] | 2 | static double |
---|
| 3 | form_volume(double r_minor, |
---|
[becded3] | 4 | double x_core, |
---|
| 5 | double thick_rim, |
---|
| 6 | double thick_face, |
---|
| 7 | double length) |
---|
[fcb33e4] | 8 | { |
---|
[44e8a93] | 9 | return M_PI*(r_minor+thick_rim)*(r_minor*x_core+thick_rim)*(length+2.0*thick_face); |
---|
[fcb33e4] | 10 | } |
---|
| 11 | |
---|
[44e8a93] | 12 | static double |
---|
| 13 | Iq(double q, |
---|
[becded3] | 14 | double r_minor, |
---|
| 15 | double x_core, |
---|
| 16 | double thick_rim, |
---|
| 17 | double thick_face, |
---|
| 18 | double length, |
---|
| 19 | double sld_core, |
---|
| 20 | double sld_face, |
---|
| 21 | double sld_rim, |
---|
| 22 | double sld_solvent) |
---|
[fcb33e4] | 23 | { |
---|
| 24 | // core_shell_bicelle_elliptical, RKH Dec 2016, based on elliptical_cylinder and core_shell_bicelle |
---|
[dedcf34] | 25 | // tested against limiting cases of cylinder, elliptical_cylinder, stacked_discs, and core_shell_bicelle |
---|
[fcb33e4] | 26 | const double halfheight = 0.5*length; |
---|
[44e8a93] | 27 | const double r_major = r_minor * x_core; |
---|
[dedcf34] | 28 | const double r2A = 0.5*(square(r_major) + square(r_minor)); |
---|
| 29 | const double r2B = 0.5*(square(r_major) - square(r_minor)); |
---|
[2a0b2b1] | 30 | const double vol1 = M_PI*r_minor*r_major*(2.0*halfheight); |
---|
| 31 | const double vol2 = M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); |
---|
| 32 | const double vol3 = M_PI*r_minor*r_major*2.0*(halfheight+thick_face); |
---|
| 33 | const double dr1 = vol1*(sld_core-sld_face); |
---|
| 34 | const double dr2 = vol2*(sld_rim-sld_solvent); |
---|
| 35 | const double dr3 = vol3*(sld_face-sld_rim); |
---|
[fcb33e4] | 36 | |
---|
| 37 | //initialize integral |
---|
| 38 | double outer_sum = 0.0; |
---|
[74768cb] | 39 | for(int i=0;i<GAUSS_N;i++) { |
---|
[fcb33e4] | 40 | //setup inner integral over the ellipsoidal cross-section |
---|
[2a0b2b1] | 41 | //const double va = 0.0; |
---|
| 42 | //const double vb = 1.0; |
---|
[74768cb] | 43 | //const double cos_theta = ( GAUSS_Z[i]*(vb-va) + va + vb )/2.0; |
---|
| 44 | const double cos_theta = ( GAUSS_Z[i] + 1.0 )/2.0; |
---|
[2a0b2b1] | 45 | const double sin_theta = sqrt(1.0 - cos_theta*cos_theta); |
---|
| 46 | const double qab = q*sin_theta; |
---|
| 47 | const double qc = q*cos_theta; |
---|
| 48 | const double si1 = sas_sinx_x(halfheight*qc); |
---|
| 49 | const double si2 = sas_sinx_x((halfheight+thick_face)*qc); |
---|
| 50 | double inner_sum=0.0; |
---|
[74768cb] | 51 | for(int j=0;j<GAUSS_N;j++) { |
---|
[fcb33e4] | 52 | //76 gauss points for the inner integral (WAS 20 points,so this may make unecessarily slow, but playing safe) |
---|
[2a0b2b1] | 53 | // inner integral limits |
---|
| 54 | //const double vaj=0.0; |
---|
| 55 | //const double vbj=M_PI; |
---|
[74768cb] | 56 | //const double phi = ( GAUSS_Z[j]*(vbj-vaj) + vaj + vbj )/2.0; |
---|
| 57 | const double phi = ( GAUSS_Z[j] +1.0)*M_PI_2; |
---|
[2a0b2b1] | 58 | const double rr = sqrt(r2A - r2B*cos(phi)); |
---|
| 59 | const double be1 = sas_2J1x_x(rr*qab); |
---|
| 60 | const double be2 = sas_2J1x_x((rr+thick_rim)*qab); |
---|
| 61 | const double fq = dr1*si1*be1 + dr2*si2*be2 + dr3*si2*be1; |
---|
| 62 | |
---|
[74768cb] | 63 | inner_sum += GAUSS_W[j] * fq * fq; |
---|
[fcb33e4] | 64 | } |
---|
| 65 | //now calculate outer integral |
---|
[74768cb] | 66 | outer_sum += GAUSS_W[i] * inner_sum; |
---|
[fcb33e4] | 67 | } |
---|
| 68 | |
---|
| 69 | return outer_sum*2.5e-05; |
---|
| 70 | } |
---|
| 71 | |
---|
[44e8a93] | 72 | static double |
---|
[becded3] | 73 | Iqxy(double qa, double qb, double qc, |
---|
| 74 | double r_minor, |
---|
| 75 | double x_core, |
---|
| 76 | double thick_rim, |
---|
| 77 | double thick_face, |
---|
| 78 | double length, |
---|
| 79 | double sld_core, |
---|
| 80 | double sld_face, |
---|
| 81 | double sld_rim, |
---|
| 82 | double sld_solvent) |
---|
[fcb33e4] | 83 | { |
---|
[2a0b2b1] | 84 | const double dr1 = sld_core-sld_face; |
---|
| 85 | const double dr2 = sld_rim-sld_solvent; |
---|
| 86 | const double dr3 = sld_face-sld_rim; |
---|
[44e8a93] | 87 | const double r_major = r_minor*x_core; |
---|
[fcb33e4] | 88 | const double halfheight = 0.5*length; |
---|
[44e8a93] | 89 | const double vol1 = M_PI*r_minor*r_major*length; |
---|
| 90 | const double vol2 = M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); |
---|
| 91 | const double vol3 = M_PI*r_minor*r_major*2.0*(halfheight+thick_face); |
---|
[fcb33e4] | 92 | |
---|
[44e8a93] | 93 | // Compute effective radius in rotated coordinates |
---|
[82592da] | 94 | const double qr_hat = sqrt(square(r_major*qb) + square(r_minor*qa)); |
---|
| 95 | const double qrshell_hat = sqrt(square((r_major+thick_rim)*qb) |
---|
| 96 | + square((r_minor+thick_rim)*qa)); |
---|
[2a0b2b1] | 97 | const double be1 = sas_2J1x_x( qr_hat ); |
---|
| 98 | const double be2 = sas_2J1x_x( qrshell_hat ); |
---|
| 99 | const double si1 = sas_sinx_x( halfheight*qc ); |
---|
| 100 | const double si2 = sas_sinx_x( (halfheight + thick_face)*qc ); |
---|
| 101 | const double fq = vol1*dr1*si1*be1 + vol2*dr2*si2*be2 + vol3*dr3*si2*be1; |
---|
| 102 | return 1.0e-4 * fq*fq; |
---|
[fcb33e4] | 103 | } |
---|