Changeset 0164899a in sasview for sansmodels/src/sans/models
- Timestamp:
- Nov 1, 2010 4:22:12 PM (14 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 4b3d25b
- Parents:
- 6cda91f
- Location:
- sansmodels/src/sans/models
- Files:
-
- 9 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_extensions/onion.c
r339ce67 r0164899a 1 1 /** 2 * Scattering model for a sphere2 * Scattering model for a onion 3 3 */ 4 4 … … 7 7 #include <stdio.h> 8 8 #include <stdlib.h> 9 9 // some details can be found in sld_cal.c 10 10 double so_kernel(double dp[], double q) { 11 11 int n = dp[0]; … … 107 107 108 108 vol = 4.0 * pi / 3.0 * r * r * r; 109 if (j == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && A[i]==0.0){110 vol_sub += (vol_pre - vol);111 }109 //if (j == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && A[i]==0.0){ 110 // vol_sub += (vol_pre - vol); 111 //} 112 112 f += vol * (contr * (fun) + (sld_in[i]-slope[i]) * bes); 113 113 } … … 148 148 } 149 149 vol = 4.0 * pi / 3.0 * r * r * r; 150 if (j == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && fun_type[i]==0){151 vol_sub += (vol_pre - vol);152 }150 //if (j == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && fun_type[i]==0){ 151 // vol_sub += (vol_pre - vol); 152 //} 153 153 f += vol * (bes * contr + fun * slope[i]); 154 154 } … … 157 157 158 158 } 159 vol += vol_sub;159 //vol += vol_sub; 160 160 f2 = f * f / vol * 1.0e8; 161 161 f2 *= scale; -
sansmodels/src/sans/models/c_extensions/refl.c
r339ce67 r0164899a 1 1 /** 2 * Scattering model for a sphere2 * model for NR 3 3 */ 4 4 // The original code, of which work was not DANSE funded, 5 // was provided by J. Cho. 5 6 #include <math.h> 6 7 #include "refl.h" 8 #include "libmultifunc/librefl.h" 7 9 #include <stdio.h> 8 10 #include <stdlib.h> … … 10 12 #define lamda 4.62 11 13 12 typedef struct {13 double re;14 double im;15 } complex;16 17 typedef struct {18 complex a;19 complex b;20 complex c;21 complex d;22 } matrix;23 24 complex cassign(real, imag)25 double real, imag;26 {27 complex x;28 x.re = real;29 x.im = imag;30 return x;31 }32 33 34 complex cadd(x,y)35 complex x,y;36 {37 complex z;38 z.re = x.re + y.re;39 z.im = x.im + y.im;40 return z;41 }42 43 complex rcmult(x,y)44 double x;45 complex y;46 {47 complex z;48 z.re = x*y.re;49 z.im = x*y.im;50 return z;51 }52 53 complex csub(x,y)54 complex x,y;55 {56 complex z;57 z.re = x.re - y.re;58 z.im = x.im - y.im;59 return z;60 }61 62 63 complex cmult(x,y)64 complex x,y;65 {66 complex z;67 z.re = x.re*y.re - x.im*y.im;68 z.im = x.re*y.im + x.im*y.re;69 return z;70 }71 72 complex cdiv(x,y)73 complex x,y;74 {75 complex z;76 z.re = (x.re*y.re + x.im*y.im)/(y.re*y.re + y.im*y.im);77 z.im = (x.im*y.re - x.re*y.im)/(y.re*y.re + y.im*y.im);78 return z;79 }80 81 complex cexp(b)82 complex b;83 {84 complex z;85 double br,bi;86 br=b.re;87 bi=b.im;88 z.re = exp(br)*cos(bi);89 z.im = exp(br)*sin(bi);90 return z;91 }92 93 94 complex csqrt(z) /* see Schaum`s Math Handbook p. 22, 6.6 and 6.10 */95 complex z;96 {97 complex c;98 double zr,zi,x,y,r,w;99 100 zr=z.re;101 zi=z.im;102 103 if (zr==0.0 && zi==0.0)104 {105 c.re=0.0;106 c.im=0.0;107 return c;108 }109 else110 {111 x=fabs(zr);112 y=fabs(zi);113 if (x>y)114 {115 r=y/x;116 w=sqrt(x)*sqrt(0.5*(1.0+sqrt(1.0+r*r)));117 }118 else119 {120 r=x/y;121 w=sqrt(y)*sqrt(0.5*(r+sqrt(1.0+r*r)));122 }123 if (zr >=0.0)124 {125 c.re=w;126 c.im=zi/(2.0*w);127 }128 else129 {130 c.im=(zi >= 0) ? w : -w;131 c.re=zi/(2.0*c.im);132 }133 return c;134 }135 }136 137 complex ccos(b)138 complex b;139 {140 complex neg,negb,zero,two,z,i,bi,negbi;141 zero = cassign(0.0,0.0);142 two = cassign(2.0,0.0);143 i = cassign(0.0,1.0);144 bi = cmult(b,i);145 negbi = csub(zero,bi);146 z = cdiv(cadd(cexp(bi),cexp(negbi)),two);147 return z;148 }149 150 double errfunc(n_sub, i)151 double n_sub;152 int i;153 {154 double bin_size, ind, func;155 ind = i;156 // i range = [ -4..4], x range = [ -2.5..2.5]157 bin_size = n_sub/2.0/2.5; //size of each sub-layer158 // rescale erf so that 0 < erf < 1 in -2.5 <= x <= 2.5159 func = (erf(ind/bin_size)/2.0+0.5);160 return func;161 }162 163 double linefunc(n_sub, i)164 double n_sub;165 int i;166 {167 double bin_size, ind, func;168 ind = i + 0.5;169 // i range = [ -4..4], x range = [ -2.5..2.5]170 bin_size = 1.0/n_sub; //size of each sub-layer171 // rescale erf so that 0 < erf < 1 in -2.5 <= x <= 2.5172 func = ((ind + floor(n_sub/2.0))*bin_size);173 return func;174 }175 176 double parabolic_r(n_sub, i)177 double n_sub;178 int i;179 {180 double bin_size, ind, func;181 ind = i + 0.5;182 // i range = [ -4..4], x range = [ 0..1]183 bin_size = 1.0/n_sub; //size of each sub-layer; n_sub = 0 is a singular point (error)184 func = ((ind + floor(n_sub/2.0))*bin_size)*((ind + floor(n_sub/2.0))*bin_size);185 return func;186 }187 188 double parabolic_l(n_sub, i)189 double n_sub;190 int i;191 {192 double bin_size,ind, func;193 ind = i + 0.5;194 bin_size = 1.0/n_sub; //size of each sub-layer; n_sub = 0 is a singular point (error)195 func =1.0-(((ind + floor(n_sub/2.0))*bin_size) - 1.0) *(((ind + floor(n_sub/2.0))*bin_size) - 1.0);196 return func;197 }198 199 double cubic_r(n_sub, i)200 double n_sub;201 int i;202 {203 double bin_size,ind, func;204 ind = i + 0.5;205 // i range = [ -4..4], x range = [ 0..1]206 bin_size = 1.0/n_sub; //size of each sub-layer; n_sub = 0 is a singular point (error)207 func = ((ind+ floor(n_sub/2.0))*bin_size)*((ind + floor(n_sub/2.0))*bin_size)*((ind + floor(n_sub/2.0))*bin_size);208 return func;209 }210 211 double cubic_l(n_sub, i)212 double n_sub;213 int i;214 {215 double bin_size,ind, func;216 ind = i + 0.5;217 bin_size = 1.0/n_sub; //size of each sub-layer; n_sub = 0 is a singular point (error)218 func = 1.0+(((ind + floor(n_sub/2.0)))*bin_size - 1.0)*(((ind + floor(n_sub/2.0)))*bin_size - 1.0)*(((ind + floor(n_sub/2.0)))*bin_size - 1.0);219 return func;220 }221 222 double interfunc(fun_type, n_sub, i, sld_l, sld_r)223 double n_sub, sld_l, sld_r;224 int fun_type, i;225 {226 double sld_i, func;227 switch(fun_type){228 case 1 :229 func = linefunc(n_sub, i);230 break;231 case 2 :232 func = parabolic_r(n_sub, i);233 break;234 case 3 :235 func = parabolic_l(n_sub, i);236 break;237 case 4 :238 func = cubic_r(n_sub, i);239 break;240 case 5 :241 func = cubic_l(n_sub, i);242 break;243 default:244 func = errfunc(n_sub, i);245 break;246 }247 if (sld_r>sld_l){248 sld_i = (sld_r-sld_l)*func+sld_l; //sld_cal(sld[i],sld[i+1],n_sub,dz,thick);249 }250 else if (sld_r<sld_l){251 func = 1.0-func;252 sld_i = (sld_l-sld_r)*func+sld_r; //sld_cal(sld[i],sld[i+1],n_sub,dz,thick);253 }254 else{255 sld_i = sld_r;256 }257 return sld_i;258 }259 14 260 15 double re_kernel(double dp[], double q) { … … 268 23 double background = dp[6]; 269 24 270 double sld[n+2], sld_im[n+2],thick_inter[n+2],thick[n+2],total_thick;25 double sld[n+2],thick_inter[n+2],thick[n+2],total_thick; 271 26 fun_type[0] = dp[3]; 272 27 for (i =1; i<=n; i++){ … … 275 30 thick[i] = dp[i+26]; 276 31 fun_type[i] = dp[i+36]; 277 sld_im[i] = dp[i+46];278 279 32 total_thick += thick[i] + thick_inter[i]; 280 33 } 281 34 sld[0] = sld_sub; 282 35 sld[n+1] = sld_super; 283 sld_im[0] = fabs(dp[0+56]); 284 sld_im[n+1] = fabs(dp[1+56]); 36 285 37 thick[0] = total_thick/5.0; 286 38 thick[n+1] = total_thick/5.0; … … 288 40 thick_inter[n+1] = 0.0; 289 41 290 double nsl=21.0; //nsl = Num_sub_layer: MUST ODD number in double //no other number works now291 int n_s , floor_nsl;42 double nsl=21.0; //nsl = Num_sub_layer: 43 int n_s; 292 44 double sld_i,sldim_i,dz,phi,R,ko2; 293 double sign,erfunc ;45 double sign,erfunc, fun; 294 46 double pi; 295 47 complex inv_n,phi1,alpha,alpha2,kn,fnm,fnp,rn,Xn,nn,nn2,an,nnp1,one,zero,two,n_sub,n_sup,knp1,Xnp1; … … 299 51 two= cassign(0.0,-2.0); 300 52 301 floor_nsl = floor(nsl/2.0);302 303 53 //Checking if floor is available. 304 54 //no imaginary sld inputs in this function yet 305 n_sub=cassign(1.0-sld_sub*pow(lamda,2.0)/(2.0*pi), pow(lamda,2.0)/(2.0*pi)*sld_im[0]);306 n_sup=cassign(1.0-sld_super*pow(lamda,2.0)/(2.0*pi), pow(lamda,2.0)/(2.0*pi)*sld_im[n+1]);55 n_sub=cassign(1.0-sld_sub*pow(lamda,2.0)/(2.0*pi),0.0); 56 n_sup=cassign(1.0-sld_super*pow(lamda,2.0)/(2.0*pi),0.0); 307 57 ko2 = pow(2.0*pi/lamda,2.0); 308 58 … … 318 68 // iteration for # of layers +sub from the top 319 69 for (i=1;i<=n+1; i++){ 70 if (fun_type[i-1]==1) 71 fun = 5; 72 else 73 fun = 0; 320 74 //iteration for 9 sub-layers 321 75 for (j=0;j<2;j++){ 322 for (n_s= -floor_nsl;n_s<=floor_nsl; n_s++){76 for (n_s=0;n_s<nsl; n_s++){ 323 77 if (j==1){ 324 78 if (i==n+1) … … 326 80 dz = thick[i]; 327 81 sld_i = sld[i]; 328 sldim_i = sld_im[i];329 82 } 330 83 else{ 331 dz = thick_inter[i-1]/nsl; 84 dz = thick_inter[i-1]/nsl;//nsl; 332 85 if (sld[i-1] == sld[i]){ 333 86 sld_i = sld[i]; 334 87 } 335 88 else{ 336 sld_i = interfunc(fun_type[i-1],nsl, n_s, sld[i-1], sld[i]); 337 } 338 if (sld_im[i-1] == sld_im[i]){ 339 sldim_i = sld_im[i]; 340 } 341 else{ 342 sldim_i = interfunc(fun_type[i-1],nsl, n_s, sld_im[i-1], sld_im[i]); 89 sld_i = intersldfunc(fun,nsl, n_s+0.5, 2.5, sld[i-1], sld[i]); 343 90 } 344 91 } 345 nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi), pow(lamda,2.0)/(2.0*pi)*sldim_i);92 nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi),0.0); 346 93 nn2=cmult(nn,nn); 347 94 … … 375 122 } 376 123 /** 377 * Function to evaluate 1D scatteringfunction378 * @param pars: parameters of the sphere124 * Function to evaluate NR function 125 * @param pars: parameters 379 126 * @param q: q-value 380 127 * @return: function value 381 128 */ 382 129 double refl_analytical_1D(ReflParameters *pars, double q) { 383 double dp[ 59];130 double dp[47]; 384 131 385 132 dp[0] = pars->n_layers; … … 387 134 dp[2] = pars->thick_inter0; 388 135 dp[3] = pars->func_inter0; 389 dp[4] = pars->sld_ sub0;136 dp[4] = pars->sld_bottom0; 390 137 dp[5] = pars->sld_medium; 391 138 dp[6] = pars->background; … … 435 182 dp[46] = pars->func_inter10; 436 183 437 dp[47] = pars->sldIM_flat1;438 dp[48] = pars->sldIM_flat2;439 dp[49] = pars->sldIM_flat3;440 dp[50] = pars->sldIM_flat4;441 dp[51] = pars->sldIM_flat5;442 dp[52] = pars->sldIM_flat6;443 dp[53] = pars->sldIM_flat7;444 dp[54] = pars->sldIM_flat8;445 dp[55] = pars->sldIM_flat9;446 dp[56] = pars->sldIM_flat10;447 448 dp[57] = pars->sldIM_sub0;449 dp[58] = pars->sldIM_medium;450 451 184 return re_kernel(dp, q); 452 185 } 453 186 454 187 /** 455 * Function to evaluate 2D scatteringfunction456 * @param pars: parameters of the sphere188 * Function to evaluate NR function 189 * @param pars: parameters of NR 457 190 * @param q: q-value 458 191 * @return: function value -
sansmodels/src/sans/models/c_extensions/refl.h
r339ce67 r0164899a 1 // The original code, of which work was not DANSE funded, 2 // was provided by J. Cho. 1 3 #if !defined(o_h) 2 4 #define refl_h … … 7 9 //[PYTHONCLASS] = ReflModel 8 10 //[DISP_PARAMS] = thick_inter0 9 //[DESCRIPTION] =<text>Form factor of mutishells normalized by the volume. Here each shell is described 10 // by an exponential function; 11 // I) 12 // For A_shell != 0, 13 // f(r) = B*exp(A_shell*(r-r_in)/thick_shell)+C 14 // where 15 // B=(sld_out-sld_in)/(exp(A_shell)-1) 16 // C=sld_in-B. 17 // Note that in the above case, 18 // the function becomes a linear function 19 // as A_shell --> 0+ or 0-. 20 // II) 21 // For the exact point of A_shell == 0, 22 // f(r) = sld_in ,i.e., it crosses over flat function 23 // Note that the 'sld_out' becaomes NULL in this case. 24 // 25 // background:background, 26 // rad_core: radius of sphere(core) 27 // thick_shell#:the thickness of the shell# 28 // sld_core: the SLD of the sphere 29 // sld_solv: the SLD of the solvent 30 // sld_shell: the SLD of the shell# 31 // A_shell#: the coefficient in the exponential function 11 //[DESCRIPTION] =<text>Calculate neutron reflectivity using the Parratt iterative formula 12 // Parameters: 13 // background:background 14 // scale: scale factor 15 // sld_bottom0: the SLD of the substrate 16 // sld_medium: the SLD of the incident medium 17 // or superstrate 18 // sld_flatN: the SLD of the flat region of 19 // the N'th layer 20 // thick_flatN: the thickness of the flat 21 // region of the N'th layer 22 // func_interN: the function used to describe 23 // the interface of the N'th layer 24 // thick_interN: the thickness of the interface 25 // of the N'th layer 26 // Note: the layer number starts to increase 27 // from the bottom (substrate) to the top. 32 28 // </text> 33 29 //[FIXED]= <text></text> … … 48 44 // [DEFAULT]=func_inter0= 0 49 45 double func_inter0; 50 /// sld_ sub0 [1/A^(2)]51 // [DEFAULT]=sld_ sub0= 2.07e-6 [1/A^(2)]52 double sld_ sub0;46 /// sld_bottom0 [1/A^(2)] 47 // [DEFAULT]=sld_bottom0= 2.07e-6 [1/A^(2)] 48 double sld_bottom0; 53 49 /// sld_medium [1/A^(2)] 54 50 // [DEFAULT]=sld_medium= 1.0e-6 [1/A^(2)] … … 142 138 double func_inter10; 143 139 144 // [DEFAULT]=sldIM_flat1=0145 double sldIM_flat1;146 // [DEFAULT]=sldIM_flat2=0147 double sldIM_flat2;148 // [DEFAULT]=sldIM_flat3=0149 double sldIM_flat3;150 // [DEFAULT]=sldIM_flat4=0151 double sldIM_flat4;152 // [DEFAULT]=sldIM_flat5=0153 double sldIM_flat5;154 // [DEFAULT]=sldIM_flat6=0155 double sldIM_flat6;156 // [DEFAULT]=sldIM_flat7=0157 double sldIM_flat7;158 // [DEFAULT]=sldIM_flat8=0159 double sldIM_flat8;160 // [DEFAULT]=sldIM_flat9=0161 double sldIM_flat9;162 // [DEFAULT]=sldIM_flat10=0163 double sldIM_flat10;164 // [DEFAULT]=sldIM_sub0=0165 double sldIM_sub0;166 // [DEFAULT]=sldIM_medium=0167 double sldIM_medium;168 140 169 141 } ReflParameters; -
sansmodels/src/sans/models/c_models/CReflModel.cpp
r339ce67 r0164899a 90 90 91 91 // Initialize parameter dictionary 92 PyDict_SetItemString(self->params,"sldIM_flat4",Py_BuildValue("d",0.000000000000));93 92 PyDict_SetItemString(self->params,"thick_flat8",Py_BuildValue("d",100.000000000000)); 94 93 PyDict_SetItemString(self->params,"thick_flat9",Py_BuildValue("d",100.000000000000)); 95 PyDict_SetItemString(self->params,"sldIM_flat7",Py_BuildValue("d",0.000000000000));96 PyDict_SetItemString(self->params,"sldIM_flat10",Py_BuildValue("d",0.000000000000));97 PyDict_SetItemString(self->params,"sldIM_flat5",Py_BuildValue("d",0.000000000000));98 94 PyDict_SetItemString(self->params,"thick_flat1",Py_BuildValue("d",10.000000000000)); 99 95 PyDict_SetItemString(self->params,"thick_flat3",Py_BuildValue("d",100.000000000000)); … … 103 99 PyDict_SetItemString(self->params,"thick_flat4",Py_BuildValue("d",100.000000000000)); 104 100 PyDict_SetItemString(self->params,"thick_flat5",Py_BuildValue("d",100.000000000000)); 105 PyDict_SetItemString(self->params," sld_sub0",Py_BuildValue("d",0.000002070000));101 PyDict_SetItemString(self->params,"thick_inter0",Py_BuildValue("d",1.000000000000)); 106 102 PyDict_SetItemString(self->params,"thick_inter1",Py_BuildValue("d",1.000000000000)); 107 PyDict_SetItemString(self->params," thick_inter2",Py_BuildValue("d",1.000000000000));103 PyDict_SetItemString(self->params,"sld_bottom0",Py_BuildValue("d",0.000002070000)); 108 104 PyDict_SetItemString(self->params,"thick_inter3",Py_BuildValue("d",1.000000000000)); 109 105 PyDict_SetItemString(self->params,"thick_inter4",Py_BuildValue("d",1.000000000000)); … … 113 109 PyDict_SetItemString(self->params,"thick_inter8",Py_BuildValue("d",1.000000000000)); 114 110 PyDict_SetItemString(self->params,"thick_inter9",Py_BuildValue("d",1.000000000000)); 115 PyDict_SetItemString(self->params,"sldIM_flat1",Py_BuildValue("d",0.000000000000));116 111 PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000)); 117 PyDict_SetItemString(self->params,"sldIM_flat2",Py_BuildValue("d",0.000000000000));118 112 PyDict_SetItemString(self->params,"func_inter9",Py_BuildValue("d",0.000000000000)); 119 113 PyDict_SetItemString(self->params,"thick_inter10",Py_BuildValue("d",1.000000000000)); 120 PyDict_SetItemString(self->params,"sldIM_flat3",Py_BuildValue("d",0.000000000000));121 114 PyDict_SetItemString(self->params,"func_inter8",Py_BuildValue("d",0.000000000000)); 122 115 PyDict_SetItemString(self->params,"thick_flat2",Py_BuildValue("d",100.000000000000)); … … 136 129 PyDict_SetItemString(self->params,"sld_flat2",Py_BuildValue("d",0.000003500000)); 137 130 PyDict_SetItemString(self->params,"sld_flat3",Py_BuildValue("d",0.000004000000)); 138 PyDict_SetItemString(self->params,"sldIM_flat8",Py_BuildValue("d",0.000000000000));139 131 PyDict_SetItemString(self->params,"sld_flat8",Py_BuildValue("d",0.000003500000)); 140 132 PyDict_SetItemString(self->params,"sld_flat9",Py_BuildValue("d",0.000004000000)); 141 PyDict_SetItemString(self->params,"sldIM_flat9",Py_BuildValue("d",0.000000000000));142 133 PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000)); 143 134 PyDict_SetItemString(self->params,"func_inter1",Py_BuildValue("d",0.000000000000)); 144 PyDict_SetItemString(self->params,"sldIM_sub0",Py_BuildValue("d",0.000000000000));145 PyDict_SetItemString(self->params,"sldIM_medium",Py_BuildValue("d",0.000000000000));146 135 PyDict_SetItemString(self->params,"sld_flat10",Py_BuildValue("d",0.000003500000)); 147 PyDict_SetItemString(self->params,"thick_inter0",Py_BuildValue("d",1.000000000000));148 PyDict_SetItemString(self->params,"sldIM_flat6",Py_BuildValue("d",0.000000000000));149 136 PyDict_SetItemString(self->params,"func_inter4",Py_BuildValue("d",0.000000000000)); 137 PyDict_SetItemString(self->params,"thick_inter2",Py_BuildValue("d",1.000000000000)); 150 138 PyDict_SetItemString(self->params,"func_inter10",Py_BuildValue("d",0.000000000000)); 151 139 // Initialize dispersion / averaging parameter dict … … 284 272 285 273 // Reader parameter dictionary 286 self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );287 274 self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") ); 288 275 self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") ); 289 self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );290 self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );291 self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );292 276 self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") ); 293 277 self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") ); … … 297 281 self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") ); 298 282 self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") ); 299 self->model-> sld_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sub0") );283 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") ); 300 284 self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") ); 301 self->model-> thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );285 self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") ); 302 286 self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") ); 303 287 self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") ); … … 307 291 self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") ); 308 292 self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") ); 309 self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );310 293 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 311 self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );312 294 self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") ); 313 295 self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") ); 314 self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );315 296 self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") ); 316 297 self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") ); … … 330 311 self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") ); 331 312 self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") ); 332 self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );333 313 self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") ); 334 314 self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") ); 335 self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );336 315 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 337 316 self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") ); 338 self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );339 self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );340 317 self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") ); 341 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );342 self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );343 318 self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") ); 319 self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") ); 344 320 self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") ); 345 321 // Read in dispersion parameters … … 410 386 411 387 // Reader parameter dictionary 412 self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );413 388 self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") ); 414 389 self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") ); 415 self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );416 self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );417 self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );418 390 self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") ); 419 391 self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") ); … … 423 395 self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") ); 424 396 self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") ); 425 self->model-> sld_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sub0") );397 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") ); 426 398 self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") ); 427 self->model-> thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );399 self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") ); 428 400 self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") ); 429 401 self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") ); … … 433 405 self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") ); 434 406 self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") ); 435 self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );436 407 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 437 self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );438 408 self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") ); 439 409 self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") ); 440 self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );441 410 self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") ); 442 411 self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") ); … … 456 425 self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") ); 457 426 self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") ); 458 self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );459 427 self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") ); 460 428 self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") ); 461 self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );462 429 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 463 430 self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") ); 464 self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );465 self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );466 431 self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") ); 467 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );468 self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );469 432 self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") ); 433 self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") ); 470 434 self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") ); 471 435 // Read in dispersion parameters … … 523 487 524 488 // Reader parameter dictionary 525 self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );526 489 self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") ); 527 490 self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") ); 528 self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );529 self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );530 self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );531 491 self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") ); 532 492 self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") ); … … 536 496 self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") ); 537 497 self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") ); 538 self->model-> sld_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sub0") );498 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") ); 539 499 self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") ); 540 self->model-> thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );500 self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") ); 541 501 self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") ); 542 502 self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") ); … … 546 506 self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") ); 547 507 self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") ); 548 self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );549 508 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 550 self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );551 509 self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") ); 552 510 self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") ); 553 self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );554 511 self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") ); 555 512 self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") ); … … 569 526 self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") ); 570 527 self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") ); 571 self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );572 528 self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") ); 573 529 self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") ); 574 self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );575 530 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 576 531 self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") ); 577 self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );578 self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );579 532 self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") ); 580 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );581 self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );582 533 self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") ); 534 self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") ); 583 535 self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") ); 584 536 // Read in dispersion parameters … … 605 557 606 558 // Reader parameter dictionary 607 self->model->sldIM_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat4") );608 559 self->model->thick_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat8") ); 609 560 self->model->thick_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat9") ); 610 self->model->sldIM_flat7 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat7") );611 self->model->sldIM_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat10") );612 self->model->sldIM_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat5") );613 561 self->model->thick_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat1") ); 614 562 self->model->thick_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat3") ); … … 618 566 self->model->thick_flat4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat4") ); 619 567 self->model->thick_flat5 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat5") ); 620 self->model-> sld_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_sub0") );568 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") ); 621 569 self->model->thick_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter1") ); 622 self->model-> thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") );570 self->model->sld_bottom0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_bottom0") ); 623 571 self->model->thick_inter3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter3") ); 624 572 self->model->thick_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter4") ); … … 628 576 self->model->thick_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter8") ); 629 577 self->model->thick_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter9") ); 630 self->model->sldIM_flat1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat1") );631 578 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 632 self->model->sldIM_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat2") );633 579 self->model->func_inter9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter9") ); 634 580 self->model->thick_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter10") ); 635 self->model->sldIM_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat3") );636 581 self->model->func_inter8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter8") ); 637 582 self->model->thick_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_flat2") ); … … 651 596 self->model->sld_flat2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat2") ); 652 597 self->model->sld_flat3 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat3") ); 653 self->model->sldIM_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat8") );654 598 self->model->sld_flat8 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat8") ); 655 599 self->model->sld_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat9") ); 656 self->model->sldIM_flat9 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat9") );657 600 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 658 601 self->model->func_inter1 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter1") ); 659 self->model->sldIM_sub0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_sub0") );660 self->model->sldIM_medium = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_medium") );661 602 self->model->sld_flat10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_flat10") ); 662 self->model->thick_inter0 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter0") );663 self->model->sldIM_flat6 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sldIM_flat6") );664 603 self->model->func_inter4 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter4") ); 604 self->model->thick_inter2 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thick_inter2") ); 665 605 self->model->func_inter10 = PyFloat_AsDouble( PyDict_GetItemString(self->params, "func_inter10") ); 666 606 // Read in dispersion parameters -
sansmodels/src/sans/models/c_models/refl.cpp
r339ce67 r0164899a 15 15 thick_inter0 = Parameter(1.0); 16 16 func_inter0 = Parameter(0); 17 sld_ sub0 = Parameter(2.07e-06);17 sld_bottom0 = Parameter(2.07e-06); 18 18 sld_medium = Parameter(1.0e-06); 19 19 background = Parameter(0.0); … … 67 67 func_inter10 = Parameter(0); 68 68 69 sldIM_flat1 = Parameter(0);70 sldIM_flat2 = Parameter(0);71 sldIM_flat3 = Parameter(0);72 sldIM_flat4 = Parameter(0);73 sldIM_flat5 = Parameter(0);74 sldIM_flat6 = Parameter(0);75 sldIM_flat7 = Parameter(0);76 sldIM_flat8 = Parameter(0);77 sldIM_flat9 = Parameter(0);78 sldIM_flat10 = Parameter(0);79 80 sldIM_sub0 = Parameter(0);81 sldIM_medium = Parameter(0);82 69 } 83 70 … … 88 75 */ 89 76 double ReflModel :: operator()(double q) { 90 double dp[ 59];77 double dp[47]; 91 78 // Fill parameter array for IGOR library 92 79 // Add the background after averaging … … 95 82 dp[2] = thick_inter0(); 96 83 dp[3] = func_inter0(); 97 dp[4] = sld_ sub0();84 dp[4] = sld_bottom0(); 98 85 dp[5] = sld_medium(); 99 86 dp[6] = background(); … … 143 130 dp[46] = func_inter10(); 144 131 145 dp[47] = sldIM_flat1();146 dp[48] = sldIM_flat2();147 dp[49] = sldIM_flat3();148 dp[50] = sldIM_flat4();149 dp[51] = sldIM_flat5();150 dp[52] = sldIM_flat6();151 dp[53] = sldIM_flat7();152 dp[54] = sldIM_flat8();153 dp[55] = sldIM_flat9();154 dp[56] = sldIM_flat10();155 156 dp[57] = sldIM_sub0();157 dp[58] = sldIM_medium();158 159 132 // Get the dispersion points for the radius 160 133 //vector<WeightPoint> weights_thick;
Note: See TracChangeset
for help on using the changeset viewer.