Changeset a189283 in sasmodels for explore/asymint.py
- Timestamp:
- Dec 6, 2017 6:32:37 PM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- cfa28d3
- Parents:
- 0f113fb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/asymint.py
r49eb251 ra189283 96 96 97 97 def make_core_shell_parallelepiped(a, b, c, da, db, dc, slda, sldb, sldc, env=NPenv): 98 overlapping = False 98 99 a, b, c = env.mpf(a), env.mpf(b), env.mpf(c) 99 100 da, db, dc = env.mpf(da), env.mpf(db), env.mpf(dc) 100 101 slda, sldb, sldc = env.mpf(slda), env.mpf(sldb), env.mpf(sldc) 101 drV0 = CONTRAST*a*b*c 102 dra, drb, drc = slda-SLD_SOLVENT, sldb-SLD_SOLVENT, sldc-SLD_SOLVENT 103 Aa, Ab, Ac = b*c, a*c, a*b 104 Ta, Tb, Tc = a + 2*da, b + 2*db, c + 2*dc 105 drVa, drVb, drVc = dra*a*Aa, drb*b*Ab, drc*c*Ac 106 drVTa, drVTb, drVTc = dra*Ta*Aa, drb*Tb*Ab, drc*Tc*Ac 107 def Fq(qa, qb, qc): 108 siA = env.sas_sinx_x(a*qa/2) 109 siB = env.sas_sinx_x(b*qb/2) 110 siC = env.sas_sinx_x(c*qc/2) 111 siAt = env.sas_sinx_x(Ta*qa/2) 112 siBt = env.sas_sinx_x(Tb*qb/2) 113 siCt = env.sas_sinx_x(Tc*qc/2) 114 return (drV0*siA*siB*siC 115 + (drVTa*siAt-drVa*siA)*siB*siC 116 + siA*(drVTb*siBt-drVb*siB)*siC 117 + siA*siB*(drVTc*siCt-drVc*siC)) 102 dr0 = CONTRAST 103 drA, drB, drC = slda-SLD_SOLVENT, sldb-SLD_SOLVENT, sldc-SLD_SOLVENT 104 tA, tB, tC = a + 2*da, b + 2*db, c + 2*dc 105 def Fq(qa, qb, qc): 106 siA = a*env.sas_sinx_x(a*qa/2) 107 siB = b*env.sas_sinx_x(b*qb/2) 108 siC = c*env.sas_sinx_x(c*qc/2) 109 siAt = tA*env.sas_sinx_x(tA*qa/2) 110 siBt = tB*env.sas_sinx_x(tB*qb/2) 111 siCt = tC*env.sas_sinx_x(tC*qc/2) 112 if overlapping: 113 return (dr0*siA*siB*siC 114 + drA*(siAt-siA)*siB*siC 115 + drB*siAt*(siBt-siB)*siC 116 + drC*siAt*siBt*(siCt-siC)) 117 else: 118 return (dr0*siA*siB*siC 119 + drA*(siAt-siA)*siB*siC 120 + drB*siA*(siBt-siB)*siC 121 + drC*siA*siB*(siCt-siC)) 118 122 Fq.__doc__ = "core-shell parallelepiped a=%g, b=%g c=%g"%(a, b, c) 119 volume = a*b*c + 2*da*Aa + 2*db*Ab + 2*dc*Ac 123 if overlapping: 124 volume = a*b*c + 2*da*b*c + 2*tA*db*c + 2*tA*tB*dc 125 else: 126 volume = a*b*c + 2*da*b*c + 2*a*db*c + 2*a*b*dc 120 127 norm = 1/(volume*10000) 121 128 return norm, Fq
Note: See TracChangeset
for help on using the changeset viewer.