Changeset 0d41aeed in sasview for src/sans/models/c_extension
- Timestamp:
- Nov 24, 2014 9:35:22 AM (10 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:
- 2cdcbb5
- Parents:
- afd42432
- Location:
- src/sans/models/c_extension
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sans/models/c_extension/libigor/libSphere.c
r230f479 r0d41aeed 2330 2330 } 2331 2331 2332 2332 // Micelle with spherical core 2333 // J.S. Pedersen, J. Appl. Cryst. 33, 637 (2000) 2334 2335 double 2336 MicelleSphericalCore(double dp[], double q) 2337 { 2338 double x, pi; 2339 double ndensity, v_core, v_corona, rho_solv, rho_core, rho_corona; // local names of input params 2340 double radius_core, radius_gyr, d_penetration, n_aggreg, bkg, scale; // local names of input params 2341 double beta_core, beta_corona, qr, qrg, qrg2, qrdrg, bes_core, bes_corona; 2342 double term1, term2, term3, term4, debye_chain, chain_ampl, i_micelle; 2343 2344 x = q; 2345 2346 scale = dp[0]; 2347 ndensity = dp[1]; // number density [1/cm^3] 2348 v_core = dp[2]; // volume block in core [A^3] 2349 v_corona = dp[3]; // volume block in corona [A^3] 2350 rho_solv = dp[4]; // sld of solvent [1/A^2] 2351 rho_core = dp[5]; // sld of core [1/A^2] 2352 rho_corona = dp[6]; // sld of corona [1/A^2] 2353 radius_core = dp[7]; // radius of core [A] 2354 radius_gyr = dp[8]; // radius of gyration of chains in corona [A] 2355 d_penetration = dp[9]; // close to unity, mimics non-penetration of gaussian chains 2356 n_aggreg = dp[10]; // aggregation number of the micelle 2357 bkg = dp[11]; // background 2358 2359 beta_core = v_core * (rho_core - rho_solv); 2360 beta_corona = v_corona * (rho_corona - rho_solv); 2361 2362 2363 // Self-correlation term of the core 2364 2365 qr = x*radius_core; 2366 if(qr == 0){bes_core = 1.0;} else {bes_core = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);} 2367 2368 term1 = n_aggreg * n_aggreg * beta_core * beta_core * bes_core * bes_core; 2369 2370 // Self-correlation term of the chains 2371 2372 qrg = x*radius_gyr; 2373 qrg2 = qrg*qrg; 2374 if(qrg2 == 0){debye_chain = 1.0;} else {debye_chain = 2.0*(exp(-qrg2)-1+qrg2)/(qrg2*qrg2);} 2375 2376 term2 = n_aggreg * beta_corona * beta_corona * debye_chain; 2377 2378 // Interference cross-term between core and chains 2379 2380 if(qrg2 == 0){chain_ampl = 1.0;} else {chain_ampl = (1-exp(-qrg2))/qrg2;} 2381 2382 qrdrg = x * (radius_core + d_penetration * radius_gyr); 2383 if(qrdrg == 0){bes_corona = 1.0;} else {bes_corona = sin(qrdrg)/qrdrg;} 2384 2385 term3 = 2 * n_aggreg * n_aggreg * beta_core * beta_corona * bes_core * chain_ampl * bes_corona; 2386 2387 // Interference cross-term between chains 2388 2389 term4 = n_aggreg * (n_aggreg - 1.0) * beta_corona * beta_corona * chain_ampl * chain_ampl * bes_corona * bes_corona; 2390 2391 // I(q)_micelle : Sum of 4 terms computed above 2392 2393 i_micelle = term1 + term2 + term3 + term4 ; 2394 2395 // rescale from [A^2] to [cm^2] 2396 2397 i_micelle *= 1.0e-16; 2398 2399 // "normalize" by number density --> intensity in [cm-1] 2400 2401 i_micelle *= ndensity; 2402 2403 //scale if desired 2404 i_micelle *= scale; 2405 2406 // add in the background 2407 i_micelle += bkg; 2408 2409 return(i_micelle); 2410 2411 } 2412 -
src/sans/models/c_extension/libigor/libSphere.h
r230f479 r0d41aeed 34 34 double SC_ParaCrystal(double dp[], double q); 35 35 double FuzzySpheres(double dp[], double q); 36 double MicelleSphericalCore(double dp[], double q); 36 37 37 38 //function prototypes
Note: See TracChangeset
for help on using the changeset viewer.