source: sasmodels/sasmodels/models/hollow_cylinder.c @ 2d81cfe

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

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

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