source: sasmodels/sasmodels/models/core_shell_cylinder.c @ becded3

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

update oriented models to new interface (which will be in the next commit)

  • Property mode set to 100644
File size: 2.2 KB
Line 
1// vd = volume * delta_rho
2// besarg = q * R * sin(theta)
3// siarg = q * L/2 * cos(theta)
4static double _cyl(double vd, double besarg, double siarg)
5{
6    return vd * sas_sinx_x(siarg) * sas_2J1x_x(besarg);
7}
8
9static double
10form_volume(double radius, double thickness, double length)
11{
12    return M_PI*square(radius+thickness)*(length+2.0*thickness);
13}
14
15static double
16Iq(double q,
17    double core_sld,
18    double shell_sld,
19    double solvent_sld,
20    double radius,
21    double thickness,
22    double length)
23{
24    // precalculate constants
25    const double core_r = radius;
26    const double core_h = 0.5*length;
27    const double core_vd = form_volume(radius,0,length) * (core_sld-shell_sld);
28    const double shell_r = (radius + thickness);
29    const double shell_h = (0.5*length + thickness);
30    const double shell_vd = form_volume(radius,thickness,length) * (shell_sld-solvent_sld);
31    double total = 0.0;
32    for (int i=0; i<76 ;i++) {
33        // translate a point in [-1,1] to a point in [0, pi/2]
34        //const double theta = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0;
35        double sin_theta, cos_theta;
36        const double theta = Gauss76Z[i]*M_PI_4 + M_PI_4;
37        SINCOS(theta, sin_theta,  cos_theta);
38        const double qab = q*sin_theta;
39        const double qc = q*cos_theta;
40        const double fq = _cyl(core_vd, core_r*qab, core_h*qc)
41            + _cyl(shell_vd, shell_r*qab, shell_h*qc);
42        total += Gauss76Wt[i] * fq * fq * sin_theta;
43    }
44    // translate dx in [-1,1] to dx in [lower,upper]
45    //const double form = (upper-lower)/2.0*total;
46    return 1.0e-4 * total * M_PI_4;
47}
48
49
50double Iqxy(double qab, double qc,
51    double core_sld,
52    double shell_sld,
53    double solvent_sld,
54    double radius,
55    double thickness,
56    double length)
57{
58    const double core_r = radius;
59    const double core_h = 0.5*length;
60    const double core_vd = form_volume(radius,0,length) * (core_sld-shell_sld);
61    const double shell_r = (radius + thickness);
62    const double shell_h = (0.5*length + thickness);
63    const double shell_vd = form_volume(radius,thickness,length) * (shell_sld-solvent_sld);
64
65    const double fq = _cyl(core_vd, core_r*qab, core_h*qc)
66        + _cyl(shell_vd, shell_r*qab, shell_h*qc);
67    return 1.0e-4 * fq * fq;
68}
Note: See TracBrowser for help on using the repository browser.