corrected OR models and set up simple test to check them

This commit is contained in:
Yannick Naunheim 2015-06-29 16:02:56 +00:00
parent 61e3987bfa
commit 5fe65bfcc3
1 changed files with 156 additions and 123 deletions

View File

@ -900,8 +900,15 @@ class Orientation:
def related(self, relationModel, direction, targetSymmetry = None): def related(self, relationModel, direction, targetSymmetry = None):
if relationModel not in ['KS','GT',"GT'",'NW','Bain']: return None if relationModel not in ['KS','GT','GTdash','NW','Pitsch','Bain']: return None
if int(direction) == 0: return None if int(direction) == 0: return None
# KS from S. Morito et al./Journal of Alloys and Compounds 5775 (2013) S587-S592
# GT from Y. He et al./Journal of Applied Crystallography (2006). 39, 72-81
# GT' from Y. He et al./Journal of Applied Crystallography (2006). 39, 72-81
# NW from H. Kitahara et al./Materials Characterization 54 (2005) 378-386
# Pitsch from Y. He et al./Acta Materialia 53 (2005) 1179-1190
# Bain from Y. He et al./Journal of Applied Crystallography (2006). 39, 72-81
variant = int(abs(direction))-1 variant = int(abs(direction))-1
(me,other) = (0,1) if direction > 0 else (1,0) (me,other) = (0,1) if direction > 0 else (1,0)
@ -925,62 +932,62 @@ class Orientation:
[[ -1, 1, 1],[ 0, 1, 1]],\ [[ -1, 1, 1],[ 0, 1, 1]],\
[[ -1, 1, 1],[ 0, 1, 1]],\ [[ -1, 1, 1],[ 0, 1, 1]],\
[[ -1, 1, 1],[ 0, 1, 1]],\ [[ -1, 1, 1],[ 0, 1, 1]],\
[[ 1, 1, 1],[ 0, 1, 1]],\ [[ 1, 1, -1],[ 0, 1, 1]],\
[[ 1, 1, 1],[ 0, 1, 1]],\ [[ 1, 1, -1],[ 0, 1, 1]],\
[[ 1, 1, 1],[ 0, 1, 1]],\ [[ 1, 1, -1],[ 0, 1, 1]],\
[[ 1, 1, 1],[ 0, 1, 1]],\ [[ 1, 1, -1],[ 0, 1, 1]],\
[[ 1, 1, 1],[ 0, 1, 1]],\ [[ 1, 1, -1],[ 0, 1, 1]],\
[[ 1, 1, 1],[ 0, 1, 1]]]), [[ 1, 1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],[ 1, 1, 0]],\
[[-17, 7,-17],[-17, 12, -5]],\ [[ 1, 1, 1],[ 0, 1, 1]],\
[[-17, -7, 17],[-17,-12, 5]],\ [[ 1, 1, 1],[ 1, 0, 1]],\
[[ 17, -7,-17],[ 17,-12, -5]],\ [[ -1, -1, 1],[ -1, -1, 0]],\
[[ 17, 17, 7],[ 17, 5, 12]],\ [[ -1, -1, 1],[ 0, -1, 1]],\
[[-17,-17, 7],[-17, -5, 12]],\ [[ -1, -1, 1],[ -1, 0, 1]],\
[[ 17,-17, -7],[ 17, -5,-12]],\ [[ -1, 1, 1],[ -1, 1, 0]],\
[[-17, 17, -7],[-17, 5,-12]],\ [[ -1, 1, 1],[ 0, 1, 1]],\
[[ -1, 1, 1],[ -1, 0, 1]],\
[[ 1, -1, 1],[ 1, -1, 0]],\
[[ 1, -1, 1],[ 0, -1, 1]],\
[[ 1, -1, 1],[ 1, 0, 1]]]),
'GTdash': \
np.array([[[ 7, 17, 17],[ 12, 5, 17]],\
[[ 17, 7, 17],[ 17, 12, 5]],\
[[ 17, 17, 7],[ 5, 17, 12]],\ [[ 17, 17, 7],[ 5, 17, 12]],\
[[ -7,-17, 17],[-12, -5, 17]],\
[[-17, -7, 17],[-17,-12, 5]],\
[[-17,-17, 7],[ -5,-17, 12]],\ [[-17,-17, 7],[ -5,-17, 12]],\
[[ 7,-17,-17],[ 12, -5,-17]],\
[[ 17, -7,-17],[ 17,-12, -5]],\
[[ 17,-17, -7],[ 5,-17,-12]],\ [[ 17,-17, -7],[ 5,-17,-12]],\
[[ -7, 17,-17],[-12, 5,-17]],\
[[-17, 7,-17],[-17, 12, -5]],\
[[-17, 17, -7],[ -5, 17,-12]],\ [[-17, 17, -7],[ -5, 17,-12]],\
[[ 7, 17, 17],[ 12, 17, 5]],\ [[ 7, 17, 17],[ 12, 17, 5]],\
[[ 7,-17,-17],[ 12,-17, -5]],\
[[ -7,-17, 17],[-12,-17, 5]],\
[[ -7, 17,-17],[-12, 17, -5]],\
[[ 7, 17, 17],[ 12, 5, 17]],\
[[ 7,-17,-17],[ 12, -5,-17]],\
[[ -7,-17, 17],[-12, -5, 17]],\
[[ -7, 17,-17],[-12, 5,-17]],\
[[ 17, 7, 17],[ 5, 12, 17]],\ [[ 17, 7, 17],[ 5, 12, 17]],\
[[-17, 7,-17],[ -5, 12,-17]],\ [[ 17, 17, 7],[ 17, 5, 12]],\
[[ -7,-17, 17],[-12,-17, 5]],\
[[-17, -7, 17],[ -5,-12, 17]],\ [[-17, -7, 17],[ -5,-12, 17]],\
[[ 17, -7,-17],[ 5,-12,-17]]]), [[-17,-17, 7],[-17, -5, 12]],\
[[ 7,-17,-17],[ 12,-17, -5]],\
[[ 17, -7,-17],[ 5, -12,-17]],\
[[ 17,-17, 7],[ 17, -5,-12]],\
[[ -7, 17,-17],[-12, 17, -5]],\
[[-17, 7,-17],[ -5, 12,-17]],\
[[-17, 17, -7],[-17, 5,-12]]]),
'NW': \ 'NW': \
np.array([[[ 1, 1, 1],[ 0, 1, 1]],\ np.array([[[ 1, 1, 1],[ 0, 1, 1]],\
[[ 1, 1, 1],[ 0, 1, 1]],\ [[ 1, 1, 1],[ 0, 1, 1]],\
@ -991,9 +998,22 @@ class Orientation:
[[ 1, -1, 1],[ 0, 1, 1]],\ [[ 1, -1, 1],[ 0, 1, 1]],\
[[ 1, -1, 1],[ 0, 1, 1]],\ [[ 1, -1, 1],[ 0, 1, 1]],\
[[ 1, -1, 1],[ 0, 1, 1]],\ [[ 1, -1, 1],[ 0, 1, 1]],\
[[ 1, 1, -1],[ 0, 1, 1]],\ [[ -1, -1, 1],[ 0, 1, 1]],\
[[ 1, 1, -1],[ 0, 1, 1]],\ [[ -1, -1, 1],[ 0, 1, 1]],\
[[ 1, 1, -1],[ 0, 1, 1]]]), [[ -1, -1, 1],[ 0, 1, 1]]]),
'Pitsch': \
np.array([[[ 0, 1, 0],[ -1, 0, 1]],\
[[ 0, 0, 1],[ 1, -1, 0]],\
[[ 1, 0, 0],[ 0, 1, -1]],\
[[ 1, 0, 0],[ 0, -1, -1]],\
[[ 0, 1, 0],[ -1, 0, -1]],\
[[ 0, 0, 1],[ -1, -1, 0]],\
[[ 0, 1, 0],[ -1, 0, -1]],\
[[ 0, 0, 1],[ -1, -1, 0]],\
[[ 1, 0, 0],[ 0, -1, -1]],\
[[ 1, 0, 0],[ 0, -1, 1]],\
[[ 0, 1, 0],[ 1, 0, -1]],\
[[ 0, 0, 1],[ -1, 1, 0]]]),
'Bain': \ 'Bain': \
np.array([[[ 1, 0, 0],[ 1, 0, 0]],\ np.array([[[ 1, 0, 0],[ 1, 0, 0]],\
[[ 0, 1, 0],[ 0, 1, 0]],\ [[ 0, 1, 0],[ 0, 1, 0]],\
@ -1007,87 +1027,100 @@ class Orientation:
[[ 0, 1, -1],[ -1, 1, -1]],\ [[ 0, 1, -1],[ -1, 1, -1]],\
[[ 1, -1, 0],[ -1, -1, 1]],\ [[ 1, -1, 0],[ -1, -1, 1]],\
[[ 1, -1, 0],[ -1, 1, -1]],\ [[ 1, -1, 0],[ -1, 1, -1]],\
[[ -1, 0, 1],[ -1, -1, 1]],\ [[ 1, 0, -1],[ -1, -1, 1]],\
[[ -1, 0, 1],[ -1, 1, -1]],\ [[ 1, 0, -1],[ -1, 1, -1]],\
[[ 0, 1, -1],[ -1, -1, 1]],\
[[ 0, 1, -1],[ -1, 1, -1]],\
[[ 1, -1, 0],[ -1, -1, 1]],\
[[ 1, -1, 0],[ -1, 1, -1]],\
[[ -1, 0, 1],[ -1, -1, 1]],\
[[ -1, 0, 1],[ -1, 1, -1]],\
[[ 0, 1, -1],[ -1, -1, 1]],\
[[ 0, 1, -1],[ -1, 1, -1]],\
[[ 1, -1, 0],[ -1, -1, 1]],\
[[ 1, -1, 0],[ -1, 1, -1]],\
[[ -1, 0, 1],[ -1, -1, 1]],\
[[ -1, 0, 1],[ -1, 1, -1]],\
[[ 0, 1, -1],[ -1, -1, 1]],\
[[ 0, 1, -1],[ -1, 1, -1]],\
[[ 1, -1, 0],[ -1, -1, 1]],\
[[ 1, -1, 0],[ -1, 1, -1]]]),
'GT': \
np.array([[[ 17, -5,-12],[ 17,-17, -7]],\
[[ 17,-12, -5],[ 17, -7,-17]],\
[[-17, 5,-12],[-17, 17, -7]],\
[[-17, 12, -5],[-17, 7,-17]],\
[[ 17, 5, 12],[ 17, 17, 7]],\
[[ 17, 12, 5],[ 17, 7, 17]],\
[[-17, -5, 12],[-17,-17, 7]],\
[[-17,-12, 5],[-17, -7, 17]],\
[[-12, 17, -5],[ -7, 17,-17]],\
[[ -5, 17,-12],[-17, 17, -7]],\
[[ 12,-17, -5],[ 7,-17,-17]],\
[[ 5,-17,-12],[ 17,-17, -7]],\
[[-12,-17, 5],[ -7,-17, 17]],\
[[ -5,-17, 12],[-17,-17, 7]],\
[[ 12, 17, 5],[ 7, 17, 17]],\
[[ 5, 17, 12],[ 17, 17, 7]],\
[[ -5,-12, 17],[-17, -7, 17]],\
[[-12, -5, 17],[ -7,-17, 17]],\
[[ 5, 12, 17],[ 17, 7, 17]],\
[[ 12, 5, 17],[ 7, 17, 17]],\
[[ -5, 12,-17],[-17, 7,-17]],\
[[-12, 5,-17],[ -7, 17,-17]],\
[[ 5,-12,-17],[ 17, -7,-17]],\
[[ 12, -5,-17],[ 7,-17,-17]]]),
"GT'": \
np.array([[[ -1, 0, 1],[ -1, 1, 1]],\
[[ -1, 0, 1],[ -1, -1, 1]],\
[[ 1, 0, 1],[ 1, -1, 1]],\
[[ 1, 0, 1],[ 1, 1, 1]],\
[[ -1, 1, 0],[ -1, 1, 1]],\
[[ -1, 1, 0],[ -1, 1, -1]],\
[[ 1, 1, 0],[ 1, 1, 1]],\
[[ 1, 1, 0],[ 1, 1, -1]],\
[[ 1, -1, 0],[ 1, -1, 1]],\
[[ 1, -1, 0],[ 1, -1, -1]],\
[[ -1, -1, 0],[ -1, -1, 1]],\ [[ -1, -1, 0],[ -1, -1, 1]],\
[[ -1, -1, 0],[ -1, 1, -1]],\
[[ 0, 1, 1],[ -1, -1, 1]],\
[[ 0, 1, 1],[ -1, 1, -1]],\
[[ 0, -1, 1],[ -1, -1, 1]],\
[[ 0, -1, 1],[ -1, 1, -1]],\
[[ -1, 0, -1],[ -1, -1, 1]],\
[[ -1, 0, -1],[ -1, 1, -1]],\
[[ 1, 1, 0],[ -1, -1, 1]],\
[[ 1, 1, 0],[ -1, 1, -1]],\
[[ -1, 1, 0],[ -1, -1, 1]],\
[[ -1, 1, 0],[ -1, 1, -1]],\
[[ 0, -1, -1],[ -1, -1, 1]],\
[[ 0, -1, -1],[ -1, 1, -1]],\
[[ 1, 0, 1],[ -1, -1, 1]],\
[[ 1, 0, 1],[ -1, 1, -1]]]),
'GT': \
np.array([[[ -5,-12, 17],[-17, -7, 17]],\
[[ 17, -5,-12],[ 17,-17, -7]],\
[[-12, 17, -5],[ -7, 17,-17]],\
[[ 5, 12, 17],[ 17, 7, 17]],\
[[-17, 5,-12],[-17, 17, -7]],\
[[ 12,-17, -5],[ 7,-17,-17]],\
[[ -5, 12,-17],[-17, 7,-17]],\
[[ 17, 5, 12],[ 17, 17, 7]],\
[[-12,-17, 5],[ -7,-17, 17]],\
[[ 5,-12,-17],[ 17, -7,-17]],\
[[-17, -5, 12],[-17,-17, 7]],\
[[ 12, 17, 5],[ 7, 17, 17]],\
[[ -5, 17,-12],[-17, 17, -7]],\
[[-12, -5, 17],[ -7,-17, 17]],\
[[ 17,-12, -5],[ 17, -7,-17]],\
[[ 5,-17,-12],[ 17,-17, -7]],\
[[ 12, 5, 17],[ 7, 17, 17]],\
[[-17, 12, -5],[-17, 7,-17]],\
[[ -5,-17, 12],[-17,-17, 7]],\
[[-12, 5,-17],[ -7, 17,-17]],\
[[ 17, 12, 5],[ 17, 7, 17]],\
[[ 5, 17, 12],[ 17, 17, 7]],\
[[ 12, -5,-17],[ 7,-17,-17]],\
[[-17,-12, 5],[-17, 7, 17]]]),
'GTdash': \
np.array([[[ 0, 1, -1],[ 1, 1, -1]],\
[[ -1, 0, 1],[ -1, 1, 1]],\
[[ 1, -1, 0],[ 1, -1, 1]],\
[[ 0, -1, -1],[ -1, -1, -1]],\
[[ 1, 0, 1],[ 1, -1, 1]],\
[[ 1, -1, 0],[ 1, -1, -1]],\
[[ 0, 1, -1],[ -1, 1, -1]],\
[[ 1, 0, 1],[ 1, 1, 1]],\
[[ -1, -1, 0],[ -1, -1, 1]],\
[[ 0, -1, -1],[ 1, -1, -1]],\
[[ -1, 0, 1],[ -1, -1, 1]],\
[[ -1, -1, 0],[ -1, -1, -1]],\ [[ -1, -1, 0],[ -1, -1, -1]],\
[[ 0, -1, 1],[ 1, -1, 1]],\ [[ 0, -1, 1],[ 1, -1, 1]],\
[[ 1, 0, -1],[ 1, 1, -1]],\
[[ -1, 1, 0],[ -1, 1, 1]],\
[[ 0, 1, 1],[ -1, 1, 1]],\
[[ -1, 0, -1],[ -1, -1, -1]],\
[[ -1, 1, 0],[ -1, 1, -1]],\
[[ 0, -1, 1],[ -1, -1, 1]],\
[[ -1, 0, -1],[ -1, 1, -1]],\
[[ 1, 1, 0],[ 1, 1, 1]],\
[[ 0, 1, 1],[ 1, 1, 1]],\
[[ 1, 0, -1],[ 1, -1, -1]],\
[[ 1, 1, 0],[ 1, 1, -1]]]),
'NW': \
np.array([[[ 2, -1, -1],[ 0, -1, 1]],\
[[ -1, 2, -1],[ 0, -1, 1]],\
[[ -1, -1, 2],[ 0, -1, 1]],\
[[ -2, -1, -1],[ 0, -1, 1]],\
[[ 1, 2, -1],[ 0, -1, 1]],\
[[ 1, -1, 2],[ 0, -1, 1]],\
[[ 2, 1, -1],[ 0, -1, 1]],\
[[ -1, -2, -1],[ 0, -1, 1]],\
[[ -1, 1, 2],[ 0, -1, 1]],\
[[ -1, 2, 1],[ 0, -1, 1]],\
[[ -1, 2, 1],[ 0, -1, 1]],\
[[ -1, -1, -2],[ 0, -1, 1]]]),
'Pitsch': \
np.array([[[ 1, 0, 1],[ 1, -1, 1]],\
[[ 1, 1, 0],[ 1, 1, -1]],\
[[ 0, 1, 1],[ -1, 1, 1]],\
[[ 0, 1, -1],[ -1, 1, -1]],\
[[ -1, 0, 1],[ -1, -1, 1]],\
[[ 1, -1, 0],[ 1, -1, -1]],\
[[ 1, 0, -1],[ 1, -1, -1]],\
[[ -1, 1, 0],[ -1, 1, -1]],\
[[ 0, -1, 1],[ -1, -1, 1]],\ [[ 0, -1, 1],[ -1, -1, 1]],\
[[ 0, 1, 1],[ -1, 1, 1]],\ [[ 0, 1, 1],[ -1, 1, 1]],\
[[ 0, 1, 1],[ 1, 1, 1]],\ [[ 1, 0, 1],[ 1, -1, 1]],\
[[ 0, 1, -1],[ 1, 1, -1]],\ [[ 1, 1, 0],[ 1, 1, -1]]]),
[[ 0, 1, -1],[ -1, 1, -1]],\
[[ 0, -1, -1],[ -1, -1, -1]],\
[[ 0, -1, -1],[ 1, -1, -1]],\
[[ 1, 0, -1],[ 1, 1, -1]],\
[[ 1, 0, -1],[ 1, -1, -1]],\
[[ -1, 0, -1],[ -1, -1, -1]],\
[[ -1, 0, -1],[ -1, 1, -1]]]),
'NW': \
np.array([[[ 1, -1, 0],[ 1, 0, 0]],\
[[ 1, 0, -1],[ 1, 0, 0]],\
[[ 0, -1, 1],[ 1, 0, 0]],\
[[ 1, 1, 0],[ 1, 0, 0]],\
[[ 0, 1, -1],[ 1, 0, 0]],\
[[ 1, 0, 1],[ 1, 0, 0]],\
[[ 1, 1, 0],[ 1, 0, 0]],\
[[ 0, 1, 1],[ 1, 0, 0]],\
[[ -1, 0, 1],[ 1, 0, 0]],\
[[ 1, 0, 1],[ 1, 0, 0]],\
[[ 1, -1, 0],[ 1, 0, 0]],\
[[ 0, 1, 1],[ 1, 0, 0]]]),
'Bain': \ 'Bain': \
np.array([[[ 0, 1, 0],[ 0, 1, 1]], np.array([[[ 0, 1, 0],[ 0, 1, 1]],
[[ 0, 0, 1],[ 1, 0, 1]], [[ 0, 0, 1],[ 1, 0, 1]],
@ -1104,7 +1137,7 @@ class Orientation:
otherNormal = [float(i) for i in normals[relationModel][variant,other]] # map(float, planes[...]) does not work in python 3 otherNormal = [float(i) for i in normals[relationModel][variant,other]] # map(float, planes[...]) does not work in python 3
otherNormal /= np.linalg.norm(otherNormal) otherNormal /= np.linalg.norm(otherNormal)
otherMatrix = np.array([otherPlane,otherNormal,np.cross(otherPlane,otherNormal)]) otherMatrix = np.array([otherPlane,otherNormal,np.cross(otherPlane,otherNormal)])
rot=np.dot(otherMatrix.T,myMatrix) rot=np.dot(otherMatrix.T,myMatrix)
return Orientation(matrix=np.dot(rot,self.asMatrix())) # no symmetry information ?? return Orientation(matrix=np.dot(rot,self.asMatrix())) # no symmetry information ??