Skip to content

Commit 70b03f1

Browse files
committed
handle case of 0 boxvectors being read
1 parent d40642b commit 70b03f1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

moleculekit/unitcell.py

+11
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ def box_vectors_to_lengths_and_angles(a, b, c):
174174
"vectors must be 1d or 2d (for a vectorized "
175175
"operation on multiple frames)",
176176
)
177+
if np.all(a == 0) or np.all(b == 0) or np.all(c == 0):
178+
nf = a.shape[:-1]
179+
return (
180+
np.zeros(nf),
181+
np.zeros(nf),
182+
np.zeros(nf),
183+
np.full(nf, 90.0),
184+
np.full(nf, 90.0),
185+
np.full(nf, 90.0),
186+
)
187+
177188
last_dim = a.ndim - 1
178189

179190
a_length = np.sqrt(np.sum(a * a, axis=last_dim))

0 commit comments

Comments
 (0)