Skip to content

Commit b944247

Browse files
committed
bugfix in bond guesser when system has 1 or 0 atoms
1 parent e1dc4b1 commit b944247

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

moleculekit/bondguesser.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@
124124

125125

126126
def guess_bonds(mol):
127+
if mol.numAtoms <= 1:
128+
return np.zeros((0, 2), dtype=np.uint32)
129+
127130
defaults = {"H": 1.0, "C": 1.5, "N": 1.4, "O": 1.3, "F": 1.2, "S": 1.9}
128131

129132
if mol.frame >= mol.numFrames:
@@ -161,6 +164,9 @@ def guess_bonds_rdkit(mol):
161164
import tempfile
162165
import os
163166

167+
if mol.numAtoms <= 1:
168+
return [], []
169+
164170
btypemap = {"SINGLE": "1", "DOUBLE": "2", "TRIPLE": "3", "AROMATIC": "ar"}
165171

166172
def _uq_id(name, resname, resid, insertion, chain):

0 commit comments

Comments
 (0)