source: sasmodels/sasmodels/models/core_shell_bicelle.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.5 KB
Line 
1static double
2form_volume(double radius, double thick_rim, double thick_face, double length)
3{
4    return M_PI*square(radius+thick_rim)*(length+2.0*thick_face);
5}
6
7static double
8bicelle_kernel(double qab,
9    double qc,
10    double radius,
11    double thick_radius,
12    double thick_face,
13    double halflength,
14    double sld_core,
15    double sld_face,
16    double sld_rim,
17    double sld_solvent)
18{
19    const double dr1 = sld_core-sld_face;
20    const double dr2 = sld_rim-sld_solvent;
21    const double dr3 = sld_face-sld_rim;
22    const double vol1 = M_PI*square(radius)*2.0*(halflength);
23    const double vol2 = M_PI*square(radius+thick_radius)*2.0*(halflength+thick_face);
24    const double vol3 = M_PI*square(radius)*2.0*(halflength+thick_face);
25
26    const double be1 = sas_2J1x_x((radius)*qab);
27    const double be2 = sas_2J1x_x((radius+thick_radius)*qab);
28    const double si1 = sas_sinx_x((halflength)*qc);
29    const double si2 = sas_sinx_x((halflength+thick_face)*qc);
30
31    const double t = vol1*dr1*si1*be1 +
32                     vol2*dr2*si2*be2 +
33                     vol3*dr3*si2*be1;
34
35    return t;
36}
37
38static void
39Fq(double q,
40    double *F1,
41    double *F2,
42    double radius,
43    double thick_radius,
44    double thick_face,
45    double length,
46    double sld_core,
47    double sld_face,
48    double sld_rim,
49    double sld_solvent)
50{
51    // set up the integration end points
52    const double uplim = M_PI_4;
53    const double halflength = 0.5*length;
54
55    double total_F1 = 0.0;
56    double total_F2 = 0.0;
57    for(int i=0;i<GAUSS_N;i++) {
58        double theta = (GAUSS_Z[i] + 1.0)*uplim;
59        double sin_theta, cos_theta; // slots to hold sincos function output
60        SINCOS(theta, sin_theta, cos_theta);
61        double form = bicelle_kernel(q*sin_theta, q*cos_theta, radius, thick_radius, thick_face,
62                                   halflength, sld_core, sld_face, sld_rim, sld_solvent);
63        total_F1 += GAUSS_W[i]*form*sin_theta;
64        total_F2 += GAUSS_W[i]*form*form*sin_theta;
65    }
66    // Correct for integration range
67    total_F1 *= uplim;
68    total_F2 *= uplim;
69
70    *F1 = 1.0e-2*total_F1;
71    *F2 = 1.0e-4*total_F2;
72}
73
74static double
75Iqac(double qab, double qc,
76    double radius,
77    double thick_rim,
78    double thick_face,
79    double length,
80    double core_sld,
81    double face_sld,
82    double rim_sld,
83    double solvent_sld)
84{
85    double fq = bicelle_kernel(qab, qc, radius, thick_rim, thick_face,
86                           0.5*length, core_sld, face_sld, rim_sld,
87                           solvent_sld);
88    return 1.0e-4*fq*fq;
89}
Note: See TracBrowser for help on using the repository browser.