[099e053] | 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, |
---|
| 5 | const int size, const int total) |
---|
| 6 | { |
---|
| 7 | int i = get_global_id(0); |
---|
| 8 | if(i < total) |
---|
| 9 | { |
---|
| 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 alpha = acos(cos(theta)*cos(axis_phi*pi/180.0)*qx[i]/q + sin(theta)*qy[i]/q); |
---|
| 14 | |
---|
| 15 | if (alpha == 0.0){ |
---|
| 16 | alpha = 1.0e-26; |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | real si1=0; real si2=0; real be1=0; real be2=0; |
---|
| 20 | |
---|
| 21 | real vol2 = pi*(radius+thickness)*(radius+thickness)*(length+2.0*thickness); |
---|
| 22 | |
---|
| 23 | real besarg1 = q*radius*sin(alpha); |
---|
| 24 | real besarg2 = q*(radius+thickness)*sin(alpha); |
---|
| 25 | real sinarg1 = q*length/2.0*cos(alpha); |
---|
| 26 | real sinarg2 = q*(length/2.0+thickness)*cos(alpha); |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | if (besarg1 == 0.0){be1 = 0.5;} |
---|
| 30 | else{be1 = NR_BessJ1(besarg1)/besarg1;} |
---|
| 31 | |
---|
| 32 | if (besarg2 == 0.0){be2 = 0.5;} |
---|
| 33 | else{be2 = NR_BessJ1(besarg2)/besarg2;} |
---|
| 34 | |
---|
| 35 | if (sinarg1 == 0.0){si1 = 1.0;} |
---|
| 36 | else{si1 = sin(sinarg1)/sinarg1;} |
---|
| 37 | |
---|
| 38 | if (sinarg2 == 0.0){si2 = 1.0;} |
---|
| 39 | else{si2 = sin(sinarg2)/sinarg2;} |
---|
| 40 | |
---|
| 41 | real tt = 2.0*vol2*(shell_sld-solvent_sld)*si2*be2+2.0*(pi*radius*radius*(length))*(core_sld-shell_sld)*si1*be1; |
---|
| 42 | |
---|
| 43 | real answer = (tt*tt)*sin(alpha)/fabs(sin(alpha)); |
---|
| 44 | answer *= answer/(pi*(radius+thickness)*(radius+thickness)*(length+2.0*thickness))*1.0e8*scale; |
---|
| 45 | |
---|
[a42fec0] | 46 | _ptvalue[i] += radius_weight*length_weight*thickness_weight*theta_weight*phi_weight*answer*pow(radius+thickness,2)*(length+2.0*thickness); |
---|
[099e053] | 47 | // if (size>1) { |
---|
| 48 | // _ptvalue[i] *= fabs(cos(axis_theta*pi/180.0)); |
---|
| 49 | //} |
---|
| 50 | |
---|
| 51 | } |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | |
---|