Changeset 917


Ignore:
Timestamp:
May 17, 2013 10:25:30 AM (9 years ago)
Author:
vondreele
Message:

final fixes to RB derivs - all seem OK now

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstruct.py

    r915 r917  
    3737   
    3838ateln2 = 8.0*math.log(2.0)
    39 DEBUG = True
     39DEBUG = False
    4040
    4141def GetControls(GPXfile):
     
    754754        VModel = RBData['Vector'][RBObj['RBId']]
    755755        Q = RBObj['Orient'][0]
    756         QM = G2mth.Q2Mat(Q)
    757756        Pos = RBObj['Orig'][0]
    758757        jrb = VRBIds.index(RBObj['RBId'])
     
    785784            dFdu = np.array([dFdvDict[pfx+Uid+str(AtLookup[atId])] for Uid in atuIds]).T/gvec
    786785            dFdu = G2lat.U6toUij(dFdu.T)
    787             dFdu = np.tensordot(Amat,np.tensordot(Amat,dFdu,([1,0])),([0,1]))
    788            
     786            dFdu = np.tensordot(Amat,np.tensordot(Amat,dFdu,([1,0])),([0,1]))           
    789787            dFdu = G2lat.UijtoU6(dFdu)
    790788            atNum = AtLookup[atId]
     
    837835        for ia,atId in enumerate(RBObj['Ids']):
    838836            atNum = AtLookup[atId]
    839             dx = 0.00001
     837            dx = 0.0001
    840838            for i,name in enumerate(['RBRPx:','RBRPy:','RBRPz:']):
    841839                dFdvDict[pfx+name+rbsx] += dFdvDict[pfx+atxIds[i]+str(atNum)]
    842840            for iv in range(4):
    843841                Q[iv] -= dx
    844                 Cart1 = G2mth.prodQVQ(Q,Cart[ia])
     842                XYZ1,Cart1 = G2mth.UpdateRBXYZ(Bmat,RBObj,RBData,'Residue')
    845843                Q[iv] += 2.*dx
    846                 Cart2 = G2mth.prodQVQ(Q,Cart[ia])
     844                XYZ2,Cart2 = G2mth.UpdateRBXYZ(Bmat,RBObj,RBData,'Residue')
    847845                Q[iv] -= dx
    848                 dC = Cart2-Cart1
    849                 dXdO = np.inner(Bmat,G2mth.prodQVQ(Q,dC))/(2.*dx)
     846                dXdO = (XYZ2[ia]-XYZ1[ia])/(2.*dx)
    850847                for ix in [0,1,2]:
    851848                    dFdvDict[pfx+'RBR'+OIds[iv]+rbsx] += dXdO[ix]*dFdvDict[pfx+atxIds[ix]+str(atNum)]
     
    865862                dFdvDict[pfx+'RBRL12:'+rbsx] += rpd2*(-dFdu[3]*X[2]**2-2.*dFdu[2]*X[0]*X[1]+
    866863                    dFdu[4]*X[1]*X[2]+dFdu[5]*X[0]*X[2])
    867                 dFdvDict[pfx+'RBRL13:'+rbsx] += rpd2*(dFdu[0]*X[1]**2-2.*dFdu[1]*X[0]*X[2]+
     864                dFdvDict[pfx+'RBRL13:'+rbsx] += rpd2*(dFdu[4]*X[1]**2-2.*dFdu[1]*X[0]*X[2]+
    868865                    dFdu[3]*X[1]*X[2]+dFdu[5]*X[0]*X[1])
    869                 dFdvDict[pfx+'RBRL23:'+rbsx] += rpd2*(dFdu[0]*X[1]**2-2.*dFdu[0]*X[1]*X[2]+
     866                dFdvDict[pfx+'RBRL23:'+rbsx] += rpd2*(dFdu[5]*X[0]**2-2.*dFdu[0]*X[1]*X[2]+
    870867                    dFdu[3]*X[0]*X[2]+dFdu[4]*X[0]*X[1])
    871868            if 'S' in RBObj['ThermalMotion'][0]:
  • trunk/testDeriv.py

    r905 r917  
    8080                self.pawleyLookup = cPickle.load(file)
    8181                self.use = [False for i in range(len(self.varylist))]
    82                 self.delt = [max(abs(self.parmDict[name])*0.0001,1e-8) for name in self.varylist]
     82                self.delt = [max(abs(self.parmDict[name])*0.001,1e-6) for name in self.varylist]
    8383                file.close()
    8484                self.UpdateControls(event)
Note: See TracChangeset for help on using the changeset viewer.