Changeset 0ba3b08 in sasview for sansmodels/src/c_models/fuzzysphere.cpp
- Timestamp:
- Jan 5, 2012 10:16:29 AM (13 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:
- 011e0e4
- Parents:
- bbbed8c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/c_models/fuzzysphere.cpp
r67424cd r0ba3b08 15 15 16 16 #include <math.h> 17 #include "models.hh"18 17 #include "parameters.hh" 19 18 #include <stdio.h> 19 #include <stdlib.h> 20 20 using namespace std; 21 #include "fuzzysphere.h" 21 22 22 23 extern "C" { 23 #include "fuzzysphere.h" 24 #include "libSphere.h" 25 } 26 27 // scattering from a uniform sphere w/ fuzzy surface 28 // Modified from FuzzySpheres in libigor/libSphere.c without polydispersion: JHC 29 static double fuzzysphere_kernel(double dp[], double q){ 30 double pi,x,xr; 31 double radius,sldSph,sldSolv,scale,bkg,delrho,fuzziness,f2,bes,vol,f; //my local names 32 33 pi = 4.0*atan(1.0); 34 x= q; 35 scale = dp[0]; 36 radius = dp[1]; 37 fuzziness = dp[2]; 38 sldSph = dp[3]; 39 sldSolv = dp[4]; 40 bkg = dp[5]; 41 delrho=sldSph-sldSolv; 42 43 xr = x*radius; 44 //handle xr==0 separately 45 if(xr == 0.0){ 46 bes = 1.0; 47 }else{ 48 bes = 3.0*(sin(xr)-xr*cos(xr))/(xr*xr*xr); 49 } 50 vol = 4.0*pi/3.0*radius*radius*radius; 51 f = vol*bes*delrho; // [=] A 52 f *= exp(-0.5*fuzziness*fuzziness*x*x); 53 // normalize to single particle volume, convert to 1/cm 54 f2 = f * f / vol * 1.0e8; // [=] 1/cm 55 56 f2 *= scale; 57 f2 += bkg; 58 59 return(f2); //scale, and add in the background 24 60 } 25 61
Note: See TracChangeset
for help on using the changeset viewer.