corrected the convention added yesterday; “proper” and ‘improper” was the wrong way around. “proper = True ” considers the bigger (2 adjacent) SST. In general, an improper rotation is implicitly assumed when projecting a pole into the (single) SST, hence this is termed “improper” now.
This commit is contained in:
parent
15963391aa
commit
9ea0898cd9
|
@ -688,11 +688,11 @@ class Symmetry:
|
||||||
|
|
||||||
def inSST(self,
|
def inSST(self,
|
||||||
vector,
|
vector,
|
||||||
improper = False,
|
proper = 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.
|
proper 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
|
||||||
|
@ -710,40 +710,40 @@ class Symmetry:
|
||||||
# }
|
# }
|
||||||
|
|
||||||
if self.lattice == 'cubic':
|
if self.lattice == 'cubic':
|
||||||
basis = {'proper':np.array([ [-1. , 0. , 1. ],
|
basis = {'improper':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. ],
|
'proper':np.array([ [ 0. , -1. , 1. ],
|
||||||
[-np.sqrt(2.) , np.sqrt(2.) , 0. ],
|
[-np.sqrt(2.) , np.sqrt(2.) , 0. ],
|
||||||
[ np.sqrt(3.) , 0. , 0. ] ]),
|
[ np.sqrt(3.) , 0. , 0. ] ]),
|
||||||
}
|
}
|
||||||
elif self.lattice == 'hexagonal':
|
elif self.lattice == 'hexagonal':
|
||||||
basis = {'proper':np.array([ [ 0. , 0. , 1. ],
|
basis = {'improper':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. ],
|
'proper':np.array([ [ 0. , 0. , 1. ],
|
||||||
[-1. , np.sqrt(3.) , 0. ],
|
[-1. , np.sqrt(3.) , 0. ],
|
||||||
[ np.sqrt(3) , -1. , 0. ] ]),
|
[ np.sqrt(3) , -1. , 0. ] ]),
|
||||||
}
|
}
|
||||||
elif self.lattice == 'tetragonal':
|
elif self.lattice == 'tetragonal':
|
||||||
basis = {'proper':np.array([ [ 0. , 0. , 1. ],
|
basis = {'improper':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. ],
|
'proper':np.array([ [ 0. , 0. , 1. ],
|
||||||
[-1. , 1. , 0. ],
|
[-1. , 1. , 0. ],
|
||||||
[ np.sqrt(2.) , 0. , 0. ] ]),
|
[ np.sqrt(2.) , 0. , 0. ] ]),
|
||||||
}
|
}
|
||||||
elif self.lattice == 'orthorhombic':
|
elif self.lattice == 'orthorhombic':
|
||||||
basis = {'proper':np.array([ [ 0., 0., 1.],
|
basis = {'improper':np.array([ [ 0., 0., 1.],
|
||||||
[ 1., 0., 0.],
|
[ 1., 0., 0.],
|
||||||
[ 0., 1., 0.] ]),
|
[ 0., 1., 0.] ]),
|
||||||
'improper':np.array([ [ 0., 0., 1.],
|
'proper':np.array([ [ 0., 0., 1.],
|
||||||
[-1., 0., 0.],
|
[-1., 0., 0.],
|
||||||
[ 0., 1., 0.] ]),
|
[ 0., 1., 0.] ]),
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
basis = {'proper':np.zeros((3,3),dtype=float),
|
basis = {'improper':np.zeros((3,3),dtype=float),
|
||||||
'improper':np.zeros((3,3),dtype=float),
|
'proper':np.zeros((3,3),dtype=float),
|
||||||
}
|
}
|
||||||
|
|
||||||
if np.all(basis == 0.0):
|
if np.all(basis == 0.0):
|
||||||
|
@ -751,15 +751,15 @@ class Symmetry:
|
||||||
inSST = np.all(theComponents >= 0.0)
|
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 ...
|
if proper: # check both improper ...
|
||||||
theComponents = np.dot(basis['proper'],v)
|
|
||||||
inSST = np.all(theComponents >= 0.0)
|
|
||||||
if not inSST: # ... and improper SST
|
|
||||||
theComponents = np.dot(basis['improper'],v)
|
theComponents = np.dot(basis['improper'],v)
|
||||||
inSST = np.all(theComponents >= 0.0)
|
inSST = np.all(theComponents >= 0.0)
|
||||||
|
if not inSST: # ... and proper SST
|
||||||
|
theComponents = np.dot(basis['proper'],v)
|
||||||
|
inSST = np.all(theComponents >= 0.0)
|
||||||
else:
|
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['proper'],v)
|
theComponents = np.dot(basis['improper'],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
|
||||||
|
@ -906,7 +906,7 @@ class Orientation:
|
||||||
|
|
||||||
def inversePole(self,
|
def inversePole(self,
|
||||||
axis,
|
axis,
|
||||||
improper = False,
|
proper = 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)
|
||||||
|
@ -915,7 +915,7 @@ 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,improper): break # found SST version
|
if self.symmetry.inSST(pole,proper): 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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue