source: sasmodels/sasmodels/models/lib/cylkernel.c @ 14de349

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 14de349 was 14de349, checked in by Paul Kienzle <pkienzle@…>, 10 years ago

add autogenerated polydispersity loops

  • Property mode set to 100644
File size: 663 bytes
Line 
1// Compute the form factor for a cylinder
2// qq is the q-value for the calculation (1/A)
3// radius is the radius of the cylinder (A)
4// h is the HALF-LENGTH of the cylinder = L/2 (A)
5real CylKernel(real q, real radius, real h, real theta);
6real CylKernel(real q, real radius, real h, real theta)
7{
8    real sn, cn;
9    SINCOS(theta, sn, cn);
10    const real besarg = q*radius*sn;
11    const real siarg = q*h*cn;
12    // lim_{x->0} J1(x)/x = 1/2,  lim_{x->0} sin(x)/x = 1
13    const real bj = (besarg == REAL(0.0) ? REAL(0.5) : J1(besarg)/besarg);
14    const real si = (siarg == REAL(0.0) ? REAL(1.0) : sin(siarg)/siarg);
15    return REAL(4.0)*sin(theta)*bj*bj*si*si;
16}
Note: See TracBrowser for help on using the repository browser.