2022-11-23 02:56:15 +05:30
|
|
|
|
from typing import Optional, Union, Dict, List, Tuple
|
2021-12-07 05:19:12 +05:30
|
|
|
|
|
2021-06-02 12:58:27 +05:30
|
|
|
|
import numpy as np
|
|
|
|
|
|
2023-08-17 01:31:20 +05:30
|
|
|
|
from ._typehints import FloatSequence, CrystalFamily, BravaisLattice, CrystalKinematics
|
2021-06-02 12:58:27 +05:30
|
|
|
|
from . import util
|
2021-06-03 12:45:12 +05:30
|
|
|
|
from . import Rotation
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
2023-10-25 00:09:17 +05:30
|
|
|
|
|
|
|
|
|
lattice_symmetries: Dict[Optional[BravaisLattice], CrystalFamily] = {
|
2021-06-02 12:58:27 +05:30
|
|
|
|
'aP': 'triclinic',
|
|
|
|
|
|
|
|
|
|
'mP': 'monoclinic',
|
|
|
|
|
'mS': 'monoclinic',
|
|
|
|
|
|
|
|
|
|
'oP': 'orthorhombic',
|
|
|
|
|
'oS': 'orthorhombic',
|
|
|
|
|
'oI': 'orthorhombic',
|
|
|
|
|
'oF': 'orthorhombic',
|
|
|
|
|
|
|
|
|
|
'tP': 'tetragonal',
|
|
|
|
|
'tI': 'tetragonal',
|
|
|
|
|
|
|
|
|
|
'hP': 'hexagonal',
|
|
|
|
|
|
|
|
|
|
'cP': 'cubic',
|
|
|
|
|
'cI': 'cubic',
|
|
|
|
|
'cF': 'cubic',
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-25 00:09:17 +05:30
|
|
|
|
orientation_relationships: Dict[str, Dict[str,List[np.ndarray]]] = {
|
2023-10-24 08:23:27 +05:30
|
|
|
|
'KS': { # https://doi.org/10.1016/j.jallcom.2012.02.004
|
|
|
|
|
'cF-->cI' : [
|
|
|
|
|
np.repeat(np.array([
|
|
|
|
|
[[-1, 0, 1],[ 1, 1, 1]],
|
|
|
|
|
[[ 0, 1,-1],[ 1, 1, 1]],
|
|
|
|
|
[[ 1,-1, 0],[ 1, 1, 1]],
|
|
|
|
|
|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],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
2,axis=0),
|
|
|
|
|
np.tile(np.array([[[ 0, 1,-1],[ 1, 1, 1]],
|
|
|
|
|
[[ 0,-1, 1],[ 1, 1, 1]]],dtype=float),
|
|
|
|
|
(12,1,1)),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
'GT': { # https://doi.org/10.1107/S0021889805038276
|
|
|
|
|
'cF-->cI' : [
|
|
|
|
|
np.array([
|
|
|
|
|
[[ -5,-12, 17],[ 1, 1, 1]],
|
|
|
|
|
[[ 17, -5,-12],[ 1, 1, 1]],
|
|
|
|
|
[[-12, 17, -5],[ 1, 1, 1]],
|
|
|
|
|
[[ 5, 12, 17],[ -1, -1, 1]],
|
|
|
|
|
[[-17, 5,-12],[ -1, -1, 1]],
|
|
|
|
|
[[ 12,-17, -5],[ -1, -1, 1]],
|
|
|
|
|
[[ -5, 12,-17],[ -1, 1, 1]],
|
|
|
|
|
[[ 17, 5, 12],[ -1, 1, 1]],
|
|
|
|
|
[[-12,-17, 5],[ -1, 1, 1]],
|
|
|
|
|
[[ 5,-12,-17],[ 1, -1, 1]],
|
|
|
|
|
[[-17, -5, 12],[ 1, -1, 1]],
|
|
|
|
|
[[ 12, 17, 5],[ 1, -1, 1]],
|
|
|
|
|
[[ -5, 17,-12],[ 1, 1, 1]],
|
|
|
|
|
[[-12, -5, 17],[ 1, 1, 1]],
|
|
|
|
|
[[ 17,-12, -5],[ 1, 1, 1]],
|
|
|
|
|
[[ 5,-17,-12],[ -1, -1, 1]],
|
|
|
|
|
[[ 12, 5, 17],[ -1, -1, 1]],
|
|
|
|
|
[[-17, 12, -5],[ -1, -1, 1]],
|
|
|
|
|
[[ -5,-17, 12],[ -1, 1, 1]],
|
|
|
|
|
[[-12, 5,-17],[ -1, 1, 1]],
|
|
|
|
|
[[ 17, 12, 5],[ -1, 1, 1]],
|
|
|
|
|
[[ 5, 17, 12],[ 1, -1, 1]],
|
|
|
|
|
[[ 12, -5,-17],[ 1, -1, 1]],
|
|
|
|
|
[[-17,-12, 5],[ 1, -1, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
np.array([
|
|
|
|
|
[[-17, -7, 17],[ 1, 0, 1]],
|
|
|
|
|
[[ 17,-17, -7],[ 1, 1, 0]],
|
|
|
|
|
[[ -7, 17,-17],[ 0, 1, 1]],
|
|
|
|
|
[[ 17, 7, 17],[ -1, 0, 1]],
|
|
|
|
|
[[-17, 17, -7],[ -1, -1, 0]],
|
|
|
|
|
[[ 7,-17,-17],[ 0, -1, 1]],
|
|
|
|
|
[[-17, 7,-17],[ -1, 0, 1]],
|
|
|
|
|
[[ 17, 17, 7],[ -1, 1, 0]],
|
|
|
|
|
[[ -7,-17, 17],[ 0, 1, 1]],
|
|
|
|
|
[[ 17, -7,-17],[ 1, 0, 1]],
|
|
|
|
|
[[-17,-17, 7],[ 1, -1, 0]],
|
|
|
|
|
[[ 7, 17, 17],[ 0, -1, 1]],
|
|
|
|
|
[[-17, 17, -7],[ 1, 1, 0]],
|
|
|
|
|
[[ -7,-17, 17],[ 0, 1, 1]],
|
|
|
|
|
[[ 17, -7,-17],[ 1, 0, 1]],
|
|
|
|
|
[[ 17,-17, -7],[ -1, -1, 0]],
|
|
|
|
|
[[ 7, 17, 17],[ 0, -1, 1]],
|
|
|
|
|
[[-17, 7,-17],[ -1, 0, 1]],
|
|
|
|
|
[[-17,-17, 7],[ -1, 1, 0]],
|
|
|
|
|
[[ -7, 17,-17],[ 0, 1, 1]],
|
|
|
|
|
[[ 17, 7, 17],[ -1, 0, 1]],
|
|
|
|
|
[[ 17, 17, 7],[ 1, -1, 0]],
|
|
|
|
|
[[ 7,-17,-17],[ 0, -1, 1]],
|
|
|
|
|
[[-17, -7, 17],[ 1, 0, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
],
|
|
|
|
|
'cI-->cF' : [
|
|
|
|
|
np.array([
|
|
|
|
|
[[-17, -7, 17],[ 1, 0, 1]],
|
|
|
|
|
[[ 17,-17, -7],[ 1, 1, 0]],
|
|
|
|
|
[[ -7, 17,-17],[ 0, 1, 1]],
|
|
|
|
|
[[ 17, 7, 17],[ -1, 0, 1]],
|
|
|
|
|
[[-17, 17, -7],[ -1, -1, 0]],
|
|
|
|
|
[[ 7,-17,-17],[ 0, -1, 1]],
|
|
|
|
|
[[-17, 7,-17],[ -1, 0, 1]],
|
|
|
|
|
[[ 17, 17, 7],[ -1, 1, 0]],
|
|
|
|
|
[[ -7,-17, 17],[ 0, 1, 1]],
|
|
|
|
|
[[ 17, -7,-17],[ 1, 0, 1]],
|
|
|
|
|
[[-17,-17, 7],[ 1, -1, 0]],
|
|
|
|
|
[[ 7, 17, 17],[ 0, -1, 1]],
|
|
|
|
|
[[-17, 17, -7],[ 1, 1, 0]],
|
|
|
|
|
[[ -7,-17, 17],[ 0, 1, 1]],
|
|
|
|
|
[[ 17, -7,-17],[ 1, 0, 1]],
|
|
|
|
|
[[ 17,-17, -7],[ -1, -1, 0]],
|
|
|
|
|
[[ 7, 17, 17],[ 0, -1, 1]],
|
|
|
|
|
[[-17, 7,-17],[ -1, 0, 1]],
|
|
|
|
|
[[-17,-17, 7],[ -1, 1, 0]],
|
|
|
|
|
[[ -7, 17,-17],[ 0, 1, 1]],
|
|
|
|
|
[[ 17, 7, 17],[ -1, 0, 1]],
|
|
|
|
|
[[ 17, 17, 7],[ 1, -1, 0]],
|
|
|
|
|
[[ 7,-17,-17],[ 0, -1, 1]],
|
|
|
|
|
[[-17, -7, 17],[ 1, 0, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
np.array([
|
|
|
|
|
[[ -5,-12, 17],[ 1, 1, 1]],
|
|
|
|
|
[[ 17, -5,-12],[ 1, 1, 1]],
|
|
|
|
|
[[-12, 17, -5],[ 1, 1, 1]],
|
|
|
|
|
[[ 5, 12, 17],[ -1, -1, 1]],
|
|
|
|
|
[[-17, 5,-12],[ -1, -1, 1]],
|
|
|
|
|
[[ 12,-17, -5],[ -1, -1, 1]],
|
|
|
|
|
[[ -5, 12,-17],[ -1, 1, 1]],
|
|
|
|
|
[[ 17, 5, 12],[ -1, 1, 1]],
|
|
|
|
|
[[-12,-17, 5],[ -1, 1, 1]],
|
|
|
|
|
[[ 5,-12,-17],[ 1, -1, 1]],
|
|
|
|
|
[[-17, -5, 12],[ 1, -1, 1]],
|
|
|
|
|
[[ 12, 17, 5],[ 1, -1, 1]],
|
|
|
|
|
[[ -5, 17,-12],[ 1, 1, 1]],
|
|
|
|
|
[[-12, -5, 17],[ 1, 1, 1]],
|
|
|
|
|
[[ 17,-12, -5],[ 1, 1, 1]],
|
|
|
|
|
[[ 5,-17,-12],[ -1, -1, 1]],
|
|
|
|
|
[[ 12, 5, 17],[ -1, -1, 1]],
|
|
|
|
|
[[-17, 12, -5],[ -1, -1, 1]],
|
|
|
|
|
[[ -5,-17, 12],[ -1, 1, 1]],
|
|
|
|
|
[[-12, 5,-17],[ -1, 1, 1]],
|
|
|
|
|
[[ 17, 12, 5],[ -1, 1, 1]],
|
|
|
|
|
[[ 5, 17, 12],[ 1, -1, 1]],
|
|
|
|
|
[[ 12, -5,-17],[ 1, -1, 1]],
|
|
|
|
|
[[-17,-12, 5],[ 1, -1, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
'GT_prime': { # https://doi.org/10.1107/S0021889805038276
|
|
|
|
|
'cF-->cI' : [
|
|
|
|
|
np.array([
|
|
|
|
|
[[ 0, 1, -1],[ 7, 17, 17]],
|
|
|
|
|
[[ -1, 0, 1],[ 17, 7, 17]],
|
|
|
|
|
[[ 1, -1, 0],[ 17, 17, 7]],
|
|
|
|
|
[[ 0, -1, -1],[ -7,-17, 17]],
|
|
|
|
|
[[ 1, 0, 1],[-17, -7, 17]],
|
|
|
|
|
[[ 1, -1, 0],[-17,-17, 7]],
|
|
|
|
|
[[ 0, 1, -1],[ 7,-17,-17]],
|
|
|
|
|
[[ 1, 0, 1],[ 17, -7,-17]],
|
|
|
|
|
[[ -1, -1, 0],[ 17,-17, -7]],
|
|
|
|
|
[[ 0, -1, -1],[ -7, 17,-17]],
|
|
|
|
|
[[ -1, 0, 1],[-17, 7,-17]],
|
|
|
|
|
[[ -1, -1, 0],[-17, 17, -7]],
|
|
|
|
|
[[ 0, -1, 1],[ 7, 17, 17]],
|
|
|
|
|
[[ 1, 0, -1],[ 17, 7, 17]],
|
|
|
|
|
[[ -1, 1, 0],[ 17, 17, 7]],
|
|
|
|
|
[[ 0, 1, 1],[ -7,-17, 17]],
|
|
|
|
|
[[ -1, 0, -1],[-17, -7, 17]],
|
|
|
|
|
[[ -1, 1, 0],[-17,-17, 7]],
|
|
|
|
|
[[ 0, -1, 1],[ 7,-17,-17]],
|
|
|
|
|
[[ -1, 0, -1],[ 17, -7,-17]],
|
|
|
|
|
[[ 1, 1, 0],[ 17,-17, -7]],
|
|
|
|
|
[[ 0, 1, 1],[ -7, 17,-17]],
|
|
|
|
|
[[ 1, 0, -1],[-17, 7,-17]],
|
|
|
|
|
[[ 1, 1, 0],[-17, 17, -7]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
np.array([
|
|
|
|
|
[[ 1, 1, -1],[ 12, 5, 17]],
|
|
|
|
|
[[ -1, 1, 1],[ 17, 12, 5]],
|
|
|
|
|
[[ 1, -1, 1],[ 5, 17, 12]],
|
|
|
|
|
[[ -1, -1, -1],[-12, -5, 17]],
|
|
|
|
|
[[ 1, -1, 1],[-17,-12, 5]],
|
|
|
|
|
[[ 1, -1, -1],[ -5,-17, 12]],
|
|
|
|
|
[[ -1, 1, -1],[ 12, -5,-17]],
|
|
|
|
|
[[ 1, 1, 1],[ 17,-12, -5]],
|
|
|
|
|
[[ -1, -1, 1],[ 5,-17,-12]],
|
|
|
|
|
[[ 1, -1, -1],[-12, 5,-17]],
|
|
|
|
|
[[ -1, -1, 1],[-17, 12, -5]],
|
|
|
|
|
[[ -1, -1, -1],[ -5, 17,-12]],
|
|
|
|
|
[[ 1, -1, 1],[ 12, 17, 5]],
|
|
|
|
|
[[ 1, 1, -1],[ 5, 12, 17]],
|
|
|
|
|
[[ -1, 1, 1],[ 17, 5, 12]],
|
|
|
|
|
[[ -1, 1, 1],[-12,-17, 5]],
|
|
|
|
|
[[ -1, -1, -1],[ -5,-12, 17]],
|
|
|
|
|
[[ -1, 1, -1],[-17, -5, 12]],
|
|
|
|
|
[[ -1, -1, 1],[ 12,-17, -5]],
|
|
|
|
|
[[ -1, 1, -1],[ 5,-12,-17]],
|
|
|
|
|
[[ 1, 1, 1],[ 17, -5,-12]],
|
|
|
|
|
[[ 1, 1, 1],[-12, 17, -5]],
|
|
|
|
|
[[ 1, -1, -1],[ -5, 12,-17]],
|
|
|
|
|
[[ 1, 1, -1],[-17, 5,-12]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
],
|
|
|
|
|
'cI-->cF' : [
|
|
|
|
|
np.array([
|
|
|
|
|
[[ 1, 1, -1],[ 12, 5, 17]],
|
|
|
|
|
[[ -1, 1, 1],[ 17, 12, 5]],
|
|
|
|
|
[[ 1, -1, 1],[ 5, 17, 12]],
|
|
|
|
|
[[ -1, -1, -1],[-12, -5, 17]],
|
|
|
|
|
[[ 1, -1, 1],[-17,-12, 5]],
|
|
|
|
|
[[ 1, -1, -1],[ -5,-17, 12]],
|
|
|
|
|
[[ -1, 1, -1],[ 12, -5,-17]],
|
|
|
|
|
[[ 1, 1, 1],[ 17,-12, -5]],
|
|
|
|
|
[[ -1, -1, 1],[ 5,-17,-12]],
|
|
|
|
|
[[ 1, -1, -1],[-12, 5,-17]],
|
|
|
|
|
[[ -1, -1, 1],[-17, 12, -5]],
|
|
|
|
|
[[ -1, -1, -1],[ -5, 17,-12]],
|
|
|
|
|
[[ 1, -1, 1],[ 12, 17, 5]],
|
|
|
|
|
[[ 1, 1, -1],[ 5, 12, 17]],
|
|
|
|
|
[[ -1, 1, 1],[ 17, 5, 12]],
|
|
|
|
|
[[ -1, 1, 1],[-12,-17, 5]],
|
|
|
|
|
[[ -1, -1, -1],[ -5,-12, 17]],
|
|
|
|
|
[[ -1, 1, -1],[-17, -5, 12]],
|
|
|
|
|
[[ -1, -1, 1],[ 12,-17, -5]],
|
|
|
|
|
[[ -1, 1, -1],[ 5,-12,-17]],
|
|
|
|
|
[[ 1, 1, 1],[ 17, -5,-12]],
|
|
|
|
|
[[ 1, 1, 1],[-12, 17, -5]],
|
|
|
|
|
[[ 1, -1, -1],[ -5, 12,-17]],
|
|
|
|
|
[[ 1, 1, -1],[-17, 5,-12]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
np.array([
|
|
|
|
|
[[ 0, 1, -1],[ 7, 17, 17]],
|
|
|
|
|
[[ -1, 0, 1],[ 17, 7, 17]],
|
|
|
|
|
[[ 1, -1, 0],[ 17, 17, 7]],
|
|
|
|
|
[[ 0, -1, -1],[ -7,-17, 17]],
|
|
|
|
|
[[ 1, 0, 1],[-17, -7, 17]],
|
|
|
|
|
[[ 1, -1, 0],[-17,-17, 7]],
|
|
|
|
|
[[ 0, 1, -1],[ 7,-17,-17]],
|
|
|
|
|
[[ 1, 0, 1],[ 17, -7,-17]],
|
|
|
|
|
[[ -1, -1, 0],[ 17,-17, -7]],
|
|
|
|
|
[[ 0, -1, -1],[ -7, 17,-17]],
|
|
|
|
|
[[ -1, 0, 1],[-17, 7,-17]],
|
|
|
|
|
[[ -1, -1, 0],[-17, 17, -7]],
|
|
|
|
|
[[ 0, -1, 1],[ 7, 17, 17]],
|
|
|
|
|
[[ 1, 0, -1],[ 17, 7, 17]],
|
|
|
|
|
[[ -1, 1, 0],[ 17, 17, 7]],
|
|
|
|
|
[[ 0, 1, 1],[ -7,-17, 17]],
|
|
|
|
|
[[ -1, 0, -1],[-17, -7, 17]],
|
|
|
|
|
[[ -1, 1, 0],[-17,-17, 7]],
|
|
|
|
|
[[ 0, -1, 1],[ 7,-17,-17]],
|
|
|
|
|
[[ -1, 0, -1],[ 17, -7,-17]],
|
|
|
|
|
[[ 1, 1, 0],[ 17,-17, -7]],
|
|
|
|
|
[[ 0, 1, 1],[ -7, 17,-17]],
|
|
|
|
|
[[ 1, 0, -1],[-17, 7,-17]],
|
|
|
|
|
[[ 1, 1, 0],[-17, 17, -7]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
'NW': { # https://doi.org/10.1016/j.matchar.2004.12.015
|
|
|
|
|
'cF-->cI' : [
|
|
|
|
|
np.array([
|
|
|
|
|
[[ 2,-1,-1],[ 1, 1, 1]],
|
|
|
|
|
[[-1, 2,-1],[ 1, 1, 1]],
|
|
|
|
|
[[-1,-1, 2],[ 1, 1, 1]],
|
|
|
|
|
|
|
|
|
|
[[-2,-1,-1],[-1, 1, 1]],
|
|
|
|
|
[[ 1, 2,-1],[-1, 1, 1]],
|
|
|
|
|
[[ 1,-1, 2],[-1, 1, 1]],
|
|
|
|
|
|
|
|
|
|
[[ 2, 1,-1],[ 1,-1, 1]],
|
|
|
|
|
[[-1,-2,-1],[ 1,-1, 1]],
|
|
|
|
|
[[-1, 1, 2],[ 1,-1, 1]],
|
|
|
|
|
|
|
|
|
|
[[ 2,-1, 1],[ 1, 1,-1]],
|
|
|
|
|
[[-1, 2, 1],[ 1, 1,-1]],
|
|
|
|
|
[[-1,-1,-2],[ 1, 1,-1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
np.broadcast_to(np.array([[ 0,-1, 1],[ 0, 1, 1]],dtype=float),
|
|
|
|
|
(12,2,3)),
|
|
|
|
|
],
|
|
|
|
|
'cI-->cF' : [
|
|
|
|
|
np.repeat(np.array([
|
|
|
|
|
[[ 0, 1,-1],[ 0, 1, 1]],
|
|
|
|
|
[[ 0, 1, 1],[ 0, 1,-1]],
|
|
|
|
|
[[ 1, 0,-1],[ 1, 0, 1]],
|
|
|
|
|
[[ 1, 0, 1],[ 1, 0,-1]],
|
|
|
|
|
[[ 1,-1, 0],[ 1, 1, 0]],
|
|
|
|
|
[[ 1, 1, 0],[ 1,-1, 0]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
2,axis=0),
|
|
|
|
|
np.tile(np.array([
|
|
|
|
|
[[ 2,-1,-1],[ 1, 1, 1]],
|
|
|
|
|
[[-2, 1, 1],[ 1, 1, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
(6,1,1)),
|
|
|
|
|
],
|
|
|
|
|
},
|
2023-11-04 04:21:57 +05:30
|
|
|
|
'Pitsch': { # https://doi.org/10.1080/14786435908238253
|
2023-10-24 08:23:27 +05:30
|
|
|
|
'cF-->cI' : [
|
|
|
|
|
np.repeat(np.array([
|
|
|
|
|
[[ 0, 1, 1],[ 1, 0, 0]],
|
|
|
|
|
[[ 0, 1,-1],[ 1, 0, 0]],
|
|
|
|
|
[[ 1, 0, 1],[ 0, 1, 0]],
|
|
|
|
|
[[ 1, 0,-1],[ 0, 1, 0]],
|
|
|
|
|
[[ 1, 1, 0],[ 0, 0, 1]],
|
|
|
|
|
[[ 1,-1, 0],[ 0, 0, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
2,axis=0),
|
|
|
|
|
np.tile(np.array([
|
|
|
|
|
[[ 1, 1,-1],[ 0, 1, 1]],
|
|
|
|
|
[[-1, 1,-1],[ 0, 1, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
(6,1,1)),
|
|
|
|
|
],
|
|
|
|
|
'cI-->cF' : [
|
|
|
|
|
np.array([
|
|
|
|
|
[[ 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, 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]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
np.broadcast_to(np.array([[ 1, 1, 0],[ 0, 0, 1]],dtype=float),
|
|
|
|
|
(12,2,3)),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
'Bain': { # https://doi.org/10.1107/S0021889805038276
|
|
|
|
|
'cF-->cI' : [
|
|
|
|
|
np.array([
|
|
|
|
|
[[ 0, 1, 0],[ 1, 0, 0]],
|
|
|
|
|
[[ 0, 0, 1],[ 0, 1, 0]],
|
|
|
|
|
[[ 1, 0, 0],[ 0, 0, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
np.broadcast_to(np.array([[ 1, 1, 0],[ 0, 0, 1]],dtype=float),
|
|
|
|
|
(3,2,3)),
|
|
|
|
|
],
|
|
|
|
|
'cI-->cF' : [
|
|
|
|
|
np.array([
|
|
|
|
|
[[ 0, 1, 1],[ 1, 0, 0]],
|
|
|
|
|
[[ 1, 0, 1],[ 0, 1, 0]],
|
|
|
|
|
[[ 1, 1, 0],[ 0, 0, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
np.broadcast_to(np.array([[ 1, 0, 0],[ 0, 0, 1]],dtype=float),
|
|
|
|
|
(3,2,3)),
|
|
|
|
|
]
|
|
|
|
|
},
|
2023-11-04 04:21:57 +05:30
|
|
|
|
'Burgers' : { # https://doi.org/10.1016/S0031-8914(34)80244-3
|
2023-10-24 08:23:27 +05:30
|
|
|
|
'cI-->hP' : [
|
|
|
|
|
np.array([
|
|
|
|
|
[[ 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, 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]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
np.broadcast_to(np.array([[ 2,-1,-1, 0],[ 0, 0, 0, 1]],dtype=float),
|
|
|
|
|
(12,2,4)),
|
|
|
|
|
],
|
|
|
|
|
'hP-->cI' : [
|
|
|
|
|
np.repeat(np.array([
|
|
|
|
|
[[ 2,-1,-1, 0],[ 0, 0, 0, 1]],
|
|
|
|
|
[[-1, 2,-1, 0],[ 0, 0, 0, 1]],
|
|
|
|
|
[[-1,-1, 2, 0],[ 0, 0, 0, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
2,axis=0),
|
|
|
|
|
np.tile(np.array([
|
|
|
|
|
[[ 1, 1,-1],[ 0, 1, 1]],
|
|
|
|
|
[[-1, 1,-1],[ 0, 1, 1]],
|
|
|
|
|
],dtype=float),
|
|
|
|
|
(3,1,1)),
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
}
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
2021-07-13 03:44:13 +05:30
|
|
|
|
class Crystal():
|
2022-02-22 11:10:17 +05:30
|
|
|
|
"""
|
2022-02-22 19:42:58 +05:30
|
|
|
|
Representation of a crystal as (general) crystal family or (more specific) as a scaled Bravais lattice.
|
2022-02-22 11:10:17 +05:30
|
|
|
|
|
|
|
|
|
Examples
|
|
|
|
|
--------
|
|
|
|
|
Cubic crystal family:
|
|
|
|
|
|
|
|
|
|
>>> import damask
|
2023-02-21 20:57:06 +05:30
|
|
|
|
>>> (cubic := damask.Crystal(family='cubic'))
|
2022-02-22 11:10:17 +05:30
|
|
|
|
Crystal family: cubic
|
|
|
|
|
|
2022-02-22 19:42:58 +05:30
|
|
|
|
Body-centered cubic Bravais lattice with parameters of iron:
|
2022-02-22 11:10:17 +05:30
|
|
|
|
|
|
|
|
|
>>> import damask
|
2023-02-21 20:57:06 +05:30
|
|
|
|
>>> (Fe := damask.Crystal(lattice='cI', a=287e-12))
|
2022-02-22 11:10:17 +05:30
|
|
|
|
Crystal family: cubic
|
|
|
|
|
Bravais lattice: cI
|
2022-02-22 19:42:58 +05:30
|
|
|
|
a=2.87e-10 m, b=2.87e-10 m, c=2.87e-10 m
|
2022-02-22 11:10:17 +05:30
|
|
|
|
α=90°, β=90°, γ=90°
|
|
|
|
|
|
|
|
|
|
"""
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
2022-02-13 05:54:02 +05:30
|
|
|
|
def __init__(self, *,
|
2022-11-23 02:56:15 +05:30
|
|
|
|
family: Optional[CrystalFamily] = None,
|
2023-08-17 01:31:20 +05:30
|
|
|
|
lattice: Optional[BravaisLattice] = None,
|
2022-11-23 02:56:15 +05:30
|
|
|
|
a: Optional[float] = None, b: Optional[float] = None, c: Optional[float] = None,
|
|
|
|
|
alpha: Optional[float] = None, beta: Optional[float] = None, gamma: Optional[float] = None,
|
2022-01-27 13:23:27 +05:30
|
|
|
|
degrees: bool = False):
|
2021-06-02 12:58:27 +05:30
|
|
|
|
"""
|
2022-02-22 11:10:17 +05:30
|
|
|
|
New representation of a crystal.
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2021-07-18 19:12:36 +05:30
|
|
|
|
family : {'triclinic', 'monoclinic', 'orthorhombic', 'tetragonal', 'hexagonal', 'cubic'}, optional.
|
2021-07-13 03:44:13 +05:30
|
|
|
|
Name of the crystal family.
|
2021-08-09 03:26:54 +05:30
|
|
|
|
Will be inferred if 'lattice' is given.
|
2021-07-18 19:12:36 +05:30
|
|
|
|
lattice : {'aP', 'mP', 'mS', 'oP', 'oS', 'oI', 'oF', 'tP', 'tI', 'hP', 'cP', 'cI', 'cF'}, optional.
|
|
|
|
|
Name of the Bravais lattice in Pearson notation.
|
2021-06-02 12:58:27 +05:30
|
|
|
|
a : float, optional
|
|
|
|
|
Length of lattice parameter 'a'.
|
|
|
|
|
b : float, optional
|
|
|
|
|
Length of lattice parameter 'b'.
|
|
|
|
|
c : float, optional
|
|
|
|
|
Length of lattice parameter 'c'.
|
|
|
|
|
alpha : float, optional
|
|
|
|
|
Angle between b and c lattice basis.
|
|
|
|
|
beta : float, optional
|
|
|
|
|
Angle between c and a lattice basis.
|
|
|
|
|
gamma : float, optional
|
|
|
|
|
Angle between a and b lattice basis.
|
|
|
|
|
degrees : bool, optional
|
|
|
|
|
Angles are given in degrees. Defaults to False.
|
|
|
|
|
|
|
|
|
|
"""
|
2022-01-27 13:23:27 +05:30
|
|
|
|
if family is not None and family not in list(lattice_symmetries.values()):
|
2021-07-13 03:44:13 +05:30
|
|
|
|
raise KeyError(f'invalid crystal family "{family}"')
|
2021-07-18 19:12:36 +05:30
|
|
|
|
if lattice is not None and family is not None and family != lattice_symmetries[lattice]:
|
|
|
|
|
raise KeyError(f'incompatible family "{family}" for lattice "{lattice}"')
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
2023-10-25 00:09:17 +05:30
|
|
|
|
self.family = lattice_symmetries[lattice] if family is None else family
|
2021-06-06 23:19:29 +05:30
|
|
|
|
self.lattice = lattice
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
2021-06-06 23:19:29 +05:30
|
|
|
|
if self.lattice is not None:
|
|
|
|
|
self.a = 1 if a is None else a
|
|
|
|
|
self.b = b
|
|
|
|
|
self.c = c
|
|
|
|
|
self.a = float(self.a) if self.a is not None else \
|
|
|
|
|
(self.b / self.ratio['b'] if self.b is not None and self.ratio['b'] is not None else
|
|
|
|
|
self.c / self.ratio['c'] if self.c is not None and self.ratio['c'] is not None else None)
|
|
|
|
|
self.b = float(self.b) if self.b is not None else \
|
|
|
|
|
(self.a * self.ratio['b'] if self.a is not None and self.ratio['b'] is not None else
|
|
|
|
|
self.c / self.ratio['c'] * self.ratio['b']
|
|
|
|
|
if self.c is not None and self.ratio['b'] is not None and self.ratio['c'] is not None else None)
|
|
|
|
|
self.c = float(self.c) if self.c is not None else \
|
|
|
|
|
(self.a * self.ratio['c'] if self.a is not None and self.ratio['c'] is not None else
|
|
|
|
|
self.b / self.ratio['b'] * self.ratio['c']
|
|
|
|
|
if self.c is not None and self.ratio['b'] is not None and self.ratio['c'] is not None else None)
|
|
|
|
|
|
|
|
|
|
self.alpha = np.radians(alpha) if degrees and alpha is not None else alpha
|
|
|
|
|
self.beta = np.radians(beta) if degrees and beta is not None else beta
|
|
|
|
|
self.gamma = np.radians(gamma) if degrees and gamma is not None else gamma
|
|
|
|
|
if self.alpha is None and 'alpha' in self.immutable: self.alpha = self.immutable['alpha']
|
|
|
|
|
if self.beta is None and 'beta' in self.immutable: self.beta = self.immutable['beta']
|
|
|
|
|
if self.gamma is None and 'gamma' in self.immutable: self.gamma = self.immutable['gamma']
|
|
|
|
|
|
|
|
|
|
if \
|
|
|
|
|
(self.a is None) \
|
|
|
|
|
or (self.b is None or ('b' in self.immutable and self.b != self.immutable['b'] * self.a)) \
|
|
|
|
|
or (self.c is None or ('c' in self.immutable and self.c != self.immutable['c'] * self.b)) \
|
|
|
|
|
or (self.alpha is None or ('alpha' in self.immutable and self.alpha != self.immutable['alpha'])) \
|
2021-07-05 02:55:00 +05:30
|
|
|
|
or (self.beta is None or ('beta' in self.immutable and self.beta != self.immutable['beta'])) \
|
2021-06-06 23:19:29 +05:30
|
|
|
|
or (self.gamma is None or ('gamma' in self.immutable and self.gamma != self.immutable['gamma'])):
|
2021-09-29 21:41:38 +05:30
|
|
|
|
raise ValueError (f'incompatible parameters {self.parameters} for crystal family {self.family}')
|
2021-06-06 23:19:29 +05:30
|
|
|
|
|
|
|
|
|
if np.any(np.array([self.alpha,self.beta,self.gamma]) <= 0):
|
2021-09-29 21:41:38 +05:30
|
|
|
|
raise ValueError ('lattice angles must be positive')
|
2021-06-06 23:19:29 +05:30
|
|
|
|
if np.any([np.roll([self.alpha,self.beta,self.gamma],r)[0]
|
2021-09-29 21:41:38 +05:30
|
|
|
|
>= np.sum(np.roll([self.alpha,self.beta,self.gamma],r)[1:]) for r in range(3)]):
|
|
|
|
|
raise ValueError ('each lattice angle must be less than sum of others')
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
|
|
|
|
|
2021-08-09 03:26:54 +05:30
|
|
|
|
def __repr__(self):
|
2022-07-08 21:36:41 +05:30
|
|
|
|
"""
|
|
|
|
|
Return repr(self).
|
|
|
|
|
|
2023-02-21 20:57:06 +05:30
|
|
|
|
Give short, human-readable summary.
|
2022-07-08 21:36:41 +05:30
|
|
|
|
|
|
|
|
|
"""
|
2022-01-04 21:55:01 +05:30
|
|
|
|
family = f'Crystal family: {self.family}'
|
|
|
|
|
return family if self.lattice is None else \
|
2022-02-22 19:42:58 +05:30
|
|
|
|
util.srepr([family,
|
|
|
|
|
f'Bravais lattice: {self.lattice}',
|
|
|
|
|
'a={:.5g} m, b={:.5g} m, c={:.5g} m'.format(*self.parameters[:3]),
|
|
|
|
|
'α={:.5g}°, β={:.5g}°, γ={:.5g}°'.format(*np.degrees(self.parameters[3:]))])
|
2022-01-04 21:55:01 +05:30
|
|
|
|
|
2021-08-09 03:26:54 +05:30
|
|
|
|
|
2022-01-27 19:59:33 +05:30
|
|
|
|
def __eq__(self,
|
2023-11-07 16:02:40 +05:30
|
|
|
|
other: object) -> bool:
|
2021-06-03 13:01:24 +05:30
|
|
|
|
"""
|
2022-07-08 21:36:41 +05:30
|
|
|
|
Return self==other.
|
|
|
|
|
|
2022-07-08 21:37:07 +05:30
|
|
|
|
Test equality of other.
|
2021-06-03 13:01:24 +05:30
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2021-08-09 03:26:54 +05:30
|
|
|
|
other : Crystal
|
|
|
|
|
Crystal to check for equality.
|
2021-06-03 13:01:24 +05:30
|
|
|
|
|
|
|
|
|
"""
|
2023-10-25 00:09:17 +05:30
|
|
|
|
return (NotImplemented if not isinstance(other, Crystal) else
|
|
|
|
|
self.lattice == other.lattice and
|
|
|
|
|
self.parameters == other.parameters and
|
2023-11-07 16:02:40 +05:30
|
|
|
|
self.family == other.family) # type: ignore
|
2021-06-03 13:01:24 +05:30
|
|
|
|
|
2021-06-02 12:58:27 +05:30
|
|
|
|
@property
|
2023-10-25 00:30:19 +05:30
|
|
|
|
def parameters(self) -> Optional[Tuple]:
|
2021-06-02 12:58:27 +05:30
|
|
|
|
"""Return lattice parameters a, b, c, alpha, beta, gamma."""
|
2023-10-25 00:30:19 +05:30
|
|
|
|
return (self.a,self.b,self.c,self.alpha,self.beta,self.gamma) if hasattr(self,'a') else None
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
2021-07-13 03:44:13 +05:30
|
|
|
|
@property
|
2023-10-25 00:09:17 +05:30
|
|
|
|
def immutable(self) -> Dict[str, float]:
|
2021-07-13 03:44:13 +05:30
|
|
|
|
"""Return immutable lattice parameters."""
|
2023-10-25 00:09:17 +05:30
|
|
|
|
_immutable: Dict[CrystalFamily, Dict[str,float]] = {
|
2021-07-18 19:27:51 +05:30
|
|
|
|
'cubic': {
|
|
|
|
|
'b': 1.0,
|
|
|
|
|
'c': 1.0,
|
|
|
|
|
'alpha': np.pi/2.,
|
|
|
|
|
'beta': np.pi/2.,
|
|
|
|
|
'gamma': np.pi/2.,
|
|
|
|
|
},
|
|
|
|
|
'hexagonal': {
|
|
|
|
|
'b': 1.0,
|
|
|
|
|
'alpha': np.pi/2.,
|
|
|
|
|
'beta': np.pi/2.,
|
|
|
|
|
'gamma': 2.*np.pi/3.,
|
|
|
|
|
},
|
|
|
|
|
'tetragonal': {
|
|
|
|
|
'b': 1.0,
|
|
|
|
|
'alpha': np.pi/2.,
|
|
|
|
|
'beta': np.pi/2.,
|
|
|
|
|
'gamma': np.pi/2.,
|
|
|
|
|
},
|
|
|
|
|
'orthorhombic': {
|
|
|
|
|
'alpha': np.pi/2.,
|
|
|
|
|
'beta': np.pi/2.,
|
|
|
|
|
'gamma': np.pi/2.,
|
|
|
|
|
},
|
|
|
|
|
'monoclinic': {
|
|
|
|
|
'alpha': np.pi/2.,
|
|
|
|
|
'gamma': np.pi/2.,
|
|
|
|
|
},
|
|
|
|
|
'triclinic': {}
|
|
|
|
|
}
|
|
|
|
|
return _immutable[self.family]
|
2021-07-13 03:44:13 +05:30
|
|
|
|
|
|
|
|
|
|
2022-02-26 22:10:12 +05:30
|
|
|
|
@property
|
2023-10-25 00:09:17 +05:30
|
|
|
|
def orientation_relationships(self) -> List[str]:
|
2022-02-26 22:10:12 +05:30
|
|
|
|
"""Return labels of orientation relationships."""
|
2023-10-25 00:09:17 +05:30
|
|
|
|
return [k for k,v in orientation_relationships.items() if np.any([m.startswith(str(self.lattice)) for m in v])]
|
2022-02-26 22:10:12 +05:30
|
|
|
|
|
|
|
|
|
|
2021-07-13 03:44:13 +05:30
|
|
|
|
@property
|
2021-12-07 05:19:12 +05:30
|
|
|
|
def standard_triangle(self) -> Union[Dict[str, np.ndarray], None]:
|
2021-07-13 03:44:13 +05:30
|
|
|
|
"""
|
|
|
|
|
Corners of the standard triangle.
|
|
|
|
|
|
2021-07-18 19:32:05 +05:30
|
|
|
|
Notes
|
|
|
|
|
-----
|
2021-07-13 03:44:13 +05:30
|
|
|
|
Not yet defined for monoclinic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
----------
|
|
|
|
|
Bases are computed from
|
|
|
|
|
|
|
|
|
|
>>> basis = {
|
2021-07-18 19:32:05 +05:30
|
|
|
|
... 'cubic' : np.linalg.inv(np.array([[0.,0.,1.], # direction of red
|
|
|
|
|
... [1.,0.,1.]/np.sqrt(2.), # green
|
|
|
|
|
... [1.,1.,1.]/np.sqrt(3.)]).T), # blue
|
|
|
|
|
... 'hexagonal' : np.linalg.inv(np.array([[0.,0.,1.], # direction of red
|
|
|
|
|
... [1.,0.,0.], # green
|
|
|
|
|
... [np.sqrt(3.),1.,0.]/np.sqrt(4.)]).T), # blue
|
|
|
|
|
... 'tetragonal' : np.linalg.inv(np.array([[0.,0.,1.], # direction of red
|
|
|
|
|
... [1.,0.,0.], # green
|
|
|
|
|
... [1.,1.,0.]/np.sqrt(2.)]).T), # blue
|
|
|
|
|
... 'orthorhombic': np.linalg.inv(np.array([[0.,0.,1.], # direction of red
|
|
|
|
|
... [1.,0.,0.], # green
|
|
|
|
|
... [0.,1.,0.]]).T), # blue
|
2021-07-13 03:44:13 +05:30
|
|
|
|
... }
|
|
|
|
|
|
|
|
|
|
"""
|
2022-02-12 02:10:14 +05:30
|
|
|
|
_basis: Dict[CrystalFamily, Dict[str, np.ndarray]] = {
|
2021-07-13 03:44:13 +05:30
|
|
|
|
'cubic': {'improper':np.array([ [-1. , 0. , 1. ],
|
|
|
|
|
[ np.sqrt(2.) , -np.sqrt(2.) , 0. ],
|
|
|
|
|
[ 0. , np.sqrt(3.) , 0. ] ]),
|
|
|
|
|
'proper':np.array([ [ 0. , -1. , 1. ],
|
|
|
|
|
[-np.sqrt(2.) , np.sqrt(2.) , 0. ],
|
|
|
|
|
[ np.sqrt(3.) , 0. , 0. ] ]),
|
|
|
|
|
},
|
|
|
|
|
'hexagonal':
|
|
|
|
|
{'improper':np.array([ [ 0. , 0. , 1. ],
|
|
|
|
|
[ 1. , -np.sqrt(3.) , 0. ],
|
|
|
|
|
[ 0. , 2. , 0. ] ]),
|
|
|
|
|
'proper':np.array([ [ 0. , 0. , 1. ],
|
|
|
|
|
[-1. , np.sqrt(3.) , 0. ],
|
|
|
|
|
[ np.sqrt(3.) , -1. , 0. ] ]),
|
|
|
|
|
},
|
|
|
|
|
'tetragonal':
|
|
|
|
|
{'improper':np.array([ [ 0. , 0. , 1. ],
|
|
|
|
|
[ 1. , -1. , 0. ],
|
|
|
|
|
[ 0. , np.sqrt(2.) , 0. ] ]),
|
|
|
|
|
'proper':np.array([ [ 0. , 0. , 1. ],
|
|
|
|
|
[-1. , 1. , 0. ],
|
|
|
|
|
[ np.sqrt(2.) , 0. , 0. ] ]),
|
|
|
|
|
},
|
|
|
|
|
'orthorhombic':
|
|
|
|
|
{'improper':np.array([ [ 0., 0., 1.],
|
|
|
|
|
[ 1., 0., 0.],
|
|
|
|
|
[ 0., 1., 0.] ]),
|
|
|
|
|
'proper':np.array([ [ 0., 0., 1.],
|
|
|
|
|
[-1., 0., 0.],
|
|
|
|
|
[ 0., 1., 0.] ]),
|
|
|
|
|
}}
|
2021-12-07 05:19:12 +05:30
|
|
|
|
return _basis.get(self.family, None)
|
2021-07-13 03:44:13 +05:30
|
|
|
|
|
|
|
|
|
|
2022-02-22 20:41:07 +05:30
|
|
|
|
@property
|
|
|
|
|
def symmetry_operations(self) -> Rotation:
|
2023-08-17 18:09:47 +05:30
|
|
|
|
"""
|
|
|
|
|
Return symmetry operations.
|
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
----------
|
|
|
|
|
U.F. Kocks et al.,
|
|
|
|
|
Texture and Anisotropy:
|
|
|
|
|
Preferred Orientations in Polycrystals and their Effect on Materials Properties.
|
|
|
|
|
Cambridge University Press 1998. Table II
|
|
|
|
|
|
|
|
|
|
"""
|
2022-02-22 20:41:07 +05:30
|
|
|
|
_symmetry_operations: Dict[CrystalFamily, List] = {
|
|
|
|
|
'cubic': [
|
|
|
|
|
[ 1.0, 0.0, 0.0, 0.0 ],
|
|
|
|
|
[ 0.0, 1.0, 0.0, 0.0 ],
|
|
|
|
|
[ 0.0, 0.0, 1.0, 0.0 ],
|
|
|
|
|
[ 0.0, 0.0, 0.0, 1.0 ],
|
|
|
|
|
[ 0.0, 0.0, 0.5*np.sqrt(2), 0.5*np.sqrt(2) ],
|
|
|
|
|
[ 0.0, 0.0, 0.5*np.sqrt(2),-0.5*np.sqrt(2) ],
|
|
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(_symmetry_operations[self.family],accept_homomorph=True)
|
|
|
|
|
|
|
|
|
|
|
2021-06-02 12:58:27 +05:30
|
|
|
|
@property
|
|
|
|
|
def ratio(self):
|
|
|
|
|
"""Return axes ratios of own lattice."""
|
|
|
|
|
_ratio = { 'hexagonal': {'c': np.sqrt(8./3.)}}
|
|
|
|
|
|
|
|
|
|
return dict(b = self.immutable['b']
|
|
|
|
|
if 'b' in self.immutable else
|
|
|
|
|
_ratio[self.family]['b'] if self.family in _ratio and 'b' in _ratio[self.family] else None,
|
|
|
|
|
c = self.immutable['c']
|
|
|
|
|
if 'c' in self.immutable else
|
|
|
|
|
_ratio[self.family]['c'] if self.family in _ratio and 'c' in _ratio[self.family] else None,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
2021-12-07 05:19:12 +05:30
|
|
|
|
def basis_real(self) -> np.ndarray:
|
2021-06-02 12:58:27 +05:30
|
|
|
|
"""
|
2021-07-05 02:55:00 +05:30
|
|
|
|
Return orthogonal real space crystal basis.
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
----------
|
|
|
|
|
C.T. Young and J.L. Lytton, Journal of Applied Physics 43:1408–1417, 1972
|
|
|
|
|
https://doi.org/10.1063/1.1661333
|
|
|
|
|
|
|
|
|
|
"""
|
2022-01-27 13:23:27 +05:30
|
|
|
|
if self.parameters is None:
|
2021-06-02 12:58:27 +05:30
|
|
|
|
raise KeyError('missing crystal lattice parameters')
|
|
|
|
|
return np.array([
|
|
|
|
|
[1,0,0],
|
|
|
|
|
[np.cos(self.gamma),np.sin(self.gamma),0],
|
|
|
|
|
[np.cos(self.beta),
|
|
|
|
|
(np.cos(self.alpha)-np.cos(self.beta)*np.cos(self.gamma)) /np.sin(self.gamma),
|
|
|
|
|
np.sqrt(1 - np.cos(self.alpha)**2 - np.cos(self.beta)**2 - np.cos(self.gamma)**2
|
|
|
|
|
+ 2 * np.cos(self.alpha) * np.cos(self.beta) * np.cos(self.gamma))/np.sin(self.gamma)],
|
|
|
|
|
],dtype=float).T \
|
|
|
|
|
* np.array([self.a,self.b,self.c])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
2021-12-07 05:19:12 +05:30
|
|
|
|
def basis_reciprocal(self) -> np.ndarray:
|
2021-07-05 02:55:00 +05:30
|
|
|
|
"""Return reciprocal (dual) crystal basis."""
|
2021-06-02 12:58:27 +05:30
|
|
|
|
return np.linalg.inv(self.basis_real.T)
|
|
|
|
|
|
|
|
|
|
|
2021-09-29 21:41:38 +05:30
|
|
|
|
@property
|
2023-10-25 00:09:17 +05:30
|
|
|
|
def lattice_points(self) -> np.ndarray:
|
2021-09-29 21:41:38 +05:30
|
|
|
|
"""Return lattice points."""
|
2023-10-25 00:09:17 +05:30
|
|
|
|
_lattice_points: Dict[str, List] = {
|
2021-09-29 21:41:38 +05:30
|
|
|
|
'P': [
|
|
|
|
|
],
|
|
|
|
|
'S': [
|
|
|
|
|
[0.5,0.5,0],
|
|
|
|
|
],
|
|
|
|
|
'I': [
|
|
|
|
|
[0.5,0.5,0.5],
|
|
|
|
|
],
|
|
|
|
|
'F': [
|
|
|
|
|
[0.0,0.5,0.5],
|
|
|
|
|
[0.5,0.0,0.5],
|
|
|
|
|
[0.5,0.5,0.0],
|
|
|
|
|
],
|
|
|
|
|
'hP': [
|
|
|
|
|
[2./3.,1./3.,0.5],
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if self.lattice is None: raise KeyError('no lattice type specified')
|
2021-09-30 20:31:42 +05:30
|
|
|
|
return np.array([[0,0,0]]
|
2023-10-25 00:09:17 +05:30
|
|
|
|
+ _lattice_points.get(self.lattice if self.lattice == 'hP' else
|
|
|
|
|
self.lattice[-1],[]),dtype=float)
|
2021-09-29 21:41:38 +05:30
|
|
|
|
|
2022-01-27 16:44:54 +05:30
|
|
|
|
def to_lattice(self, *,
|
2022-11-23 02:56:15 +05:30
|
|
|
|
direction: Optional[FloatSequence] = None,
|
|
|
|
|
plane: Optional[FloatSequence] = None) -> np.ndarray:
|
2021-06-02 12:58:27 +05:30
|
|
|
|
"""
|
|
|
|
|
Calculate lattice vector corresponding to crystal frame direction or plane normal.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2022-02-12 02:10:14 +05:30
|
|
|
|
direction|plane : numpy.ndarray, shape (...,3)
|
2022-02-22 19:42:58 +05:30
|
|
|
|
Real space vector along direction or
|
|
|
|
|
reciprocal space vector along plane normal.
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
-------
|
2022-02-12 02:10:14 +05:30
|
|
|
|
Miller : numpy.ndarray, shape (...,3)
|
2021-07-05 02:55:00 +05:30
|
|
|
|
Lattice vector of direction or plane.
|
2021-06-02 12:58:27 +05:30
|
|
|
|
Use util.scale_to_coprime to convert to (integer) Miller indices.
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
if (direction is not None) ^ (plane is None):
|
2021-09-29 21:41:38 +05:30
|
|
|
|
raise KeyError('specify either "direction" or "plane"')
|
2022-02-11 03:27:23 +05:30
|
|
|
|
basis,axis = (self.basis_reciprocal,np.array(direction)) \
|
|
|
|
|
if plane is None else \
|
|
|
|
|
(self.basis_real,np.array(plane))
|
|
|
|
|
return np.einsum('li,...l',basis,axis)
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
|
|
|
|
|
2022-01-27 16:44:54 +05:30
|
|
|
|
def to_frame(self, *,
|
2022-11-23 02:56:15 +05:30
|
|
|
|
uvw: Optional[FloatSequence] = None,
|
|
|
|
|
hkl: Optional[FloatSequence] = None) -> np.ndarray:
|
2021-06-02 12:58:27 +05:30
|
|
|
|
"""
|
2022-02-22 19:42:58 +05:30
|
|
|
|
Calculate crystal frame vector corresponding to lattice direction [uvw] or plane normal (hkl).
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
2022-02-12 02:10:14 +05:30
|
|
|
|
uvw|hkl : numpy.ndarray, shape (...,3)
|
2021-06-02 12:58:27 +05:30
|
|
|
|
Miller indices of crystallographic direction or plane normal.
|
|
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
-------
|
2022-02-12 02:10:14 +05:30
|
|
|
|
vector : numpy.ndarray, shape (...,3)
|
2022-02-22 19:42:58 +05:30
|
|
|
|
Crystal frame vector in real space along [uvw] direction or
|
|
|
|
|
in reciprocal space along (hkl) plane normal.
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
2022-02-22 11:10:17 +05:30
|
|
|
|
Examples
|
|
|
|
|
--------
|
2022-02-22 19:42:58 +05:30
|
|
|
|
Crystal frame vector (real space) of Magnesium corresponding to [1,1,0] direction:
|
2022-02-22 11:10:17 +05:30
|
|
|
|
|
|
|
|
|
>>> import damask
|
2022-02-22 19:42:58 +05:30
|
|
|
|
>>> Mg = damask.Crystal(lattice='hP', a=321e-12, c=521e-12)
|
|
|
|
|
>>> Mg.to_frame(uvw=[1, 1, 0])
|
|
|
|
|
array([1.60500000e-10, 2.77994155e-10, 0.00000000e+00])
|
2022-02-22 11:10:17 +05:30
|
|
|
|
|
2022-02-22 19:42:58 +05:30
|
|
|
|
Crystal frame vector (reciprocal space) of Titanium along (1,0,0) plane normal:
|
2022-02-22 11:10:17 +05:30
|
|
|
|
|
|
|
|
|
>>> import damask
|
2023-10-24 08:23:27 +05:30
|
|
|
|
>>> Ti = damask.Crystal(lattice='hP', a=295e-12, c=469e-12)
|
2022-02-22 11:10:17 +05:30
|
|
|
|
>>> Ti.to_frame(hkl=(1, 0, 0))
|
|
|
|
|
array([ 3.38983051e+09, 1.95711956e+09, -4.15134508e-07])
|
|
|
|
|
|
2021-06-02 12:58:27 +05:30
|
|
|
|
"""
|
|
|
|
|
if (uvw is not None) ^ (hkl is None):
|
2021-09-29 21:41:38 +05:30
|
|
|
|
raise KeyError('specify either "uvw" or "hkl"')
|
2022-02-11 03:27:23 +05:30
|
|
|
|
basis,axis = (self.basis_real,np.array(uvw)) \
|
|
|
|
|
if hkl is None else \
|
|
|
|
|
(self.basis_reciprocal,np.array(hkl))
|
2021-06-02 12:58:27 +05:30
|
|
|
|
return np.einsum('il,...l',basis,axis)
|
|
|
|
|
|
|
|
|
|
|
2022-01-27 15:15:14 +05:30
|
|
|
|
def kinematics(self,
|
2022-02-12 02:10:14 +05:30
|
|
|
|
mode: CrystalKinematics) -> Dict[str, List[np.ndarray]]:
|
2021-07-25 23:01:48 +05:30
|
|
|
|
"""
|
2021-08-09 03:26:54 +05:30
|
|
|
|
Return crystal kinematics systems.
|
2021-07-25 23:01:48 +05:30
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
mode : {'slip','twin'}
|
|
|
|
|
Deformation mode.
|
|
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
-------
|
|
|
|
|
direction_plane : dictionary
|
2021-08-09 03:26:54 +05:30
|
|
|
|
Directions and planes of deformation mode families.
|
2021-07-25 23:01:48 +05:30
|
|
|
|
|
|
|
|
|
"""
|
2023-10-25 00:09:17 +05:30
|
|
|
|
_kinematics: Dict[Optional[BravaisLattice], Dict[CrystalKinematics, List[np.ndarray]]] = {
|
2021-07-18 19:32:05 +05:30
|
|
|
|
'cF': {
|
2022-01-05 12:38:10 +05:30
|
|
|
|
'slip': [np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[ 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]]),
|
2021-08-04 19:36:28 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[+1,+1, 0, +1,-1, 0],
|
|
|
|
|
[+1,-1, 0, +1,+1, 0],
|
|
|
|
|
[+1, 0,+1, +1, 0,-1],
|
|
|
|
|
[+1, 0,-1, +1, 0,+1],
|
|
|
|
|
[ 0,+1,+1, 0,+1,-1],
|
|
|
|
|
[ 0,+1,-1, 0,+1,+1]])],
|
2022-01-05 12:38:10 +05:30
|
|
|
|
'twin': [np.array([
|
2021-08-04 19:36:28 +05:30
|
|
|
|
[-2, 1, 1, 1, 1, 1],
|
|
|
|
|
[ 1,-2, 1, 1, 1, 1],
|
|
|
|
|
[ 1, 1,-2, 1, 1, 1],
|
|
|
|
|
[ 2,-1, 1, -1,-1, 1],
|
|
|
|
|
[-1, 2, 1, -1,-1, 1],
|
|
|
|
|
[-1,-1,-2, -1,-1, 1],
|
|
|
|
|
[-2,-1,-1, 1,-1,-1],
|
|
|
|
|
[ 1, 2,-1, 1,-1,-1],
|
|
|
|
|
[ 1,-1, 2, 1,-1,-1],
|
|
|
|
|
[ 2, 1,-1, -1, 1,-1],
|
|
|
|
|
[-1,-2,-1, -1, 1,-1],
|
|
|
|
|
[-1, 1, 2, -1, 1,-1]])]
|
2021-07-18 19:32:05 +05:30
|
|
|
|
},
|
|
|
|
|
'cI': {
|
2022-01-05 12:38:10 +05:30
|
|
|
|
'slip': [np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[+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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|
|
|
[-1,+1,+1, +2,+3,-1],
|
|
|
|
|
[-1,+1,+1, +3,+1,+2],
|
|
|
|
|
[+1,+1,+1, -3,+1,+2],
|
|
|
|
|
[+1,+1,-1, +3,-1,+2],
|
|
|
|
|
[+1,-1,+1, +3,+1,-2],
|
|
|
|
|
[-1,+1,+1, +3,+2,+1],
|
|
|
|
|
[+1,+1,+1, -3,+2,+1],
|
|
|
|
|
[+1,+1,-1, +3,-2,+1],
|
|
|
|
|
[+1,-1,+1, +3,+2,-1]])],
|
2022-01-05 12:38:10 +05:30
|
|
|
|
'twin': [np.array([
|
2021-08-04 19:36:28 +05:30
|
|
|
|
[-1, 1, 1, 2, 1, 1],
|
|
|
|
|
[ 1, 1, 1, -2, 1, 1],
|
|
|
|
|
[ 1, 1,-1, 2,-1, 1],
|
|
|
|
|
[ 1,-1, 1, 2, 1,-1],
|
|
|
|
|
[ 1,-1, 1, 1, 2, 1],
|
|
|
|
|
[ 1, 1,-1, -1, 2, 1],
|
|
|
|
|
[ 1, 1, 1, 1,-2, 1],
|
|
|
|
|
[-1, 1, 1, 1, 2,-1],
|
|
|
|
|
[ 1, 1,-1, 1, 1, 2],
|
|
|
|
|
[ 1,-1, 1, -1, 1, 2],
|
|
|
|
|
[-1, 1, 1, 1,-1, 2],
|
|
|
|
|
[ 1, 1, 1, 1, 1,-2]])]
|
2021-07-18 19:32:05 +05:30
|
|
|
|
},
|
|
|
|
|
'hP': {
|
2022-01-05 12:38:10 +05:30
|
|
|
|
'slip': [np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[+2,-1,-1, 0, 0, 0, 0,+1],
|
|
|
|
|
[-1,+2,-1, 0, 0, 0, 0,+1],
|
|
|
|
|
[-1,-1,+2, 0, 0, 0, 0,+1]]),
|
2021-08-04 19:36:28 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[+2,-1,-1, 0, 0,+1,-1, 0],
|
|
|
|
|
[-1,+2,-1, 0, -1, 0,+1, 0],
|
|
|
|
|
[-1,-1,+2, 0, +1,-1, 0, 0]]),
|
2021-08-04 19:36:28 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[-1,+2,-1, 0, +1, 0,-1,+1],
|
|
|
|
|
[-2,+1,+1, 0, 0,+1,-1,+1],
|
|
|
|
|
[-1,-1,+2, 0, -1,+1, 0,+1],
|
|
|
|
|
[+1,-2,+1, 0, -1, 0,+1,+1],
|
|
|
|
|
[+2,-1,-1, 0, 0,-1,+1,+1],
|
|
|
|
|
[+1,+1,-2, 0, +1,-1, 0,+1]]),
|
2021-08-04 19:36:28 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[-2,+1,+1,+3, +1, 0,-1,+1],
|
|
|
|
|
[-1,-1,+2,+3, +1, 0,-1,+1],
|
|
|
|
|
[-1,-1,+2,+3, 0,+1,-1,+1],
|
|
|
|
|
[+1,-2,+1,+3, 0,+1,-1,+1],
|
|
|
|
|
[+1,-2,+1,+3, -1,+1, 0,+1],
|
|
|
|
|
[+2,-1,-1,+3, -1,+1, 0,+1],
|
|
|
|
|
[+2,-1,-1,+3, -1, 0,+1,+1],
|
|
|
|
|
[+1,+1,-2,+3, -1, 0,+1,+1],
|
|
|
|
|
[+1,+1,-2,+3, 0,-1,+1,+1],
|
|
|
|
|
[-1,+2,-1,+3, 0,-1,+1,+1],
|
|
|
|
|
[-1,+2,-1,+3, +1,-1, 0,+1],
|
|
|
|
|
[-2,+1,+1,+3, +1,-1, 0,+1]]),
|
2021-08-04 19:36:28 +05:30
|
|
|
|
np.array([
|
|
|
|
|
[-1,-1,+2,+3, +1,+1,-2,+2],
|
|
|
|
|
[+1,-2,+1,+3, -1,+2,-1,+2],
|
|
|
|
|
[+2,-1,-1,+3, -2,+1,+1,+2],
|
|
|
|
|
[+1,+1,-2,+3, -1,-1,+2,+2],
|
|
|
|
|
[-1,+2,-1,+3, +1,-2,+1,+2],
|
|
|
|
|
[-2,+1,+1,+3, +2,-1,-1,+2]])],
|
2022-01-05 12:38:10 +05:30
|
|
|
|
'twin': [np.array([
|
2021-08-04 19:36:28 +05:30
|
|
|
|
[-1, 0, 1, 1, 1, 0,-1, 2], # shear = (3-(c/a)^2)/(sqrt(3) c/a) <-10.1>{10.2}
|
|
|
|
|
[ 0,-1, 1, 1, 0, 1,-1, 2],
|
|
|
|
|
[ 1,-1, 0, 1, -1, 1, 0, 2],
|
|
|
|
|
[ 1, 0,-1, 1, -1, 0, 1, 2],
|
|
|
|
|
[ 0, 1,-1, 1, 0,-1, 1, 2],
|
|
|
|
|
[-1, 1, 0, 1, 1,-1, 0, 2]]),
|
|
|
|
|
np.array([
|
|
|
|
|
[-1,-1, 2, 6, 1, 1,-2, 1], # shear = 1/(c/a) <11.6>{-1-1.1}
|
|
|
|
|
[ 1,-2, 1, 6, -1, 2,-1, 1],
|
|
|
|
|
[ 2,-1,-1, 6, -2, 1, 1, 1],
|
|
|
|
|
[ 1, 1,-2, 6, -1,-1, 2, 1],
|
|
|
|
|
[-1, 2,-1, 6, 1,-2, 1, 1],
|
|
|
|
|
[-2, 1, 1, 6, 2,-1,-1, 1]]),
|
|
|
|
|
np.array([
|
|
|
|
|
[ 1, 0,-1,-2, 1, 0,-1, 1], # shear = (4(c/a)^2-9)/(4 sqrt(3) c/a) <10.-2>{10.1}
|
|
|
|
|
[ 0, 1,-1,-2, 0, 1,-1, 1],
|
|
|
|
|
[-1, 1, 0,-2, -1, 1, 0, 1],
|
|
|
|
|
[-1, 0, 1,-2, -1, 0, 1, 1],
|
|
|
|
|
[ 0,-1, 1,-2, 0,-1, 1, 1],
|
|
|
|
|
[ 1,-1, 0,-2, 1,-1, 0, 1]]),
|
|
|
|
|
np.array([
|
|
|
|
|
[ 1, 1,-2,-3, 1, 1,-2, 2], # shear = 2((c/a)^2-2)/(3 c/a) <11.-3>{11.2}
|
|
|
|
|
[-1, 2,-1,-3, -1, 2,-1, 2],
|
|
|
|
|
[-2, 1, 1,-3, -2, 1, 1, 2],
|
|
|
|
|
[-1,-1, 2,-3, -1,-1, 2, 2],
|
|
|
|
|
[ 1,-2, 1,-3, 1,-2, 1, 2],
|
|
|
|
|
[ 2,-1,-1,-3, 2,-1,-1, 2]])]
|
2022-01-05 12:38:10 +05:30
|
|
|
|
},
|
|
|
|
|
'tI': {
|
|
|
|
|
'slip': [np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[ 0, 0,+1, +1, 0, 0],
|
|
|
|
|
[ 0, 0,+1, 0,+1, 0]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[ 0, 0,+1, +1,+1, 0],
|
|
|
|
|
[ 0, 0,+1, -1,+1, 0]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[ 0,+1, 0, +1, 0, 0],
|
|
|
|
|
[+1, 0, 0, 0,+1, 0]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[+1,-1,+1, +1,+1, 0],
|
|
|
|
|
[+1,-1,-1, +1,+1, 0],
|
|
|
|
|
[-1,-1,-1, -1,+1, 0],
|
|
|
|
|
[-1,-1,+1, -1,+1, 0]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[+1,-1, 0, +1,+1, 0],
|
|
|
|
|
[+1,+1, 0, +1,-1, 0]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[ 0,+1,+1, +1, 0, 0],
|
|
|
|
|
[ 0,-1,+1, +1, 0, 0],
|
|
|
|
|
[-1, 0,+1, 0,+1, 0],
|
|
|
|
|
[+1, 0,+1, 0,+1, 0]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[ 0,+1, 0, 0, 0,+1],
|
|
|
|
|
[+1, 0, 0, 0, 0,+1]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[+1,+1, 0, 0, 0,+1],
|
|
|
|
|
[-1,+1, 0, 0, 0,+1]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[ 0,+1,-1, 0,+1,+1],
|
|
|
|
|
[ 0,-1,-1, 0,-1,+1],
|
|
|
|
|
[-1, 0,-1, -1, 0,+1],
|
|
|
|
|
[+1, 0,-1, +1, 0,+1]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[+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, 0,-1],
|
|
|
|
|
[+1,-1,+1, +1, 0,-1]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[+1, 0, 0, 0,+1,+1],
|
|
|
|
|
[+1, 0, 0, 0,+1,-1],
|
|
|
|
|
[ 0,+1, 0, +1, 0,+1],
|
|
|
|
|
[ 0,+1, 0, +1, 0,-1]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
2023-09-15 02:15:24 +05:30
|
|
|
|
[ 0,+1,-1, +2,+1,+1],
|
|
|
|
|
[ 0,-1,-1, +2,-1,+1],
|
|
|
|
|
[+1, 0,-1, +1,+2,+1],
|
|
|
|
|
[-1, 0,-1, -1,+2,+1],
|
|
|
|
|
[ 0,+1,-1, -2,+1,+1],
|
|
|
|
|
[ 0,-1,-1, -2,-1,+1],
|
|
|
|
|
[-1, 0,-1, -1,-2,+1],
|
|
|
|
|
[+1, 0,-1, +1,-2,+1]]),
|
2022-01-05 12:38:10 +05:30
|
|
|
|
np.array([
|
|
|
|
|
[-1,+1,+1, +2,+1,+1],
|
|
|
|
|
[-1,-1,+1, +2,-1,+1],
|
|
|
|
|
[+1,-1,+1, +1,+2,+1],
|
|
|
|
|
[-1,-1,+1, -1,+2,+1],
|
|
|
|
|
[+1,+1,+1, -2,+1,+1],
|
|
|
|
|
[+1,-1,+1, -2,-1,+1],
|
|
|
|
|
[-1,+1,+1, -1,-2,+1],
|
|
|
|
|
[+1,+1,+1, +1,-2,+1]])]
|
|
|
|
|
}
|
2021-07-18 19:32:05 +05:30
|
|
|
|
}
|
|
|
|
|
master = _kinematics[self.lattice][mode]
|
2022-03-09 22:30:17 +05:30
|
|
|
|
return {'direction':[util.Bravais_to_Miller(uvtw=m[:,0:4]) if self.lattice == 'hP'
|
|
|
|
|
else m[:,0:3] for m in master],
|
|
|
|
|
'plane': [util.Bravais_to_Miller(hkil=m[:,4:8]) if self.lattice == 'hP'
|
|
|
|
|
else m[:,3:6] for m in master]}
|
2021-06-02 12:58:27 +05:30
|
|
|
|
|
|
|
|
|
|
2022-01-27 15:15:14 +05:30
|
|
|
|
def relation_operations(self,
|
2023-10-24 08:23:27 +05:30
|
|
|
|
model: str,
|
|
|
|
|
target = None) -> Tuple[BravaisLattice, Rotation]:
|
2021-06-03 12:45:12 +05:30
|
|
|
|
"""
|
|
|
|
|
Crystallographic orientation relationships for phase transformations.
|
|
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
|
----------
|
|
|
|
|
model : str
|
|
|
|
|
Name of orientation relationship.
|
2023-11-06 20:30:07 +05:30
|
|
|
|
target : Crystal, optional
|
2023-10-24 08:23:27 +05:30
|
|
|
|
Crystal to transform to.
|
|
|
|
|
Providing this parameter allows specification of non-standard lattice parameters.
|
2023-11-06 20:30:07 +05:30
|
|
|
|
Default is inferred from selected model and uses standard lattice parameters.
|
2021-06-03 12:45:12 +05:30
|
|
|
|
|
|
|
|
|
Returns
|
|
|
|
|
-------
|
|
|
|
|
operations : (string, damask.Rotation)
|
2021-08-09 03:26:54 +05:30
|
|
|
|
Resulting lattice and rotations characterizing the orientation relationship.
|
2021-06-03 12:45:12 +05:30
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
----------
|
|
|
|
|
S. Morito et al., Journal of Alloys and Compounds 577:s587-s592, 2013
|
|
|
|
|
https://doi.org/10.1016/j.jallcom.2012.02.004
|
|
|
|
|
|
|
|
|
|
K. Kitahara et al., Acta Materialia 54(5):1279-1288, 2006
|
|
|
|
|
https://doi.org/10.1016/j.actamat.2005.11.001
|
|
|
|
|
|
|
|
|
|
Y. He et al., Journal of Applied Crystallography 39:72-81, 2006
|
|
|
|
|
https://doi.org/10.1107/S0021889805038276
|
|
|
|
|
|
|
|
|
|
H. Kitahara et al., Materials Characterization 54(4-5):378-386, 2005
|
|
|
|
|
https://doi.org/10.1016/j.matchar.2004.12.015
|
|
|
|
|
|
|
|
|
|
Y. He et al., Acta Materialia 53(4):1179-1190, 2005
|
|
|
|
|
https://doi.org/10.1016/j.actamat.2004.11.021
|
|
|
|
|
|
|
|
|
|
"""
|
2023-10-25 00:09:17 +05:30
|
|
|
|
m_l: BravaisLattice
|
|
|
|
|
o_l: BravaisLattice
|
|
|
|
|
|
2023-10-24 08:23:27 +05:30
|
|
|
|
if model not in self.orientation_relationships:
|
2021-06-03 12:45:12 +05:30
|
|
|
|
raise KeyError(f'unknown orientation relationship "{model}"')
|
|
|
|
|
|
2023-10-24 08:23:27 +05:30
|
|
|
|
sep = '-->'
|
2023-11-07 04:12:11 +05:30
|
|
|
|
search = self.lattice+sep+('' if target is None else target.lattice) # type: ignore
|
|
|
|
|
transform = [t for t in orientation_relationships[model].keys() if t.startswith(search)] # type: ignore
|
2023-10-25 00:09:17 +05:30
|
|
|
|
|
2023-11-07 04:12:11 +05:30
|
|
|
|
if len(transform) != 1:
|
|
|
|
|
raise ValueError(f'invalid target lattice "{search.split(sep)[1]}"')
|
|
|
|
|
|
|
|
|
|
m_l,o_l = transform[0].split(sep) # type: ignore
|
2023-10-24 08:23:27 +05:30
|
|
|
|
m_p,o_p = orientation_relationships[model][m_l+sep+o_l]
|
|
|
|
|
other = Crystal(lattice=o_l) if target is None else target
|
|
|
|
|
m_p = np.stack((self.to_frame(uvw=m_p[:,0] if len(m_p[0,0])==3 else util.Bravais_to_Miller(uvtw=m_p[:,0])),
|
|
|
|
|
self.to_frame(hkl=m_p[:,1] if len(m_p[0,1])==3 else util.Bravais_to_Miller(hkil=m_p[:,1]))),
|
|
|
|
|
axis=1)
|
|
|
|
|
o_p = np.stack((other.to_frame(uvw=o_p[:,0] if len(o_p[0,0])==3 else util.Bravais_to_Miller(uvtw=o_p[:,0])),
|
|
|
|
|
other.to_frame(hkl=o_p[:,1] if len(o_p[0,1])==3 else util.Bravais_to_Miller(hkil=o_p[:,1]))),
|
|
|
|
|
axis=1)
|
|
|
|
|
|
|
|
|
|
return (o_l,Rotation.from_parallel(a=m_p,b=o_p))
|