source: sasmodels/sasmodels/models/vesicle.c @ 321736f

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 321736f was 321736f, checked in by butler, 8 years ago

convert vesicle model to sasmodels

  • Property mode set to 100644
File size: 2.0 KB
Line 
1double form_volume(double radius, double thickness);
2
3double Iq(double q, 
4          double sld, double solvent_sld,
5          double radius, double thickness);
6
7double Iqxy(double qx, double qy,
8          double sld, double solvent_sld,
9          double radius, double thickness);
10
11double 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
20double 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
62double 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}
Note: See TracBrowser for help on using the repository browser.