- Timestamp:
- Oct 24, 2017 11:22:19 AM (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:
- 1820208
- Parents:
- 6e604f8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/asymint.py
r6e604f8 r5110e16 2 2 """ 3 3 Asymmetric shape integration 4 5 Usage: 6 7 explore/asymint.py [MODEL] [q-value] 8 9 Computes the numerical integral over theta and phi of the given model at a 10 single point q using different algorithms or the same algorithm with different 11 precision. It also displays a 2-D image of the theta-phi surface that is 12 being integrated. 13 14 The available models are: 15 16 triaxial_ellipsoid, parallelpiped, paracrystal, cylinder, sphere 17 18 Cylinder and sphere are included as simple checks on the integration 19 algorithms. Cylinder is better investigated using 1-D integration methods in 20 explore/symint.py. Sphere has an easily computed analytic value which is 21 identical for all theta-phi for a given q, so it is useful for checking 22 that the normalization constants are correct for the different algorithms. 4 23 """ 5 24 … … 116 135 return a1, a2, a3 117 136 def fcc(qa, qb, qc): 118 a1 = ( 0 .+ qb + qc)/2119 a2 = (-qa + 0 .+ qc)/2120 a3 = (-qa + qb + 0 .)/2137 a1 = ( 0 + qb + qc)/2 138 a2 = (-qa + 0 + qc)/2 139 a3 = (-qa + qb + 0)/2 121 140 return a1, a2, a3 122 141 lattice_fn = {'sc': sc, 'bcc': bcc, 'fcc': fcc}[lattice] … … 126 145 # Note: paper says that different directions can have different 127 146 # distoration factors. Easy enough to add to the code. 128 # This would definitely break 8-fold symmetry.129 147 arg = -(dnn*d_factor)**2*(a1**2 + a2**2 + a3**2)/2 130 148 exp_arg = env.exp(arg) … … 134 152 q = env.sqrt(qa**2 + qb**2 + qc**2) 135 153 Fq = env.sas_3j1x_x(q*radius) 136 # the kernel computes F(q)**2, but we needS(q)*F(q)**2154 # the caller computes F(q)**2, but we need it to compute S(q)*F(q)**2 137 155 return env.sqrt(Sq)*Fq 138 156 Fq.__doc__ = "%s paracrystal a=%g da=%g r=%g"%(lattice, dnn, d_factor, radius) … … 141 159 'sc': sphere_volume(radius/dnn), 142 160 'bcc': 2*sphere_volume(env.sqrt(3)/2*radius/dnn), 143 'fcc': 4*sphere_volume( radius/dnn/env.sqrt(2)),161 'fcc': 4*sphere_volume(1/env.sqrt(2)*radius/dnn), 144 162 }[lattice] 145 163 volume = sphere_volume(radius) 146 norm = CONTRAST**2*volume *Vf/10000164 norm = CONTRAST**2*volume/10000*Vf 147 165 return norm, Fq 148 166
Note: See TracChangeset
for help on using the changeset viewer.