source: sasmodels/sasmodels/models/lib/gfn.c @ 925ad6e

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 925ad6e was 925ad6e, checked in by wojciech, 6 years ago

sph_j1c translated to sas_3j1x_x

  • Property mode set to 100644
File size: 1.3 KB
Line 
1//
2//     FUNCTION gfn4:    CONTAINS F(Q,A,B,MU)**2  AS GIVEN
3//                       BY (53) & (58-59) IN CHEN AND
4//                       KOTLARCHYK REFERENCE
5//
6//       <OBLATE ELLIPSOID>
7// function gfn4 for oblate ellipsoids
8double
9gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq);
10double
11gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq)
12{
13    // local variables
14    const double aa = crmaj;
15    const double bb = crmin;
16    const double u2 = (bb*bb*xx*xx + aa*aa*(1.0-xx*xx));
17    const double uq = sqrt(u2)*qq;
18    // changing to more accurate sph_j1c since the following inexplicably fails on Radeon Nano.
19    //const double siq = (uq == 0.0 ? 1.0 : 3.0*(sin(uq)/uq/uq - cos(uq)/uq)/uq);
20    const double siq = sas_3j1x_x(uq);
21    const double vc = M_4PI_3*aa*aa*bb;
22    const double gfnc = siq*vc*delpc;
23
24    const double ut2 = (trmin*trmin*xx*xx + trmaj*trmaj*(1.0-xx*xx));
25    const double ut= sqrt(ut2)*qq;
26    const double vt = M_4PI_3*trmaj*trmaj*trmin;
27    //const double sit = (ut == 0.0 ? 1.0 : 3.0*(sin(ut)/ut/ut - cos(ut)/ut)/ut);
28    const double sit = sas_3j1x_x(ut);
29    const double gfnt = sit*vt*delps;
30
31    const double tgfn = gfnc + gfnt;
32    const double result = tgfn*tgfn;
33
34    return result;
35}
Note: See TracBrowser for help on using the repository browser.