cell_utils.compute_cell_matrix_batch

cell_utils.compute_cell_matrix_batch(lengths, angles, device=None)[source]

Compute a batch of real-space cell matrices from unit-cell parameters.

Parameters:
  • lengths (torch.Tensor, shape (B, 3)) – Unit-cell lengths [a, b, c] for each structure in the batch.

  • angles (torch.Tensor, shape (B, 3)) – Unit-cell angles [α, β, γ] in degrees for each structure in the batch.

  • device (torch.device, optional) – Target device for output. If None, uses the device of lengths.

Returns:

Real-space cell matrices on the specified device, where each 3×3 matrix has rows:

[a, 0, 0] [b·cos(γ), b·sin(γ), 0] [c·cos(β), c·(cos(α) – cos(β)·cos(γ))/sin(γ), c_z]

with c_z = sqrt(c² – M[2,0]² – M[2,1]²).

Return type:

torch.Tensor, shape (B, 3, 3)