# source:sasmodels/sasmodels/models/triaxial_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, 13 months ago

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

• Property mode set to `100644`
File size: 5.9 KB
Line
2
3static double
5{
7}
8
9static double
11{
12    // Trivial cases
15
16
17    double r_equat_equiv, r_polar_equiv;
20
24
30            } else {
33                }
34            }
35    }
39    } else  {
42    }
43
44    // see equation (26) in A.Isihara, J.Chem.Phys. 18(1950)1446-1449
45    const double ratio = (r_polar_equiv < r_equat_equiv
46                          ? r_polar_equiv / r_equat_equiv
47                          : r_equat_equiv / r_polar_equiv);
48    const double e1 = sqrt(1.0 - ratio*ratio);
49    const double b1 = 1.0 + asin(e1) / (e1 * ratio);
50    const double bL = (1.0 + e1) / (1.0 - e1);
51    const double b2 = 1.0 + 0.5 * ratio * ratio / e1 * log(bL);
52    const double delta = 0.75 * b1 * b2;
53    const double ddd = 2.0 * (delta + 1.0) * r_polar_equiv * r_equat_equiv * r_equat_equiv;
54    return 0.5 * cbrt(ddd);
55}
56
57static double
59{
61}
62
63static double
65{
68}
69
70static double
72{
75}
76
77static double
79{
80    switch (mode) {
81    default:
82    case 1: // equivalent biaxial ellipsoid average curvature
84    case 2: // equivalent volume sphere
86    case 3: // min radius
88    case 4: // max radius
90    }
91}
92
93static void
94Fq(double q,
95    double *F1,
96    double *F2,
97    double sld,
98    double sld_solvent,
102{
105    // translate a point in [-1,1] to a point in [0, pi/2]
106    const double zm = M_PI_4;
107    const double zb = M_PI_4;
108    double outer_sum_F1 = 0.0;
109    double outer_sum_F2 = 0.0;
110    for (int i=0;i<GAUSS_N;i++) {
111        //const double u = GAUSS_Z[i]*(upper-lower)/2 + (upper + lower)/2;
112        const double phi = GAUSS_Z[i]*zm + zb;
113        const double pa_sinsq_phi = pa*square(sin(phi));
114
115        double inner_sum_F1 = 0.0;
116        double inner_sum_F2 = 0.0;
117        const double um = 0.5;
118        const double ub = 0.5;
119        for (int j=0;j<GAUSS_N;j++) {
120            // translate a point in [-1,1] to a point in [0, 1]
121            const double usq = square(GAUSS_Z[j]*um + ub);
122            const double r = radius_equat_major*sqrt(pa_sinsq_phi*(1.0-usq) + 1.0 + pc*usq);
123            const double fq = sas_3j1x_x(q*r);
124            inner_sum_F1 += GAUSS_W[j] * fq;
125            inner_sum_F2 += GAUSS_W[j] * fq * fq;
126        }
127        outer_sum_F1 += GAUSS_W[i] * inner_sum_F1;  // correcting for dx later
128        outer_sum_F2 += GAUSS_W[i] * inner_sum_F2;  // correcting for dx later
129    }
130    // translate integration ranges from [-1,1] to [lower,upper] and normalize by 4 pi
131    outer_sum_F1 *= 0.25;  // = outer*um*zm*8.0/(4.0*M_PI);
132    outer_sum_F2 *= 0.25;  // = outer*um*zm*8.0/(4.0*M_PI);
133
135    const double contrast = (sld - sld_solvent);
136    *F1 = 1.0e-2 * contrast * volume * outer_sum_F1;
137    *F2 = 1.0e-4 * square(contrast * volume) * outer_sum_F2;
138}
139
140
141static double
142Iqabc(double qa, double qb, double qc,
143    double sld,
144    double sld_solvent,