Changeset d529d93 in sasmodels for sasmodels/models/hayter_msa.py


Ignore:
Timestamp:
Mar 17, 2016 8:16:55 AM (8 years ago)
Author:
richardh
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
3a45c2c, 0784c18
Parents:
c5dadbb
Message:

updated docs for several S(Q)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hayter_msa.py

    r348557a rd529d93  
    99 
    1010**This routine only works for charged particles**. If the charge is set to 
    11 zero the routine will self-destruct! For non-charged particles use a hard 
     11zero the routine may self-destruct! For non-charged particles use a hard 
    1212sphere potential. 
    1313 
     
    1515which in turn is used to compute the Debye screening length. At present 
    1616there is no provision for entering the ionic strength directly nor for use 
    17 of any multivalent salts. The counterions are also assumed to be monovalent. 
     17of any multivalent salts, though it should be possible to simulate the effect 
     18of this by increasing the salt concentration. The counterions are also assumed to  
     19be monovalent. 
     20 
     21In sasview the effective radius may be calculated from the parameters 
     22used in the form factor $P(q)$ that this $S(q)$ is combined with. 
     23 
     24The computation uses a Taylor series expansion at very small rescaled $qR$, to  
     25avoid some serious rounding error issues, this may result in a minor artefact  
     26in the transition region under some circumstances. 
    1827 
    1928For 2D data, the scattering intensity is calculated in the same way as 1D, 
     
    2433    q = \sqrt{q_x^2 + q_y^2} 
    2534 
    26 .. figure:: img/HayterMSAsq_227.jpg 
    27  
    28     1D plot using the default values (in linear scale). 
    2935 
    3036References 
     
    3541J P Hansen and J B Hayter, *Molecular Physics*, 46 (1982) 651-656 
    3642""" 
     43from numpy import inf 
    3744 
    38 #  dp[0] = 2.0*effect_radius(); 
     45category = "structure-factor" 
     46structure_factor = True 
     47single = False  # double precision only! 
     48 
     49#  dp[0] = 2.0*radius_effective(); 
    3950#  dp[1] = fabs(charge()); 
    4051#  dp[2] = volfraction(); 
     
    4354#  dp[5] = dielectconst(); 
    4455 
    45 from numpy import inf 
    4656 
    47 source = ["hayter_msa_kernel.c"] 
     57 
    4858 
    4959name = "hayter_msa" 
    50 title = "Hayter-Penfold MSA charged sphere interparticle S(Q) structure factor" 
     60title = "Hayter-Penfold rescaled MSA, charged sphere, interparticle S(Q) structure factor" 
    5161description = """\ 
    52     [Hayter-Penfold MSA charged sphere interparticle S(Q) structure factor] 
     62    [Hayter-Penfold RMSA charged sphere interparticle S(Q) structure factor] 
    5363        Interparticle structure factor S(Q)for a charged hard spheres. 
    5464        Routine takes absolute value of charge, use HardSphere if charge 
    5565        goes to zero. 
    56         In sasview the effective radius will be calculated from the 
    57         parameters used in P(Q). 
     66        In sasview the effective radius and volume fraction may be calculated  
     67        from the parameters used in P(Q). 
    5868""" 
    59 single = False  # double precision only! 
     69 
    6070 
    6171# pylint: disable=bad-whitespace, line-too-long 
    6272#             [ "name", "units", default, [lower, upper], "type", "description" ], 
    6373parameters = [ 
    64     ["effect_radius", "Ang", 20.75,   [0, inf],    "volume", "effective radius of hard sphere"], 
     74    ["radius_effective", "Ang", 20.75,   [0, inf],    "volume", "effective radius of charged sphere"], 
    6575    ["charge",        "e",   19.0,    [0, inf],    "", "charge on sphere (in electrons)"], 
    66     ["volfraction",   "",     0.0192, [0, 0.74],   "", "volume fraction of spheres"], 
     76    ["volfraction",   "None",     0.0192, [0, 0.74],   "", "volume fraction of spheres"], 
    6777    ["temperature",   "K",  318.16,   [0, inf],    "", "temperature, in Kelvin, for Debye length calculation"], 
    68     ["saltconc",      "M",    0.0,    [-inf, inf], "", "conc of salt, 1:1 electolyte, for Debye length"], 
    69     ["dielectconst",  "",    71.08,   [-inf, inf], "", "dielectric constant of solvent (default water), for Debye length"], 
     78    ["saltconc",      "M",    0.0,    [-inf, inf], "", "conc of salt, moles/litre, 1:1 electolyte, for Debye length"], 
     79    ["dielectconst",  "None",    71.08,   [-inf, inf], "", "dielectric constant (relative permittivity) of solvent, default water, for Debye length"] 
    7080    ] 
    7181# pylint: enable=bad-whitespace, line-too-long 
    72 category = "structure-factor" 
    7382 
     83source = ["hayter_msa_kernel.c"] 
    7484# No volume normalization despite having a volume parameter 
    7585# This should perhaps be volume normalized? 
     
    8595 
    8696oldname = 'HayterMSAStructure' 
    87 oldpars = dict() 
     97#oldpars = dict(effect_radius="radius_effective",effect_radius_pd="radius_effective_pd",effect_radius_pd_n="radius_effective_pd_n") 
     98oldpars = dict(radius_effective="effect_radius",radius_effective_pd="effect_radius_pd",radius_effective_pd_n="effect_radius_pd_n") 
     99#oldpars = dict( ) 
    88100# default parameter set,  use  compare.sh -midQ -linear 
    89101# note the calculation varies in different limiting cases so a wide range of 
    90102# parameters will be required for a thorough test! 
    91103# odd that the default st has saltconc zero 
    92 demo = dict(effect_radius=20.75, 
     104demo = dict(radius_effective=20.75, 
    93105            charge=19.0, 
    94106            volfraction=0.0192, 
     
    96108            saltconc=0.05, 
    97109            dielectconst=71.08, 
    98             effect_radius_pd=0.1, 
    99             effect_radius_pd_n=40) 
     110            radius_effective_pd=0.1, 
     111            radius_effective_pd_n=40) 
    100112# 
    101113# attempt to use same values as old sasview unit test at Q=.001 was 0.0712928,  
     
    104116    [{'scale': 1.0, 
    105117      'background': 0.0, 
    106       'effect_radius': 20.75, 
     118      'radius_effective': 20.75, 
    107119      'charge': 19.0, 
    108120      'volfraction': 0.0192, 
     
    110122      'saltconc': 0, 
    111123      'dielectconst': 78.0, 
    112       'effect_radius_pd': 0}, 
     124      'radius_effective_pd': 0}, 
    113125     [0.00001,0.0010,0.01,0.075], [0.0711646,0.0712928,0.0847006,1.07150]], 
    114126    [{'scale': 1.0, 
    115127      'background': 0.0, 
    116       'effect_radius': 20.75, 
     128      'radius_effective': 20.75, 
    117129      'charge': 19.0, 
    118130      'volfraction': 0.0192, 
     
    120132      'saltconc': 0.05, 
    121133      'dielectconst': 78.0, 
    122       'effect_radius_pd': 0.1, 
    123       'effect_radius_pd_n': 40}, 
     134      'radius_effective_pd': 0.1, 
     135      'radius_effective_pd_n': 40}, 
    124136     [0.00001,0.0010,0.01,0.075], [0.450272,0.450420,0.465116,1.039625]] 
    125137    ] 
    126  
     138# ADDED by:  RKH  ON: 16Mar2016 converted from sasview, new Taylor expansion at smallest rescaled Q 
Note: See TracChangeset for help on using the changeset viewer.