get_fragment

Cartesian.get_fragment(list_of_indextuples, give_only_index=False)[source]

Get the indices of the atoms in a fragment.

The list_of_indextuples contains all bondings from the
molecule to the fragment. [(1,3), (2,4)] means for example that the fragment is connected over two bonds. The first bond is from atom 1 in the molecule to atom 3 in the fragment. The second bond is from atom 2 in the molecule to atom 4 in the fragment.
Parameters:
  • list_of_indextuples (list) –
  • give_only_index (bool) – If True a set of indices is returned. Otherwise a new Cartesian instance.
Returns:

A set of indices or a new Cartesian instance.