Skip to content

Commit

Permalink
fix(fragmentation): check number of residues
Browse files Browse the repository at this point in the history
fail gracefully with a helpful error message.
  • Loading branch information
bi-ran committed Dec 10, 2024
1 parent 04c65d3 commit 2ab2c4d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Fragmentation/basefrag.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ def get_fragments_index(prot: Atoms) -> tuple[list[int], list[int]]:
num_dipeptides = num_residue - 2
num_acenmes = num_residue - 3

if num_dipeptides < 2:
raise NotImplementedError(
"Attempting to fragment protein with 3 or fewer residues "
"(including ACE/NME caps). Please check that the input file "
"is prepared according to the instructions, or pass "
"'--mode visnet' to run simulations on the input as an entire "
"unit, i.e., without fragmentation."
)

dipeptides: list[list[int]] = [[] for _ in range(num_dipeptides)]
sidechains: list[list[int]] = [[] for _ in range(num_dipeptides)]
acenmes: list[list[int]] = [[] for _ in range(num_acenmes)]
Expand Down

0 comments on commit 2ab2c4d

Please sign in to comment.