qstack.orcaio¶
ORCA quantum chemistry package I/O utilities.
Read and parse ORCA output files, including orbitals and densities binary files.
- qstack.orcaio.read_density(mol, basename, directory='./', version=500, openshell=False, reorder_dest='pyscf')[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’.
- 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 for def2 basis with 3d elements.
- qstack.orcaio.read_gbw(mol, fname, reorder_dest='pyscf', sort_l=True)[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.
- 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.orcaio.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.orcaio.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.