qstack.reorder¶
Functions for reordering atomic orbitals between different conventions.
- As the base convention, we use the “SA-GPR” ordering:
m=-l, -l+1, …, -1, 0, +1, …, l-1, l
- In PySCF, it is the same except for p-orbitals which are ordered as:
if l==1: m=+1, -1, 0 (i.e., x,y,z)
- In Orca, it is:
m=0, +1, -1, +2, -2, …, +l, -l
Additionally, Orca uses a different sign convention for |m|>=3.
- In Gaussian, it is:
if l==1: m=+1, -1, 0 (like in PySCF) if l>1: m=0, +1, -1, +2, -2, …, +l, -l (like in Orca)
- In Turbomole, it is:
if l==1: m=+1, -1, 0 (like in PySCF) if l>1: m=0, +1, -1, -2, +2, …, -(-1)**(l%2)*l, (-1)**(l%2)*l
- class qstack.reorder.MagneticOrder(l_checker=None, m_generator=None)[source]¶
Bases:
objectClass to handle ordering conventions of atomic orbitals.
- Parameters:
l_checker (callable) – Function that takes angular momentum l and returns True if the convention defines an order for that l.
m_generator (callable or dict) – Function that takes angular momentum l and returns the list of magnetic quantum numbers in the convention’s order, or a dict mapping l to the corresponding list.
- qstack.reorder.reorder_ao(mol, vector, src='pyscf', dest='gpr')[source]¶
Reorder the atomic orbitals from one convention to another.
For example, src=pyscf dest=gpr reorders p-orbitals from +1,-1,0 (pyscf convention) to -1,0,+1 (SA-GPR convention).
- Parameters:
mol (pyscf.gto.Mole) – pyscf Mole object.
vector (numpy.ndarray) – Vector (nao,) or matrix (mol.nao,mol.nao) to reorder. If None, returns the indices to reorder and sign multipliers for an 1D vector to use as x = x[idx]*sign.
src (str) – Current convention. Defaults to ‘pyscf’.
dest (str) – Convention to convert to (available: ‘pyscf’, ‘gpr’, ‘orca’, ‘gaussian’, ‘turbomole’). Defaults to ‘gpr’.
- Returns:
Reordered vector or matrix, or tuple of (idx (numpy.ndarray), sign (numpy.ndarray)) if vector is None.
- Return type:
numpy.ndarray
- Raises:
ValueError – If vector dimension is not 1 or 2.