Ignore:
Timestamp:
Jun 4, 2015 1:49:58 PM (8 years ago)
Author:
vondreele
Message:

refactor DDataGUI - mostly move event routines to be inside respective sizer routines
Enable Flack parameter - function OK; derivatives need work
Allow inversion of noncentrosymmetric structures in SymOpDialog? - to test enantiomers
some work to make pdf stuff neutron TOF friendly - not complete
fix Debye background function - now works; refactor result printing for it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r1877 r1878  
    816816    FFtables = calcControls['FFtables']
    817817    BLtables = calcControls['BLtables']
     818    Flack = 1.0
     819    if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType']:
     820        Flack = 1.-2.*parmDict[phfx+'Flack']
    818821    Tdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata = GetAtomFXU(pfx,calcControls,parmDict)
    819822    FF = np.zeros(len(Tdata))
     
    856859            FPP = np.repeat(FPP.T,len(SGT),axis=0)
    857860        Bab = np.repeat(parmDict[phfx+'BabA']*np.exp(-parmDict[phfx+'BabU']*SQfactor),len(SGT))
    858         Flack = 1.0
    859 #        Flack = 1.-2.*parmDict[phfx+'Flack']
    860861        Tindx = np.array([refDict['FF']['El'].index(El) for El in Tdata])
    861862        FF = np.repeat(refDict['FF']['FF'][iBeg:iFin].T[Tindx].T,len(SGT),axis=0)
     
    912913    dFdua = np.zeros((nRef,mSize,6))
    913914    dFdbab = np.zeros((nRef,2))
     915    dFdfl = np.zeros(nRef)
     916    Flack = 1.0
     917    if not SGData['SGInv'] and 'S' in calcControls[hfx+'histType']:
     918        Flack = 1.-2.*parmDict[phfx+'Flack']
    914919    for iref,refl in enumerate(refDict['RefList']):
    915920        if 'T' in calcControls[hfx+'histType']:
     
    935940        Tuij = np.where(HbH<1.,np.exp(HbH),1.0)
    936941        Tcorr = Tiso*Tuij
    937         Flack = 1.0
    938 #        Flack = (1.-2.*parmDict[phfx+'Flack'])
    939942        fot = (FF+FP-Bab)*occ*Tcorr
    940         fotp = Flack*FPP*occ*Tcorr
    941         fa = np.array([fot[:,np.newaxis]*cosp,fotp[:,np.newaxis]*cosp])       #non positions
    942         fb = np.array([fot[:,np.newaxis]*sinp,-fotp[:,np.newaxis]*sinp])
     943        fotp = FPP*occ*Tcorr
     944        fa = np.array([fot[:,np.newaxis]*cosp,-Flack*fotp[:,np.newaxis]*sinp])       #non positions
     945        fb = np.array([fot[:,np.newaxis]*sinp,Flack*fotp[:,np.newaxis]*cosp])
    943946       
    944947        fas = np.sum(np.sum(fa,axis=1),axis=1)      #real sum over atoms & unique hkl
    945948        fbs = np.sum(np.sum(fb,axis=1),axis=1)      #imag sum over atoms & uniq hkl
    946         fax = np.array([-fot[:,np.newaxis]*sinp,-fotp[:,np.newaxis]*sinp])   #positions
    947         fbx = np.array([fot[:,np.newaxis]*cosp,-fot[:,np.newaxis]*cosp])
     949        fax = np.array([-fot[:,np.newaxis]*sinp,-fotp[:,np.newaxis]*cosp])   #positions
     950        fbx = np.array([fot[:,np.newaxis]*cosp,-fotp[:,np.newaxis]*sinp])
    948951        #sum below is over Uniq
    949952        dfadfr = np.sum(fa/occ[:,np.newaxis],axis=2)        #Fdata != 0 ever avoids /0. problem
     
    958961            dfbdua = np.sum(-Hij*fb[:,:,:,np.newaxis],axis=2)
    959962            dfbdba = np.sum(-sinp*(occ*Tcorr)[:,np.newaxis],axis=1)
     963            dfadfl = np.sum(fotp[:,np.newaxis]*cosp)
     964            dfbdfl = np.sum(-fotp[:,np.newaxis]*sinp)
    960965        else:
    961966            dfbdfr = np.zeros_like(dfadfr)
     
    964969            dfbdua = np.zeros_like(dfadua)
    965970            dfbdba = np.zeros_like(dfadba)
     971            dfadfl = 0.0
     972            dfbdfl = 0.0
    966973        #NB: the above have been checked against PA(1:10,1:2) in strfctr.for for Al2O3!   
    967974        if 'P' in calcControls[hfx+'histType']: #checked perfect for centro & noncentro
     
    982989            dFdui[iref] = 2.*SA*(dfadui[0]+dfbdui[1])+2.*SB*(dfbdui[0]+dfadui[1])
    983990            dFdua[iref] = 2.*SA*(dfadua[0]+dfbdua[1])+2.*SB*(dfbdua[0]+dfadua[1])
     991            dFdfl[iref] = -4.*SA*(dfadfl+dfbdfl)-4.*SB*(dfbdfl+dfadfl)
    984992        dFdbab[iref] = 2.*fas[0]*np.array([np.sum(dfadba*dBabdA),np.sum(-dfadba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T+ \
    985993            2.*fbs[0]*np.array([np.sum(dfbdba*dBabdA),np.sum(-dfbdba*parmDict[phfx+'BabA']*SQfactor*dBabdA)]).T
     994           
    986995        #loop over atoms - each dict entry is list of derivatives for all the reflections
    987996    for i in range(len(Mdata)):
     
    9971006        dFdvDict[pfx+'AU13:'+str(i)] = 0.5*dFdua.T[4][i]
    9981007        dFdvDict[pfx+'AU23:'+str(i)] = 0.5*dFdua.T[5][i]
    999     dFdvDict[pfx+'BabA'] = dFdbab.T[0]
    1000     dFdvDict[pfx+'BabU'] = dFdbab.T[1]
     1008    dFdvDict[phfx+'BabA'] = dFdbab.T[0]
     1009    dFdvDict[phfx+'BabU'] = dFdbab.T[1]
     1010    dFdvDict[phfx+'Flack'] = dFdfl.T
    10011011    return dFdvDict
    10021012   
     
    11121122        dFdvDict[pfx+'AU23:'+str(i)] = .5*dFdua.T[5][i]
    11131123        #need dFdvDict[pfx+'Xsin:'+str[i]:str(m)], etc for modulations...
    1114     dFdvDict[pfx+'BabA'] = dFdbab.T[0]
    1115     dFdvDict[pfx+'BabU'] = dFdbab.T[1]
     1124    dFdvDict[phfx+'BabA'] = dFdbab.T[0]
     1125    dFdvDict[phfx+'BabU'] = dFdbab.T[1]
    11161126    return dFdvDict
    11171127   
Note: See TracChangeset for help on using the changeset viewer.