source: sasmodels/Kernel-TriaxialEllipse.cpp @ 2de9a5e

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

Update for Aaron

  • Property mode set to 100644
File size: 1.7 KB
Line 
1__kernel void TriaxialEllipseKernel(__global const real *qx, __global const real *qy, __global real *_ptvalue,
2const real sub, const real scale, const real axisA, const real axisB, const real axisC, const real axis_phi,
3const real axis_theta, const real axis_psi, const real axisA_weight, const real axisB_weight, const real axisC_weight,
4const real psi_weight, const real phi_weight, const real theta_weight, const int total, const int size)
5{
6    int i = get_global_id(0);
7    if(i < total)
8    {
9        real q = sqrt(qx[i]*qx[i]+qy[i]*qy[i]);
10        real q_x = qx[i]/q;
11        real q_y = qy[i]/q;
12        real pi = 4.0*atan(1.0);
13       
14        //convert angle degree to radian
15        real theta = axis_theta*pi/180.0;
16        real phi = axis_phi*pi/180.0;
17        real psi = axis_psi*pi/180.0;
18        real cos_val = cos(theta)*cos(phi)*q_x + sin(theta)*q_y;
19       
20        // calculate the axis of the ellipse wrt q-coord.
21        real cos_nu = (-cos(phi)*sin(psi)*sin(theta)+sin(phi)*cos(psi))*q_x + sin(psi)*cos(theta)*q_y;
22        real cos_mu = (-sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi))*q_x + cos(theta)*cos(psi)*q_y;
23
24        real answer=0;
25        real t = q*sqrt(axisA*axisA*cos_nu*cos_nu+axisB*axisB*cos_mu*cos_mu+axisC*axisC*cos_val*cos_val);
26
27        if (t==0.0){
28            answer = 1.0;
29        }
30        else{
31            answer  = 3.0*(sin(t)-t*cos(t))/(t*t*t);
32        }
33        answer*=answer*sub*sub*4.0*pi/3.0*axisA*axisB*axisC*1.0e8*scale;
34
35        _ptvalue[i] = axisA_weight*axisB_weight*axisC_weight*theta_weight*phi_weight*psi_weight*answer*axisA*axisB*axisC;
36        if (size>1)
37        {
38            _ptvalue[i] *= fabs(cos(theta*pi/180.0));
39        }
40    }
41}
42
43
44
45
Note: See TracBrowser for help on using the repository browser.