Changeset 1511c37c in sasmodels for sasmodels/models/sc_paracrystal.py


Ignore:
Timestamp:
Aug 1, 2017 3:29:07 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
8f04da4
Parents:
31df0c9
Message:

tuned random model generation for more models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/sc_paracrystal.py

    r404ebbd r1511c37c  
    140140def random(): 
    141141    import numpy as np 
    142     # Define lattice spacing as a multiple of the particle radius 
    143     # using the formulat a = 4 r/sqrt(3).  Systems which are ordered 
    144     # are probably mostly filled, so use a distribution which goes from 
    145     # zero to one, but leaving 90% of them within 80% of the 
    146     # maximum bcc packing.  Lattice distortion values are empirically 
    147     # useful between 0.01 and 0.7.  Use an exponential distribution 
    148     # in this range 'cuz its easy. 
     142    # copied from bcc_paracrystal 
     143    radius = 10**np.random.uniform(1.3, 4) 
     144    d_factor = 10**np.random.uniform(-2, -0.7)  # sigma_d in 0.01-0.7 
    149145    dnn_fraction = np.random.beta(a=10, b=1) 
     146    dnn = radius*4/np.sqrt(3)/dnn_fraction 
    150147    pars = dict( 
    151148        #sld=1, sld_solvent=0, scale=1, background=1e-32, 
    152         radius=10**np.random.uniform(1.3, 4), 
    153         d_factor=10**np.random.uniform(-2, -0.7),  # sigma_d in 0.01-0.7 
     149        dnn=dnn, 
     150        d_factor=d_factor, 
     151        radius=radius, 
    154152    ) 
    155     pars['dnn'] = pars['radius']*4/np.sqrt(3)/dnn_fraction 
    156     #pars['scale'] = 1/(0.68*dnn_fraction**3)  # bcc packing fraction is 0.68 
    157     pars['scale'] = 1 
    158153    return pars 
    159  
    160 demo = dict(scale=1, background=0, 
    161             dnn=220.0, 
    162             d_factor=0.06, 
    163             radius=40.0, 
    164             sld=3.0, 
    165             sld_solvent=6.3, 
    166             theta=0.0, 
    167             phi=0.0, 
    168             psi=0.0) 
    169154 
    170155tests = [ 
     
    172157    [{}, 0.001, 10.3048], 
    173158    [{}, 0.215268, 0.00814889], 
    174     [{}, (0.414467), 0.001313289], 
    175     [{'theta':10.0,'phi':20,'psi':30.0},(0.045,-0.035),18.0397138402 ], 
    176     [{'theta':10.0,'phi':20,'psi':30.0},(0.023,0.045),0.0177333171285 ] 
     159    [{}, 0.414467, 0.001313289], 
     160    [{'theta': 10.0, 'phi': 20, 'psi': 30.0}, (0.045, -0.035), 18.0397138402], 
     161    [{'theta': 10.0, 'phi': 20, 'psi': 30.0}, (0.023, 0.045), 0.0177333171285], 
    177162    ] 
    178163 
Note: See TracChangeset for help on using the changeset viewer.