np.flip() by default flips over all axes. In the calculate_bond_vector_combinations() funtion, topo has three axes corresponding to which bond pair, which bond in a bond pair, and which particle on the bond; [idx[0], idx[1]] filters out a group of bonds; and topo[idx[0], idx[1]] has two axes corresponding to which bond in the group of bonds, and which particle on the bond. Therefore, np.flip(topo[idx[0], idx[1]]) flips both the filtered bonds and the particles on each bond. The latter is expected, but the former breaks the correspondence between the bonds in the bond pairs. So np.flip() should be used include the parameter axis=1, so that only the particles on each bond are flipped.
np.flip() by default flips over all axes. In the calculate_bond_vector_combinations() funtion, topo has three axes corresponding to which bond pair, which bond in a bond pair, and which particle on the bond; [idx[0], idx[1]] filters out a group of bonds; and topo[idx[0], idx[1]] has two axes corresponding to which bond in the group of bonds, and which particle on the bond. Therefore, np.flip(topo[idx[0], idx[1]]) flips both the filtered bonds and the particles on each bond. The latter is expected, but the former breaks the correspondence between the bonds in the bond pairs. So np.flip() should be used include the parameter axis=1, so that only the particles on each bond are flipped.