From 1fa7623aa766b5d314c0fbafba6b0b7f3f30e0f7 Mon Sep 17 00:00:00 2001 From: Hao-Wei Pang Date: Fri, 4 Aug 2023 12:21:14 -0400 Subject: [PATCH] remove label in adjlist before detecting cutting label --- rmgpy/species.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rmgpy/species.py b/rmgpy/species.py index d96ddd307ad..2e0df42cfef 100644 --- a/rmgpy/species.py +++ b/rmgpy/species.py @@ -365,8 +365,17 @@ def from_adjacency_list(self, adjlist, raise_atomtype_exception=True, raise_char list in the `molecule` attribute. Does not generate resonance isomers of the loaded molecule. """ + lines = adjlist.splitlines() + + if len(lines[0].split()) == 1: + label = lines.pop(0) # remove the first line if it is a label before detecting cutting label + adjlist_no_label = '\n'.join(lines) + else: + adjlist_no_label = adjlist + # detect if it contains cutting label - _ , cutting_label_list = Fragment().detect_cutting_label(adjlist) + _ , cutting_label_list = Fragment().detect_cutting_label(adjlist_no_label) + if cutting_label_list == []: self.molecule = [Molecule().from_adjacency_list(adjlist, saturate_h=False, raise_atomtype_exception=raise_atomtype_exception,