def split_into_connections(self, traj): c, i, d = self.assign_trajectory(traj) l_traj = [] traj_mode = 0 t = Trajectory() first = None for index, snapshot in enumerate(traj): if (c[index] != -1 and i[index]==0 and traj_mode == 0): # core set first = snapshot elif (i[index] != 0 and first is not None): # in void t.forward(snapshot) traj_mode = 1 elif (c[index] != -1 and i[index]==0 and traj_mode == 1): t.insert(0, first) t.forward(snapshot) l_traj.forward(t) t = Trajectory() first = snapshot traj_mode = 0 return l_traj