Changeset 2598


Ignore:
Timestamp:
Dec 21, 2016 3:01:03 PM (5 years ago)
Author:
vondreele
Message:

serviceable derivatives for mag moments - not perfect except for single axis moments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r2596 r2598  
    10441044        Q = HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]-Gdata[:,nxs,:,:] #Mxyz,Nref,Nop,Natm = BPM in magstrfc.for OK
    10451045        NQ = np.where(np.abs(Q)>0.,1./np.abs(Q),0.)     #this sort of works esp for 1 axis moments
     1046#        NQ2 = np.where(np.abs(Q)>0.,1./np.sqrt(np.sum(Q**2,axis=0)),0.)
    10461047        dqdm = np.array([np.outer(hm,hm)-np.eye(3) for hm in HM.T]).T   #Mxyz,Mxyz,Nref (3x3 matrix)
    10471048        dqmx = dqdm[:,:,:,nxs,nxs]*dGdm[:,nxs,nxs,:,:]
    1048         dqmx = np.sum(dqmx,axis=1)   #matrix * vector = vector
    1049         dmx = NQ*Q*dGdM[:,nxs,:,:]+dqmx                                    #*Mag canceled out of dqmx term
     1049        dqmx2 = np.sum(dqmx,axis=1)   #matrix * vector = vector
     1050        dqmx1 = np.swapaxes(np.swapaxes(np.inner(dqdm.T,dGdm.T),0,1),2,3)
     1051        dmx = NQ*Q*dGdM[:,nxs,:,:]-Q*dqmx2                                #*Mag canceled out of dqmx term
    10501052       
    10511053        fam = Q*TMcorr[nxs,:,nxs,:]*cosm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #Mxyz,Nref,Nop,Natm
Note: See TracChangeset for help on using the changeset viewer.