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

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

restructure all 2D models to work with (qa,qb,qc) = rotate(qx,qy) rather than working with angles directly in preparation for revised jitter algorithm

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