[496b252] | 1 | __kernel void CoreShellCylinderKernel(__global const real *qx, __global const real *qy, __global real *_ptvalue, |
---|
| 2 | const real axis_theta, const real axis_phi, const real thickness, const real length, const real radius, |
---|
| 3 | const real scale, const real radius_weight, const real length_weight, const real thickness_weight, |
---|
| 4 | const real theta_weight, const real phi_weight, const real core_sld, const real shell_sld, const real solvent_sld, |
---|
[5378e40] | 5 | const int size, const int total) |
---|
| 6 | { |
---|
| 7 | int i = get_global_id(0); |
---|
| 8 | if(i < total) |
---|
| 9 | { |
---|
[496b252] | 10 | real q = sqrt(qx[i]*qx[i]+qy[i]*qy[i]); |
---|
| 11 | real pi = 4.0*atan(1.0); |
---|
| 12 | real theta = axis_theta*pi/180.0; |
---|
| 13 | real cyl_x = cos(theta)*cos(axis_phi*pi/180.0); |
---|
| 14 | real cyl_y = sin(theta); |
---|
| 15 | real alpha = acos(cyl_x*qx[i]/q + cyl_y*qy[i]/q); |
---|
[5378e40] | 16 | |
---|
| 17 | if (alpha == 0.0){ |
---|
| 18 | alpha = 1.0e-26; |
---|
| 19 | } |
---|
| 20 | |
---|
[496b252] | 21 | real si1=0; real si2=0; real be1=0; real be2=0; |
---|
[5378e40] | 22 | |
---|
[496b252] | 23 | real vol2 = pi*(radius+thickness)*(radius+thickness)*(length+2.0*thickness); |
---|
[5378e40] | 24 | |
---|
[496b252] | 25 | real besarg1 = q*radius*sin(alpha); |
---|
| 26 | real besarg2 = q*(radius+thickness)*sin(alpha); |
---|
| 27 | real sinarg1 = q*length/2.0*cos(alpha); |
---|
| 28 | real sinarg2 = q*(length/2.0+thickness)*cos(alpha); |
---|
[5378e40] | 29 | |
---|
| 30 | |
---|
| 31 | if (besarg1 == 0.0){be1 = 0.5;} |
---|
| 32 | else{ |
---|
[8faffcd] | 33 | be1 = NR_BessJ1(besarg1)/besarg1; |
---|
[5378e40] | 34 | } |
---|
| 35 | if (besarg2 == 0.0){be2 = 0.5;} |
---|
| 36 | else{ |
---|
[8faffcd] | 37 | be2 = NR_BessJ1(besarg2)/besarg2; |
---|
[5378e40] | 38 | } |
---|
| 39 | if (sinarg1 == 0.0){ |
---|
| 40 | si1 = 1.0; |
---|
| 41 | } |
---|
| 42 | else{ |
---|
| 43 | si1 = sin(sinarg1)/sinarg1; |
---|
| 44 | } |
---|
| 45 | if (sinarg2 == 0.0){ |
---|
| 46 | si2 = 1.0; |
---|
| 47 | } |
---|
| 48 | else{ |
---|
| 49 | si2 = sin(sinarg2)/sinarg2; |
---|
| 50 | } |
---|
[496b252] | 51 | real tt = 2.0*vol2*(shell_sld-solvent_sld)*si2*be2 + 2.0*(pi*radius*radius*(length))*(core_sld-shell_sld)*si1*be1; |
---|
[5378e40] | 52 | |
---|
[496b252] | 53 | real answer = (tt*tt)*sin(alpha)/fabs(sin(alpha)); |
---|
| 54 | real vol=pi*(radius+thickness)*(radius+thickness)*(length+2.0*thickness); |
---|
[5378e40] | 55 | answer = answer/vol*1.0e8*scale; |
---|
| 56 | |
---|
| 57 | _ptvalue[i] = radius_weight*length_weight*thickness_weight*theta_weight*phi_weight*answer; |
---|
| 58 | _ptvalue[i] *= pow(radius+thickness,2)*(length+2.0*thickness); |
---|
| 59 | |
---|
| 60 | if (size>1) { |
---|
| 61 | _ptvalue[i] *= fabs(cos(axis_theta*pi/180.0)); |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | } |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | |
---|