Skip to content

Commit 7e40074

Browse files
authored
Fixes leaflet override bug (#72)
The function overwrites the leaflet selection every time molecules of a sterol type are assigned to a leaflet.
1 parent 15bd3d8 commit 7e40074

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

domhmm/analysis/base.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def get_leaflets_sterol(self):
410410
"""
411411

412412
# Copy dict for leaflet selection without sterols, only the AtomGroups in the copied dict should be updated
413-
leaflet_selection = {}
413+
leaflet_selection = self.leaflet_selection_no_sterol.copy()
414414

415415
# Iterate over each type of sterol in the membrane
416416
for rsn, head in self.sterol_heads.items():
@@ -432,12 +432,8 @@ def get_leaflets_sterol(self):
432432

433433
# Merge the atom selections for the phospholipids and cholesterol. "+" just adds the second selection on
434434
# top of the former one.
435-
leaflet_selection['0'] = self.leaflet_selection_no_sterol['0'] + upper_sterol
436-
leaflet_selection['1'] = self.leaflet_selection_no_sterol['1'] + lower_sterol
437-
438-
# If not sterol compound was assigned the leaflet selection is the same as the leaflet selection without sterols
439-
if not any(leaflet_selection):
440-
leaflet_selection = self.leaflet_selection_no_sterol
435+
leaflet_selection['0'] += upper_sterol
436+
leaflet_selection['1'] += lower_sterol
441437

442438
leaflet_selection['0'] = leaflet_selection['0'][np.argsort(leaflet_selection['0'].resids)]
443439
leaflet_selection['1'] = leaflet_selection['1'][np.argsort(leaflet_selection['1'].resids)]

0 commit comments

Comments
 (0)