inSST and inversePole now can consider the secondary SST related to improper rotations. Secondary SST is immediately neighboring (positively rotated around Z).
This commit is contained in:
parent
1f356a6833
commit
15963391aa
|
@ -688,9 +688,11 @@ class Symmetry:
|
||||||
|
|
||||||
def inSST(self,
|
def inSST(self,
|
||||||
vector,
|
vector,
|
||||||
|
improper = False,
|
||||||
color = False):
|
color = False):
|
||||||
'''
|
'''
|
||||||
Check whether given vector falls into standard stereographic triangle of own symmetry.
|
Check whether given vector falls into standard stereographic triangle of own symmetry.
|
||||||
|
Improper considers only vectors with z >= 0, hence uses two neighboring SSTs.
|
||||||
Return inverse pole figure color if requested.
|
Return inverse pole figure color if requested.
|
||||||
'''
|
'''
|
||||||
# basis = {'cubic' : np.linalg.inv(np.array([[0.,0.,1.], # direction of red
|
# basis = {'cubic' : np.linalg.inv(np.array([[0.,0.,1.], # direction of red
|
||||||
|
@ -706,32 +708,58 @@ class Symmetry:
|
||||||
# [1.,0.,0.], # direction of green
|
# [1.,0.,0.], # direction of green
|
||||||
# [0.,1.,0.]]).transpose()), # direction of blue
|
# [0.,1.,0.]]).transpose()), # direction of blue
|
||||||
# }
|
# }
|
||||||
|
|
||||||
if self.lattice == 'cubic':
|
if self.lattice == 'cubic':
|
||||||
basis = np.array([ [-1. , 0. , 1. ],
|
basis = {'proper':np.array([ [-1. , 0. , 1. ],
|
||||||
[ np.sqrt(2.), -np.sqrt(2.), 0. ],
|
[ np.sqrt(2.) , -np.sqrt(2.) , 0. ],
|
||||||
[ 0. , np.sqrt(3.), 0. ] ])
|
[ 0. , np.sqrt(3.) , 0. ] ]),
|
||||||
|
'improper':np.array([ [ 0. , -1. , 1. ],
|
||||||
|
[-np.sqrt(2.) , np.sqrt(2.) , 0. ],
|
||||||
|
[ np.sqrt(3.) , 0. , 0. ] ]),
|
||||||
|
}
|
||||||
elif self.lattice == 'hexagonal':
|
elif self.lattice == 'hexagonal':
|
||||||
basis = np.array([ [ 0. , 0. , 1. ],
|
basis = {'proper':np.array([ [ 0. , 0. , 1. ],
|
||||||
[ 1. , -np.sqrt(3.), 0. ],
|
[ 1. , -np.sqrt(3.), 0. ],
|
||||||
[ 0. , 2. , 0. ] ])
|
[ 0. , 2. , 0. ] ]),
|
||||||
|
'improper':np.array([ [ 0. , 0. , 1. ],
|
||||||
|
[-1. , np.sqrt(3.) , 0. ],
|
||||||
|
[ np.sqrt(3) , -1. , 0. ] ]),
|
||||||
|
}
|
||||||
elif self.lattice == 'tetragonal':
|
elif self.lattice == 'tetragonal':
|
||||||
basis = np.array([ [ 0. , 0. , 1. ],
|
basis = {'proper':np.array([ [ 0. , 0. , 1. ],
|
||||||
[ 1. , -1. , 0. ],
|
[ 1. , -1. , 0. ],
|
||||||
[ 0. , np.sqrt(2.), 0. ] ])
|
[ 0. , np.sqrt(2.), 0. ] ]),
|
||||||
|
'improper':np.array([ [ 0. , 0. , 1. ],
|
||||||
|
[-1. , 1. , 0. ],
|
||||||
|
[ np.sqrt(2.) , 0. , 0. ] ]),
|
||||||
|
}
|
||||||
elif self.lattice == 'orthorhombic':
|
elif self.lattice == 'orthorhombic':
|
||||||
basis = np.array([ [ 0., 0., 1.],
|
basis = {'proper':np.array([ [ 0., 0., 1.],
|
||||||
[ 1., 0., 0.],
|
[ 1., 0., 0.],
|
||||||
[ 0., 1., 0.] ])
|
[ 0., 1., 0.] ]),
|
||||||
|
'improper':np.array([ [ 0., 0., 1.],
|
||||||
|
[-1., 0., 0.],
|
||||||
|
[ 0., 1., 0.] ]),
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
basis = np.zeros((3,3),dtype=float)
|
basis = {'proper':np.zeros((3,3),dtype=float),
|
||||||
|
'improper':np.zeros((3,3),dtype=float),
|
||||||
|
}
|
||||||
|
|
||||||
if np.all(basis == 0.0):
|
if np.all(basis == 0.0):
|
||||||
theComponents = -np.ones(3,'d')
|
theComponents = -np.ones(3,'d')
|
||||||
|
inSST = np.all(theComponents >= 0.0)
|
||||||
else:
|
else:
|
||||||
v = np.array(vector,dtype = float)
|
v = np.array(vector,dtype = float)
|
||||||
|
if improper: # check both proper ...
|
||||||
|
theComponents = np.dot(basis['proper'],v)
|
||||||
|
inSST = np.all(theComponents >= 0.0)
|
||||||
|
if not inSST: # ... and improper SST
|
||||||
|
theComponents = np.dot(basis['improper'],v)
|
||||||
|
inSST = np.all(theComponents >= 0.0)
|
||||||
|
else:
|
||||||
v[2] = abs(v[2]) # z component projects identical for positive and negative values
|
v[2] = abs(v[2]) # z component projects identical for positive and negative values
|
||||||
theComponents = np.dot(basis,v)
|
theComponents = np.dot(basis['proper'],v)
|
||||||
|
|
||||||
inSST = np.all(theComponents >= 0.0)
|
inSST = np.all(theComponents >= 0.0)
|
||||||
|
|
||||||
if color: # have to return color array
|
if color: # have to return color array
|
||||||
|
@ -878,6 +906,7 @@ class Orientation:
|
||||||
|
|
||||||
def inversePole(self,
|
def inversePole(self,
|
||||||
axis,
|
axis,
|
||||||
|
improper = False,
|
||||||
SST = True):
|
SST = True):
|
||||||
'''
|
'''
|
||||||
axis rotated according to orientation (using crystal symmetry to ensure location falls into SST)
|
axis rotated according to orientation (using crystal symmetry to ensure location falls into SST)
|
||||||
|
@ -886,11 +915,11 @@ class Orientation:
|
||||||
if SST: # pole requested to be within SST
|
if SST: # pole requested to be within SST
|
||||||
for i,q in enumerate(self.symmetry.equivalentQuaternions(self.quaternion)): # test all symmetric equivalent quaternions
|
for i,q in enumerate(self.symmetry.equivalentQuaternions(self.quaternion)): # test all symmetric equivalent quaternions
|
||||||
pole = q.conjugated()*axis # align crystal direction to axis
|
pole = q.conjugated()*axis # align crystal direction to axis
|
||||||
if self.symmetry.inSST(pole): break # found SST version
|
if self.symmetry.inSST(pole,improper): break # found SST version
|
||||||
else:
|
else:
|
||||||
pole = self.quaternion.conjugated()*axis # align crystal direction to axis
|
pole = self.quaternion.conjugated()*axis # align crystal direction to axis
|
||||||
|
|
||||||
return pole
|
return (pole,i if SST else 0)
|
||||||
|
|
||||||
def IPFcolor(self,axis):
|
def IPFcolor(self,axis):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in New Issue