Skip to main content


mrh is a free and open-source Python3 program which implements localized active space self-consistent fields (LASSCF) and density matrix embedding theory (DMET) calculations utilizing PySCF as a quantum-chemistry backend. It is available at


LASSCF is implemented as a PySCF-like method class:

from mrh.my_pyscf.mcscf.lasscf_o0 import LASSCF
las = LASSCF (mf, (ncas1, ncas2), (nelecas1, nelecas2), spin_sub=(s1, s2))

where mf is a standard PySCF mean-field method instance. Practical LASSCF calculations often require a reasonably-localized initial guess for the active orbitals, which is provided by the localize_init_guess function:

mo_init = las.localize_init_guess (([0,1,2],[9,10,11]))
las.kernel (mo_init)

Here, localize_init_guess localizes the first active subspace, nelecas1 electrons in ncas1 orbitals, to the first three atoms of the molecule; and the second active subspace, nelecas2 electrons in ncas2 orbitals, to atoms 9 through 11. For more information about running LASSCF calculations, check out the examples/lasscf folder in the source code.

The DMET API is somewhat more involved:

from mrh.my_dmet import localintegrals, dmet, fragments

myints = localintegrals.localintegrals (mf, range (mf.mol.nao_nr ()), 'meta_lowdin')
frag1 = fragments.make_fragment_atom_list (myints, [0,1,2], 'CASSCF(4,4)')
frag2 = fragments.make_fragment_atom_list (myints, [3,4,5,6,7,8], 'RHF')
frag3 = fragments.make_fragment_atom_list (myints, [9,10,11], 'CASSCF(4,4)')
dmet_obj = dmet (myints, [frag1, frag2, frag3])
energy = dmet_obj.doselfconsistent ()

Examples of more complete DMET scripts are available in the examples/lasscf_old/me2n2 and examples/lasscf_old/c2h6n4 folders.


mrh is licensed under GNU General Public License v2.0, and is a fork of casdmet by Hung Pham and QC-DMET by Sebastian Wouters.


  1. “Can Density Matrix Embedding Theory with the Complete Activate Space Self-Consistent Field Solver Describe Single and Double Bond Breaking in Molecular Systems?” H. Q. Pham, V. Bernales, L. Gagliardi, J. Chem. Theory Comput. 2018, 14, 1960.
  2. “Multiconfigurational Self-Consistent Field Theory with Density Matrix Embedding: The Localized Active Space Self-Consistent Field Method,” M. R. Hermes and L. Gagliardi, J. Chem. Theory Comput. 2019, 15, 972.
  3. “Variational Localized Active Space Self-Consistent Field Method,” M. R. Hermes, R. Pandharkar, and L. Gagliardi, J. Chem. Theory Comput. 2020, 16, 4923.