defdap.crystal module

class defdap.crystal.Phase(name, laue_group, space_group, lattice_params)[source]

Bases: object

property c_over_a
print_slip_systems()[source]

Print a list of slip planes (with colours) and slip directions.

class defdap.crystal.CrystalStructure(name, symmetries, vertices, faces)[source]

Bases: object

static l_matrix(a, b, c, alpha, beta, gamma, convention=None)[source]

Construct L matrix based on Page 22 of Randle and Engle - Introduction to texture analysis

static q_matrix(l_matrix)[source]

Construct matrix of reciprocal lattice vectors to transform plane normals See C. T. Young and J. L. Lytton, J. Appl. Phys., vol. 43, no. 4, pp. 1408–1417, 1972.

class defdap.crystal.SlipSystem(slip_plane, slip_dir, crystal_structure, c_over_a=None)[source]

Bases: object

Class used for defining and performing operations on a slip system.

property slip_plane_label

Return the slip plane label. For example ‘(111)’.

Returns:

Slip plane label.

Return type:

str

property slip_dir_label

Returns the slip direction label. For example ‘[110]’.

Returns:

Slip direction label.

Return type:

str

generate_family()[source]

Generate the family of slip systems which this system belongs to.

Returns:

The family of slip systems.

Return type:

list of SlipSystem

static load(name, crystal_structure, c_over_a=None, group_by='plane')[source]

Load in slip systems from file. 3 integers for slip plane normal and 3 for slip direction. Returns a list of list of slip systems grouped by slip plane.

Parameters:
  • name (str) – Name of the slip system file (without file extension) stored in the defdap install dir or path to a file.

  • crystal_structure (defdap.crystal.CrystalStructure) – Crystal structure of the slip systems.

  • c_over_a (float, optional) – C over a ratio for hexagonal crystals.

  • group_by (str, optional) – How to group the slip systems, either by slip plane (‘plane’) or slip system family (‘family’) or don’t group (None).

Returns:

A list of list of slip systems grouped slip plane.

Return type:

list of list of SlipSystem

Raises:

IOError – Raised if not 6/8 integers per line.

static group(slip_systems, group_by)[source]

Groups slip systems by their slip plane.

Parameters:
  • slip_systems (list of SlipSystem) – A list of slip systems.

  • group_by (str) – How to group the slip systems, either by slip plane (‘plane’) or slip system family (‘family’).

Returns:

A list of list of grouped slip systems.

Return type:

list of list of SlipSystem

static print_slip_system_directory()[source]

Prints the location where slip system definition files are stored.

defdap.crystal.convert_idc(in_type, *, dir=None, plane=None)[source]

Convert between Miller and Miller-Bravais indices.

Parameters:
  • in_type (str {'m', 'mb'}) – Type of indices provided. If ‘m’ converts from Miller to Miller-Bravais, opposite for ‘mb’.

  • dir (tuple of int or equivalent, optional) – Direction to convert. This OR plane must me provided.

  • plane (tuple of int or equivalent, optional) – Plane to convert. This OR direction must me provided.

Returns:

The converted plane or direction.

Return type:

tuple of int

defdap.crystal.pos_idc(vec)[source]

Return a consistent positive version of a set of indices.

Parameters:

vec (tuple of int or equivalent) – Indices to convert.

Returns:

Positive version of indices.

Return type:

tuple of int

defdap.crystal.reduce_idc(vec)[source]

Reduce indices to lowest integers

Parameters:

vec (tuple of int or equivalent) – Indices to reduce.

Returns:

The reduced indices.

Return type:

tuple of int

defdap.crystal.safe_int_cast(vec, tol=0.001)[source]

Cast a tuple of floats to integers, raising an error if rounding is over a tolerance.

Parameters:
  • vec (tuple of float or equivalent) – Vector to cast.

  • tol (float) – Tolerance above which an error is raised.

Return type:

tuple of int

Raises:

ValueError – If the rounding is over the tolerance for any value.

defdap.crystal.str_idx(idx)[source]

String representation of an index with overbars.

Parameters:

idx (int) –

Return type:

str