source: sasmodels/sasmodels/models/hollow_cylinder.c @ 6cf1cb3

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 6cf1cb3 was 6cf1cb3, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

hollow cylinder: scale SLD by 1e-6, mark volume and orientation parameters, scale by volume

  • Property mode set to 100644
File size: 2.5 KB
Line 
1double _hollow_cylinder_kernel(double q, double core_radius, double radius, 
2        double length, double dum);
3
4double form_volume(double radius, double core_radius, double length);
5double Iq(double q, double radius, double core_radius, double length, double sld,
6        double solvent_sld);
7double Iqxy(double qx, double qy, double radius, double core_radius, double length, double sld,
8        double solvent_sld, double theta, double phi);
9
10// From Igor library
11double _hollow_cylinder_kernel(double q, double core_radius, double radius, 
12        double length, double dum)
13{
14    double gamma,arg1,arg2,lam1,lam2,psi,sinarg,t2,retval;              //local variables
15   
16    gamma = core_radius/radius;
17    arg1 = q*radius*sqrt(1.0-dum*dum);          //1=shell (outer radius)
18    arg2 = q*core_radius*sqrt(1.0-dum*dum);                     //2=core (inner radius)
19    if (arg1 == 0.0){
20        lam1 = 1.0;
21    }else{
22        lam1 = 2.0*J1(arg1)/arg1;
23    }
24    if (arg2 == 0.0){
25        lam2 = 1.0;
26    }else{
27        lam2 = 2.0*J1(arg2)/arg2;
28    }
29    //Todo: Need to check psi behavior as gamma goes to 1.
30    psi = (lam1 -  gamma*gamma*lam2)/(1.0-gamma*gamma);         //SRK 10/19/00
31    sinarg = q*length*dum/2.0;
32    if (sinarg == 0.0){
33        t2 = 1.0;
34    }else{
35        t2 = sin(sinarg)/sinarg;
36    }
37
38    retval = psi*psi*t2*t2;
39   
40    return(retval);
41}
42
43double form_volume(double radius, double core_radius, double length)
44{
45        double pi = 4.0*atan(1.0);
46        double v_shell = pi*length*(radius*radius-core_radius*core_radius);
47        return(v_shell);
48}
49
50double Iq(double q, double radius, double core_radius, double length, double sld,
51        double solvent_sld)
52{
53    int i;
54        int nord=76;                    //order of integration
55        double lower,upper,zi, inter;           //upper and lower integration limits
56        double summ,answer,delrho;                      //running tally of integration
57        double norm,scale,volume,convert;       //final calculation variables
58       
59        delrho = solvent_sld - sld;
60        lower = 0.0;
61        upper = 1.0;            //limits of numerical integral
62
63        summ = 0.0;                     //initialize intergral
64        for(i=0;i<nord;i++) {
65                zi = ( Gauss76Z[i] * (upper-lower) + lower + upper )/2.0;
66                inter = Gauss76Wt[i] * _hollow_cylinder_kernel(q, core_radius, radius, length, zi);
67                summ += inter;
68        }
69       
70        norm = summ*(upper-lower)/2.0;
71        // Multiply by contrast^2
72        scale = delrho*delrho;
73        //normalize by volume
74        volume = form_volume(radius, core_radius, length);
75        //convert to [cm-1] given sld*1e6
76        convert = 1.0e-4;
77        answer = norm*scale*convert*volume*volume;
78       
79        return(answer);
80}
81
82//TODO: Add this in
83double Iqxy(double qx, double qy, double radius, double core_radius, double length, double sld,
84        double solvent_sld, double theta, double phi)
85{
86    return(0.0);
87}
Note: See TracBrowser for help on using the repository browser.