qstack.fields.dm

Density matrix manipulation and analysis functions.

qstack.fields.dm.get_converged_dm(mol, xc, verbose=False)[source]

Get a converged density matrix.

Parameters:
  • mol (pyscf Mole) – pyscf Mole object.

  • xc (str) – Exchange-correlation functional.

  • verbose (bool) – If print more information.

Returns:

A numpy ndarray containing the density matrix in AO-basis.

qstack.fields.dm.get_converged_mf(mol, xc, dm0=None, verbose=False)[source]

Perform SCF calculation.

Parameters:
  • mol (pyscf Mole) – pyscf Mole object.

  • xc (str) – Exchange-correlation functional.

  • dm0 (numpy ndarray, optional) – Initial guess for density matrix. Defaults to None.

  • verbose (bool) – If print more information.

Returns:

A tuple containing: - mf (pyscf.dft.rks.RKS or pyscf.dft.uks.UKS): Converged mean-field object. - dm (numpy ndarray): Converged density matrix in AO-basis.

Return type:

tuple

qstack.fields.dm.make_grid_for_rho(mol, grid_level=3)[source]

Generate a grid of real space coordinates and weights for integration.

Parameters:
  • mol (pyscf Mole) – pyscf Mole object.

  • grid_level (int) – Controls the number of radial and angular points.

Returns:

pyscf Grid object.

qstack.fields.dm.sphericalize_density_matrix(mol, dm)[source]

Sphericalize the density matrix in the sense of an integral over all possible rotations.

Parameters:
  • mol (pyscf Mole) – pyscf Mole object.

  • dm (2D numpy array) – Density matrix in AO-basis.

Returns:

A numpy ndarray with the sphericalized density matrix.