graintrace.slip_systems#

Slip-system definitions for the NEML2 crystal-plasticity decks.

The CPFE deck (cpfe_base/neml2_cpfe.i) and the Taylor/calibration deck (cpfe_base/neml2_cpfe_calibration.i) describe slip with NEML2’s CubicCrystal: one or more slip families, each a Miller direction and a Miller plane normal. NEML2 expands every family over the cubic point group, so (<110>, {111}) gives the 12 FCC systems. The two deck lines that hold the families carry # @SLIP directions / # @SLIP planes markers; SlipSystems.apply_to_deck() rewrites them.

Pass a preset name (SLIP_SYSTEM_PRESETS) or the families directly:

SlipSystems.resolve("bcc")                              # {110}<111>, 12 systems
SlipSystems.resolve([((1, 1, 1), (1, 1, 0)),
                     ((1, 1, 1), (1, 1, 2))])           # 24 systems
SlipSystems.resolve([{"direction": [1, 1, 1], "plane": [1, 2, 3]}])

Only the cubic crystal class is supported: NEML2 v3 exposes CubicCrystal as its only crystal-geometry input block (HCP and other classes need upstream support).

graintrace.slip_systems.SLIP_SYSTEM_PRESETS = {'bcc': (((1, 1, 1), (1, 1, 0)),), 'bcc_110_112': (((1, 1, 1), (1, 1, 0)), ((1, 1, 1), (1, 1, 2))), 'bcc_110_112_123': (((1, 1, 1), (1, 1, 0)), ((1, 1, 1), (1, 1, 2)), ((1, 1, 1), (1, 2, 3))), 'bcc_112': (((1, 1, 1), (1, 1, 2)),), 'fcc': (((1, 1, 0), (1, 1, 1)),)}#

name -> tuple of (direction, plane) families.

Type:

Named slip-system sets

graintrace.slip_systems.DEFAULT_SLIP_SYSTEMS = 'fcc'#

Preset used when nothing is specified (the shipped decks’ historical slip).

class graintrace.slip_systems.SlipSystems(families, name='custom', crystal='cubic')[source]#

Bases: object

Slip families for a cubic crystal, as written into the NEML2 decks.

Variables:
  • families (Tuple[Tuple[Tuple[int, int, int], Tuple[int, int, int]], ...]) – tuple of (direction, plane) Miller-index pairs; each is expanded over the cubic point group by NEML2.

  • name (str) – preset name, or "custom" for user-defined families.

  • crystal (str) – crystal class; only "cubic" is supported.

Parameters:
families: Tuple[Tuple[Tuple[int, int, int], Tuple[int, int, int]], ...]#
name: str = 'custom'#
crystal: str = 'cubic'#
classmethod resolve(spec=None)[source]#

Build a SlipSystems from a preset name, families, or itself.

Parameters:

spec (None | str | SlipSystems | Iterable[Any]) – None (the default preset, "fcc"), a preset name from SLIP_SYSTEM_PRESETS, a SlipSystems, or an iterable of families, each (direction, plane) or {"direction": [...], "plane": [...]}.

Returns:

The validated SlipSystems.

Raises:

ValueError – unknown preset, malformed family, or a direction not in its plane.

Return type:

SlipSystems

property directions: Tuple[Tuple[int, int, int], ...]#

Slip directions, one per family.

property planes: Tuple[Tuple[int, int, int], ...]#

Slip-plane normals, one per family.

to_dict()[source]#

JSON-friendly description (name, crystal, families).

Return type:

dict

apply_to_deck(text)[source]#

Rewrite the # @SLIP lines of a NEML2 deck with these families.

Parameters:

text (str) – deck source containing exactly one # @SLIP directions and one # @SLIP planes MillerIndex line.

Returns:

The deck text with both lines replaced.

Raises:

RuntimeError – if a marker is missing or duplicated.

Return type:

str