# 10.9. doci — Doubly occupied configuration interaction¶

The doci implements doubly-occupied configuration interaction. A minimal example on N2 calculation:

from pyscf import gto, doci
mol = gto.M(atom='N 0 0 0; N 0 0 2.', basis='6-31g')
mf = mol.RHF().run()
mc = doci.CASSCF(mf, 18, 14)
mc.kernel()


## 10.9.1. Examples¶

Relevant examples examples/doci/00-simple_doci_casscf.py

## 10.9.2. Program reference¶

DOCI and DOCI based MCSCF

### 10.9.2.1. doci_mcscf¶

class pyscf.doci.doci_mcscf.CASCI(mf_or_mol, ncas, nelecas, ncore=None)[source]

DOCI-CASCI

class pyscf.doci.doci_mcscf.CASSCF(mf_or_mol, ncas, nelecas, ncore=None, frozen=None)[source]

DOCI-CASSCF

### 10.9.2.2. doci_slow¶

Doubly occupied configuration interaction (DOCI)

class pyscf.doci.doci_slow.DOCI(*args, **kwargs)[source]
contract_2e(eri, fcivec, norb, nelec, link_index=None, **kwargs)[source]

Contract the 4-index tensor eri[pqrs] with a FCI vector

\begin{align}\begin{aligned}\begin{split}|output\rangle = E_{pq} E_{rs} eri_{pq,rs} |CI\rangle \\\end{split}\\\begin{split}E_{pq}E_{rs} = E_{pr,qs} + \delta_{qr} E_{ps} \\\end{split}\\E_{pq} = p^+ q + \bar{p}^+ \bar{q}\\E_{pr,qs} = p^+ r^+ s q + \bar{p}^+ r^+ s \bar{q} + ...\end{aligned}\end{align}

$$p,q,...$$ means spin-up orbitals and $$\bar{p}, \bar{q}$$ means spin-down orbitals.

Note the input argument eri is NOT the 2e hamiltonian tensor. 2e hamiltonian is

$\begin{split}h2e &= (pq|rs) E_{pr,qs} \\ &= (pq|rs) (E_{pq}E_{rs} - \delta_{qr} E_{ps}) \\ &= eri_{pq,rs} E_{pq}E_{rs} \\\end{split}$

So the relation between eri and hamiltonian (the 2e-integral tensor) is

$eri_{pq,rs} = (pq|rs) - (1/Nelec) \sum_q (pq|qs)$

to restore the symmetry between pq and rs,

$eri_{pq,rs} = (pq|rs) - (.5/Nelec) [\sum_q (pq|qs) + \sum_p (pq|rp)]$

See also direct_spin1.absorb_h1e()

get_init_guess(norb, nelec, nroots, hdiag)[source]

Initial guess is the single Slater determinant

kernel(h1e, eri, norb, nelec, ci0=None, ecore=0, **kwargs)[source]

Kernel function is the main driver of a method. Every method should define the kernel function as the entry of the calculation. Note the return value of kernel function is not strictly defined. It can be anything related to the method (such as the energy, the wave-function, the DFT mesh grids etc.).

make_hdiag(h1e, eri, norb, nelec, *args, **kwargs)[source]

Diagonal Hamiltonian for Davidson preconditioner

make_rdm1(civec, norb, nelec, link_index=None)[source]

Spin-traced one-particle density matrix

dm1[p,q] = <q_alpha^dagger p_alpha> + <q_beta^dagger p_beta>

The convention is based on McWeeney’s book, Eq (5.4.20) The contraction between 1-particle Hamiltonian and rdm1 is E = einsum(‘pq,qp’, h1, rdm1)

make_rdm12(civec, norb, nelec, link_index=None, reorder=True)[source]

Spin traced 1- and 2-particle density matrices.

1pdm[p,q] = :math:langle q_alpha^dagger p_alpha rangle +

langle q_beta^dagger p_beta rangle;

2pdm[p,q,r,s] = :math:langle p_alpha^dagger r_alpha^dagger s_alpha q_alpharangle +

langle p_beta^dagger r_alpha^dagger s_alpha q_betarangle + langle p_alpha^dagger r_beta^dagger s_beta q_alpharangle + langle p_beta^dagger r_beta^dagger s_beta q_betarangle.

Energy should be computed as E = einsum(‘pq,qp’, h1, 1pdm) + 1/2 * einsum(‘pqrs,pqrs’, eri, 2pdm) where h1[p,q] = <p|h|q> and eri[p,q,r,s] = (pq|rs)

pyscf.doci.doci_slow.contract_2e(eri, civec, norb, nelec, link_index=None)[source]

Compute E_{pq}E_{rs}|CI>