Static Eigenstate Method#

Ground state and state-averaged method#

This module contains functions to optimize mps for a single ground state or several lowest excited states with state-averaged algorithm.

class renormalizer.mps.gs.DmrgFCISolver[source]#

DMRG interface for PySCF FCI/CASCI/CASSCF

kernel(h1, h2, norb, nelec, ci0=None, ecore=0, **kwargs)[source]#
make_rdm1(params, norb, nelec)[source]#

Evaluate the spin-traced one-body reduced density matrix (1RDM).

\[\textrm{1RDM}[p,q] = \langle p_{\alpha}^\dagger q_{\alpha} \rangle + \langle p_{\beta}^\dagger q_{\beta} \rangle\]
Returns:

rdm1 – The spin-traced one-body RDM.

Return type:

np.ndarray

See also

make_rdm2

Evaluate the spin-traced two-body reduced density matrix (2RDM).

make_rdm12(params, norb, nelec)[source]#
make_rdm2(params, norb, nelec)[source]#

Evaluate the spin-traced two-body reduced density matrix (2RDM).

\[\begin{split}\begin{aligned} \textrm{2RDM}[p,q,r,s] & = \langle p_{\alpha}^\dagger r_{\alpha}^\dagger s_{\alpha} q_{\alpha} \rangle + \langle p_{\beta}^\dagger r_{\alpha}^\dagger s_{\alpha} q_{\beta} \rangle \\ & \quad + \langle p_{\alpha}^\dagger r_{\beta}^\dagger s_{\beta} q_{\alpha} \rangle + \langle p_{\beta}^\dagger r_{\beta}^\dagger s_{\beta} q_{\beta} \rangle \end{aligned}\end{split}\]
Returns:

rdm2 – The spin-traced two-body RDM.

Return type:

np.ndarray

See also

make_rdm1

Evaluate the spin-traced one-body reduced density matrix (1RDM).

spin_square(params, norb, nelec)[source]#
renormalizer.mps.gs.construct_mps_mpo(model, mmax, nexciton, offset=<renormalizer.utils.quantity.Quantity object>)[source]#

MPO/MPS structure 2 e1,ph11,ph12,..e2,ph21,ph22,…en,phn1,phn2…

renormalizer.mps.gs.eigh_direct(mps: Mps, qn_mask: ndarray, ltensor: Union[ndarray, List[ndarray]], rtensor: Union[ndarray, List[ndarray]], cmo: List[ndarray], omega: float)[source]#
renormalizer.mps.gs.eigh_iterative(mps: Mps, qn_mask: ndarray, ltensor: Union[ndarray, List[ndarray]], rtensor: Union[ndarray, List[ndarray]], cmo: List[ndarray], omega: float, cguess: List[ndarray])[source]#
renormalizer.mps.gs.func_sum(funcs)[source]#
renormalizer.mps.gs.get_ham_direct(mps: Mps, qn_mask: ndarray, ltensor: Union[ndarray, List[ndarray]], rtensor: Union[ndarray, List[ndarray]], cmo: List[ndarray], omega: float)[source]#
renormalizer.mps.gs.get_ham_iterative(mps: Mps, qn_mask: ndarray, ltensor: Union[ndarray, List[ndarray]], rtensor: Union[ndarray, List[ndarray]], cmo: List[ndarray], omega: float)[source]#
renormalizer.mps.gs.optimize_mps(mps: Mps, mpo: Union[Mpo, StackedMpo], omega: Optional[float] = None) Tuple[List, Mps][source]#

DMRG ground state algorithm and state-averaged excited states algorithm

Parameters:
  • mps (renormalizer.mps.Mps) – initial guess of mps. The MPS is overwritten during the optimization.

  • mpo (Union[renormalizer.mps.Mpo, renormalizer.mps.StackedMpo]) – mpo of Hamiltonian

  • omega (float, optional) – target the eigenpair near omega with special variational function :math:(hat{H}-omega)^2. Default is None.

Returns:

  • energy (list) – list of energy of each marco sweep. \([e_0, e_0, \cdots, e_0]\) if nroots=1. \([[e_0, \cdots, e_n], \dots, [e_0, \cdots, e_n]]\) if nroots=n.

  • mps (renormalizer.mps.Mps) –

    optimized ground state MPS.

    Note it’s not the same with the overwritten input MPS.

See also

renormalizer.utils.configs.OptimizeConfig

The optimization configuration.

Note

When On-the-fly swapping algorithm is used, the site ordering of the returned MPS is changed and the original MPO will not correspond to it and should be updated with returned mps.model.

renormalizer.mps.gs.sign_fix(c, nroots)[source]#
renormalizer.mps.gs.single_sweep(mps: Mps, mpo: Union[Mpo, StackedMpo], environ: Environ, omega: float, percent: float, last_opt_e_idx: int)[source]#

Tamm-Dancoff approximation for excited state#

class renormalizer.mps.tda.TDA(model, hmpo, mps, nroots=1, algo=None)[source]#

Tamm–Dancoff approximation (or called CIS) to calculate the excited states based on MPS. TDA use the first order tangent space to do excitation. The implementation is similar to J. Chem. Phys. 140, 024108 (2014).

Parameters:
  • model (renormalizer.model.model) – Model of the system

  • hmpo (renormalizer.mps.Mpo) – mpo of Hamiltonian

  • mps (renormalizer.mps.Mps) – ground state mps (will be overwritten)

  • nroots (int, optional) – number of roots to be calculated. Default is 1.

  • algo (str, optional) – iterative diagonalization solver. Default is "primme" if primme is installed. Valid options are davidson and primme.

Note

Quantum number is not used, thus the conservation is not guaranteed.

analysis_1ordm()[source]#

calculate one-orbital reduced density matrix of each tda root

analysis_dominant_config(thresh=0.8, alias=None, tda_m_trunc=20, return_compressed_mps=False)[source]#
analyze the dominant configuration of each tda root.

The algorithm is to compress the tda wavefunction to a rank-1 Hartree state and get the ci coefficient of the largest configuration. Then, the configuration is subtracted from the tda wavefunction and redo the first step to get the second largest configuration. The two steps continue until the thresh is achieved.

Parameters:
  • thresh (float, optional) – the threshold to stop the analysis procedure of each root. \(\sum_i |c_i|^2 > thresh\). Default is 0.8.

  • alias (dict, optional) – The alias of each site. For example, alias={0:"v_0", 1:"v_2", 2:"v_1"}. Default is None.

  • tda_m_trunc (int, optional) – the m to compress a tda wavefunction. Default is 20.

  • return_compressed_mps (bool, optional) – If True, return the tda excited state as a single compressed mps. Default is False.

Returns:

  • configs (dict) – The dominant configration of each root. configs = {0:[(config0, config_name0, ci_coeff0),(config1, config_name1, ci_coeff1),...], 1:...}

  • compressed_mps (List[renormalizer.mps.Mps]) – see the description in return_compressed_mps.

Note

The compressed_mps is an approximation of the tda wavefunction with m=tda_m_trunc.

dump_wfn()[source]#

Dump wavefunction for restart and analysis

Note

mps_l_cano.npz: left-canonical form of initial mps mps_r_cano.npz: right-canonical form of the initial mps tangent_u: the tangent space u of the mixed-canonical mps tda_coeff_{iroot}.npz: the tda_coeff of the ith root.

kernel(restart=False, include_psi0=False)[source]#

calculate the roots

Parameters:
  • restart (bool, optional) – if restart from the former converged root. Default is False. If restart = True, include_psi0 must be the same as the former calculation.

  • include_psi0 (bool, optional) –

    if the basis of Hamiltonian includes the ground state

    \(\Psi_0\). Default is False.

Returns:

e – the energy of the states, if include_psi0 = True, the first element is the ground state energy, otherwise, it is the energy of the first excited state.

Return type:

np.ndarray

load_wfn(model)[source]#

Load tda wavefunction

renormalizer.mps.tda.merge(mpsl, mpsr, idx)[source]#

merge two mps (mpsl, mpsr) at dix idx belongs mpsr, the other attributes are the same aas mpsl