source: sasmodels/sasmodels/models/hollow_cylinder.c @ 84e6942

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 84e6942 was 84e6942, checked in by krzywon, 8 years ago

Sending hollow cylinder on so Paul can look at the 1012 issue I'm
having.

  • Property mode set to 100644
File size: 2.7 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, double axis_theta, double axis_phi);
7double Iqxy(double qx, double qy, double radius, double core_radius, double length, double sld,
8        double solvent_sld, double axis_theta, double axis_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
50//FIXME: Returning values 10^12 times too high
51double Iq(double q, double radius, double core_radius, double length, double sld,
52        double solvent_sld, double axis_theta, double axis_phi)
53{
54    int i;
55        int nord=76;                    //order of integration
56        double lower,upper,zi, inter;           //upper and lower integration limits
57        double summ,answer,delrho;                      //running tally of integration
58        double norm,scale,volume,convert;       //final calculation variables
59       
60        delrho = solvent_sld - sld;
61        lower = 0.0;
62        upper = 1.0;            //limits of numerical integral
63
64        summ = 0.0;                     //initialize intergral
65        for(i=0;i<nord;i++) {
66                zi = ( Gauss76Z[i] * (upper-lower) + lower + upper )/2.0;
67                inter = Gauss76Wt[i] * _hollow_cylinder_kernel(q, core_radius, radius, length, zi);
68                summ += inter;
69        }
70       
71        norm = summ*(upper-lower)/2.0;
72        // Multiply by contrast^2
73        scale = delrho*delrho;
74        //normalize by volume
75        volume = form_volume(radius, core_radius, length);
76        //convert to [cm-1]
77        convert = 1.0e8;
78        answer = norm*scale*volume*convert;
79       
80        return(answer);
81}
82
83//TODO: Add this in
84double Iqxy(double qx, double qy, double radius, double core_radius, double length, double sld,
85        double solvent_sld, double axis_theta, double axis_phi)
86{
87    return(0.0);
88}
Note: See TracBrowser for help on using the repository browser.