source: sasmodels/sasmodels/models/hollow_cylinder.c @ 592343f

core_shell_microgelscostrafo411magnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 592343f was 592343f, checked in by wojciech, 6 years ago

sas_J1c translated to sas_2J1x_x

  • Property mode set to 100644
File size: 2.6 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
16
17static double
18_hollow_cylinder_kernel(double q,
19    double radius, double thickness, double length, double sin_val, double cos_val)
20{
21    const double qs = q*sin_val;
22    const double lam1 = sas_2J1x_x((radius+thickness)*qs);
23    const double lam2 = sas_2J1x_x(radius*qs);
24    const double gamma_sq = square(radius/(radius+thickness));
25    //Note: lim_{thickness -> 0} psi = sas_J0(radius*qs)
26    //Note: lim_{radius -> 0} psi = sas_2J1x_x(thickness*qs)
27    const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq); //SRK 10/19/00
28    const double t2 = sas_sinx_x(0.5*q*length*cos_val);
29    return psi*t2;
30}
31
32double
33form_volume(double radius, double thickness, double length)
34{
35    double v_shell = M_PI*length*(square(radius+thickness) - radius*radius);
36    return v_shell;
37}
38
39
40double
41Iq(double q, double radius, double thickness, double length,
42    double sld, double solvent_sld)
43{
44    const double lower = 0.0;
45    const double upper = 1.0;           //limits of numerical integral
46
47    double summ = 0.0;                  //initialize intergral
48    for (int i=0;i<76;i++) {
49        const double cos_val = 0.5*( Gauss76Z[i] * (upper-lower) + lower + upper );
50        const double sin_val = sqrt(1.0 - cos_val*cos_val);
51        const double inter = _hollow_cylinder_kernel(q, radius, thickness, length,
52                                                     sin_val, cos_val);
53        summ += Gauss76Wt[i] * inter * inter;
54    }
55
56    const double Aq = 0.5*summ*(upper-lower);
57    const double volume = form_volume(radius, thickness, length);
58    return _hollow_cylinder_scaling(Aq, solvent_sld - sld, volume);
59}
60
61double
62Iqxy(double qx, double qy,
63    double radius, double thickness, double length,
64    double sld, double solvent_sld, double theta, double phi)
65{
66    double q, sin_alpha, cos_alpha;
67    ORIENT_SYMMETRIC(qx, qy, theta, phi, q, sin_alpha, cos_alpha);
68    const double Aq = _hollow_cylinder_kernel(q, radius, thickness, length,
69        sin_alpha, cos_alpha);
70
71    const double vol = form_volume(radius, thickness, length);
72    return _hollow_cylinder_scaling(Aq*Aq, solvent_sld-sld, vol);
73}
74
Note: See TracBrowser for help on using the repository browser.