added crystal repr(); fixed typos; extended help
This commit is contained in:
parent
b1dab5f398
commit
5292f9b414
|
@ -26,7 +26,7 @@ lattice_symmetries = {
|
|||
|
||||
|
||||
class Crystal():
|
||||
"""Lattice."""
|
||||
"""Crystal lattice."""
|
||||
|
||||
def __init__(self,*,
|
||||
family = None,
|
||||
|
@ -41,7 +41,7 @@ class Crystal():
|
|||
----------
|
||||
family : {'triclinic', 'monoclinic', 'orthorhombic', 'tetragonal', 'hexagonal', 'cubic'}, optional.
|
||||
Name of the crystal family.
|
||||
Will be infered if 'lattice' is given.
|
||||
Will be inferred 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
|
||||
|
@ -110,14 +110,23 @@ class Crystal():
|
|||
self.alpha = self.beta = self.gamma = None
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
"""Represent."""
|
||||
return '\n'.join([f'Crystal family {self.family}']
|
||||
+ ([] if self.lattice is None else [f'Bravais lattice {self.lattice}']+
|
||||
list(map(lambda x:f'{x[0]}:{x[1]:.5g}',
|
||||
zip(['a','b','c','alpha','beta','gamma',],
|
||||
self.parameters))))
|
||||
)
|
||||
|
||||
def __eq__(self,other):
|
||||
"""
|
||||
Equal to other.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
other : Lattice
|
||||
Lattice to check for equality.
|
||||
other : Crystal
|
||||
Crystal to check for equality.
|
||||
|
||||
"""
|
||||
return self.lattice == other.lattice and \
|
||||
|
@ -325,7 +334,7 @@ class Crystal():
|
|||
|
||||
def kinematics(self,mode):
|
||||
"""
|
||||
Return kinematic sytems.
|
||||
Return crystal kinematics systems.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
@ -335,7 +344,7 @@ class Crystal():
|
|||
Returns
|
||||
-------
|
||||
direction_plane : dictionary
|
||||
Direction and plane of deformation mode.
|
||||
Directions and planes of deformation mode families.
|
||||
|
||||
"""
|
||||
_kinematics = {
|
||||
|
@ -531,7 +540,7 @@ class Crystal():
|
|||
Returns
|
||||
-------
|
||||
operations : (string, damask.Rotation)
|
||||
Rotations characterizing the orientation relationship.
|
||||
Resulting lattice and rotations characterizing the orientation relationship.
|
||||
|
||||
References
|
||||
----------
|
||||
|
|
|
@ -108,7 +108,7 @@ class Orientation(Rotation,Crystal):
|
|||
An array of 3 x 5 random orientations reduced to the fundamental zone of tetragonal symmetry:
|
||||
|
||||
>>> import damask
|
||||
>>> o=damask.Orientation.from_random(shape=(3,5),lattice='tetragonal').reduced
|
||||
>>> o=damask.Orientation.from_random(shape=(3,5),family='tetragonal').reduced
|
||||
|
||||
"""
|
||||
|
||||
|
@ -138,9 +138,8 @@ class Orientation(Rotation,Crystal):
|
|||
|
||||
def __repr__(self):
|
||||
"""Represent."""
|
||||
return '\n'.join(([] if self.lattice is None else [f'Bravais lattice {self.lattice}'])
|
||||
+ ([f'Crystal family {self.family}'])
|
||||
+ [super().__repr__()])
|
||||
return '\n'.join([Crystal.__repr__(self),
|
||||
Rotation.__repr__(self)])
|
||||
|
||||
|
||||
def __copy__(self,rotation=None):
|
||||
|
@ -862,7 +861,7 @@ class Orientation(Rotation,Crystal):
|
|||
----------
|
||||
N_slip|N_twin : iterable of int
|
||||
Number of deformation systems per family of the deformation system.
|
||||
Use '*'. to select all.
|
||||
Use '*' to select all.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
@ -887,8 +886,8 @@ class Orientation(Rotation,Crystal):
|
|||
if (N_slip is not None) ^ (N_twin is None):
|
||||
raise KeyError('Specify either "N_slip" or "N_twin"')
|
||||
|
||||
kinematics = self.kinematics('slip' if N_twin is None else 'twin')
|
||||
active = N_slip if N_twin is None else N_twin
|
||||
kinematics,active = (self.kinematics('slip'),N_slip) if N_twin is None else \
|
||||
(self.kinematics('twin'),N_twin)
|
||||
if active == '*': active = [len(a) for a in kinematics['direction']]
|
||||
|
||||
d = self.to_frame(uvw=np.vstack([kinematics['direction'][i][:n] for i,n in enumerate(active)]))
|
||||
|
|
Loading…
Reference in New Issue