Changeset 2330
 Timestamp:
 Jun 17, 2016 12:05:54 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r2329 r2330 1904 1904 1905 1905 def getAngleDerv(Oxyz,Axyz,Bxyz,Amat,Tunit,symNo,SGData): 1906 1907 def calcAngle(Oxyz,ABxyz,Amat,Tunit,symNo,SGData): 1908 vec = np.zeros((2,3)) 1909 for i in range(2): 1910 inv = 1 1911 if symNo[i] < 0: 1912 inv = 1 1913 cen = inv*symNo[i]/100 1914 op = inv*symNo[i]%1001 1915 M,T = SGData['SGOps'][op] 1916 D = T*inv+SGData['SGCen'][cen] 1917 D += Tunit[i] 1918 ABxyz[i] = np.inner(M*inv,ABxyz[i])+D 1919 vec[i] = np.inner(Amat,(ABxyz[i]Oxyz)) 1920 dist = np.sqrt(np.sum(vec[i]**2)) 1921 if not dist: 1922 return 0. 1923 vec[i] /= dist 1924 angle = acosd(np.sum(vec[0]*vec[1])) 1925 # GSASIIpath.IPyBreak() 1926 return angle 1927 1906 1928 dx = .00001 1907 1929 deriv = np.zeros(9) 1908 1909 1930 for i in [0,1,2]: 1931 Oxyz[i] = dx 1932 a0 = calcAngle(Oxyz,[Axyz,Bxyz],Amat,Tunit,symNo,SGData) 1933 Oxyz[i] += 2*dx 1934 deriv[i] = (calcAngle(Oxyz,[Axyz,Bxyz],Amat,Tunit,symNo,SGData)a0)/(2.*dx) 1935 Oxyz[i] = dx 1936 Axyz[i] = dx 1937 a0 = calcAngle(Oxyz,[Axyz,Bxyz],Amat,Tunit,symNo,SGData) 1938 Axyz[i] += 2*dx 1939 deriv[i+3] = (calcAngle(Oxyz,[Axyz,Bxyz],Amat,Tunit,symNo,SGData)a0)/(2.*dx) 1940 Axyz[i] = dx 1941 Bxyz[i] = dx 1942 a0 = calcAngle(Oxyz,[Axyz,Bxyz],Amat,Tunit,symNo,SGData) 1943 Bxyz[i] += 2*dx 1944 deriv[i+6] = (calcAngle(Oxyz,[Axyz,Bxyz],Amat,Tunit,symNo,SGData)a0)/(2.*dx) 1945 Bxyz[i] = dx 1910 1946 return deriv 1911 1912 1947 1913 1948 def getAngSig(VA,VB,Amat,SGData,covData={}):
Note: See TracChangeset
for help on using the changeset viewer.