resize_hessian

qcmanybody.utils.resize_hessian(hess, bas, fragment_size_dict, fragment_slice_dict, *, reverse=False)[source]

Pads or extracts a Hessian array between subsystem and full supersystem sizes.

Parameters:
  • hess (ndarray) – Hessian matrix of natural size for bas, (3 * _<nat in bas>_, 3 * _<nat in bas>_). If reverse=True, Hessian matrix of supersystem size, (3 * _<nat of all fragments>_, 3 * _<nat of all fragments>_).

  • bas (Tuple[int, ...]) – 1-indexed fragments active in hess. If reverse=True, 1-indexed fragments to be extracted from hess.

  • fragment_size_dict (Dict[int, int]) – Dictionary containing the number of atoms of each 1-indexed fragment. For He–HOOH–Me cluster, {1: 1, 2: 4, 3: 5}.

  • fragment_slice_dict (Dict[int, slice]) – Dictionary containing slices that index the gradient matrix for each of the 1-indexed fragments. For He–HOOH–Me cluster, {1: slice(0, 1), 2: slice(1, 5), 3: slice(5, 10)}.

  • reverse (bool) – If True, contract hess from supersystem size and shape to that which is natural for bas.

Returns:

Hessian array padded with zeros to supersystem size, (3 * _<nat of supersystem>_, 3 * _<nat of supersystem>_). If reverse=True, Hessian array extracted to natural size, (3 * _<nat in bas>_, 3 * _<nat in bas>_).

Return type:

ndarray