pyscf.hci package

Submodules

pyscf.hci.hci module

Selected CI using Heat-Bath CI algorithm (JCTC 2016, 12, 3674-3680)

Simple usage:

.. py:attribute:: SCI
module

pyscf.hci.hci

alias of pyscf.hci.hci.SelectedCI

class pyscf.hci.hci.SelectedCI(mol=None)

Bases: pyscf.fci.direct_spin1.FCISolver

absorb_h1e(eri, *args, **kwargs)

Modify 2e Hamiltonian to include 1e Hamiltonian contribution.

contract_2e(h1_h2, civec, norb, nelec, hdiag=None, **kwargs)

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()

contract_ss(civec, norb, nelec)
dump_flags(verbose=None)
enlarge_space(civec, h1, eri, jk, eri_sorted, jk_sorted, norb, nelec)
kernel(h1e, eri, norb, nelec, ci0=None, tol=None, lindep=None, max_cycle=None, max_space=None, nroots=None, davidson_only=None, max_iter=None, max_memory=None, verbose=None, ecore=0, return_integrals=False, eri_sorted=None, jk=None, jk_sorted=None, **kwargs)

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, strs, norb, nelec)

Diagonal Hamiltonian for Davidson preconditioner

make_rdm12s(civec, norb, nelec)

Spin separated 1- and 2-particle density matrices. The return values include two lists, a list of 1-particle density matrices and a list of 2-particle density matrices. The density matrices are: (alpha,alpha), (beta,beta) for 1-particle density matrices; (alpha,alpha,alpha,alpha), (alpha,alpha,beta,beta), (beta,beta,beta,beta) for 2-particle density matrices.

1pdm[p,q] = \(\langle q^\dagger p\rangle\); 2pdm[p,q,r,s] = \(\langle p^\dagger r^\dagger s q\rangle\).

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)

spin_square(civec, norb, nelec)

Spin square for RHF-FCI CI wfn only (obtained from spin-degenerated Hamiltonian)

to_fci(civec, norb, nelec)
pyscf.hci.hci.argunique(strs)
pyscf.hci.hci.argunique_ctypes(strs)
pyscf.hci.hci.as_SCIvector(civec, ci_strs)
pyscf.hci.hci.as_SCIvector_if_not(civec, ci_strs)
pyscf.hci.hci.contract_2e(h1_h2, civec, norb, nelec, hdiag=None, **kwargs)
pyscf.hci.hci.contract_2e_ctypes(h1_h2, civec, norb, nelec, hdiag=None, **kwargs)
pyscf.hci.hci.contract_ss(civec, norb, nelec)
pyscf.hci.hci.cre_des_sign(p, q, string)
pyscf.hci.hci.enlarge_space(myci, civec, h1, eri, jk, eri_sorted, jk_sorted, norb, nelec)
pyscf.hci.hci.excitation_level(string, nelec=None)
pyscf.hci.hci.find1(s)
pyscf.hci.hci.fix_spin(myci, shift=0.2, ss=None, **kwargs)

If Selected CI solver cannot stick on spin eigenfunction, modify the solver by adding a shift on spin square operator

\[(H + shift*S^2) |\Psi\rangle = E |\Psi\rangle\]
Args:

myci : An instance of SelectedCI

Kwargs:
shiftfloat

Level shift for states which have different spin

ssnumber

S^2 expection value == s*(s+1)

Returns

A modified Selected CI object based on myci.

pyscf.hci.hci.from_fci(fcivec, ci_strs, norb, nelec)
pyscf.hci.hci.kernel_float_space(myci, h1e, eri, norb, nelec, ci0=None, tol=None, lindep=None, max_cycle=None, max_space=None, nroots=None, davidson_only=None, max_iter=None, max_memory=None, verbose=None, ecore=0, return_integrals=False, eri_sorted=None, jk=None, jk_sorted=None, **kwargs)
pyscf.hci.hci.make_hdiag(h1e, eri, strs, norb, nelec)
pyscf.hci.hci.make_rdm12s(civec, norb, nelec)

Spin orbital 1- and 2-particle reduced density matrices (aa, bb, aaaa, aabb, bbbb)

pyscf.hci.hci.orblst2str(lst, norb)
pyscf.hci.hci.select_strs_ctypes(myci, civec, h1, eri, jk, eri_sorted, jk_sorted, norb, nelec)
pyscf.hci.hci.spin_square(civec, norb, nelec)
pyscf.hci.hci.str2orblst(string, norb)
pyscf.hci.hci.str_diff(string0, string1)
pyscf.hci.hci.to_fci(civec, norb, nelec, root=0)
pyscf.hci.hci.toggle_bit(s, place)

Module contents