Changeset 513efc5 in sasmodels for sasmodels/models/sphere.py
- Timestamp:
- Jan 20, 2016 4:50:50 AM (8 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:
- 7ed702f
- Parents:
- 30b4ddf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/sphere.py
rd53d3cd r513efc5 78 78 ] 79 79 80 source = ["lib/J1c.c"] 80 81 81 82 # No volume normalization despite having a volume parameter … … 87 88 Iq = """ 88 89 const double qr = q*radius; 89 const double qrsq = qr*qr; 90 double sn, cn; 91 SINCOS(qr, sn, cn); 92 // Use taylor series for low q to avoid cancellation error. Tested against 93 // the following expression in quad precision: 94 // 3.0*(sn-qr*cn)/(qr*qr*qr); 95 // Note that the values differ from sasview ~ 5e-12 rather than 5e-14, but 96 // in this case it is likely cancellation errors in the original expression 97 // using double precision that are the source. Single precision only 98 // requires the first 3 terms. Double precision requires the 4th term. 99 // The fifth term is not needed, and is commented out below. 100 const double bes = (qr < 1.e-1) 101 ? 1.0 + qrsq*(-3./30. + qrsq*(3./840. + qrsq*(-3./45360.)))// + qrsq*(3./3991680.)))) 102 : 3.0*(sn/qr - cn)/qrsq; 90 const double bes = J1c(qr); 103 91 const double fq = bes * (sld - solvent_sld) * form_volume(radius); 104 92 return 1.0e-4*fq*fq;
Note: See TracChangeset
for help on using the changeset viewer.