Changeset 496b252 in sasmodels
- Timestamp:
- Jul 11, 2014 3:09:57 PM (10 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 8a21ba3
- Parents:
- be5d7df
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Kernel-CoreShellCylinder.cpp
r2de9a5e r496b252 1 __kernel void CoreShellCylinderKernel(__global const float *qx, __global const float *qy, __global float*_ptvalue,2 const float axis_theta, const float axis_phi, const float thickness, const float length, const floatradius,3 const float scale, const float radius_weight, const float length_weight, const floatthickness_weight,4 const float theta_weight, const float phi_weight, const float core_sld, const float shell_sld, const floatsolvent_sld,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 5 const int size, const int total) 6 6 { … … 8 8 if(i < total) 9 9 { 10 floatq = sqrt(qx[i]*qx[i]+qy[i]*qy[i]);11 floatpi = 4.0*atan(1.0);12 floattheta = axis_theta*pi/180.0;13 floatcyl_x = cos(theta)*cos(axis_phi*pi/180.0);14 floatcyl_y = sin(theta);15 float alpha = acos(cyl_x*qx[i]/q + cyl_y*qx[i]/q);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 cyl_x = cos(theta)*cos(axis_phi*pi/180.0); 14 real cyl_y = sin(theta); 15 real alpha = acos(cyl_x*qx[i]/q + cyl_y*qy[i]/q); 16 16 17 17 if (alpha == 0.0){ … … 19 19 } 20 20 21 float si1=0; float si2=0; float be1=0; floatbe2=0;21 real si1=0; real si2=0; real be1=0; real be2=0; 22 22 23 floatvol2 = pi*(radius+thickness)*(radius+thickness)*(length+2.0*thickness);23 real vol2 = pi*(radius+thickness)*(radius+thickness)*(length+2.0*thickness); 24 24 25 floatbesarg1 = q*radius*sin(alpha);26 floatbesarg2 = q*(radius+thickness)*sin(alpha);27 floatsinarg1 = q*length/2.0*cos(alpha);28 floatsinarg2 = q*(length/2.0+thickness)*cos(alpha);25 real besarg1 = q*radius*sin(alpha); 26 real besarg2 = q*(radius+thickness)*sin(alpha); 27 real sinarg1 = q*length/2.0*cos(alpha); 28 real sinarg2 = q*(length/2.0+thickness)*cos(alpha); 29 29 30 30 … … 49 49 si2 = sin(sinarg2)/sinarg2; 50 50 } 51 floattt = 2.0*vol2*(shell_sld-solvent_sld)*si2*be2 + 2.0*(pi*radius*radius*(length))*(core_sld-shell_sld)*si1*be1;51 real tt = 2.0*vol2*(shell_sld-solvent_sld)*si2*be2 + 2.0*(pi*radius*radius*(length))*(core_sld-shell_sld)*si1*be1; 52 52 53 floatanswer = (tt*tt)*sin(alpha)/fabs(sin(alpha));54 floatvol=pi*(radius+thickness)*(radius+thickness)*(length+2.0*thickness);53 real answer = (tt*tt)*sin(alpha)/fabs(sin(alpha)); 54 real vol=pi*(radius+thickness)*(radius+thickness)*(length+2.0*thickness); 55 55 answer = answer/vol*1.0e8*scale; 56 56 -
Kernel-Lamellar.cpp
r2de9a5e r496b252 7 7 { 8 8 real q = sqrt(qx[i]*qx[i]+qy[i]*qy[i]); 9 real pi = 4.0*atan(1.0); 10 real Pq = 2.0*sub*(sub/q)/q*(1.0-cos(q*bi_thick)); 11 ret[i] = 2.0*pi*scale*Pq/(q*q)/bi_thick*1.0e8 ; 9 ret[i] = 2.0*4.0*atan(1.0)*scale*2.0*sub*(sub/q)/q*(1.0-cos(q*bi_thick))/(q*q)/bi_thick*1.0e8 ; 12 10 } 13 11 } -
code_coreshellcyl.py
r2de9a5e r496b252 57 57 size = len(axis_theta.weight) 58 58 59 real = np.float32 if self.qx.dtype == np.dtype('float32') else np.float64 59 60 for i in xrange(len(radius.weight)): 60 61 for j in xrange(len(length.weight)): … … 64 65 65 66 self.prg.CoreShellCylinderKernel(queue, self.qx.shape, None, self.qx_b, self.qy_b, self.res_b, 66 np.float32(axis_theta.value[k]), np.float32(axis_phi.value[l]), np.float32(thickness.value[f]),67 np.float32(length.value[j]), np.float32(radius.value[i]), np.float32(pars['scale']),68 np.float32(radius.weight[i]), np.float32(length.weight[j]), np.float32(thickness.weight[f]),69 np.float32(axis_theta.weight[k]), np.float32(axis_phi.weight[l]), np.float32(pars['core_sld']),70 np.float32(pars['shell_sld']), np.float32(pars['solvent_sld']),np.uint32(size),67 real(axis_theta.value[k]), real(axis_phi.value[l]), real(thickness.value[f]), 68 real(length.value[j]), real(radius.value[i]), real(pars['scale']), 69 real(radius.weight[i]), real(length.weight[j]), real(thickness.weight[f]), 70 real(axis_theta.weight[k]), real(axis_phi.weight[l]), real(pars['core_sld']), 71 real(pars['shell_sld']), real(pars['solvent_sld']),np.uint32(size), 71 72 np.uint32(self.qx.size)) 72 73 cl.enqueue_copy(queue, self.res, self.res_b) -
code_triaxialellipse.py
rbe5d7df r496b252 58 58 size = len(theta.weight) 59 59 sub = pars['sldEll'] - pars['sldSolv'] 60 60 61 real = np.float32 if self.qx.dtype == np.dtype('float32') else np.float64 61 62 62 for a in xrange(len(axisA.weight)): 63 63 for b in xrange(len(axisB.weight)): -
fit.py
r2de9a5e r496b252 18 18 cyl_theta=0, cyl_phi=0, radius_pd=0.1, radius_pd_n=10, radius_pd_nsigma=3,length_pd=0.1, 19 19 length_pd_n=5, length_pd_nsigma=3, cyl_theta_pd=0.1, cyl_theta_pd_n=5, cyl_theta_pd_nsigma=3, 20 cyl_phi_pd=0.1, cyl_phi_pd_n=10, cyl_phi_pd_nsigma=3, dtype='float 32')20 cyl_phi_pd=0.1, cyl_phi_pd_n=10, cyl_phi_pd_nsigma=3, dtype='float') 21 21 model.radius.range(0,100) 22 22 model.length.range(0, 1000) 23 23 model.cyl_theta.range(0,90) 24 24 model.cyl_phi.range(0,90) 25 """ 25 26 27 """ 26 28 model = SasModel(data, GpuEllipse, scale=.027, radius_a=60, radius_b=180, sldEll=.297e-6, sldSolv=5.773e-6, background=4.9, 27 29 axis_theta=0, axis_phi=90, radius_a_pd=0.1, radius_a_pd_n=10, radius_a_pd_nsigma=3, radius_b_pd=0.1, radius_b_pd_n=10, 28 30 radius_b_pd_nsigma=3, axis_theta_pd=0.1, axis_theta_pd_n=6, axis_theta_pd_nsigma=3, axis_phi_pd=0.1, 29 axis_phi_pd_n=6, axis_phi_pd_nsigma=3, dtype='float32') 31 axis_phi_pd_n=6, axis_phi_pd_nsigma=3, dtype='float') 32 """ 30 33 34 """ 31 35 model = SasModel(data, GpuLamellar, scale=1, bi_thick=100, sld_bi=.291e-6, sld_sol=5.77e-6, background=0, 32 bi_thick_pd=0.1, bi_thick_pd_n=35, bi_thick_pd_nsigma=3, dtype='float32') 36 bi_thick_pd=0.1, bi_thick_pd_n=35, bi_thick_pd_nsigma=3, dtype='float') 37 """ 33 38 34 39 … … 37 42 length_pd=0.1, length_pd_n=10, length_pd_nsigma=3, thickness_pd=0.1, thickness_pd_n=2, thickness_pd_nsigma=3, 38 43 axis_theta_pd=0.1, axis_theta_pd_n=2, axis_theta_pd_nsigma=3, axis_phi_pd=0.1, axis_phi_pd_n=2, 39 axis_phi_pd_nsigma=3, dtype='float 32')44 axis_phi_pd_nsigma=3, dtype='float') 40 45 46 47 48 """ 41 49 model = SasModel(data, GpuCapCylinder, scale=1, rad_cyl=20, rad_cap=40, length=400, sld_capcyl=1e-6, sld_solv=6.3e-6, 42 50 background=0, theta=0, phi=0, rad_cyl_pd=.1, rad_cyl_pd_n=10, rad_cyl_nsigma=3, rad_cap_pd=.1, rad_cap_pd_n=1, 43 51 rad_cap_pd_nsigma=3, length_pd=.1, length_pd_n=10, length_pd_nsigma=3, theta_pd=.1, theta_pd_n=4, 44 theta_pd_nsigma=3, phi_pd=.1, phi_pd_n=4, phi_pd_nsigma=3, dtype='float32') 52 theta_pd_nsigma=3, phi_pd=.1, phi_pd_n=4, phi_pd_nsigma=3, dtype='float') 53 """ 54 45 55 """ 46 56 model = SasModel(data, GpuTriEllipse, scale=1, axisA=35, axisB=100, axisC=400, sldEll=1e-6, sldSolv=6.3e-6, … … 49 59 axisA_pd=.1, axisA_pd_n=4, axisA_pd_nsigma=3, axisB_pd=.1, axisB_pd_n=4, axisB_pd_nsigma=3, 50 60 axisC_pd=.1, axisC_pd_n=4, axisC_pd_nsigma=3, dtype='float') 61 """ 62 51 63 52 64 model.scale.range(0,1)
Note: See TracChangeset
for help on using the changeset viewer.