[9aa4881] | 1 | // vd = volume * delta_rho |
---|
[2a0b2b1] | 2 | // besarg = q * R * sin(theta) |
---|
| 3 | // siarg = q * L/2 * cos(theta) |
---|
| 4 | static double _cyl(double vd, double besarg, double siarg) |
---|
[5d4777d] | 5 | { |
---|
[592343f] | 6 | return vd * sas_sinx_x(siarg) * sas_2J1x_x(besarg); |
---|
[5d4777d] | 7 | } |
---|
| 8 | |
---|
[2a0b2b1] | 9 | static double |
---|
| 10 | form_volume(double radius, double thickness, double length) |
---|
[5d4777d] | 11 | { |
---|
[2a0b2b1] | 12 | return M_PI*square(radius+thickness)*(length+2.0*thickness); |
---|
[5d4777d] | 13 | } |
---|
| 14 | |
---|
[2a0b2b1] | 15 | static double |
---|
| 16 | Iq(double q, |
---|
[994d77f] | 17 | double core_sld, |
---|
| 18 | double shell_sld, |
---|
| 19 | double solvent_sld, |
---|
| 20 | double radius, |
---|
| 21 | double thickness, |
---|
| 22 | double length) |
---|
[5d4777d] | 23 | { |
---|
| 24 | // precalculate constants |
---|
[2a0b2b1] | 25 | const double core_r = radius; |
---|
| 26 | const double core_h = 0.5*length; |
---|
[9aa4881] | 27 | const double core_vd = form_volume(radius,0,length) * (core_sld-shell_sld); |
---|
[2a0b2b1] | 28 | const double shell_r = (radius + thickness); |
---|
| 29 | const double shell_h = (0.5*length + thickness); |
---|
[9aa4881] | 30 | const double shell_vd = form_volume(radius,thickness,length) * (shell_sld-solvent_sld); |
---|
[994d77f] | 31 | double total = 0.0; |
---|
[5d4777d] | 32 | for (int i=0; i<76 ;i++) { |
---|
[2a0b2b1] | 33 | // translate a point in [-1,1] to a point in [0, pi/2] |
---|
| 34 | //const double theta = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0; |
---|
| 35 | double sin_theta, cos_theta; |
---|
| 36 | const double theta = Gauss76Z[i]*M_PI_4 + M_PI_4; |
---|
| 37 | SINCOS(theta, sin_theta, cos_theta); |
---|
| 38 | const double qab = q*sin_theta; |
---|
| 39 | const double qc = q*cos_theta; |
---|
| 40 | const double fq = _cyl(core_vd, core_r*qab, core_h*qc) |
---|
| 41 | + _cyl(shell_vd, shell_r*qab, shell_h*qc); |
---|
| 42 | total += Gauss76Wt[i] * fq * fq * sin_theta; |
---|
[5d4777d] | 43 | } |
---|
| 44 | // translate dx in [-1,1] to dx in [lower,upper] |
---|
[994d77f] | 45 | //const double form = (upper-lower)/2.0*total; |
---|
| 46 | return 1.0e-4 * total * M_PI_4; |
---|
[5d4777d] | 47 | } |
---|
| 48 | |
---|
| 49 | |
---|
[becded3] | 50 | double Iqxy(double qab, double qc, |
---|
[994d77f] | 51 | double core_sld, |
---|
| 52 | double shell_sld, |
---|
| 53 | double solvent_sld, |
---|
| 54 | double radius, |
---|
| 55 | double thickness, |
---|
[becded3] | 56 | double length) |
---|
[5d4777d] | 57 | { |
---|
[2a0b2b1] | 58 | const double core_r = radius; |
---|
| 59 | const double core_h = 0.5*length; |
---|
[9aa4881] | 60 | const double core_vd = form_volume(radius,0,length) * (core_sld-shell_sld); |
---|
[2a0b2b1] | 61 | const double shell_r = (radius + thickness); |
---|
| 62 | const double shell_h = (0.5*length + thickness); |
---|
[9aa4881] | 63 | const double shell_vd = form_volume(radius,thickness,length) * (shell_sld-solvent_sld); |
---|
[5d4777d] | 64 | |
---|
[2a0b2b1] | 65 | const double fq = _cyl(core_vd, core_r*qab, core_h*qc) |
---|
| 66 | + _cyl(shell_vd, shell_r*qab, shell_h*qc); |
---|
[994d77f] | 67 | return 1.0e-4 * fq * fq; |
---|
[5d4777d] | 68 | } |
---|