Changeset 4143


Ignore:
Timestamp:
Sep 11, 2019 8:30:14 AM (4 years ago)
Author:
vondreele
Message:

revert back to 4138 version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r4140 r4143  
    14821482    phfx = pfx.split(':')[0]+hfx
    14831483    ast = np.sqrt(np.diag(G))
    1484     g = nl.inv(G)
    1485     ainv = np.sqrt(np.diag(g))
    1486     GS = G/np.outer(ast,ast)
    1487     uAmat = G2lat.Gmat2AB(GS)[0]
    1488     Ginv = g/np.outer(ainv,ainv)
     1484#    GS = G/np.outer(ast,ast)
     1485#    uAmat = G2lat.Gmat2AB(GS)[0]
    14891486    Mast = twopisq*np.multiply.outer(ast,ast)   
    14901487    SGInv = SGData['SGInv']
    14911488    SGMT = np.array([ops[0].T for ops in SGData['SGOps']])
    1492 #    Ncen = len(SGData['SGCen'])
     1489    Ncen = len(SGData['SGCen'])
    14931490    Nops = len(SGMT)*(1+SGData['SGInv'])
    14941491    SSGMT = np.array([ops[0].T for ops in SSGData['SSGOps']])
     
    15141511        mXYZ = np.array([[xyz[0] for xyz in list(G2spc.GenAtom(xyz,SGData,All=True,Move=True))] for xyz in (Xdata+dXdata).T])%1. #Natn,Nop,xyz
    15151512        MmodA,MmodB = G2mth.MagMod(glTau,mXYZ,modQ,MSSdata,SGData,SSGData)  #Ntau,Nops,Natm,Mxyz sum matches drawing
    1516         Mmod = MmodA+MmodB
    15171513       
    15181514        if not SGData['SGGray']:    #for fixed Mx,My,Mz
     
    15231519            GSdata = SGData['MagMom'][nxs,:,nxs]*GSdata   #flip vectors according to spin flip * det(opM)
    15241520            GSdata = np.swapaxes(GSdata,0,1)    #Nop,Natm,Mxyz
    1525             Mmod += GSdata[nxs,:,:,:]
    1526            
    1527         Mag = np.array([np.sqrt(np.inner(mag,np.inner(mag,Ginv))) for mag in Mmod])     #Ntau,Nop,Natm
    1528         Kdata = np.inner(Mmod,uAmat)     #Cartesian vectors; Mxyz,Natm,Nop,Ntau
    1529         Kmean = np.sqrt(np.sum(Kdata**2,axis=-1))
    1530         Kdata /= Kmean[:,:,:,nxs]      #normalized cartesian mag. moment Ntau,Nop,Natm,Mxyz
    15311521
    15321522    FF = np.zeros(len(Tdata))
     
    16031593            MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T   #Nref,Natm
    16041594            TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*Fdata*MF/(2.*Nops)     #Nref,Natm
    1605 #                     
    1606             HM = np.inner(Bmat,HP.T)                            #put into cartesian space
    1607             eM = (HM/np.sqrt(np.sum(HM**2,axis=0))).T               #& normalize; Nref,Mhkl
    1608             eDotK = np.sum(eM[:,nxs,nxs,nxs,:]*Kdata[nxs,:,:,:,:],axis=-1)  #Nref,Ntau,Nops,Natm
    1609             Q = eM[:,nxs,nxs,nxs,:]*eDotK[:,:,:,:,nxs]-Kdata[nxs,:,:,:,:]   #Nref,Ntau,Nops,Natm,Mxyz
    1610             Q = 1.0
    1611            
     1595                     
     1596            HM = np.inner(Bmat.T,HP.T)                            #put into cartesian space
     1597            eM = HM/np.sqrt(np.sum(HM**2,axis=0))               #& normalize
     1598#for fixed moments --> m=0 reflections
    16121599            fam0 = 0.
    16131600            fbm0 = 0.
    16141601            if not SGData['SGGray']:     #correct -fixed Mx,My,Mz contribution             
    1615                 fam0 = Q*TMcorr[:,nxs,nxs,:,nxs]*GSdata[nxs,nxs,:,:,:]*cosm[:,nxs,:,:,nxs]    #Nref,Ntau,Nops,Natm,Mxyz
    1616                 fbm0 = Q*TMcorr[:,nxs,nxs,:,nxs]*GSdata[nxs,nxs,:,:,:]*sinm[:,nxs,:,:,nxs]   
     1602                fam0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*cosm[:,:,:,nxs]    #Nref,Nops,Natm,Mxyz
     1603                fbm0 = TMcorr[:,nxs,:,nxs]*GSdata[nxs,:,:,:]*sinm[:,:,:,nxs]   
    16171604#for modulated moments --> m != 0 reflections
    16181605       
    1619             fams = Q*TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*cosm[i,nxs,:,:,nxs]-    \
     1606            fams = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*cosm[i,nxs,:,:,nxs]-    \
    16201607                np.sign(H[3,i])*MmodB*sinm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])          #Nref,Ntau,Nops,Natm,Mxyz
    16211608                       
    1622             fbms = Q*TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*sinm[i,nxs,:,:,nxs]+    \
     1609            fbms = TMcorr[:,nxs,nxs,:,nxs]*np.array([np.where(H[3,i]!=0,(MmodA*sinm[i,nxs,:,:,nxs]+    \
    16231610                np.sign(H[3,i])*MmodB*cosm[i,nxs,:,:,nxs]),0.) for i in range(mRef)])          #Nref,Ntau,Nops,Natm,Mxyz
    16241611           
    16251612            if not SGData['SGGray']:
    1626                 fams *= .5
    1627                 fbms *= .5
    1628                 fams += fam0
    1629                 fbms += fbm0
    1630                
    1631 #   do GL integral before making mag F's - less correct; gives F's where there shouldn't be any                     
    1632 #                       
    1633 #            fass = np.sum(glWt[nxs,:,nxs,nxs,nxs]*fams,axis=1)         #GL integration
    1634 #            fbss = np.sum(glWt[nxs,:,nxs,nxs,nxs]*fbms,axis=1)
    1635 #           
    1636 #            fas = np.sum(np.sum(fass,axis=-1),axis=-1)      #Nref,Ntau,Mxyz; sum ops & atoms
    1637 #            fbs = np.sum(np.sum(fbss,axis=-1),axis=-1)
    1638 #            refl.T[10] = np.sum(fas**2,axis=1)+np.sum(fbs**2,axis=1)
    1639 #            refl.T[11] = atan2d(fbs[:,0],fas[:,0])
    1640 ##
    1641 # do GL integral after making mag. F's - better but not right               
    1642                
     1613                fams *= 0.5
     1614                fbms *= 0.5
     1615                fams += fam0[:,nxs,:,:,:]
     1616                fbms += fbm0[:,nxs,:,:,:]
     1617                       
    16431618            famqs = np.sum(np.sum(fams,axis=-2),axis=-2)      #Nref,Ntau,Mxyz; sum ops & atoms
    16441619            fbmqs = np.sum(np.sum(fbms,axis=-2),axis=-2)
     
    16531628            fbmcs = np.nan_to_num(fbmcs)
    16541629           
    1655             fass = np.sum(famqs**2,axis=-1)*(1.-np.sum(eM[:,nxs,:]*famcs,axis=-1)**2)      #mag intensity calc F^2-(e.F)^2
    1656             fbss = np.sum(fbmqs**2,axis=-1)*(1.-np.sum(eM[:,nxs,:]*fbmcs,axis=-1)**2)       #WRONG - needs mag. moment not F!
     1630            fass = np.sum(famqs**2,axis=-1)*(1.-np.sum(eM.T[:,nxs,:]*famcs,axis=-1)**2)      #mag intensity calc F^2-(e.F)^2
     1631            fbss = np.sum(fbmqs**2,axis=-1)*(1.-np.sum(eM.T[:,nxs,:]*fbmcs,axis=-1)**2)
    16571632           
    1658             fas = np.sum(glWt*fass,axis=1)          #GL integration
     1633            fas = np.sum(glWt*fass,axis=1)
    16591634            fbs = np.sum(glWt*fbss,axis=1)
    16601635           
    16611636            refl.T[10] = fas+fbs
    16621637            refl.T[11] = atan2d(fbs,fas)
    1663 #
     1638
    16641639        else:
    16651640            GfpuA = G2mth.Modulation(Uniq,UniqP,nWaves,Fmod,Xmod,Umod,glTau,glWt) #2 x refBlk x sym X atoms
Note: See TracChangeset for help on using the changeset viewer.