Changeset ec2ca99 in sasmodels
- Timestamp:
- Feb 8, 2016 8:01:18 AM (9 years ago)
- 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:
- f0fb9fe, 66d119f
- Parents:
- 98f3053
- Location:
- sasmodels/models
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/HayterMSAsq.py
r13ed84c rec2ca99 52 52 [Hayter-Penfold MSA charged sphere interparticle S(Q) structure factor] 53 53 Interparticle structure factor S(Q)for a charged hard spheres. 54 Routine takes absolute value of charge, use HardSphere if charge goes to zero. 54 Routine takes absolute value of charge, use HardSphere if charge 55 goes to zero. 55 56 In sasview the effective radius will be calculated from the 56 57 parameters used in P(Q). 57 58 """ 58 59 single = False # double precision only for now 60 61 # pylint: disable=bad-whitespace, line-too-long 59 62 # [ "name", "units", default, [lower, upper], "type", "description" ], 60 parameters = [["effect_radius", "Ang", 20.75, [0, inf], "volume", 61 "effective radius of hard sphere"], 62 ["charge", "e", 19.0, [0, inf], "", 63 "charge on sphere (in electrons)"], 64 ["volfraction", "", 0.0192, [0, 0.74], "", 65 "volume fraction of spheres"], 66 ["temperature", "K", 318.16, [0, inf], "", 67 "temperature, in Kelvin, for Debye length calculation"], 68 ["saltconc", "M", 0.0, [-inf, inf], "", 69 "conc of salt, 1:1 electolyte, for Debye length"], 70 ["dielectconst", "", 71.08, [-inf, inf], "", 71 "dielectric constant of solvent (default water), for Debye length"], 72 ] 63 parameters = [ 64 ["effect_radius", "Ang", 20.75, [0, inf], "volume", "effective radius of hard sphere"], 65 ["charge", "e", 19.0, [0, inf], "", "charge on sphere (in electrons)"], 66 ["volfraction", "", 0.0192, [0, 0.74], "", "volume fraction of spheres"], 67 ["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"], 70 ] 71 # pylint: enable=bad-whitespace, line-too-long 73 72 category = "structure-factor" 74 73 … … 88 87 oldpars = dict() 89 88 # default parameter set, use compare.sh -midQ -linear 90 # note the calculation varies in different limiting cases so a wide range of parameters will be required for a thorough test! 89 # note the calculation varies in different limiting cases so a wide range of 90 # parameters will be required for a thorough test! 91 91 # odd that the default st has saltconc zero 92 demo = dict(effect_radius = 20.75,charge=19.0,volfraction = 0.0192,temperature=318.16,saltconc=0.05,dielectconst=71.08,effect_radius_pd = 0.1,effect_radius_pd_n = 40) 92 demo = dict(effect_radius=20.75, 93 charge=19.0, 94 volfraction=0.0192, 95 temperature=318.16, 96 saltconc=0.05, 97 dielectconst=71.08, 98 effect_radius_pd=0.1, 99 effect_radius_pd_n=40) 93 100 # 94 101 # attempt to use same values as old sasview unit test 95 102 tests = [ 96 [ {'scale': 1.0, 'background' : 0.0, 'effect_radius' : 20.75, 'charge' : 19.0, 'volfraction' : 0.0192, 'temperature' : 298.0, 97 'saltconc' : 0,'dielectconst' : 78.0, 'effect_radius_pd' : 0}, [0.0010], [0.0712928]] 98 ] 103 [{'scale': 1.0, 104 'background': 0.0, 105 'effect_radius': 20.75, 106 'charge': 19.0, 107 'volfraction': 0.0192, 108 'temperature': 298.0, 109 'saltconc': 0, 110 'dielectconst': 78.0, 111 'effect_radius_pd': 0}, 112 [0.0010], [0.0712928]] 113 ] 99 114 -
sasmodels/models/hollow_cylinder.py
r0420af7 rec2ca99 78 78 """ 79 79 category = "shape:cylinder" 80 81 # 80 # pylint: disable=bad-whitespace, line-too-long 81 # ["name", "units", default, [lower, upper], "type","description"], 82 82 parameters = [ 83 ["radius", "Ang", 30.0, [0, inf], "volume", "Cylinder radius"], 84 ["core_radius", "Ang", 20.0, [0, inf], "volume", "Hollow core radius"], 85 ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder length"], 86 ["sld", "1/Ang^2", 6.3, [-inf, inf], "", "Cylinder sld"], 87 ["solvent_sld", "1/Ang^2", 1, [-inf, inf], "", "Solvent sld"], 88 ["theta", "degrees", 90, [-360, 360], "orientation", "Theta angle"], 89 ["phi", "degrees", 0, [-360, 360], "orientation", "Phi angle"], 90 ] 83 ["radius", "Ang", 30.0, [0, inf], "volume", "Cylinder radius"], 84 ["core_radius", "Ang", 20.0, [0, inf], "volume", "Hollow core radius"], 85 ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder length"], 86 ["sld", "1/Ang^2", 6.3, [-inf, inf], "", "Cylinder sld"], 87 ["solvent_sld", "1/Ang^2", 1, [-inf, inf], "", "Solvent sld"], 88 ["theta", "degrees", 90, [-360, 360], "orientation", "Theta angle"], 89 ["phi", "degrees", 0, [-360, 360], "orientation", "Phi angle"], 90 ] 91 # pylint: enable=bad-whitespace, line-too-long 91 92 92 93 source = ["lib/J1.c", "lib/gauss76.c", "hollow_cylinder.c"] 93 94 94 95 def ER(radius, core_radius, length): 96 """ 97 :param radius: Cylinder radius 98 :param core_radius: Hollow core radius, UNUSED 99 :param length: Cylinder length 100 :return: Effective radius 101 """ 95 102 if radius == 0 or length == 0: 96 103 return 0.0 … … 104 111 105 112 def VR(radius, core_radius, length): 113 """ 114 :param radius: Cylinder radius 115 :param core_radius: Hollow core radius 116 :param length: Cylinder length 117 :return: Volf ratio for P(q)*S(q) 118 """ 106 119 vol_core = pi*core_radius*core_radius*length 107 120 vol_total = pi*radius*radius*length … … 110 123 111 124 # parameters for demo 112 demo = dict(scale=1.0, background=0.0,length=400.0,radius=30.0,core_radius=20.0,113 sld=6.3,solvent_sld=1,theta=90,phi=0,125 demo = dict(scale=1.0, background=0.0, length=400.0, radius=30.0, 126 core_radius=20.0, sld=6.3, solvent_sld=1, theta=90, phi=0, 114 127 radius_pd=.2, radius_pd_n=9, 115 128 length_pd=.2, length_pd_n=10, 116 129 core_radius_pd=.2, core_radius_pd_n=9, 117 130 theta_pd=10, theta_pd_n=5, 118 131 ) 119 132 120 133 # For testing against the old sasview models, include the converted parameter 121 134 # names and the target sasview model name. 122 135 oldname = 'HollowCylinderModel' 123 oldpars = dict(scale='scale', background='background',radius='radius',124 core_radius='core_radius', sld='sldCyl',length='length',125 solvent_sld='sldSolv', phi='axis_phi',theta='axis_theta')136 oldpars = dict(scale='scale', background='background', radius='radius', 137 core_radius='core_radius', sld='sldCyl', length='length', 138 solvent_sld='sldSolv', phi='axis_phi', theta='axis_theta') 126 139 127 140 # Parameters for unit tests 128 141 tests = [ 129 [{"radius" : 30.0},0.00005,1764.926],130 [{},'VR',1.8],131 [{},0.001,1756.76]132 142 [{"radius": 30.0}, 0.00005, 1764.926], 143 [{}, 'VR', 1.8], 144 [{}, 0.001, 1756.76] 145 ] -
sasmodels/models/lamellarCaille.py
r13ed84c rec2ca99 1 # Note: model title and parameter table are inserted automatically2 1 r""" 3 2 This model provides the scattering intensity, $I(q) = P(q) S(q)$, for a … … 77 76 title = "Random lamellar sheet with Caille structure factor" 78 77 description = """\ 79 80 81 82 83 84 85 78 [Random lamellar phase with Caille structure factor] 79 randomly oriented stacks of infinite sheets 80 with Caille S(Q), having polydisperse spacing. 81 sld = sheet scattering length density 82 sld_solvent = solvent scattering length density 83 background = incoherent background 84 scale = scale factor 86 85 """ 87 86 category = "shape:lamellae" 88 87 89 88 single = False 90 89 # pylint: disable=bad-whitespace, line-too-long 91 90 # ["name", "units", default, [lower, upper], "type","description"], 92 parameters = [ ["thickness", "Ang", 30.0, [0, inf], "volume", "sheet thickness"],93 ["Nlayers", "", 20, [0, inf], "", "Number of layers"],94 ["spacing", "Ang", 400., [0.0,inf], "volume", "d-spacing of Caille S(Q)"],95 ["Caille_parameter", "1/Ang^2", 0.1, [0.0,0.8], "", "Caille parameter"],96 ["sld", "1e-6/Ang^2", 6.3, [-inf,inf], "",97 98 ["solvent_sld", "1e-6/Ang^2", 1.0, [-inf,inf], "",99 "Solvent scattering length density"],100 ] 91 parameters = [ 92 ["thickness", "Ang", 30.0, [0, inf], "volume", "sheet thickness"], 93 ["Nlayers", "", 20, [0, inf], "", "Number of layers"], 94 ["spacing", "Ang", 400., [0.0,inf], "volume", "d-spacing of Caille S(Q)"], 95 ["Caille_parameter", "1/Ang^2", 0.1, [0.0,0.8], "", "Caille parameter"], 96 ["sld", "1e-6/Ang^2", 6.3, [-inf,inf], "", "layer scattering length density"], 97 ["solvent_sld", "1e-6/Ang^2", 1.0, [-inf,inf], "", "Solvent scattering length density"], 98 ] 99 # pylint: enable=bad-whitespace, line-too-long 101 100 102 101 source = ["lamellarCaille_kernel.c"] … … 116 115 117 116 demo = dict(scale=1, background=0, 118 thickness=67., Nlayers=3.75,spacing=200.,119 Caille_parameter=0.268, sld=1.0, solvent_sld=6.34,120 thickness_pd= 121 spacing_pd= 117 thickness=67., Nlayers=3.75, spacing=200., 118 Caille_parameter=0.268, sld=1.0, solvent_sld=6.34, 119 thickness_pd=0.1, thickness_pd_n=100, 120 spacing_pd=0.05, spacing_pd_n=40) 122 121 123 122 oldname = 'LamellarPSModel' 124 oldpars = dict(thickness='delta', Nlayers='N_plates', Caille_parameter='caille', 125 sld='sld_bi',solvent_sld='sld_sol') 123 oldpars = dict(thickness='delta', Nlayers='N_plates', 124 Caille_parameter='caille', 125 sld='sld_bi', solvent_sld='sld_sol') 126 126 # 127 127 tests = [ 128 [ {'scale': 1.0, 'background' : 0.0, 'thickness' : 30.,'Nlayers' : 20.0, 'spacing' : 400., 129 'Caille_parameter' : 0.1, 'sld' : 6.3, 'solvent_sld' : 1.0, 130 'thickness_pd' : 0.0, 'spacing_pd' : 0.0 }, [0.001], [28895.13397]] 131 ] 128 [{'scale': 1.0, 'background': 0.0, 'thickness': 30., 'Nlayers': 20.0, 129 'spacing': 400., 'Caille_parameter': 0.1, 'sld': 6.3, 130 'solvent_sld': 1.0, 'thickness_pd': 0.0, 'spacing_pd': 0.0}, 131 [0.001], [28895.13397]] 132 ]
Note: See TracChangeset
for help on using the changeset viewer.