Skip to content

Commit 7c194d4

Browse files
authored
Merge pull request #245 from avcopan/dev
Prevent code from dying when grad is None
2 parents 66afb6d + 7f7bd19 commit 7c194d4

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

pixi.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "autoio"
3-
version = "2025.10.2"
3+
version = "2025.11.0"
44
description = "I/O interfaces for external codes used by AutoMech"
55
readme = "README.md"
66
dependencies = []

src/projrot_io/util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ def _format_grad_str(geo, grad):
6666
:type grads: list
6767
:rtype: str
6868
"""
69-
7069
atom_list = []
7170
for i, (sym, _) in enumerate(geo):
7271
atom_list.append(int(ptab.to_number(sym)))
7372

7473
# Format the strings for the xyz gradients
7574
full_grads_str = ''
76-
for i, grads in enumerate(grad):
77-
grads_str = f'{grads[0]:>14.8f}{grads[1]:>14.8f}{grads[2]:>14.8f}'
78-
full_grads_str += f'{i+1:2d}{atom_list[i]:4d}{grads_str}\n'
75+
if grad:
76+
for i, grads in enumerate(grad):
77+
grads_str = f'{grads[0]:>14.8f}{grads[1]:>14.8f}{grads[2]:>14.8f}'
78+
full_grads_str += f'{i+1:2d}{atom_list[i]:4d}{grads_str}\n'
7979

8080
return remove_trail_whitespace(full_grads_str)
8181

0 commit comments

Comments
 (0)