Ignore:
Timestamp:
Oct 27, 2016 12:50:38 PM (6 years ago)
Author:
vondreele
Message:

fix move difference curve problem
mag derivs are better but still not right - refinements work (sort of)
fix to testDeriv to show atom pos derivs for depVarList parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r2506 r2508  
    12221222    Mag = np.sqrt(np.sum(Gdata**2,axis=0))      #magnitude of moments for uniq atoms
    12231223    Gdata = np.where(Mag>0.,Gdata/Mag,0.)       #normalze mag. moments
    1224     dGdM = np.copy(Gdata)
     1224    dGdM = np.repeat(Gdata[:,nxs,:],Nops*Ncen*(1+SGData['SGInv']),axis=1)
    12251225    Gdata = np.inner(Bmat,Gdata.T)              #convert to crystal space
    12261226    Gdata = np.inner(Gdata.T,SGMT).T            #apply sym. ops.
     
    12351235    if SGData['SGInv']:
    12361236        Mag = np.repeat(Mag,2,axis=0)
    1237     dGdm = (1.-Gdata**2)    #1/Mag removed - canceled out in dqmx=sum(dqdm*dGdm)
     1237    dGdm = (1.-Gdata**2)                        #1/Mag removed - canceled out in dqmx=sum(dqdm*dGdm)
    12381238    dFdMx = np.zeros((nRef,mSize,3))
    12391239    Uij = np.array(G2lat.U6toUij(Uijdata))
     
    12841284        cosm = np.cos(mphase)                               #ditto
    12851285        HM = np.inner(Bmat.T,H)                             #put into cartesian space
    1286         HM = HM/np.sqrt(np.sum(HM**2,axis=0))               
     1286        HM = HM/np.sqrt(np.sum(HM**2,axis=0))               #unit vector for H
    12871287        eDotK = np.sum(HM[:,:,nxs,nxs]*Gdata[:,nxs,:,:],axis=0)
    12881288        Q = HM[:,:,nxs,nxs]*eDotK[nxs,:,:,:]-Gdata[:,nxs,:,:] #Mxyz,Nref,Nop,Natm = BPM in magstrfc.for OK
    12891289        dqdm = np.array([np.outer(hm,hm)-np.eye(3) for hm in HM.T]).T   #Mxyz,Mxyz,Nref (3x3 matrix)
    12901290        dqmx = np.sum(dqdm[:,:,:,nxs,nxs]*dGdm[:,nxs,nxs,:,:],axis=0)   #matrix * vector = vector
    1291         dmx = Q*Gdata[:,nxs,:,:]+dqmx      #*Mag canceled out of dqmx term
    1292         fam = Q*TMcorr[nxs,:,nxs,:]*cosm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #ditto
    1293         fbm = Q*TMcorr[nxs,:,nxs,:]*sinm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #ditto
    1294         fams = np.sum(np.sum(fam,axis=-1),axis=-1)                          #Mxyz,Nref
    1295         fbms = np.sum(np.sum(fbm,axis=-1),axis=-1)                          #ditto
     1291        dmx = Q*dGdM[:,nxs,:,:]+dqmx                                    #*Mag canceled out of dqmx term
     1292        fam = Q*TMcorr[nxs,:,nxs,:]*cosm[nxs,:,:,:]*Mag[nxs,nxs,:,:]    #Mxyz,Nref,Nop,Natm
     1293        fbm = Q*TMcorr[nxs,:,nxs,:]*sinm[nxs,:,:,:]*Mag[nxs,nxs,:,:]
     1294        fams = np.sum(np.sum(fam,axis=-1),axis=-1)                      #Mxyz,Nref
     1295        fbms = np.sum(np.sum(fbm,axis=-1),axis=-1)
    12961296        famx = Q*TMcorr[nxs,:,nxs,:]*Mag[nxs,nxs,:,:]*sinm[nxs,:,:,:]   #Mxyz,Nref,Nops,Natom
    12971297        fbmx = Q*TMcorr[nxs,:,nxs,:]*Mag[nxs,nxs,:,:]*cosm[nxs,:,:,:]
Note: See TracChangeset for help on using the changeset viewer.