Skip to content

Commit

Permalink
MAINT: Ensure that a proper error is raised when unable to find polya…
Browse files Browse the repository at this point in the history
…tomic core anchors
  • Loading branch information
BvB93 committed Apr 25, 2023
1 parent 5a792ae commit b8349e6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CAT/attachment/core_anchoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def set_core_anchors(
anchors = mol.properties.dummies
if anchors is None:
anchor_idx_group, remove_idx = find_core_substructure(mol, anchor_tup)
anchor_idx = anchor_idx_group[:, anchor_tup.group_idx[0]].copy()
if anchor_idx_group.size:
anchor_idx = anchor_idx_group[:, anchor_tup.group_idx[0]].copy()
else:
anchor_idx = np.empty(0, dtype=anchor_idx_group.dtype)
else:
anchor_idx = np.fromiter(anchors, count=len(anchors), dtype=np.int64)
anchor_idx -= 1
Expand Down Expand Up @@ -163,7 +166,7 @@ def find_core_substructure(
remove_list += [idx_tup[i] for i in remove]
anchor_list.append(idx_tup)

anchor_array = np.array(anchor_list, dtype=np.int64)
anchor_array = np.array(anchor_list, dtype=np.int64, ndmin=2)
if remove is not None:
remove_array = np.fromiter(remove_list, dtype=np.int64, count=len(remove_list))
return anchor_array, remove_array
Expand Down

0 comments on commit b8349e6

Please sign in to comment.