source: sasmodels/Kernel-CoreShellCylinder.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: 2.0 KB
Line 
1__kernel void CoreShellCylinderKernel(__global const real *qx, __global const real *qy, __global real *_ptvalue,
2const real axis_theta, const real axis_phi, const real thickness, const real length, const real radius,
3const real scale, const real radius_weight, const real length_weight, const real thickness_weight,
4const real theta_weight, const real phi_weight, const real core_sld, const real shell_sld, const real solvent_sld,
5const 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
46        _ptvalue[i] = radius_weight*length_weight*thickness_weight*theta_weight*phi_weight*answer*pow(radius+thickness,2)*(length+2.0*thickness);
47     //   if (size>1) {
48       // _ptvalue[i] *= fabs(cos(axis_theta*pi/180.0));
49        //}
50
51    }
52}
53
54
55
Note: See TracBrowser for help on using the repository browser.