Skip to content

Commit

Permalink
Update atomgroup.py
Browse files Browse the repository at this point in the history
incorporated change from James t check for bondOrder being None before checking its length in setBondOrders()
  • Loading branch information
michelsanner authored Jan 23, 2025
1 parent 4d9d28c commit 7e10756
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions prody/atomic/atomgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,15 +1261,17 @@ def setBondOrders(self, bondOrders):
all bonds must be set at once. This method must be called after
the setBonds() has been called. The bond order is stored in the
*_bondOrders* array."""

if bondOrders is None:
self._bondOrders = bondOrders
return

if len(bondOrders)!=len(self._bonds):
raise ValueError('invalid bond order list, bond and bond order length mismatch')
if min(bondOrders)<1 or max(bondOrders)>5:
raise ValueError('invalid bond order value, values must range from 1 to 5')

if bondOrders is None:
self._bondOrders = bondOrders
else:
self._bondOrders = np.array(bondOrders, np.int8)
self._bondOrders = np.array(bondOrders, np.int8)

def setBonds(self, bonds, bondOrders=None):
"""Set covalent bonds between atoms. *bonds* must be a list or an
Expand Down

0 comments on commit 7e10756

Please sign in to comment.