defdap.crystal module

class defdap.crystal.Phase(name, laueGroup, spaceGroup, latticeParams)[source]

Bases: object

property cOverA
printSlipSystems()[source]

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

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

Bases: object

static lMatrix(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 qMatrix(lMatrix)[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(slipPlane, slipDir, crystalStructure, cOverA=None)[source]

Bases: object

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

property slipPlaneLabel

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

Returns:

Slip plane label.

Return type:

str

property slipDirLabel

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

Returns:

Slip direction label.

Return type:

str

generateFamily()[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, crystalStructure, cOverA=None, groupBy='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.

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

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

  • groupBy (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(slipSystems, groupBy)[source]

Groups slip systems by their slip plane.

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

  • groupBy (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 printSlipSystemDirectory()[source]

Prints the location where slip system definition files are stored.

defdap.crystal.convertIdc(inType, *, dir=None, plane=None)[source]

Convert between Miller and Miller-Bravais indices.

Parameters:
  • inType (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.posIdc(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.reduceIdc(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.safeIntCast(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.strIdx(idx)[source]

String representation of an index with overbars.

Parameters:

idx (int) –

Return type:

str