Changeset 2327


Ignore:
Timestamp:
Jun 16, 2016 8:34:05 AM (5 years ago)
Author:
vondreele
Message:

dist & angles now work for seq results table; esds are fake

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r2326 r2327  
    34713471            calcobj.UpdateDict(PSvarDict)
    34723472            valList.append(calcobj.EvalExpression())
    3473             # if calcobj.su is not None: esdList[-1] = calcobj.su
     3473            if calcobj.su is not None: esdList[-1] = calcobj.su
    34743474        if not esdList:
    34753475            esdList = None
  • trunk/GSASIImath.py

    r2326 r2327  
    15291529    return dist   
    15301530   
    1531 def CalcDistSig(distance_dict, distance_atoms, parmDict,covData={}):
     1531def CalcDistSu(distance_dict, distance_atoms, parmDict,covData={}):
    15321532    '''default doc string
    15331533   
     
    15371537   
    15381538    '''
    1539     def calcDist(Atoms,SyOps,Amat):
    1540         XYZ = []
    1541         for i,atom in enumerate(Atoms):
    1542             Inv,M,T,C,U = SyOps[i]
    1543             XYZ.append(np.array(atom[1:4]))
    1544             XYZ[-1] = Inv*(np.inner(M,np.array(XYZ[-1]))+T)+C+U
    1545             XYZ[-1] = np.inner(Amat,XYZ[-1]).T
    1546         V1 = XYZ[1]-XYZ[0]
    1547         return np.sqrt(np.sum(V1**2))
    1548        
    1549     if not len(parmDict):
    1550         return 0.
    1551     pId = distance_dict['pId']
    1552     pfx = '%d::'%(pId)
    1553     A = [parmDict['%s::A%d'%(pId,i)] for i in range(6)]
    1554     Amat = G2lat.cell2AB(G2lat.A2cell(A))[0]
    1555     Oxyz = [parmDict['%s::A%s:%d'%(pId,x,distance_atoms[0])] for x in ['x','y','z']]
    1556     Txyz = [parmDict['%s::A%s:%d'%(pId,x,distance_atoms[1])] for x in ['x','y','z']]
    1557     inv = 1
    1558     symNo = distance_dict['symNo']
    1559     if symNo < 0:
    1560         inv = -1
    1561         symNo *= -1
    1562     cen = symNo/100
    1563     op = symNo%100-1
    1564     M,T = distance_dict['SGData']['SGOps'][op]
    1565     D = T*inv+distance_dict['SGData']['SGCen'][cen]
    1566     D += distance_dict['cellNo']
    1567     Txyz = np.inner(M*inv,Txyz)+D
    1568     dist = np.sqrt(np.sum(np.inner(Amat,(Txyz-Oxyz))**2))
    1569 
    1570     sig = -0.001
    1571     if 'covMatrix' in covData:
    1572         parmNames = []
    1573         dx = .00001
    1574         dadx = np.zeros(6)
    1575         for i in range(6):
    1576             ia = i/3
    1577             ix = i%3
    1578             Oxyz[ix+1] += dx
    1579             a0 = calcDist(Oatoms,SyOps,Amat)
    1580             Oatoms[ia][ix+1] -= 2*dx
    1581             dadx[i] = (calcDist(Oatoms,SyOps,Amat)-a0)/(2.*dx)
    1582         covMatrix = covData['covMatrix']
    1583         varyList = covData['varyList']
    1584         DistVcov = getVCov(names,varyList,covMatrix)
    1585         sig = np.sqrt(np.inner(dadx,np.inner(DistVcov,dadx)))
    1586         if sig < 0.001:
    1587             sig = -0.001
    1588    
    1589     return Dist,sig
     1539    sig = 0.001
     1540   
     1541    return sig
    15901542
    15911543def CalcAngle(angle_dict, angle_atoms, parmDict):
     
    16011553    ABxyz = [Axyz,Bxyz]
    16021554    symNo = angle_dict['symNo']
     1555    vec = np.zeros((2,3))
    16031556    for i in range(2):
    16041557        inv = 1
    16051558        if symNo[i] < 0:
    16061559            inv = -1
    1607             symNo[i] *= -1
    1608         cen = symNo[i]/100
    1609         op = symNo[i]%100-1
     1560        cen = inv*symNo[i]/100
     1561        op = inv*symNo[i]%100-1
    16101562        M,T = angle_dict['SGData']['SGOps'][op]
    16111563        D = T*inv+angle_dict['SGData']['SGCen'][cen]
    16121564        D += angle_dict['cellNo'][i]
    16131565        ABxyz[i] = np.inner(M*inv,ABxyz[i])+D
    1614         ABxyz[i] = np.inner(Amat,(ABxyz[i]-Oxyz))
    1615         dist = np.sqrt(np.sum(ABxyz[i]**2))
     1566        vec[i] = np.inner(Amat,(ABxyz[i]-Oxyz))
     1567        dist = np.sqrt(np.sum(vec[i]**2))
    16161568        if not dist:
    16171569            return 0.
    1618         ABxyz[i] /= dist
    1619     angle = acosd(np.sum(ABxyz[0]*ABxyz[1]))
     1570        vec[i] /= dist
     1571    angle = acosd(np.sum(vec[0]*vec[1]))
     1572#    GSASIIpath.IPyBreak()
    16201573    return angle
    16211574
     1575def CalcAngleSu(angle_dict, angle_atoms, parmDict,covData={}):
     1576    '''default doc string
     1577   
     1578    :param type name: description
     1579   
     1580    :returns: type name: description
     1581   
     1582    '''
     1583    sig = 0.5
     1584   
     1585    return sig
     1586
    16221587def getSyXYZ(XYZ,ops,SGData):
    1623     '''default doc string
     1588    '''default doc stringvec
     1589   
    16241590   
    16251591    :param type name: description
  • trunk/GSASIIobj.py

    r2326 r2327  
    20462046        self.su = None
    20472047        if self.eObj.expression.startswith('Dist'):
    2048             dist = 0
    20492048#            GSASIIpath.IPyBreak()
    20502049            dist = G2mth.CalcDist(self.eObj.distance_dict, self.eObj.distance_atoms, self.parmDict)
    2051             #self.su = G2mth.CalcDistSu(self.eObj.distance_dict, self.eObj.distance_atoms, self.parmDict)
     2050            self.su = G2mth.CalcDistSu(self.eObj.distance_dict, self.eObj.distance_atoms, self.parmDict)
    20522051            return dist
    20532052        elif self.eObj.expression.startswith('Angle'):
    2054             angle = 0
    2055             dist = G2mth.CalcAngle(self.eObj.angle_dict, self.eObj.angle_atoms, self.parmDict)
     2053            angle = G2mth.CalcAngle(self.eObj.angle_dict, self.eObj.angle_atoms, self.parmDict)
     2054            self.su = G2mth.CalcAngleSu(self.eObj.angle_dict, self.eObj.angle_atoms, self.parmDict)
    20562055            return angle
    20572056        if self.compiledExpr is None:
Note: See TracChangeset for help on using the changeset viewer.