Changeset 2767 for trunk/GSASIIpwd.py


Ignore:
Timestamp:
Mar 31, 2017 2:41:15 PM (5 years ago)
Author:
vondreele
Message:

make clearer H->R & R->H transformation labels
implement generic unit scatterer for reflectometry (& small angle) modeling
implement plot of scattering contrast with transition markers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r2763 r2767  
    19321932            name = layer['Name']
    19331933            cid = str(ilay)+';'
    1934             for parm in ['Thick','Rough','DenMul','Mag SLD']:
     1934            parmDict[cid+'Name'] = name
     1935            for parm in ['Thick','Rough','DenMul','Mag SLD','iDenMul']:
    19351936                parmDict[cid+parm] = layer.get(parm,[0.,False])[0]
    19361937                if layer.get(parm,[0.,False])[1]:
     
    19381939                    values.append(layer[parm][0])
    19391940                    bounds.append(Bounds[parm])
    1940             parmDict[cid+'rho'] = Substances[name]['Scatt density']
    1941             parmDict[cid+'irho'] = Substances[name].get('XImag density',0.)
     1941            if name not in ['vacuum','unit scatter']:
     1942                parmDict[cid+'rho'] = Substances[name]['Scatt density']
     1943                parmDict[cid+'irho'] = Substances[name].get('XImag density',0.)
    19421944        return parmDict,varyList,values,bounds
    19431945   
     
    19601962            line2 = ' Scattering density: Real %.5g'%(Substances[name]['Scatt density']*parmDict[cid+'DenMul'])
    19611963            line2 += ' Imag %.5g'%(Substances[name].get('XImag density',0.)**parmDict[cid+'DenMul'])
    1962             for parm in ['Thick','Rough','DenMul','Mag SLD']:
     1964            for parm in ['Thick','Rough','DenMul','Mag SLD','iDenMul']:
    19631965                if parm in layer:
    19641966                    layer[parm][0] = parmDict[cid+parm]
     
    19911993            depth[ilay] = parmDict[cid+'Thick']
    19921994            sigma[ilay] = parmDict[cid+'Rough']
    1993             rho[ilay] = parmDict[cid+'rho']*parmDict[cid+'DenMul']
     1995            if parmDict[cid+'Name'] == u'unit scatter':
     1996                rho[ilay] = parmDict[cid+'DenMul']
     1997                irho[ilay] = parmDict[cid+'iDenMul']
     1998            elif 'vacuum' != parmDict[cid+'Name']:
     1999                rho[ilay] = parmDict[cid+'rho']*parmDict[cid+'DenMul']
     2000                irho[ilay] = parmDict[cid+'irho']*parmDict[cid+'DenMul']
    19942001            if cid+'Mag SLD' in parmDict:
    19952002                rho[ilay] += parmDict[cid+'Mag SLD']
    1996             irho[ilay] = parmDict[cid+'irho']*parmDict[cid+'DenMul']
    1997             A,B = abeles(0.5*Q,depth,rho,irho,sigma[1:])     #Q --> k, offset roughness for abeles
     2003        A,B = abeles(0.5*Q,depth,rho,irho,sigma[1:])     #Q --> k, offset roughness for abeles
    19982004        Ic += (A**2+B**2)*Scale     
    19992005        return Ic
     
    20072013    Ic[:] = 0
    20082014    Bounds = {'Scale':[data['Scale'][0]*.85,data['Scale'][0]/.85],'FltBack':[None,None],
    2009               'DenMul':[0.,None],'Thick':[1.,None],'Rough':[0.,None],'Mag SLD':[-10.,10.]}
     2015              'DenMul':[None,None],'Thick':[1.,None],'Rough':[0.,None],'Mag SLD':[-10.,10.],'iDenMul':[None,None]}
    20102016    parmDict,varyList,values,bounds = GetModelParms()
    20112017    Msg = 'Failed to converge'
     
    21322138        if 'Rough' in layer:    #skips first layer
    21332139            sigma[ilayer] = layer['Rough'][0]
    2134         rho[ilayer] = Substances[name]['Scatt density']*layer['DenMul'][0]
     2140        if 'unit scatter' == name:
     2141            rho[ilayer] = layer['DenMul'][0]
     2142            irho[ilayer] = layer['iDenMul'][0]
     2143        else:
     2144            rho[ilayer] = Substances[name]['Scatt density']*layer['DenMul'][0]
     2145            irho[ilayer] = Substances[name].get('XImag density',0.)*layer['DenMul'][0]
    21352146        if 'Mag SLD' in layer:
    21362147            rho[ilayer] += layer['Mag SLD'][0]
    2137         irho[ilayer] = Substances[name].get('XImag density',0.)*layer['DenMul'][0]
    2138         A,B = abeles(0.5*Q[iBeg:iFin],depth,rho,irho,sigma[1:])     #Q --> k, offset roughness for abeles
     2148    A,B = abeles(0.5*Q[iBeg:iFin],depth,rho,irho,sigma[1:])     #Q --> k, offset roughness for abeles
    21392149    Ic[iBeg:iFin] = (A**2+B**2)*Scale+Ib[iBeg:iFin]
    21402150
Note: See TracChangeset for help on using the changeset viewer.