neml2.data¶
Native [Data] objects.
Construction-time inputs shared by reference across consumers (mirrors the C++
[Data] section). CrystalGeometry is the base slip-system geometry;
CubicCrystal is the registered [Data] block that specializes it to the
cubic crystal system. Importing this package fires the @register_neml2_object
side effects.
- class neml2.data.CrystalGeometry(*, sym_ops, lattice_vectors, slip_directions, slip_planes)[source]¶
Bases:
ModuleSlip-system geometry shared by all CP leaves in a single crystal model.
Constructed once at HIT-load time by the factory; CP slip leaves (
ResolvedShear,PlasticDeformationRate,PlasticVorticity) receive it by reference through theirfrom_hitconstructors and read $M$ / $W$ / $A$ in their forward pass.nn.Moduleis the parent so that assigning aCrystalGeometryto a CP leaf viaself._cg = crystal_geometryregisters it as a sub-module —leaf.to('cuda')then moves the Schmid / lattice buffers via the standard PyTorch buffer-propagation path. Without this, the buffers stay on CPU and Inductor trips a device-mismatch on the firstbmmagainst a CUDA input duringtorch.export. Wrapper-typed views ($A$, $M$, $W$,sym_ops,slip_directions,slip_planes) are reconstructed on the fly from the underlying buffers so they always carry the current device.Buffer attributes¶
- sym_ops_datatorch.Tensor
(nsym, 3, 3)proper-rotation symmetry operators.- lattice_vectorstorch.Tensor
(3, 3)real-space lattice vectors (rows).- reciprocal_lattice_vectorstorch.Tensor
(3, 3)reciprocal-lattice vectors (rows).- cartesian_slip_directions, cartesian_slip_planestorch.Tensor
(nslip, 3)unit-vector representations.- burgerstorch.Tensor
(nslip,)Burgers vector lengths.- A_data, M_data, W_datatorch.Tensor
Raw storage for the wrapper-typed Schmid tensors (
(nslip, 3, 3),(nslip, 6),(nslip, 3)respectively).- slip_directions_data, slip_planes_datatorch.Tensor
Raw Miller-index storage.
- slip_offsetslist[int]
[0, ..., nslip]group boundaries; the size of groupiisslip_offsets[i+1] - slip_offsets[i]. Plain Python list; not a buffer.
Wrapper-typed properties¶
sym_ops : R2 A : R2 (
sub_batch_ndim=1) M : SR2 (sub_batch_ndim=1) W : WR2 (sub_batch_ndim=1) slip_directions, slip_planes : MillerIndex- property slip_directions: MillerIndex¶
- property slip_planes: MillerIndex¶
- Parameters:
sym_ops (R2)
lattice_vectors (torch.Tensor)
slip_directions (MillerIndex)
slip_planes (MillerIndex)
- class neml2.data.CubicCrystal[source]¶
Bases:
objectA specialization of the general CrystalGeometry class defining a cubic crystal system.
- SECTION = 'Data'¶
- classmethod from_hit(node, factory)[source]¶
- Parameters:
node (nmhit.Node)
factory (_NativeInputFile)
- Return type:
- hit = <neml2.schema.HitSchema object>¶