diff --git a/python/damask/_crystal.py b/python/damask/_crystal.py index 525ce9682..5d3fa24ea 100644 --- a/python/damask/_crystal.py +++ b/python/damask/_crystal.py @@ -35,14 +35,15 @@ class Crystal(): alpha = None,beta = None,gamma = None, degrees = False): """ - Lattice. + Representation of crystal in terms of crystal family or Bravais lattice. Parameters ---------- - lattice : {'aP', 'mP', 'mS', 'oP', 'oS', 'oI', 'oF', 'tP', 'tI', 'hP', 'cP', 'cI', 'cF'}. - Name of the Bravais lattice in Pearson notation. - family : {'triclinic', 'monoclinic', 'orthorhombic', 'tetragonal', 'hexagonal', 'cubic'} + family : {'triclinic', 'monoclinic', 'orthorhombic', 'tetragonal', 'hexagonal', 'cubic'}, optional. Name of the crystal family. + Will be infered if 'lattice' is given. + lattice : {'aP', 'mP', 'mS', 'oP', 'oS', 'oI', 'oF', 'tP', 'tI', 'hP', 'cP', 'cI', 'cF'}, optional. + Name of the Bravais lattice in Pearson notation. a : float, optional Length of lattice parameter 'a'. b : float, optional @@ -61,6 +62,8 @@ class Crystal(): """ if family not in [None] + list(self._immutable.keys()): raise KeyError(f'invalid crystal family "{family}"') + if lattice is not None and family is not None and family != lattice_symmetries[lattice]: + raise KeyError(f'incompatible family "{family}" for lattice "{lattice}"') self.family = lattice_symmetries[lattice] if family is None else family self.lattice = lattice diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index f6f489b44..a78b6a189 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -32,11 +32,11 @@ lattice_symmetries = { _parameter_doc = \ """ - family : {'triclinic', 'monoclinic', 'orthorhombic', 'tetragonal', 'hexagonal', 'cubic'} - Crystal family. Mutually exclusive with 'lattice' parameter. - lattice : {'aP', 'mP', 'mS', 'oP', 'oS', 'oI', 'oF', 'tP', 'tI', 'hP', 'cP', 'cI', 'cF'}. - Bravais lattice in Pearson notation. - Mutually exclusive with 'family' parameter. + family : {'triclinic', 'monoclinic', 'orthorhombic', 'tetragonal', 'hexagonal', 'cubic'}, optional. + Name of the crystal family. + Will be infered if 'lattice' is given. + lattice : {'aP', 'mP', 'mS', 'oP', 'oS', 'oI', 'oF', 'tP', 'tI', 'hP', 'cP', 'cI', 'cF'}, optional. + Name of the Bravais lattice in Pearson notation. a : float, optional Length of lattice parameter 'a'. b : float, optional