[ce27e21] | 1 | real form_volume(real radius, real length); |
---|
| 2 | real Iq(real q, real sld, real solvent_sld, real radius, real length); |
---|
| 3 | real Iqxy(real qx, real qy, real sld, real solvent_sld, real radius, real length, real theta, real phi); |
---|
| 4 | |
---|
[5d4777d] | 5 | |
---|
| 6 | // twovd = 2 * volume * delta_rho |
---|
| 7 | // besarg = q * R * sin(alpha) |
---|
| 8 | // siarg = q * L/2 * cos(alpha) |
---|
| 9 | real _cyl(real twovd, real besarg, real siarg, real alpha); |
---|
| 10 | real _cyl(real twovd, real besarg, real siarg, real alpha) |
---|
| 11 | { |
---|
| 12 | const real bj = (besarg == REAL(0.0) ? REAL(0.5) : J1(besarg)/besarg); |
---|
| 13 | const real si = (siarg == REAL(0.0) ? REAL(1.0) : sin(siarg)/siarg); |
---|
| 14 | return twovd*si*bj; |
---|
| 15 | } |
---|
| 16 | |
---|
[ce27e21] | 17 | real form_volume(real radius, real length) |
---|
| 18 | { |
---|
| 19 | return M_PI*radius*radius*length; |
---|
| 20 | } |
---|
| 21 | real Iq(real q, |
---|
| 22 | real sldCyl, |
---|
| 23 | real sldSolv, |
---|
| 24 | real radius, |
---|
| 25 | real length) |
---|
| 26 | { |
---|
[5d4777d] | 27 | const real qr = q*radius; |
---|
| 28 | const real qh = q*REAL(0.5)*length; |
---|
| 29 | const real twovd = REAL(2.0)*(sldCyl-sldSolv)*form_volume(radius, length); |
---|
| 30 | real total = REAL(0.0); |
---|
| 31 | // real lower=0, upper=M_PI_2; |
---|
[ce27e21] | 32 | for (int i=0; i<76 ;i++) { |
---|
[5d4777d] | 33 | // translate a point in [-1,1] to a point in [lower,upper] |
---|
| 34 | //const real alpha = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0; |
---|
| 35 | const real alpha = REAL(0.5)*(Gauss76Z[i]*M_PI_2 + M_PI_2); |
---|
| 36 | real sn, cn; |
---|
| 37 | SINCOS(alpha, sn, cn); |
---|
| 38 | const real fq = _cyl(twovd, qr*sn, qh*cn, alpha); |
---|
| 39 | total += Gauss76Wt[i] * fq * fq * sn; |
---|
[ce27e21] | 40 | } |
---|
[5d4777d] | 41 | // translate dx in [-1,1] to dx in [lower,upper] |
---|
| 42 | //const real form = (upper-lower)/2.0*total; |
---|
| 43 | return REAL(1.0e8) * total * M_PI_4; |
---|
[ce27e21] | 44 | } |
---|
| 45 | |
---|
| 46 | real Iqxy(real qx, real qy, |
---|
| 47 | real sldCyl, |
---|
| 48 | real sldSolv, |
---|
| 49 | real radius, |
---|
| 50 | real length, |
---|
| 51 | real cyl_theta, |
---|
| 52 | real cyl_phi) |
---|
| 53 | { |
---|
| 54 | real sn, cn; // slots to hold sincos function output |
---|
| 55 | |
---|
| 56 | // Compute angle alpha between q and the cylinder axis |
---|
| 57 | SINCOS(cyl_theta*M_PI_180, sn, cn); |
---|
| 58 | // # The following correction factor exists in sasview, but it can't be |
---|
| 59 | // # right, so we are leaving it out for now. |
---|
[ff7119b] | 60 | const real spherical_integration = fabs(cn)*M_PI_2; |
---|
[ce27e21] | 61 | const real q = sqrt(qx*qx+qy*qy); |
---|
| 62 | const real cos_val = cn*cos(cyl_phi*M_PI_180)*(qx/q) + sn*(qy/q); |
---|
| 63 | const real alpha = acos(cos_val); |
---|
| 64 | |
---|
[5d4777d] | 65 | const real qr = q*radius; |
---|
| 66 | const real qh = q*REAL(0.5)*length; |
---|
| 67 | const real twovd = REAL(2.0)*(sldCyl-sldSolv)*form_volume(radius, length); |
---|
[ce27e21] | 68 | SINCOS(alpha, sn, cn); |
---|
[5d4777d] | 69 | const real fq = _cyl(twovd, qr*sn, qh*cn, alpha); |
---|
| 70 | return REAL(1.0e8) * fq * fq * spherical_integration; |
---|
[ce27e21] | 71 | } |
---|