1 | double form_volume(void); |
---|
2 | |
---|
3 | double Iq(double q, |
---|
4 | double lg_radius, double sm_radius, |
---|
5 | double lg_vol_frac, double sm_vol_frac, |
---|
6 | double lg_sld, double sm_sld, double solvent_sld |
---|
7 | ); |
---|
8 | |
---|
9 | void calculate_psfs(double qval, |
---|
10 | double r2, double nf2, |
---|
11 | double aa, double phi, |
---|
12 | double *s11, double *s22, double *s12 |
---|
13 | ); |
---|
14 | |
---|
15 | double form_volume(void) |
---|
16 | { |
---|
17 | return 1.0; |
---|
18 | } |
---|
19 | |
---|
20 | double Iq(double q, |
---|
21 | double lg_radius, double sm_radius, |
---|
22 | double lg_vol_frac, double sm_vol_frac, |
---|
23 | double lg_sld, double sm_sld, double solvent_sld) |
---|
24 | |
---|
25 | { |
---|
26 | double r2,r1,nf2,phi,aa,rho2,rho1,rhos,inten; //my local names |
---|
27 | double psf11,psf12,psf22; |
---|
28 | double phi1,phi2,phr,a3; |
---|
29 | double v1,v2,n1,n2,qr1,qr2,b1,b2,sc1,sc2; |
---|
30 | |
---|
31 | r2 = lg_radius; |
---|
32 | r1 = sm_radius; |
---|
33 | phi2 = lg_vol_frac; |
---|
34 | phi1 = sm_vol_frac; |
---|
35 | rho2 = lg_sld; |
---|
36 | rho1 = sm_sld; |
---|
37 | rhos = solvent_sld; |
---|
38 | |
---|
39 | |
---|
40 | phi = phi1 + phi2; |
---|
41 | aa = r1/r2; |
---|
42 | //calculate the number fraction of larger spheres (eqn 2 in reference) |
---|
43 | a3=aa*aa*aa; |
---|
44 | phr=phi2/phi; |
---|
45 | nf2 = phr*a3/(1.0-phr+phr*a3); |
---|
46 | // calculate the PSF's here |
---|
47 | calculate_psfs(q,r2,nf2,aa,phi,&psf11,&psf22,&psf12); |
---|
48 | |
---|
49 | // /* do form factor calculations */ |
---|
50 | |
---|
51 | v1 = M_4PI_3*r1*r1*r1; |
---|
52 | v2 = M_4PI_3*r2*r2*r2; |
---|
53 | |
---|
54 | n1 = phi1/v1; |
---|
55 | n2 = phi2/v2; |
---|
56 | |
---|
57 | qr1 = r1*q; |
---|
58 | qr2 = r2*q; |
---|
59 | |
---|
60 | sc1 = sas_3j1x_x(qr1); |
---|
61 | sc2 = sas_3j1x_x(qr2); |
---|
62 | b1 = r1*r1*r1*(rho1-rhos)*M_4PI_3*sc1; |
---|
63 | b2 = r2*r2*r2*(rho2-rhos)*M_4PI_3*sc2; |
---|
64 | inten = n1*b1*b1*psf11; |
---|
65 | inten += sqrt(n1*n2)*2.0*b1*b2*psf12; |
---|
66 | inten += n2*b2*b2*psf22; |
---|
67 | ///* convert I(1/A) to (1/cm) */ |
---|
68 | inten *= 1.0e8; |
---|
69 | ///*convert rho^2 in 10^-6A to A*/ |
---|
70 | inten *= 1.0e-12; |
---|
71 | return(inten); |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | void calculate_psfs(double qval, |
---|
76 | double r2, double nf2, |
---|
77 | double aa, double phi, |
---|
78 | double *s11, double *s22, double *s12) |
---|
79 | |
---|
80 | { |
---|
81 | // variable qval,r2,nf2,aa,phi,&s11,&s22,&s12 |
---|
82 | |
---|
83 | // calculate constant terms |
---|
84 | double s2,v,a3,v1,v2,g11,g12,g22,wmv,wmv3,wmv4; |
---|
85 | double a1,a2i,a2,b1,b2,b12,gm1,gm12; |
---|
86 | double yy,ay,ay2,ay3,t1,t2,t3,f11,y2,y3,tt1,tt2,tt3; |
---|
87 | double c11,c22,c12,f12,f22,ttt1,ttt2,ttt3,ttt4,yl,y13; |
---|
88 | double t21,t22,t23,t31,t32,t33,t41,t42,yl3,wma3,y1; |
---|
89 | |
---|
90 | s2 = 2.0*r2; |
---|
91 | // s1 = aa*s2; why is this never used? check original paper? |
---|
92 | v = phi; |
---|
93 | a3 = aa*aa*aa; |
---|
94 | v1=((1.-nf2)*a3/(nf2+(1.-nf2)*a3))*v; |
---|
95 | v2=(nf2/(nf2+(1.-nf2)*a3))*v; |
---|
96 | g11=((1.+.5*v)+1.5*v2*(aa-1.))/(1.-v)/(1.-v); |
---|
97 | g22=((1.+.5*v)+1.5*v1*(1./aa-1.))/(1.-v)/(1.-v); |
---|
98 | g12=((1.+.5*v)+1.5*(1.-aa)*(v1-v2)/(1.+aa))/(1.-v)/(1.-v); |
---|
99 | wmv = 1/(1.-v); |
---|
100 | wmv3 = wmv*wmv*wmv; |
---|
101 | wmv4 = wmv*wmv3; |
---|
102 | a1=3.*wmv4*((v1+a3*v2)*(1.+v+v*v)-3.*v1*v2*(1.-aa)*(1.-aa)*(1.+v1+aa*(1.+v2))) + ((v1+a3*v2)*(1.+2.*v)+(1.+v+v*v)-3.*v1*v2*(1.-aa)*(1.-aa)-3.*v2*(1.-aa)*(1.-aa)*(1.+v1+aa*(1.+v2)))*wmv3; |
---|
103 | a2i=((v1+a3*v2)*(1.+v+v*v)-3.*v1*v2*(1.-aa)*(1.-aa)*(1.+v1+aa*(1.+v2)))*3*wmv4 + ((v1+a3*v2)*(1.+2.*v)+a3*(1.+v+v*v)-3.*v1*v2*(1.-aa)*(1.-aa)*aa-3.*v1*(1.-aa)*(1.-aa)*(1.+v1+aa*(1.+v2)))*wmv3; |
---|
104 | a2=a2i/a3; |
---|
105 | b1=-6.*(v1*g11*g11+.25*v2*(1.+aa)*(1.+aa)*aa*g12*g12); |
---|
106 | b2=-6.*(v2*g22*g22+.25*v1/a3*(1.+aa)*(1.+aa)*g12*g12); |
---|
107 | b12=-3.*aa*(1.+aa)*(v1*g11/aa/aa+v2*g22)*g12; |
---|
108 | gm1=(v1*a1+a3*v2*a2)*.5; |
---|
109 | gm12=2.*gm1*(1.-aa)/aa; |
---|
110 | //c |
---|
111 | //c calculate the direct correlation functions and print results |
---|
112 | //c |
---|
113 | // do 20 j=1,npts |
---|
114 | |
---|
115 | yy=qval*s2; |
---|
116 | //c calculate direct correlation functions |
---|
117 | //c ----c11 |
---|
118 | ay=aa*yy; |
---|
119 | ay2 = ay*ay; |
---|
120 | ay3 = ay*ay*ay; |
---|
121 | t1=a1*(sin(ay)-ay*cos(ay)); |
---|
122 | t2=b1*(2.*ay*sin(ay)-(ay2-2.)*cos(ay)-2.)/ay; |
---|
123 | t3=gm1*((4.*ay*ay2-24.*ay)*sin(ay)-(ay2*ay2-12.*ay2+24.)*cos(ay)+24.)/ay3; |
---|
124 | f11=24.*v1*(t1+t2+t3)/ay3; |
---|
125 | |
---|
126 | //c ------c22 |
---|
127 | y2=yy*yy; |
---|
128 | y3=yy*y2; |
---|
129 | tt1=a2*(sin(yy)-yy*cos(yy)); |
---|
130 | tt2=b2*(2.*yy*sin(yy)-(y2-2.)*cos(yy)-2.)/yy; |
---|
131 | tt3=gm1*((4.*y3-24.*yy)*sin(yy)-(y2*y2-12.*y2+24.)*cos(yy)+24.)/ay3; |
---|
132 | f22=24.*v2*(tt1+tt2+tt3)/y3; |
---|
133 | |
---|
134 | //c -----c12 |
---|
135 | yl=.5*yy*(1.-aa); |
---|
136 | yl3=yl*yl*yl; |
---|
137 | wma3 = (1.-aa)*(1.-aa)*(1.-aa); |
---|
138 | y1=aa*yy; |
---|
139 | y13 = y1*y1*y1; |
---|
140 | ttt1=3.*wma3*v*sqrt(nf2)*sqrt(1.-nf2)*a1*(sin(yl)-yl*cos(yl))/((nf2+(1.-nf2)*a3)*yl3); |
---|
141 | t21=b12*(2.*y1*cos(y1)+(y1*y1-2.)*sin(y1)); |
---|
142 | t22=gm12*((3.*y1*y1-6.)*cos(y1)+(y1*y1*y1-6.*y1)*sin(y1)+6.)/y1; |
---|
143 | t23=gm1*((4.*y13-24.*y1)*cos(y1)+(y13*y1-12.*y1*y1+24.)*sin(y1))/(y1*y1); |
---|
144 | t31=b12*(2.*y1*sin(y1)-(y1*y1-2.)*cos(y1)-2.); |
---|
145 | t32=gm12*((3.*y1*y1-6.)*sin(y1)-(y1*y1*y1-6.*y1)*cos(y1))/y1; |
---|
146 | t33=gm1*((4.*y13-24.*y1)*sin(y1)-(y13*y1-12.*y1*y1+24.)*cos(y1)+24.)/(y1*y1); |
---|
147 | t41=cos(yl)*((sin(y1)-y1*cos(y1))/(y1*y1) + (1.-aa)/(2.*aa)*(1.-cos(y1))/y1); |
---|
148 | t42=sin(yl)*((cos(y1)+y1*sin(y1)-1.)/(y1*y1) + (1.-aa)/(2.*aa)*sin(y1)/y1); |
---|
149 | ttt2=sin(yl)*(t21+t22+t23)/(y13*y1); |
---|
150 | ttt3=cos(yl)*(t31+t32+t33)/(y13*y1); |
---|
151 | ttt4=a1*(t41+t42)/y1; |
---|
152 | f12=ttt1+24.*v*sqrt(nf2)*sqrt(1.-nf2)*a3*(ttt2+ttt3+ttt4)/(nf2+(1.-nf2)*a3); |
---|
153 | |
---|
154 | c11=f11; |
---|
155 | c22=f22; |
---|
156 | c12=f12; |
---|
157 | *s11=1./(1.+c11-(c12)*c12/(1.+c22)); |
---|
158 | *s22=1./(1.+c22-(c12)*c12/(1.+c11)); |
---|
159 | *s12=-c12/((1.+c11)*(1.+c22)-(c12)*(c12)); |
---|
160 | |
---|
161 | return; |
---|
162 | } |
---|
163 | |
---|