source: sasmodels/sasmodels/models/hollow_cylinder.c @ 71b751d

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 71b751d was 71b751d, checked in by Paul Kienzle <pkienzle@…>, 6 years ago

update remaining form factors to use Fq interface

  • Property mode set to 100644
File size: 2.0 KB
Line 
1//#define INVALID(v) (v.radius_core >= v.radius)
2
3static double
4_fq(double qab, double qc,
5    double radius, double thickness, double length)
6{
7    const double lam1 = sas_2J1x_x((radius+thickness)*qab);
8    const double lam2 = sas_2J1x_x(radius*qab);
9    const double gamma_sq = square(radius/(radius+thickness));
10    //Note: lim_{thickness -> 0} psi = sas_J0(radius*qab)
11    //Note: lim_{radius -> 0} psi = sas_2J1x_x(thickness*qab)
12    const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq);    //SRK 10/19/00
13    const double t2 = sas_sinx_x(0.5*length*qc);
14    return psi*t2;
15}
16
17static double
18form_volume(double radius, double thickness, double length)
19{
20    double v_shell = M_PI*length*(square(radius+thickness) - radius*radius);
21    return v_shell;
22}
23
24
25static void
26Fq(double q, double *F1, double *F2, double radius, double thickness, double length,
27    double sld, double solvent_sld)
28{
29    const double lower = 0.0;
30    const double upper = 1.0;        //limits of numerical integral
31
32    double total_F1 = 0.0;            //initialize intergral
33    double total_F2 = 0.0;
34    for (int i=0;i<GAUSS_N;i++) {
35        const double cos_theta = 0.5*( GAUSS_Z[i] * (upper-lower) + lower + upper );
36        const double sin_theta = sqrt(1.0 - cos_theta*cos_theta);
37        const double form = _fq(q*sin_theta, q*cos_theta,
38                                radius, thickness, length);
39        total_F1 += GAUSS_W[i] * form;
40        total_F2 += GAUSS_W[i] * form * form;
41    }
42    total_F1 *= 0.5*(upper-lower);
43    total_F2 *= 0.5*(upper-lower);
44    const double s = (sld - solvent_sld) * form_volume(radius, thickness, length);
45    *F1 = 1e-2 * s * total_F1;
46    *F2 = 1e-4 * s*s * total_F2;
47}
48
49
50static double
51Iqac(double qab, double qc,
52    double radius, double thickness, double length,
53    double sld, double solvent_sld)
54{
55    const double form = _fq(qab, qc, radius, thickness, length);
56    const double s = (sld - solvent_sld) * form_volume(radius, thickness, length);
57    return 1.0e-4*square(s * form);
58}
Note: See TracBrowser for help on using the repository browser.