Skip to content

Commit

Permalink
refactor and include comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fgrunewald committed Jul 8, 2024
1 parent 0fe7b91 commit 7a2a738
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions cgsmiles/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,23 +249,19 @@ def resolve(self):
"""
Resolve a CGSmiles string once and return the next resolution.
"""
# increment the resolution counter
self.resolution_counter += 1

# check if this is an all-atom level resolution
if self.resolution_counter == self.resolutions and self.last_all_atom:
if self.resolution_counter == self.resolutions -1 and self.last_all_atom:
all_atom = True
else:
all_atom = False

# get the next set of fragments
if self.fragment_strs:
fragment_str = self.fragment_strs[self.resolution_counter - 1] # -1 because the counter has already been incremented #FIXME

fragment_str = self.fragment_strs[self.resolution_counter]
# read the fragment str and populate dict
self.fragment_dict = read_fragments(fragment_str, all_atom=all_atom))
self.fragment_dict = read_fragments(fragment_str, all_atom=all_atom)
else:
self.fragment_dict = self.fragment_dicts[self.resolution_counter - 1] # FIXME
self.fragment_dict = self.fragment_dicts[self.resolution_counter ]

# set the previous molecule as meta_graph
self.meta_graph = self.molecule
Expand Down Expand Up @@ -302,6 +298,9 @@ def resolve(self):
if all_atom:
set_atom_names_atomistic(self.meta_graph, self.molecule)

# increment the resolution counter
self.resolution_counter += 1

return self.meta_graph, self.molecule

def resolve_iter(self):
Expand Down

0 comments on commit 7a2a738

Please sign in to comment.