[321736f] | 1 | double form_volume(double radius, double thickness); |
---|
| 2 | |
---|
| 3 | double Iq(double q, |
---|
| 4 | double sld, double solvent_sld, |
---|
| 5 | double radius, double thickness); |
---|
| 6 | |
---|
| 7 | double Iqxy(double qx, double qy, |
---|
| 8 | double sld, double solvent_sld, |
---|
| 9 | double radius, double thickness); |
---|
| 10 | |
---|
| 11 | double form_volume(double radius, double thickness) |
---|
| 12 | { |
---|
| 13 | //note that for the vesicle model, the volume is ONLY the shell volume |
---|
| 14 | double volume; |
---|
| 15 | volume =4.*M_PI*(radius+thickness)*(radius+thickness)*(radius+thickness)/3; |
---|
| 16 | volume -=4.*M_PI*radius*radius*radius/3.; |
---|
| 17 | return volume; |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | double Iq(double q, |
---|
| 21 | double sld, |
---|
| 22 | double solvent_sld, |
---|
| 23 | double radius, |
---|
| 24 | double thickness) |
---|
| 25 | |
---|
| 26 | /* |
---|
| 27 | scattering from a unilamellar vesicle. |
---|
| 28 | same functional form as the core-shell sphere, but more intuitive for |
---|
| 29 | a vesicle |
---|
| 30 | */ |
---|
| 31 | |
---|
| 32 | /* |
---|
| 33 | note that the sph_j1c we are using has been optimized for precision over |
---|
| 34 | SasView's original implementation. HOWEVER at q==0 that implementation |
---|
| 35 | set bes=1.0 rather than 0.0 (correct value) on the grounds I believe that |
---|
| 36 | bes=0.00 causes Iq to have a divide by 0 error (mostly encountered when |
---|
| 37 | doing a theory curve in 2D? We should verify this and if necessary fix |
---|
| 38 | -PDB Feb 7, 2016 |
---|
| 39 | */ |
---|
| 40 | { |
---|
| 41 | double bes,vol,contrast,f,f2; |
---|
| 42 | |
---|
| 43 | // core first, then add in shell |
---|
| 44 | contrast = solvent_sld-sld; |
---|
| 45 | bes = sph_j1c(q*radius); |
---|
| 46 | vol = 4.0*M_PI/3.0*radius*radius*radius; |
---|
| 47 | f = vol*bes*contrast; |
---|
| 48 | |
---|
| 49 | //now the shell |
---|
| 50 | contrast = sld-solvent_sld; |
---|
| 51 | bes = sph_j1c(q*(radius+thickness)); |
---|
| 52 | vol = 4.0*M_PI/3.0*(radius+thickness)*(radius+thickness)*(radius+thickness); |
---|
| 53 | f += vol*bes*contrast; |
---|
| 54 | |
---|
| 55 | //rescale to [cm-1]. No volume normalization as this is done by the caller |
---|
| 56 | f2 = f*f*1.0e-4; |
---|
| 57 | |
---|
| 58 | return(f2); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | double Iqxy(double qx, double qy, |
---|
| 63 | double sld, double solvent_sld, |
---|
| 64 | double radius, double thickness) |
---|
| 65 | |
---|
| 66 | { |
---|
| 67 | double q = sqrt(qx*qx + qy*qy); |
---|
| 68 | return Iq(q, |
---|
| 69 | sld, solvent_sld, |
---|
| 70 | radius,thickness); |
---|
| 71 | |
---|
| 72 | } |
---|