@@ -1632,15 +1632,15 @@ def get_leaflet_step_order_index(self, leaflet, step):
16321632 self .universe .trajectory [self .start :self .stop :self .step ][step ]
16331633
16341634 for res in self .unique_resnames :
1635-
1636- indexes [ res ] = np . where ( self . membrane . residues [ leaflet_assignment_mask ]. resnames == res )[ 0 ]
1637-
1638- if res in self .heads .keys ():
1639- positions [res ] = (self .membrane .residues [leaflet_assignment_mask ].atoms & self .universe .select_atoms (
1640- f"resname { res } and name { self .heads [res ]} " )).positions
1641- else :
1642- positions [res ] = (self .membrane .residues [leaflet_assignment_mask ].atoms & self .universe .select_atoms (
1643- f"resname { res } and name { self .sterol_heads [res ]} " )).positions
1635+ indx = np . where ( self . membrane . residues [ leaflet_assignment_mask ]. resnames == res )[ 0 ]
1636+ if len ( indx ) != 0 :
1637+ indexes [ res ] = indx
1638+ if res in self .heads .keys ():
1639+ positions [res ] = (self .membrane .residues [leaflet_assignment_mask ].atoms & self .universe .select_atoms (
1640+ f"resname { res } and name { self .heads [res ]} " )).positions
1641+ else :
1642+ positions [res ] = (self .membrane .residues [leaflet_assignment_mask ].atoms & self .universe .select_atoms (
1643+ f"resname { res } and name { self .sterol_heads [res ]} " )).positions
16441644
16451645 return indexes , positions
16461646
@@ -1665,7 +1665,7 @@ def get_leaflet_step_index_to_resid(self, leaflet, step):
16651665 result_map = {}
16661666 for resname in self .unique_resnames :
16671667 sys_index = np .where (self .membrane .residues .resnames == resname )[0 ]
1668- sys_index = sys_index [leaflet_assignment_mask [sys_index ]]
1668+ sys_index = sys_index [leaflet_assignment_mask [sys_index ]]
16691669 leaflet_index = np .where (self .membrane .residues [leaflet_assignment_mask ].resnames == resname )[0 ]
16701670 for i in range (0 , len (leaflet_index )):
16711671 result_map [leaflet_index [i ]] = self .index_resid_map [sys_index [i ]]
0 commit comments