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
RevLine 
[aea2e2a]1double form_volume(double radius, double thickness, double length);
2double Iq(double q, double radius, double thickness, double length, double sld,
[2a0b2b1]3    double solvent_sld);
[aea2e2a]4double Iqxy(double qx, double qy, double radius, double thickness, double length, double sld,
[2a0b2b1]5    double solvent_sld, double theta, double phi);
[aea2e2a]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
[5bddd89]16static double
[2a0b2b1]17_fq(double qab, double qc,
18    double radius, double thickness, double length)
[aea2e2a]19{
[2a0b2b1]20    const double lam1 = sas_2J1x_x((radius+thickness)*qab);
21    const double lam2 = sas_2J1x_x(radius*qab);
[aea2e2a]22    const double gamma_sq = square(radius/(radius+thickness));
[2a0b2b1]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);
[5bddd89]27    return psi*t2;
[aea2e2a]28}
29
[5bddd89]30double
31form_volume(double radius, double thickness, double length)
[aea2e2a]32{
[ed23abe]33    double v_shell = M_PI*length*(square(radius+thickness) - radius*radius);
34    return v_shell;
[aea2e2a]35}
36
37
[5bddd89]38double
39Iq(double q, double radius, double thickness, double length,
[aea2e2a]40    double sld, double solvent_sld)
41{
[5bddd89]42    const double lower = 0.0;
[2a0b2b1]43    const double upper = 1.0;        //limits of numerical integral
[5bddd89]44
[2a0b2b1]45    double summ = 0.0;            //initialize intergral
[5bddd89]46    for (int i=0;i<76;i++) {
[2a0b2b1]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;
[aea2e2a]52    }
53
[5bddd89]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}
[aea2e2a]58
[5bddd89]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);
[2a0b2b1]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);
[5bddd89]70
71    const double vol = form_volume(radius, thickness, length);
[2a0b2b1]72    return _hollow_cylinder_scaling(form*form, solvent_sld-sld, vol);
[aea2e2a]73}
Note: See TracBrowser for help on using the repository browser.