qstack.io.orca¶
ORCA quantum chemistry package I/O utilities.
Read and parse ORCA output files, including orbitals and densities binary files.
- qstack.io.orca.read_density(mol, basename, directory='./', version=500, openshell=False, reorder_dest='pyscf', sort_l=True, ls=None)[source]¶
Read densities from an ORCA output.
Tested on Orca versions 4.0, 4.2, and 5.0.
- Parameters:
mol (pyscf.gto.Mole) – pyscf Mole object.
basename (str) – Job name (without extension).
directory (str) – Path to the directory with the density files. Defaults to ‘./’.
version (int) – ORCA version (400 for 4.0, 421 for 4.2, 500 for 5.0). Defaults to 500.
openshell (bool) – Whether to read spin density in addition to electron density. Defaults to False.
reorder_dest (str) – Which AO ordering convention to use. Defaults to ‘pyscf’.
sort_l (bool) – Whether to sort basis functions wrt angular momenta. Has to be True for reorder_dest != None. Defaults to True.
ls (dict) – Dictionary mapping atom index to list of basis function angular momenta in Orca order for atoms whose basis functions are NOT sorted wrt angular momenta. Defaults to None. Can be obtained from read_gbw(return_ls=True) or made manually. If None, automatic detection is attempted for selected basis sets.
- Returns:
- 2D array containing density matrix (openshell=False) or
3D array containing density and spin density matrices (openshell=True).
- Return type:
numpy.ndarray
- Raises:
RuntimeError – If density matrix reordering is compromised: - Both reorder_dest and sort_l=False are set. - ls is provided and sort_l=False. - Basis set name is unknown, sort_l=True, and ls is not provided.
NotImplementedError – If a def2-family basis set is used for which the order is not hardcoded, and ls is not provided.
- qstack.io.orca.read_gbw(mol, fname, reorder_dest='pyscf', sort_l=True, return_ls=False)[source]¶
Read orbitals from an ORCA output.
Tested on Orca versions 4.2 and 5.0. Limited for Orca version 4.0 (cannot read the basis set).
- Parameters:
mol (pyscf.gto.Mole) – pyscf Mole object.
fname (str) – Path to the gbw file.
reorder_dest (str) – Which AO ordering convention to use. Defaults to ‘pyscf’.
sort_l (bool) – Whether to sort basis functions wrt angular momenta. PySCF requires them sorted. Defaults to True.
return_ls (bool) – Whether to return the dictionary mapping atom index to list of basis function angular momenta for atoms whose basis functions are NOT sorted wrt angular momenta. Defaults to False.
- Returns:
A tuple containing: - c (numpy.ndarray): 3D array of shape (s,nao,nao) with MO coefficients. - e (numpy.ndarray): 2D array of shape (s,nao) with MO energies. - occ (numpy.ndarray): 2D array of shape (s,nao) with MO occupation numbers. Where s is 1 for closed-shell and 2 for open-shell computation,
and nao is the number of atomic/molecular orbitals.
- Return type:
tuple
- Raises:
RuntimeError – If basis set information not found and sort_l=True.
- qstack.io.orca.read_input(fname, basis, ecp=None)[source]¶
Read the structure from an Orca input (XYZ coordinates in simple format only).
Note: We do not read basis set info from the file. TODO: Read also %coords block?
- Parameters:
fname (str) – Path to Orca input file.
basis (str or dict) – Basis name, path to file, or dict in the pyscf format.
ecp (str) – Effective core potential to use. Defaults to None.
- Returns:
pyscf Mole object.
- Return type:
pyscf.gto.Mole
- qstack.io.orca.reorder_coeff_inplace(c_full, mol, reorder_dest='pyscf', ls_from_orca=None)[source]¶
Reorder coefficients read from ORCA .gbw in-place.
- Parameters:
c_full (numpy.ndarray) – 3D array of shape (s,nao,nao) containing MO coefficients to reorder.
mol (pyscf.gto.Mole) – pyscf Mole object.
reorder_dest (str) – Which AO ordering convention to use. Defaults to ‘pyscf’.
ls_from_orca (dict) – Dictionary mapping atom index to list of basis function angular momenta for atoms whose basis functions are NOT sorted wrt angular momenta. Defaults to None.