Changeset ad90df9 in sasmodels
- Timestamp:
- Mar 1, 2016 8:23:21 PM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- e6f1410, 7d4b2ae
- Parents:
- 50e1e40
- Location:
- sasmodels/models
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/bcc.c
r9aac25d rad90df9 40 40 } 41 41 42 43 42 double form_volume(double radius){ 44 return 1.333333333333333*M_PI*radius*radius*radius;43 return sphere_volume(radius); 45 44 } 46 45 … … 52 51 //Volume fraction calculated from lattice symmetry and sphere radius 53 52 const double s1 = dnn/sqrt(0.75); 54 const double latticescale = 2.0* (4.0/3.0)*M_PI*(radius*radius*radius)/(s1*s1*s1);53 const double latticescale = 2.0*sphere_volume(radius/s1); 55 54 56 55 const double va = 0.0; … … 113 112 114 113 //the occupied volume of the lattice 115 const double latticescale = 2.0* (4.0/3.0)*M_PI*(radius*radius*radius)/(s1*s1*s1);114 const double latticescale = 2.0*sphere_volume(radius/s1); 116 115 // q vector 117 116 //q_z = 0.0; // for SANS; assuming qz is negligible -
sasmodels/models/bcc.py
r9aac25d rad90df9 132 132 # pylint: enable=bad-whitespace, line-too-long 133 133 134 source = ["lib/ J1.c", "lib/gauss150.c", "lib/sphere_form.c", "bcc.c"]134 source = ["lib/sph_j1c.c", "lib/J1.c", "lib/gauss150.c", "lib/sphere_form.c", "bcc.c"] 135 135 136 136 # parameters for demo -
sasmodels/models/fcc.c
r9aac25d rad90df9 41 41 42 42 double form_volume(double radius){ 43 return 1.333333333333333*M_PI*radius*radius*radius;43 return sphere_volume(radius); 44 44 } 45 45 … … 51 51 //Volume fraction calculated from lattice symmetry and sphere radius 52 52 const double s1 = dnn*sqrt(2.0); 53 const double latticescale = 4.0* (4.0/3.0)*M_PI*(radius*radius*radius)/(s1*s1*s1);53 const double latticescale = 4.0*sphere_volume(radius/s1); 54 54 55 55 const double va = 0.0; … … 112 112 113 113 //the occupied volume of the lattice 114 const double latticescale = 2.0* (4.0/3.0)*M_PI*(radius*radius*radius)/(s1*s1*s1);114 const double latticescale = 2.0*sphere_volume(radius/s1); 115 115 // q vector 116 116 // q_z = 0.0; // for SANS; assuming qz is negligible -
sasmodels/models/fcc.py
rc0ccea8 rad90df9 127 127 # pylint: enable=bad-whitespace, line-too-long 128 128 129 source = ["lib/ J1.c", "lib/gauss150.c", "lib/sphere_form.c", "fcc.c"]129 source = ["lib/sph_j1c.c", "lib/J1.c", "lib/gauss150.c", "lib/sphere_form.c", "fcc.c"] 130 130 131 131 # parameters for demo -
sasmodels/models/lib/sphere_form.c
r9aac25d rad90df9 1 double 1 inline double 2 sphere_volume(double radius) 3 { 4 return M_4PI_3*cube(radius); 5 } 6 7 inline double 2 8 sphere_form(double q, double radius, double sld, double solvent_sld) 3 9 { 4 const double qr = q*radius; 5 double sn, cn; 6 SINCOS(qr, sn, cn); 7 const double vol = 1.333333333333333*M_PI*radius*radius*radius; 8 const double bes = (qr == 0.0 ? 1.0 : 3.0*(sn-qr*cn)/(qr*qr*qr)); 9 const double fq = bes * (sld - solvent_sld)*vol; 10 return 1.0e-4*fq*fq; 10 const double fq = sphere_volume(radius) * sph_j1c(q*radius); 11 const double contrast = (sld - solvent_sld); 12 return 1.0e-4*square(contrast * fq); 11 13 } 12 13 // Do we even need the paracrystal form?14 // The only difference is the return value at r=015 double16 sphere_form_paracrystal(double q, double radius, double delrho)17 {18 const double qr = q*radius;19 const double vol = 1.333333333333333*M_PI*radius*radius*radius;20 const double f = vol*delrho*delrho*1.0e-4;21 double sn, cn;22 SINCOS(qr, sn, cn);23 const double bes = (qr == 0.0 ? f : 3.0*(sn-qr*cn)/(qr*qr*qr));24 const double fq = bes*delrho*vol;25 return fq*fq * 1.0e-4;26 } -
sasmodels/models/sc_crystal.c
r9aac25d rad90df9 20 20 double form_volume(double radius) 21 21 { 22 return 1.333333333333333*M_PI*radius*radius*radius;22 return sphere_volume(radius); 23 23 } 24 24 … … 95 95 96 96 //Volume fraction calculated from lattice symmetry and sphere radius 97 const double latticeScale = (4.0/3.0)*M_PI*(radius*radius*radius)/pow(dnn,3);98 99 //answer *= sphere_form_paracrystal(q, radius,contrast)*latticeScale; 97 // NB: 4/3 pi r^3 / dnn^3 = 4/3 pi(r/dnn)^3 98 const double latticeScale = sphere_volume(radius/dnn); 99 100 100 answer *= sphere_form(q, radius, sphere_sld, solvent_sld)*latticeScale; 101 101 … … 180 180 181 181 //consider scales 182 const double latticeScale = (4.0/3.0)*M_PI*(radius*radius*radius)/pow(dnn,3.0);182 const double latticeScale = sphere_volume(radius/dnn); 183 183 answer *= latticeScale; 184 184 -
sasmodels/models/sc_crystal.py
r9aac25d rad90df9 142 142 # pylint: enable=bad-whitespace, line-too-long 143 143 144 source = ["lib/sph ere_form.c", "lib/gauss150.c", "sc_crystal.c"]144 source = ["lib/sph_j1c.c", "lib/sphere_form.c", "lib/gauss150.c", "sc_crystal.c"] 145 145 146 146 demo = dict(scale=1, background=0, -
sasmodels/models/sphere.py
r50e1e40 rad90df9 78 78 ] 79 79 80 source = ["lib/sph_j1c.c" ]80 source = ["lib/sph_j1c.c", "lib/sphere_form.c"] 81 81 82 82 # No volume normalization despite having a volume parameter 83 83 # This should perhaps be volume normalized? 84 84 form_volume = """ 85 return M_4PI_3*cube(radius);85 return sphere_volume(radius); 86 86 """ 87 87 88 88 Iq = """ 89 const double qr = q*radius; 90 const double bes = sph_j1c(qr); 91 const double fq = bes * (sld - solvent_sld) * form_volume(radius); 92 return 1.0e-4*fq*fq; 89 return sphere_form(q, radius, sld, solvent_sld); 93 90 """ 94 91
Note: See TracChangeset
for help on using the changeset viewer.