Changeset 2327 for trunk/GSASIImath.py
 Timestamp:
 Jun 16, 2016 8:34:05 AM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r2326 r2327 1529 1529 return dist 1530 1530 1531 def CalcDistS ig(distance_dict, distance_atoms, parmDict,covData={}):1531 def CalcDistSu(distance_dict, distance_atoms, parmDict,covData={}): 1532 1532 '''default doc string 1533 1533 … … 1537 1537 1538 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 1539 sig = 0.001 1540 1541 return sig 1590 1542 1591 1543 def CalcAngle(angle_dict, angle_atoms, parmDict): … … 1601 1553 ABxyz = [Axyz,Bxyz] 1602 1554 symNo = angle_dict['symNo'] 1555 vec = np.zeros((2,3)) 1603 1556 for i in range(2): 1604 1557 inv = 1 1605 1558 if symNo[i] < 0: 1606 1559 inv = 1 1607 symNo[i] *= 1 1608 cen = symNo[i]/100 1609 op = symNo[i]%1001 1560 cen = inv*symNo[i]/100 1561 op = inv*symNo[i]%1001 1610 1562 M,T = angle_dict['SGData']['SGOps'][op] 1611 1563 D = T*inv+angle_dict['SGData']['SGCen'][cen] 1612 1564 D += angle_dict['cellNo'][i] 1613 1565 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)) 1616 1568 if not dist: 1617 1569 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() 1620 1573 return angle 1621 1574 1575 def 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 1622 1587 def getSyXYZ(XYZ,ops,SGData): 1623 '''default doc string 1588 '''default doc stringvec 1589 1624 1590 1625 1591 :param type name: description
Note: See TracChangeset
for help on using the changeset viewer.