core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change
on this file since 3a48772 was
3a48772,
checked in by Paul Kienzle <pkienzle@…>, 7 years ago
|
use predefined constants for fractions of pi
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[81dd619] | 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 |
---|
[177c1a1] | 8 | double |
---|
| 9 | gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq); |
---|
| 10 | double |
---|
[81dd619] | 11 | gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq) |
---|
| 12 | { |
---|
[177c1a1] | 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 = sph_j1c(uq); |
---|
[3a48772] | 21 | const double vc = M_4PI_3*aa*aa*bb; |
---|
[177c1a1] | 22 | const double gfnc = siq*vc*delpc; |
---|
[81dd619] | 23 | |
---|
[177c1a1] | 24 | const double ut2 = (trmin*trmin*xx*xx + trmaj*trmaj*(1.0-xx*xx)); |
---|
| 25 | const double ut= sqrt(ut2)*qq; |
---|
[3a48772] | 26 | const double vt = M_4PI_3*trmaj*trmaj*trmin; |
---|
[177c1a1] | 27 | //const double sit = (ut == 0.0 ? 1.0 : 3.0*(sin(ut)/ut/ut - cos(ut)/ut)/ut); |
---|
| 28 | const double sit = sph_j1c(ut); |
---|
| 29 | const double gfnt = sit*vt*delps; |
---|
[81dd619] | 30 | |
---|
[177c1a1] | 31 | const double tgfn = gfnc + gfnt; |
---|
| 32 | const double result = tgfn*tgfn; |
---|
| 33 | |
---|
[3a48772] | 34 | return result; |
---|
[81dd619] | 35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.