Changeset 2321 for trunk/GSASIImath.py
 Timestamp:
 Jun 15, 2016 7:10:38 AM (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r2319 r2321 1529 1529 return dist 1530 1530 1531 def CalcDistSig(distance_dict, distance_atoms, parmDict,covData={}): 1532 '''default doc string 1533 1534 :param type name: description 1535 1536 :returns: type name: description 1537 1538 ''' 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%1001 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,(TxyzOxyz))**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 1590 1591 def CalcAngle(distance_dict, distance_atoms, parmDict): 1592 if not len(parmDict): 1593 return 0. 1594 1595 return 0. #angle 1596 1531 1597 def getSyXYZ(XYZ,ops,SGData): 1532 1598 '''default doc string
Note: See TracChangeset
for help on using the changeset viewer.