contiguize_from_fragment_pattern

qcelemental.molparse.contiguize_from_fragment_pattern(frag_pattern, *, geom=None, verbose=1, throw_reorder=False, **kwargs)[source]

Take (nat, ?) array-like arrays and return with atoms arranged by (nfr, ?) frag_pattern.

Parameters:
  • frag_pattern (List[List[int]]) – (nfr, ?) list of indices (0-indexed) grouping atoms into molecular fragments within the topology.

  • geom (Union[ndarray, List[List], None]) – (nat, 3) or (3 * nat, ) ndarray or list o’lists of Cartesian coordinates, possibly with atoms belonging to the same fragment being dispersed in geom.

  • throw_reorder (bool) – Whether, when non-contiguous fragments detected, to raise ValidationError (True) or to proceed to reorder atoms to contiguize fragments (False).

  • verbose (int) – Quantity of printing

  • kwargs (None or array-like) – Each additional array will be returned with ordering applied in the return dictionary.

Returns:

  • fragment_separators (array-like of int) – (nfr - 1, ) list of atom indices at which to split geom into fragments.

  • geom (ndarray of float, optional) – (3 * nat, ) Cartesian coordinates with fragments contiguous.

  • kwargs (None or ndarray, optional) – (nat, ) Each kwargs input array reordered for contiguous fragments.

Raises:

qcelemental.ValidationError – When frag_pattern skips atoms or any array has inconsistent length. If throw_reorder, raises when non-contiguous fragments detected.