Changeset 1175


Ignore:
Timestamp:
Dec 19, 2013 9:37:07 AM (10 years ago)
Author:
vondreele
Message:

add surface roughness (Surotti model) to Bragg-Brentano sample parameters
seems to work OK but I don't have a good test data set.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r1174 r1175  
    8989    elif 'Bragg' in Geometry:
    9090        return 0.0
     91       
     92def SurfaceRough(SRA,SRB,Tth):
     93    ''' Suortti surface roughness correction
     94    '''
     95    sth = npsind(Tth/2.)
     96    T1 = np.exp(-SRB/sth)
     97    T2 = SRA+(1.-SRA)*np.exp(-SRB)
     98    return (SRA+(1.-SRA)*T1)/T2
     99   
     100def SurfaceRoughDerv(SRA,SRB,Tth):
     101    ''' Suortti surface roughness correction derivatives
     102    '''
     103    sth = npsind(Tth/2.)
     104    T1 = np.exp(-SRB/sth)
     105    T2 = SRA+(1.-SRA)*np.exp(-SRB)
     106    Trans = (SRA+(1.-SRA)*T1)/T2
     107    dydSRA = ((1.-T1)*T2-(1.-np.exp(-SRB))*Trans)/T2**2
     108    dydSRB = ((SRA-1.)*T1*T2/sth-Trans*(SRA-T2))/T2**2
     109    return [dydSRA,dydSRB]
    91110
    92111def Absorb(Geometry,MuR,Tth,Phi=0,Psi=0):
  • trunk/GSASIIpwdGUI.py

    r1147 r1175  
    11001100                copyNames += ['DisplaceX','DisplaceY','Absorption']
    11011101            else:       #Bragg-Brentano
    1102                 copyNames += ['Shift','Transparency']
     1102                copyNames += ['Shift','Transparency','SurfRoughA','SurfRoughB']
    11031103        if len(addNames):
    11041104         copyNames += addNames
     
    13111311    if 'FreePrm3' not in data:
    13121312        data['FreePrm3'] = 0.
     1313    if 'SurfRoughA' not in data:
     1314        data['SurfRoughA'] = [0.,False]
     1315        data['SurfRoughB'] = [0.,False]
    13131316#patch end
    13141317   
     
    13221325    elif data['Type'] == 'Bragg-Brentano':
    13231326        parms += [['Shift',u'Sample displacement(\xb5m): '],
    1324             ['Transparency',u'Sample transparency(1/\xb5eff, cm): '],]
     1327            ['Transparency',u'Sample transparency(1/\xb5eff, cm): '],
     1328            ['SurfRoughA','Surface roughness A: '],
     1329            ['SurfRoughB','Surface roughness B: '],]
    13251330    parms.append(['Omega','Goniometer omega:',])
    13261331    parms.append(['Chi','Goniometer chi:',])
  • trunk/GSASIIstrIO.py

    r1160 r1175  
    22222222        Type = Sample['Type']
    22232223        if 'Bragg' in Type:             #Bragg-Brentano
    2224             for item in ['Scale','Shift','Transparency']:       #surface roughness?, diffuse scattering?
     2224            for item in ['Scale','Shift','Transparency','SurfRoughA','SurfRoughB']:
    22252225                sampDict[hfx+item] = Sample[item][0]
    22262226                if Sample[item][1]:
     
    22952295        varstr = ' refine:'
    22962296        if 'Bragg' in Sample['Type']:
    2297             for item in ['Scale','Shift','Transparency']:
     2297            for item in ['Scale','Shift','Transparency','SurfRoughA','SurfRoughB']:
    22982298                ptlbls += '%14s'%(item)
    22992299                ptstr += '%14.4f'%(Sample[item][0])
     
    24202420    def SetSampleParms(pfx,Sample,parmDict,sigDict):
    24212421        if 'Bragg' in Sample['Type']:             #Bragg-Brentano
    2422             sampSig = [0 for i in range(3)]
    2423             for i,item in enumerate(['Scale','Shift','Transparency']):       #surface roughness?, diffuse scattering?
     2422            sampSig = [0 for i in range(5)]
     2423            for i,item in enumerate(['Scale','Shift','Transparency','SurfRoughA','SurfRoughB']):
    24242424                Sample[item][0] = parmDict[pfx+item]
    24252425                if pfx+item in sigDict:
     
    25142514        refine = False
    25152515        if 'Bragg' in Sample['Type']:
    2516             for i,item in enumerate(['Scale','Shift','Transparency']):
     2516            for i,item in enumerate(['Scale','Shift','Transparency','SurfRoughA','SurfRoughB']):
    25172517                ptlbls += '%14s'%(item)
    25182518                ptstr += '%14.4f'%(Sample[item][0])
  • trunk/GSASIIstrMath.py

    r1140 r1175  
    10251025        return G2pwd.Absorb('Cylinder',parmDict[hfx+'Absorption'],refl[5],0,0)
    10261026    else:
    1027         return 1.0
     1027        return G2pwd.SurfaceRough(parmDict[hfx+'SurfRoughA'],parmDict[hfx+'SurfRoughB'],refl[5])
    10281028   
    10291029def GetAbsorbDerv(refl,hfx,calcControls,parmDict):
     
    10321032        return G2pwd.AbsorbDerv('Cylinder',parmDict[hfx+'Absorption'],refl[5],0,0)
    10331033    else:
    1034         return 0.0
     1034        return G2pwd.SurfaceRoughDerv(parmDict[hfx+'SurfRoughA'],parmDict[hfx+'SurfRoughB'],refl[5])
    10351035   
    10361036def GetIntensityCorr(refl,uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict):
     
    15821582                    hfx+'I(L2)/I(L1)':[1.0,'L1/L2'],hfx+'Zero':[dpdZ,'pos'],hfx+'Lam':[dpdw,'pos'],
    15831583                    hfx+'Shift':[dpdSh,'pos'],hfx+'Transparency':[dpdTr,'pos'],hfx+'DisplaceX':[dpdX,'pos'],
    1584                     hfx+'DisplaceY':[dpdY,'pos'],hfx+'Absorption':[dFdAb,'int'],}
     1584                    hfx+'DisplaceY':[dpdY,'pos'],}
     1585                if 'Bragg' in calcControls[hfx+'instType']:
     1586                    names.update({hfx+'SurfRoughA':[dFdAb[0],'int'],
     1587                        hfx+'SurfRoughB':[dFdAb[1],'int'],})
     1588                else:
     1589                    names.update({hfx+'Absorption':[dFdAb,'int'],})
    15851590                for name in names:
    15861591                    item = names[name]
Note: See TracChangeset for help on using the changeset viewer.