Changeset c5ac2b2 in sasmodels for sasmodels/models/core_multi_shell.py


Ignore:
Timestamp:
Jul 18, 2016 2:05:12 AM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
4a21b121
Parents:
256dfe1
Message:

working core multi shell

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_multi_shell.py

    r46ed760 rc5ac2b2  
    8787 
    8888#             ["name", "units", default, [lower, upper], "type","description"], 
    89 parameters = [["volfraction", "", 0.05, [0,1],"", 
    90                "volume fraction of spheres"], 
    91               ["sld_core", "1e-6/Ang^2", 1.0, [-inf, inf], "", 
     89parameters = [["sld_core", "1e-6/Ang^2", 1.0, [-inf, inf], "", 
    9290               "Core scattering length density"], 
    9391              ["radius", "Ang", 200., [0, inf], "volume", 
     
    9593              ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "", 
    9694               "Solvent scattering length density"], 
    97               ["n", "", 1, [0, 4], "volume", 
     95              ["n", "", 1, [0, 10], "volume", 
    9896               "number of shells"], 
    9997              ["sld[n]", "1e-6/Ang^2", 1.7, [-inf, inf], "", 
     
    103101              ] 
    104102 
    105 #source = ["lib/sph_j1c.c", "onion.c"] 
     103source = ["lib/sph_j1c.c", "core_multi_shell.c"] 
    106104 
    107 def Iq(q, *args, **kw): 
    108     return q 
    109  
    110 def Iqxy(qx, *args, **kw): 
    111     return qx 
    112  
    113  
    114 def profile(volfraction, sld_core, radius, sld_solvent, n, sld, thickness): 
     105def profile(sld_core, radius, sld_solvent, n, sld, thickness): 
    115106    """ 
    116107    SLD profile 
     
    120111 
    121112    """ 
    122 #        r = [] 
    123 #        beta = [] 
    124 #        # for core at r=0 
    125 #        r.append(0) 
    126 #        beta.append(self.params['sld_core0']) 
    127 #        # for core at r=rad_core 
    128 #        r.append(self.params['rad_core0']) 
    129 #        beta.append(self.params['sld_core0']) 
    130 # 
    131 #        # for shells 
    132 #        for n in range(1, self.n_shells+1): 
    133 #            # Left side of each shells 
    134 #            r0 = r[len(r)-1] 
    135 #            r.append(r0) 
    136 #            exec "beta.append(self.params['sld_shell%s'% str(n)])" 
    137 # 
    138 #            # Right side of each shells 
    139 #            exec "r0 += self.params['thick_shell%s'% str(n)]" 
    140 #            r.append(r0) 
    141 #            exec "beta.append(self.params['sld_shell%s'% str(n)])" 
    142 # 
    143 #        # for solvent 
    144 #        r0 = r[len(r)-1]             
    145 #        r.append(r0) 
    146 #        beta.append(self.params['sld_solv']) 
    147 #        r_solv = 5*r0/4 
    148 #        r.append(r_solv) 
    149 #        beta.append(self.params['sld_solv']) 
    150 # 
    151 #        return r, beta 
    152 # above is directly from old code -- below is alotered from Woitek's first 
    153 # cut an the onion.  Seems like we should be consistant? 
    154  
    155113    total_radius = 1.25*(sum(thickness[:n]) + radius + 1) 
    156114 
     
    172130        r.append(r0 + thickness[k]) 
    173131        beta.append(sld[k]) 
    174    # add in the solvent 
     132    # add in the solvent 
    175133    r.append(r[-1]) 
    176134    beta.append(sld_solvent) 
     
    187145    return 1.0, 1.0 
    188146 
    189 demo = dict(volfraction = 1.0, 
    190             sld_core = 6.4, 
     147demo = dict(sld_core = 6.4, 
    191148            radius = 60, 
    192149            sld_solvent = 6.4, 
    193             n = 1, 
    194             sld = [2.0], 
    195             thickness = [10]) 
     150            n = 2, 
     151            sld = [2.0, 3.0], 
     152            thickness = 20, 
     153            thickness1_pd = 0.3, 
     154            thickness2_pd = 0.3, 
     155            thickness1_pd_n = 10, 
     156            thickness2_pd_n = 10, 
     157            ) 
Note: See TracChangeset for help on using the changeset viewer.