Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/pyiron_lammps/compatibility/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ def _pressure_to_lammps(pressure, rotation_matrix, units="metal"):
(float): a single, isotropic pressure to be used with the "iso" option
"""

# in case no rotation matrix is given, assume identity
if rotation_matrix is None:
rotation_matrix = np.eye(3)

Comment thread
coderabbitai[bot] marked this conversation as resolved.
# If pressure is a scalar, only unit conversion is needed.
if np.isscalar(pressure):
return float(pressure) * LAMMPS_UNIT_CONVERSIONS[units]["pressure"]
Expand All @@ -403,11 +407,9 @@ def _pressure_to_lammps(pressure, rotation_matrix, units="metal"):

# If necessary, rotate the pressure tensor to the Lammps coordinate frame.
# Isotropic, hydrostatic pressures are rotation invariant.
if (
rotation_matrix is not None
and not np.isclose(np.matrix.trace(rotation_matrix), 3)
and not _is_isotropic_hydrostatic(pressure)
):
if not np.isclose(
np.matrix.trace(rotation_matrix), 3
) and not _is_isotropic_hydrostatic(pressure):
if any(p is None for p in pressure):
raise ValueError(
"Cells which are not orthorhombic or an upper-triangular cell are incompatible with Lammps "
Expand Down
Loading