source: sasmodels/Kernel-Ellipse.cpp @ 79fcc40

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

Attempt at faster kernel for TEST,
updated fit.py,
errors in the kernels fixed

  • Property mode set to 100644
File size: 1.2 KB
Line 
1__kernel void EllipsoidKernel(const real radius_a_weight, const real radius_b_weight, const real axis_theta_weight,
2const real axis_phi_weight, const real scale, const real radius_a, const real radius_b, const real sub, const real axis_theta, const real axis_phi, __global const real *qx,
3__global const real *qy, __global real *_ptvalue, const int length, const int size)
4{
5     int i = get_global_id(0);
6     if(i < length){
7         real ret = 0;
8         real q = sqrt(qx[i]*qx[i] + qy[i]*qy[i]);
9         real pi = 4.0*atan(1.0);
10         real theta = axis_theta*pi/180.0;
11         real cos_val = cos(theta)*cos(axis_phi*pi/180.0)*(qx[i]/q) + sin(theta)*(qy[i]/q);
12
13         real arg = q*radius_b*sqrt(1.0+(cos_val*cos_val*(((radius_a*radius_a/(radius_b*radius_b))-1.0))));
14         if(arg == 0.0){
15             ret = 1.0/3.0;
16         }
17         else{
18             ret = (sin(arg)-arg*cos(arg))/(arg*arg*arg);
19         }
20         ret*=ret*9.0*sub*sub*4.0/3.0*acos(-1.0)*radius_b*radius_b*radius_a*scale*(1.0e8);
21
22         _ptvalue[i] = radius_a_weight*radius_b_weight*axis_theta_weight*radius_a*axis_phi_weight*ret*pow(radius_b, 2);
23         //if(size > 1){
24          //  _ptvalue[i] *= fabs(cos(axis_theta*pi/180.0));
25         //}
26     }
27}
Note: See TracBrowser for help on using the repository browser.