diff --git a/src/pyiron_lammps/compatibility/calculate.py b/src/pyiron_lammps/compatibility/calculate.py index c77d562..80574a5 100644 --- a/src/pyiron_lammps/compatibility/calculate.py +++ b/src/pyiron_lammps/compatibility/calculate.py @@ -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) + # If pressure is a scalar, only unit conversion is needed. if np.isscalar(pressure): return float(pressure) * LAMMPS_UNIT_CONVERSIONS[units]["pressure"] @@ -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 "