Changeset 7420664 in sasmodels


Ignore:
Timestamp:
Sep 4, 2018 8:25:11 AM (5 months ago)
Author:
grethevj
Branches:
F1F2models_grethe
Parents:
755bc53
Message:

models giving F2(q)

Location:
sasmodels/models
Files:
10 added
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/ellipsoidF2.py

    r755bc53 r7420664  
    151151              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", 
    152152               "Solvent scattering length density"], 
    153               ["radius_polar", "Ang", 20, [0, inf], "volume", 
     153              ["radius_polarF2", "Ang", 20, [0, inf], "volume", 
    154154               "Polar radius"], 
    155               ["radius_equatorial", "Ang", 400, [0, inf], "volume", 
     155              ["radius_equatorialF2", "Ang", 400, [0, inf], "volume", 
    156156               "Equatorial radius"], 
    157157              ["theta", "degrees", 60, [-360, 360], "orientation", 
     
    162162 
    163163 
    164 source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "ellipsoid.c"] 
     164source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "ellipsoidF2.c"] 
    165165have_Fq = True 
    166166 
    167 def ER(radius_polar, radius_equatorial): 
     167def ER(radius_polarF2, radius_equatorialF2): 
    168168    # see equation (26) in A.Isihara, J.Chem.Phys. 18(1950)1446-1449 
    169     ee = np.empty_like(radius_polar) 
    170     idx = radius_polar > radius_equatorial 
    171     ee[idx] = (radius_polar[idx] ** 2 - radius_equatorial[idx] ** 2) / radius_polar[idx] ** 2 
    172     idx = radius_polar < radius_equatorial 
    173     ee[idx] = (radius_equatorial[idx] ** 2 - radius_polar[idx] ** 2) / radius_equatorial[idx] ** 2 
    174     idx = radius_polar == radius_equatorial 
    175     ee[idx] = 2 * radius_polar[idx] 
    176     valid = (radius_polar * radius_equatorial != 0) 
     169    ee = np.empty_like(radius_polarF2) 
     170    idx = radius_polarF2 > radius_equatorialF2 
     171    ee[idx] = (radius_polarF2[idx] ** 2 - radius_equatorialF2[idx] ** 2) / radius_polarF2[idx] ** 2 
     172    idx = radius_polarF2 < radius_equatorialF2 
     173    ee[idx] = (radius_equatorialF2[idx] ** 2 - radius_polarF2[idx] ** 2) / radius_equatorialF2[idx] ** 2 
     174    idx = radius_polarF2 == radius_equatorialF2 
     175    ee[idx] = 2 * radius_polarF2[idx] 
     176    valid = (radius_polarF2 * radius_equatorialF2 != 0) 
    177177    bd = 1.0 - ee[valid] 
    178178    e1 = np.sqrt(ee[valid]) 
     
    183183 
    184184    ddd = np.zeros_like(radius_polar) 
    185     ddd[valid] = 2.0 * (delta + 1.0) * radius_polar * radius_equatorial ** 2 
     185    ddd[valid] = 2.0 * (delta + 1.0) * radius_polarF2 * radius_equatorialF2 ** 2 
    186186    return 0.5 * ddd ** (1.0 / 3.0) 
    187187 
     
    199199demo = dict(scale=1, background=0, 
    200200            sld=6, sld_solvent=1, 
    201             radius_polar=50, radius_equatorial=30, 
     201            radius_polarF2=50, radius_equatorialF2=30, 
    202202            theta=30, phi=15, 
    203             radius_polar_pd=.2, radius_polar_pd_n=15, 
    204             radius_equatorial_pd=.2, radius_equatorial_pd_n=15, 
     203            radius_polarF2_pd=.2, radius_polarF2_pd_n=15, 
     204            radius_equatorialF2_pd=.2, radius_equatorialF2_pd_n=15, 
    205205            theta_pd=15, theta_pd_n=45, 
    206206            phi_pd=15, phi_pd_n=1) 
     
    210210qy = q*sin(pi/6.0) 
    211211tests = [ 
    212     [{}, 0.05, 54.8525847025], 
     212    [{}, 0.05, 0.23291238], 
    213213    [{'theta':80., 'phi':10.}, (qx, qy), 1.74134670026], 
    214214] 
Note: See TracChangeset for help on using the changeset viewer.