Changeset 0fa687d in sasmodels
 Timestamp:
 Nov 25, 2015 4:09:56 PM (7 years ago)
 Branches:
 master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket1257vesicleproduct, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
 Children:
 4b41184
 Parents:
 319ab14
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sasmodels/models/sphere.py
r3e428ec r0fa687d 90 90 Iq = """ 91 91 const double qr = q*radius; 92 const double qrsq = qr*qr; 92 93 double sn, cn; 93 94 SINCOS(qr, sn, cn); 94 const double bes = qr==0.0 ? 1.0 : 3.0*(snqr*cn)/(qr*qr*qr); 95 // Use taylor series for low Q to avoid cancellation error. Tested against 96 // the following expression in quad precision: 97 // 3.0*(snqr*cn)/(qr*qr*qr); 98 // Note that the values differ from sasview ~ 5e12 rather than 5e14, but 99 // in this case it is likely cancellation errors in the original expression 100 // using double precision that are the source. Single precision only 101 // requires the first 3 terms. Double precision requires the 4th term. 102 // The fifth term is not needed, and is commented out below. 103 const double bes = (qr < 1e1) 104 ? 1.0 + qrsq*(3./30. + qrsq*(3./840. + qrsq*(3./45360.)))// + qrsq*(3./3991680.)))) 105 : 3.0*(sn/qr  cn)/qrsq; 95 106 const double fq = bes * (sld  solvent_sld) * form_volume(radius); 96 107 return 1.0e4*fq*fq; 97 108 """ 98 99 109 100 110 Iqxy = """
Note: See TracChangeset
for help on using the changeset viewer.