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, 7 years ago

sas_J1c translated to sas_2J1x_x

  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[aea2e2a]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
[5bddd89]10static double
11_hollow_cylinder_scaling(double integrand, double delrho, double volume)
[aea2e2a]12{
[ed23abe]13    return 1.0e-4 * square(volume * delrho) * integrand;
[aea2e2a]14}
15
16
[5bddd89]17static double
18_hollow_cylinder_kernel(double q,
19    double radius, double thickness, double length, double sin_val, double cos_val)
[aea2e2a]20{
[5bddd89]21    const double qs = q*sin_val;
[592343f]22    const double lam1 = sas_2J1x_x((radius+thickness)*qs);
23    const double lam2 = sas_2J1x_x(radius*qs);
[aea2e2a]24    const double gamma_sq = square(radius/(radius+thickness));
[592343f]25    //Note: lim_{thickness -> 0} psi = sas_J0(radius*qs)
26    //Note: lim_{radius -> 0} psi = sas_2J1x_x(thickness*qs)
[aea2e2a]27    const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq); //SRK 10/19/00
[1e7b0db0]28    const double t2 = sas_sinx_x(0.5*q*length*cos_val);
[5bddd89]29    return psi*t2;
[aea2e2a]30}
31
[5bddd89]32double
33form_volume(double radius, double thickness, double length)
[aea2e2a]34{
[ed23abe]35    double v_shell = M_PI*length*(square(radius+thickness) - radius*radius);
36    return v_shell;
[aea2e2a]37}
38
39
[5bddd89]40double
41Iq(double q, double radius, double thickness, double length,
[aea2e2a]42    double sld, double solvent_sld)
43{
[5bddd89]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);
[ed23abe]53        summ += Gauss76Wt[i] * inter * inter;
[aea2e2a]54    }
55
[5bddd89]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}
[aea2e2a]60
[5bddd89]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);
[ed23abe]72    return _hollow_cylinder_scaling(Aq*Aq, solvent_sld-sld, vol);
[aea2e2a]73}
74
Note: See TracBrowser for help on using the repository browser.