Changeset 339ce67 in sasview for sansmodels/src/sans/models/c_extensions
- Timestamp:
- Oct 12, 2010 6:22:08 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:
- 20f00bed
- Parents:
- aaad3098
- Location:
- sansmodels/src/sans/models/c_extensions
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_extensions/corefourshell.c
rc724ccd r339ce67 18 18 19 19 dp[0] = pars->scale; 20 dp[1] = pars->rad_core ;21 dp[2] = pars->sld_core ;20 dp[1] = pars->rad_core0; 21 dp[2] = pars->sld_core0; 22 22 dp[3] = pars->thick_shell1; 23 23 dp[4] = pars->sld_shell1; -
sansmodels/src/sans/models/c_extensions/corefourshell.h
rc724ccd r339ce67 6 6 */ 7 7 //[PYTHONCLASS] = CoreFourShellModel 8 //[DISP_PARAMS] = rad_core , thick_shell1,thick_shell2,thick_shell3,thick_shell48 //[DISP_PARAMS] = rad_core0, thick_shell1,thick_shell2,thick_shell3,thick_shell4 9 9 //[DESCRIPTION] =<text> Calculates the scattering intensity from a core-4 shell structure. 10 10 // scale = scale factor * volume fraction 11 // rad_core : the radius of the core12 // sld_core : the SLD of the core11 // rad_core0: the radius of the core 12 // sld_core0: the SLD of the core 13 13 // thick_shelli: the thickness of the i'th shell from the core 14 14 // sld_shelli: the SLD of the i'th shell from the core … … 16 16 // background: incoherent background 17 17 // </text> 18 //[FIXED]=<text> thick_shell4.width; thick_shell1.width;thick_shell2.width;thick_shell3.width;rad_core .width </text>18 //[FIXED]=<text> thick_shell4.width; thick_shell1.width;thick_shell2.width;thick_shell3.width;rad_core0.width </text> 19 19 //[ORIENTATION_PARAMS]= <text> </text> 20 20 … … 24 24 double scale; 25 25 26 /// Radius of the core [A]27 // [DEFAULT]=rad_core =60. [A]28 double rad_core ;26 /// Radius of the core0 [A] 27 // [DEFAULT]=rad_core0=60. [A] 28 double rad_core0; 29 29 30 /// sld of core [1/A^(2)]31 // [DEFAULT]=sld_core = 6.4e-6 [1/A^(2)]32 double sld_core ;30 /// sld of core0 [1/A^(2)] 31 // [DEFAULT]=sld_core0= 6.4e-6 [1/A^(2)] 32 double sld_core0; 33 33 34 34 /// thickness of the shell1 [A] -
sansmodels/src/sans/models/c_extensions/fcc.c
rd5b6a9d r339ce67 65 65 double answer; 66 66 double Pi = 4.0*atan(1.0); 67 double aa, Da, qDa_2, latticeScale, Zq, Fkq, Fkq_2 ;67 double aa, Da, qDa_2, latticeScale, Zq, Fkq, Fkq_2,contrast; 68 68 69 69 double dp[5]; … … 77 77 Da = pars->d_factor*aa; 78 78 qDa_2 = pow(q*Da,2.0); 79 contrast = pars->sldSph - pars->sldSolv; 79 80 80 81 latticeScale = 4.0*(4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa*sqrt(2.0),3.0); … … 133 134 134 135 // Use SphereForm directly from libigor 135 answer = SphereForm (dp,q)*Zq;136 answer = SphereForm_Paracrystal(pars->radius,contrast,q)*Zq; 136 137 137 138 //consider scales -
sansmodels/src/sans/models/c_extensions/onion.c
ra1b2471 r339ce67 11 11 int n = dp[0]; 12 12 double scale = dp[1]; 13 double rad_core = dp[2];14 double sld_core = dp[3];13 double rad_core0 = dp[2]; 14 double sld_core0 = dp[3]; 15 15 double sld_solv = dp[4]; 16 16 double background = dp[5]; … … 30 30 fun_type[i] = dp[i+45]; 31 31 } 32 sld_out[0] = sld_core ;32 sld_out[0] = sld_core0; 33 33 sld_out[n+1] = sld_solv; 34 sld_in[0] = sld_core ;34 sld_in[0] = sld_core0; 35 35 sld_in[n+1] = sld_solv; 36 thick[0] = rad_core ;36 thick[0] = rad_core0; 37 37 thick[n+1] = 1e+10; 38 38 A[0] = 0.0; … … 69 69 } 70 70 else{ 71 slope[i] = (sld_out[i]-sld_in[i])/(exp(A[i])-1 );71 slope[i] = (sld_out[i]-sld_in[i])/(exp(A[i])-1.0); 72 72 } 73 73 for (j=0; j<2; j++){ … … 174 174 dp[0] = pars->n_shells; 175 175 dp[1] = pars->scale; 176 dp[2] = pars->rad_core ;177 dp[3] = pars->sld_core ;176 dp[2] = pars->rad_core0; 177 dp[3] = pars->sld_core0; 178 178 dp[4] = pars->sld_solv; 179 179 dp[5] = pars->background; -
sansmodels/src/sans/models/c_extensions/onion.h
r7381f34 r339ce67 6 6 */ 7 7 //[PYTHONCLASS] = OnionModel 8 //[DISP_PARAMS] = rad_core , thick_shell1,thick_shell2,thick_shell3,thick_shell4, thick_shell5,thick_shell6,thick_shell7,thick_shell8,thick_shell9,thick_shell108 //[DISP_PARAMS] = rad_core0, thick_shell1,thick_shell2,thick_shell3,thick_shell4, thick_shell5,thick_shell6,thick_shell7,thick_shell8,thick_shell9,thick_shell10 9 9 //[DESCRIPTION] =<text>Form factor of mutishells normalized by the volume. Here each shell is described 10 10 // by an exponential function; … … 24 24 // 25 25 // background:background, 26 // rad_core : radius of sphere(core)26 // rad_core0: radius of sphere(core) 27 27 // thick_shell#:the thickness of the shell# 28 // sld_core : the SLD of the sphere28 // sld_core0: the SLD of the sphere 29 29 // sld_solv: the SLD of the solvent 30 30 // sld_shell: the SLD of the shell# 31 31 // A_shell#: the coefficient in the exponential function 32 32 // </text> 33 //[FIXED]= <text>rad_core .width;thick_shell1.width;thick_shell2.width;thick_shell3.width;thick_shell4.width;thick_shell5.width;thick_shell6.width;thick_shell7.width;thick_shell8.width;thick_shell9.width;thick_shell10.width</text>33 //[FIXED]= <text>rad_core0.width;thick_shell1.width;thick_shell2.width;thick_shell3.width;thick_shell4.width;thick_shell5.width;thick_shell6.width;thick_shell7.width;thick_shell8.width;thick_shell9.width;thick_shell10.width</text> 34 34 //[ORIENTATION_PARAMS]= <text> </text> 35 35 … … 42 42 double scale; 43 43 /// Radius of sphere [A] 44 // [DEFAULT]=rad_core =200.0 [A]45 double rad_core ;44 // [DEFAULT]=rad_core0=200.0 [A] 45 double rad_core0; 46 46 /// sld_core [1/A^(2)] 47 // [DEFAULT]=sld_core = 1.0e-6 [1/A^(2)]48 double sld_core ;47 // [DEFAULT]=sld_core0= 1.0e-6 [1/A^(2)] 48 double sld_core0; 49 49 /// sld_solv [1/A^(2)] 50 50 // [DEFAULT]=sld_solv= 6.4e-6 [1/A^(2)] -
sansmodels/src/sans/models/c_extensions/refl.c
r35aface r339ce67 268 268 double background = dp[6]; 269 269 270 double sld[n+2],sld_ nul[n+2],thick_inter[n+2],thick[n+2],total_thick;270 double sld[n+2],sld_im[n+2],thick_inter[n+2],thick[n+2],total_thick; 271 271 fun_type[0] = dp[3]; 272 272 for (i =1; i<=n; i++){ … … 275 275 thick[i] = dp[i+26]; 276 276 fun_type[i] = dp[i+36]; 277 sld_im[i] = dp[i+46]; 277 278 278 279 total_thick += thick[i] + thick_inter[i]; … … 280 281 sld[0] = sld_sub; 281 282 sld[n+1] = sld_super; 283 sld_im[0] = fabs(dp[0+56]); 284 sld_im[n+1] = fabs(dp[1+56]); 282 285 thick[0] = total_thick/5.0; 283 286 thick[n+1] = total_thick/5.0; … … 287 290 double nsl=21.0; //nsl = Num_sub_layer: MUST ODD number in double //no other number works now 288 291 int n_s, floor_nsl; 289 double sld_i, dz,phi,R,ko2;292 double sld_i,sldim_i,dz,phi,R,ko2; 290 293 double sign,erfunc; 291 294 double pi; … … 300 303 //Checking if floor is available. 301 304 //no imaginary sld inputs in this function yet 302 n_sub=cassign(1.0-sld_sub*pow(lamda,2.0)/(2.0*pi), 0.0);303 n_sup=cassign(1.0-sld_super*pow(lamda,2.0)/(2.0*pi), 0.0);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]); 304 307 ko2 = pow(2.0*pi/lamda,2.0); 305 308 … … 323 326 dz = thick[i]; 324 327 sld_i = sld[i]; 328 sldim_i = sld_im[i]; 325 329 } 326 330 else{ 327 331 dz = thick_inter[i-1]/nsl; 328 sld_i = interfunc(fun_type[i-1],nsl, n_s, sld[i-1], sld[i]); 332 if (sld[i-1] == sld[i]){ 333 sld_i = sld[i]; 334 } 335 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]); 343 } 329 344 } 330 nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi), 0.0);345 nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sldim_i); 331 346 nn2=cmult(nn,nn); 332 347 … … 366 381 */ 367 382 double refl_analytical_1D(ReflParameters *pars, double q) { 368 double dp[ 47];383 double dp[59]; 369 384 370 385 dp[0] = pars->n_layers; … … 420 435 dp[46] = pars->func_inter10; 421 436 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 422 451 return re_kernel(dp, q); 423 452 } -
sansmodels/src/sans/models/c_extensions/refl.h
r35aface r339ce67 142 142 double func_inter10; 143 143 144 // [DEFAULT]=sldIM_flat1=0 145 double sldIM_flat1; 146 // [DEFAULT]=sldIM_flat2=0 147 double sldIM_flat2; 148 // [DEFAULT]=sldIM_flat3=0 149 double sldIM_flat3; 150 // [DEFAULT]=sldIM_flat4=0 151 double sldIM_flat4; 152 // [DEFAULT]=sldIM_flat5=0 153 double sldIM_flat5; 154 // [DEFAULT]=sldIM_flat6=0 155 double sldIM_flat6; 156 // [DEFAULT]=sldIM_flat7=0 157 double sldIM_flat7; 158 // [DEFAULT]=sldIM_flat8=0 159 double sldIM_flat8; 160 // [DEFAULT]=sldIM_flat9=0 161 double sldIM_flat9; 162 // [DEFAULT]=sldIM_flat10=0 163 double sldIM_flat10; 164 // [DEFAULT]=sldIM_sub0=0 165 double sldIM_sub0; 166 // [DEFAULT]=sldIM_medium=0 167 double sldIM_medium; 144 168 145 169 } ReflParameters;
Note: See TracChangeset
for help on using the changeset viewer.