# source:sasmodels/sasmodels/models/ellipsoid.c@99658f6

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 99658f6 was 99658f6, checked in by grethevj, 10 months ago

updated ER functions including cylinder excluded volume, to match 4.x

• Property mode set to `100644`
File size: 3.5 KB
Line
1static double
3{
5}
6
7static double
9{
11}
12
13static double
15{
16    // Trivial cases
19
20    // see equation (26) in A.Isihara, J.Chem.Phys. 18(1950)1446-1449
24    const double e1 = sqrt(1.0 - ratio*ratio);
25    const double b1 = 1.0 + asin(e1) / (e1 * ratio);
26    const double bL = (1.0 + e1) / (1.0 - e1);
27    const double b2 = 1.0 + 0.5 * ratio * ratio / e1 * log(bL);
28    const double delta = 0.75 * b1 * b2;
30    return 0.5 * cbrt(ddd);
31}
32
33static double
35{
36    switch (mode) {
37    default:
38    case 1: // average curvature
40    case 2: // equivalent volume sphere
42    case 3: // min radius
44    case 4: // max radius
46    }
47}
48
49
50static void
51Fq(double q,
52    double *F1,
53    double *F2,
54    double sld,
55    double sld_solvent,
58{
59    // Using ratio v = Rp/Re, we can implement the form given in Guinier (1955)
60    //     i(h) = int_0^pi/2 Phi^2(h a sqrt(cos^2 + v^2 sin^2) cos dT
61    //          = int_0^pi/2 Phi^2(h a sqrt((1-sin^2) + v^2 sin^2) cos dT
62    //          = int_0^pi/2 Phi^2(h a sqrt(1 + sin^2(v^2-1)) cos dT
63    // u-substitution of
64    //     u = sin, du = cos dT
65    //     i(h) = int_0^1 Phi^2(h a sqrt(1 + u^2(v^2-1)) du
67    // translate a point in [-1,1] to a point in [0, 1]
68    // const double u = GAUSS_Z[i]*(upper-lower)/2 + (upper+lower)/2;
69    const double zm = 0.5;
70    const double zb = 0.5;
71    double total_F2 = 0.0;
72    double total_F1 = 0.0;
73    for (int i=0;i<GAUSS_N;i++) {
74        const double u = GAUSS_Z[i]*zm + zb;
75        const double r = radius_equatorial*sqrt(1.0 + u*u*v_square_minus_one);
76        const double f = sas_3j1x_x(q*r);
77        total_F2 += GAUSS_W[i] * f * f;
78        total_F1 += GAUSS_W[i] * f;
79    }
80    // translate dx in [-1,1] to dx in [lower,upper]
81    total_F1 *= zm;
82    total_F2 *= zm;
84    *F1 = 1e-2 * s * total_F1;
85    *F2 = 1e-4 * s * s * total_F2;
86}
87
88static double
89Iqac(double qab, double qc,
90    double sld,
91    double sld_solvent,