source: sasmodels/Kernel/Kernel-CapCyl.cpp @ 14de349

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 14de349 was a42fec0, checked in by HMP1 <helen.park@…>, 10 years ago

Speed-up of 3X, compare.py working

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[099e053]1__kernel void CapCylinderKernel(__global const real *qx, __global const real *qy, __global real *_ptvalue, const real vol_i,
2const real hDist, const real rad_cyl, const real rad_cap, const real length, const real thet, const real ph, const real sub,
3const real scale, const real phi_weight, const real theta_float, const real rad_cap_weight, const real rad_cyl_weight,
4const real length_weight, const real theta_weight, const int total, const int size)
5//ph is phi, sub is sldc-slds, thet is theta
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 = thet*pi/180.0;
13        real phi = ph*pi/180.0;
14        real cyl_x = cos(theta)*cos(phi);
15        real cyl_y = sin(theta);
16        real cos_val = cyl_x*qx[i]/q + cyl_y*qy[i]/q;
17        real alpha = acos(cos_val);
18        real ans1=0; real ans2=0; real y=0; real xx=0; real ans=0; real zij=0; real be=0; real summj=0;
19        real vaj = -1.0*hDist/rad_cap;
20
21        for(int j=0;j<76;j++) //the 76 corresponds to the Gauss constants
22        {
23            zij = (Gauss76Z(j)*(1.0-vaj)+vaj+1.0)/2.0;
24            summj += Gauss76Wt(j)*ConvLens_kernel(length,rad_cyl,rad_cap,q,zij,alpha);
25        }
26        real yyy = (1.0-vaj)/2.0*summj*4.0*pi*rad_cap*rad_cap*rad_cap;
27        real arg1 = q*length/2.0*cos(alpha);
28        real arg2 = q*rad_cyl*sin(alpha);
29
30        if(arg2 == 0) {be = 0.5;}
31        else {
32            be = NR_BessJ1(arg2)/arg2;
33        }
34
35        if(arg1 == 0.0) {
36            yyy += pi*rad_cyl*rad_cyl*length*2.0*be;
37        } 
38        else {
39            yyy += pi*rad_cyl*rad_cyl*length*sin(arg1)/arg1*2.0*be;
40        }
41        real answer=yyy*yyy*1.0e8*sub*sub*scale/pi*rad_cyl*rad_cyl*length+2.0*pi*(2.0*rad_cap*rad_cap*rad_cap/3.0+rad_cap*rad_cap*hDist-hDist*hDist*hDist/3.0);
42        answer/=sin(alpha);
43
[a42fec0]44        _ptvalue[i] += rad_cyl_weight*length_weight*rad_cap_weight*theta_weight*phi_weight*vol_i*answer;
[099e053]45     //   if (size>1) {
46   //         _ptvalue[i] *= fabs(cos(thet*pi/180.0));
47     //   }
48    }
49}
Note: See TracBrowser for help on using the repository browser.