1 | double form_volume(double equat_core, |
---|
2 | double polar_core, |
---|
3 | double equat_shell, |
---|
4 | double polar_shell); |
---|
5 | double Iq(double q, |
---|
6 | double equat_core, |
---|
7 | double x_core, |
---|
8 | double t_shell, |
---|
9 | double x_polar_shell, |
---|
10 | double core_sld, |
---|
11 | double shell_sld, |
---|
12 | double solvent_sld); |
---|
13 | |
---|
14 | |
---|
15 | double Iqxy(double qx, double qy, |
---|
16 | double equat_core, |
---|
17 | double x_core, |
---|
18 | double t_shell, |
---|
19 | double x_polar_shell, |
---|
20 | double core_sld, |
---|
21 | double shell_sld, |
---|
22 | double solvent_sld, |
---|
23 | double theta, |
---|
24 | double phi); |
---|
25 | |
---|
26 | |
---|
27 | double form_volume(double equat_core, |
---|
28 | double x_core, |
---|
29 | double t_shell, |
---|
30 | double x_polar_shell) |
---|
31 | { |
---|
32 | double equat_shell, polar_shell; |
---|
33 | equat_shell = equat_core + t_shell; |
---|
34 | polar_shell = equat_core*x_core + t_shell*x_polar_shell; |
---|
35 | double vol = 4.0*M_PI/3.0*equat_shell*equat_shell*polar_shell; |
---|
36 | return vol; |
---|
37 | } |
---|
38 | |
---|
39 | static double |
---|
40 | core_shell_ellipsoid_xt_kernel(double q, |
---|
41 | double equat_core, |
---|
42 | double x_core, |
---|
43 | double t_shell, |
---|
44 | double x_polar_shell, |
---|
45 | double core_sld, |
---|
46 | double shell_sld, |
---|
47 | double solvent_sld) |
---|
48 | { |
---|
49 | double delpc,delps; |
---|
50 | double uplim,lolim; //upper and lower integration limits |
---|
51 | double summ,zi,yyy,answer; //running tally of integration |
---|
52 | double polar_core, equat_shell, polar_shell; |
---|
53 | |
---|
54 | lolim = 0.0; |
---|
55 | uplim = 1.0; |
---|
56 | |
---|
57 | summ = 0.0; //initialize intergral |
---|
58 | |
---|
59 | delpc = core_sld - shell_sld; //core - shell |
---|
60 | delps = shell_sld - solvent_sld; //shell - solvent |
---|
61 | |
---|
62 | |
---|
63 | polar_core = equat_core*x_core; |
---|
64 | equat_shell = equat_core + t_shell; |
---|
65 | polar_shell = equat_core*x_core + t_shell*x_polar_shell; |
---|
66 | |
---|
67 | for(int i=0;i<76;i++) { |
---|
68 | zi = ( Gauss76Z[i]*(uplim-lolim) + uplim + lolim )/2.0; |
---|
69 | yyy = Gauss76Wt[i] * gfn4(zi, |
---|
70 | equat_core, |
---|
71 | polar_core, |
---|
72 | equat_shell, |
---|
73 | polar_shell, |
---|
74 | delpc, |
---|
75 | delps, |
---|
76 | q); |
---|
77 | summ += yyy; |
---|
78 | } |
---|
79 | |
---|
80 | answer = (uplim-lolim)/2.0*summ; |
---|
81 | |
---|
82 | //convert to [cm-1] |
---|
83 | answer *= 1.0e-4; |
---|
84 | |
---|
85 | return answer; |
---|
86 | } |
---|
87 | |
---|
88 | static double |
---|
89 | core_shell_ellipsoid_xt_kernel_2d(double q, double q_x, double q_y, |
---|
90 | double equat_core, |
---|
91 | double x_core, |
---|
92 | double t_shell, |
---|
93 | double x_polar_shell, |
---|
94 | double core_sld, |
---|
95 | double shell_sld, |
---|
96 | double solvent_sld, |
---|
97 | double theta, |
---|
98 | double phi) |
---|
99 | { |
---|
100 | double cyl_x, cyl_y; |
---|
101 | double cos_val; |
---|
102 | double answer; |
---|
103 | double sldcs,sldss; |
---|
104 | double polar_core, equat_shell, polar_shell; |
---|
105 | |
---|
106 | //convert angle degree to radian |
---|
107 | theta = theta * M_PI/180.0; |
---|
108 | phi = phi * M_PI/180.0; |
---|
109 | |
---|
110 | |
---|
111 | // ellipsoid orientation, the axis of the rotation is consistent with the ploar axis. |
---|
112 | cyl_x = cos(theta) * cos(phi); |
---|
113 | cyl_y = sin(theta); |
---|
114 | |
---|
115 | sldcs = core_sld - shell_sld; |
---|
116 | sldss = shell_sld- solvent_sld; |
---|
117 | |
---|
118 | // Compute the angle btw vector q and the |
---|
119 | // axis of the cylinder |
---|
120 | cos_val = cyl_x*q_x + cyl_y*q_y; |
---|
121 | |
---|
122 | polar_core = equat_core*x_core; |
---|
123 | equat_shell = equat_core + t_shell; |
---|
124 | polar_shell = equat_core*x_core + t_shell*x_polar_shell; |
---|
125 | |
---|
126 | // Call the IGOR library function to get the kernel: |
---|
127 | // MUST use gfn4 not gf2 because of the def of params. |
---|
128 | answer = gfn4(cos_val, |
---|
129 | equat_core, |
---|
130 | polar_core, |
---|
131 | equat_shell, |
---|
132 | polar_shell, |
---|
133 | sldcs, |
---|
134 | sldss, |
---|
135 | q); |
---|
136 | |
---|
137 | //convert to [cm-1] |
---|
138 | answer *= 1.0e-4; |
---|
139 | |
---|
140 | return answer; |
---|
141 | } |
---|
142 | |
---|
143 | double Iq(double q, |
---|
144 | double equat_core, |
---|
145 | double x_core, |
---|
146 | double t_shell, |
---|
147 | double x_polar_shell, |
---|
148 | double core_sld, |
---|
149 | double shell_sld, |
---|
150 | double solvent_sld) |
---|
151 | { |
---|
152 | double intensity = core_shell_ellipsoid_xt_kernel(q, |
---|
153 | equat_core, |
---|
154 | x_core, |
---|
155 | t_shell, |
---|
156 | x_polar_shell, |
---|
157 | core_sld, |
---|
158 | shell_sld, |
---|
159 | solvent_sld); |
---|
160 | |
---|
161 | return intensity; |
---|
162 | } |
---|
163 | |
---|
164 | |
---|
165 | double Iqxy(double qx, double qy, |
---|
166 | double equat_core, |
---|
167 | double x_core, |
---|
168 | double t_shell, |
---|
169 | double x_polar_shell, |
---|
170 | double core_sld, |
---|
171 | double shell_sld, |
---|
172 | double solvent_sld, |
---|
173 | double theta, |
---|
174 | double phi) |
---|
175 | { |
---|
176 | double q; |
---|
177 | q = sqrt(qx*qx+qy*qy); |
---|
178 | double intensity = core_shell_ellipsoid_xt_kernel_2d(q, qx/q, qy/q, |
---|
179 | equat_core, |
---|
180 | x_core, |
---|
181 | t_shell, |
---|
182 | x_polar_shell, |
---|
183 | core_sld, |
---|
184 | shell_sld, |
---|
185 | solvent_sld, |
---|
186 | theta, |
---|
187 | phi); |
---|
188 | |
---|
189 | return intensity; |
---|
190 | } |
---|