Ignore:
Timestamp:
Dec 21, 2016 8:46:09 AM (5 years ago)
Author:
vondreele
Message:

tidy up PDF setup - add IofQmin? default
something that works for 1D mag moments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r2550 r2596  
    647647    SGT = np.array([ops[1] for ops in SGData['SGOps']])
    648648    Ncen = len(SGData['SGCen'])
    649     Nops = len(SGMT)
     649    Nops = len(SGMT)*Ncen*(1+SGData['SGInv'])
    650650    FFtables = calcControls['FFtables']
    651651    BLtables = calcControls['BLtables']
     
    744744        if 'N' in calcControls[hfx+'histType'] and parmDict[pfx+'isMag']:
    745745            MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T   #Nref,Natm
    746             TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Mdata*Fdata*MF/(2*Nops*Ncen)     #Nref,Natm
     746            TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Fdata*Mdata*MF/(2*Nops)     #Nref,Natm
    747747            if SGData['SGInv']:
    748748                mphase = np.hstack((phase,-phase))
    749                 TMcorr = TMcorr/2.
    750749            else:
    751750                mphase = phase
     
    762761            fams = np.sum(np.sum(fam,axis=-1),axis=-1)                          #xyz,Nref
    763762            fbms = np.sum(np.sum(fbm,axis=-1),axis=-1)                          #ditto
    764 #            GSASIIpath.IPyBreak()
    765763            refl.T[9] = np.sum(fams**2,axis=0)+np.sum(fbms**2,axis=0)
    766764            refl.T[7] = np.copy(refl.T[9])               
     
    994992    Gdata = SGData['MagMom'][nxs,:,nxs]*Gdata   #flip vectors according to spin flip
    995993    Gdata = np.inner(Amat,Gdata.T)              #convert back to cart. space MXYZ, Natoms, NOps
    996 #    dGdM = SGData['MagMom'][nxs,:,nxs]*dGdM
    997994    Gdata = np.swapaxes(Gdata,1,2)              # put Natoms last - Mxyz,Nops,Natms
    998 #    GSASIIpath.IPyBreak()
    999995    Mag = np.tile(Mag[:,nxs],Nops).T  #make Mag same length as Gdata
    1000     dGdm = (1.-Gdata**2)/Mag                        #1/Mag removed - canceled out in dqmx=sum(dqdm*dGdm)
     996    dGdm = (1.-Gdata**2)                        #1/Mag removed - canceled out in dqmx=sum(dqdm*dGdm)
    1001997    dFdMx = np.zeros((nRef,mSize,3))
    1002998    Uij = np.array(G2lat.U6toUij(Uijdata))
     
    10301026        Tindx = np.array([refDict['FF']['El'].index(El) for El in Tdata])
    10311027        MF = refDict['FF']['MF'][iBeg:iFin].T[Tindx].T   #Nref,Natm
    1032         TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Fdata*Mdata*MF/Nops     #Nref,Natm                                  #Nref,Natm
     1028        TMcorr = 0.539*(np.reshape(Tiso,Tuij.shape)*Tuij)[:,0,:]*Fdata*Mdata*MF/(2*Nops)     #Nref,Natm                                  #Nref,Natm
    10331029        if SGData['SGInv']:
    10341030            mphase = np.hstack((phase,-phase))
    1035             TMcorr = TMcorr/2.
    10361031            Uniq = np.hstack((Uniq,-Uniq))      #Nref,Nops,hkl
    10371032            Hij = np.hstack((Hij,Hij))
     
    10481043        eDotK = np.sum(HM[:,:,nxs,nxs]*Gdata[:,nxs,:,:],axis=0)
    10491044        Q = HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]-Gdata[:,nxs,:,:] #Mxyz,Nref,Nop,Natm = BPM in magstrfc.for OK
     1045        NQ = np.where(np.abs(Q)>0.,1./np.abs(Q),0.)     #this sort of works esp for 1 axis moments
    10501046        dqdm = np.array([np.outer(hm,hm)-np.eye(3) for hm in HM.T]).T   #Mxyz,Mxyz,Nref (3x3 matrix)
    10511047        dqmx = dqdm[:,:,:,nxs,nxs]*dGdm[:,nxs,nxs,:,:]
    10521048        dqmx = np.sum(dqmx,axis=1)   #matrix * vector = vector
    1053         dmx = Q*dGdM[:,nxs,:,:]+dqmx*Mag[nxs,nxs,:,:]                                    #*Mag canceled out of dqmx term
    1054 #        GSASIIpath.IPyBreak()
    1055 #
     1049        dmx = NQ*Q*dGdM[:,nxs,:,:]+dqmx                                    #*Mag canceled out of dqmx term
     1050       
    10561051        fam = Q*TMcorr[nxs,:,nxs,:]*cosm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #Mxyz,Nref,Nop,Natm
    10571052        fbm = Q*TMcorr[nxs,:,nxs,:]*sinm[nxs,:,:,:]*Mag[nxs,nxs,:,:]
Note: See TracChangeset for help on using the changeset viewer.