9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-06 19:53:30 +01:00
qp2/src/cipsi
2021-03-31 13:36:42 +02:00
..
cipsi.irp.f Added save_wf_after_selection keyword 2021-01-19 18:28:00 +01:00
energy.irp.f Global Replacement of 'occupation pattern' with 'configuration' 2020-12-22 00:55:14 +01:00
environment.irp.f Initial commit 2019-01-25 11:39:31 +01:00
EZFIO.cfg Added save_wf_after_selection keyword 2021-01-19 18:28:00 +01:00
lock_2rdm.irp.f beginning to make work 2019-07-08 13:13:48 +02:00
NEED beginning to compute perturbative rdm 2019-07-05 13:05:11 +02:00
pert_rdm_providers.irp.f Global Replacement of 'occupation pattern' with 'configuration' 2020-12-22 00:55:14 +01:00
pt2_stoch_routines.irp.f Fixes #148 2021-03-12 11:41:58 +01:00
pt2_type.irp.f Removed norm2 2020-08-31 22:39:40 +02:00
README.rst Warnings in documentation 2019-01-29 17:09:08 +01:00
run_pt2_slave.irp.f Removed error from type 2020-08-31 02:12:18 +02:00
run_selection_slave.irp.f Removed internal reads in zmq 2021-03-31 13:36:42 +02:00
selection_buffer.irp.f Global Replacement of 'occupation pattern' with 'configuration' 2020-12-22 00:55:14 +01:00
selection_types.f90 Removed norm2 2020-08-31 22:39:40 +02:00
selection_weight.irp.f Add 2-RDM defined on all MOs 2021-02-22 12:12:30 +01:00
selection.irp.f Merge branch 'dev' of github.com:QuantumPackage/qp2 into dev 2021-03-31 08:50:23 +02:00
slave_cipsi.irp.f Modernize openmp 2021-02-13 16:19:48 +01:00
stochastic_cipsi.irp.f Save wf after selection 2021-01-20 12:35:15 +01:00
update_2rdm.irp.f beginning to make work 2019-07-08 13:13:48 +02:00
zmq_selection.irp.f Print overlap in deterministic PT2 2020-09-03 17:21:13 +02:00

=====
cipsi
=====

|CIPSI| algorithm.

The :c:func:`run_stochastic_cipsi` and :c:func:`run_cipsi` subroutines start with a single
determinant, or with the wave function in the |EZFIO| database if
:option:`determinants read_wf` is |true|.

The :c:func:`run_cipsi` subroutine iteratively:

* Selects the most important determinants from the external space and adds them to the
  internal space
* If :option:`determinants s2_eig` is |true|, it adds all the necessary
  determinants to allow the eigenstates of |H| to be eigenstates of |S^2|
* Diagonalizes |H| in the enlarged internal space
* Computes the |PT2| contribution to the energy stochastically :cite:`Garniron_2017.2`
  or deterministically, depending on :option:`perturbation do_pt2`
* Extrapolates the variational energy by fitting
  :math:`E=E_\text{FCI} - \alpha\, E_\text{PT2}`

The difference between :c:func:`run_stochastic_cipsi` and :c:func:`run_cipsi` is that
:c:func:`run_stochastic_cipsi` selects the determinants on the fly with the computation
of the stochastic |PT2| :cite:`Garniron_2017.2`. Hence, it is a semi-stochastic selection. It

* Selects the most important determinants from the external space and adds them to the
  internal space, on the fly with the computation of the PT2 with the stochastic algorithm
  presented in :cite:`Garniron_2017.2`.
* If :option:`determinants s2_eig` is |true|, it adds all the necessary
  determinants to allow the eigenstates of |H| to be eigenstates of |S^2|
* Extrapolates the variational energy by fitting
  :math:`E=E_\text{FCI} - \alpha\, E_\text{PT2}`
* Diagonalizes |H| in the enlarged internal space


The number of selected determinants at each iteration will be such that the
size of the wave function will double at every iteration. If :option:`determinants
s2_eig` is |true|, then the number of selected determinants will be 1.5x the
current number, and then all the additional determinants will be added.

By default, the program will stop when more than one million determinants have
been selected, or when the |PT2| energy is below :math:`10^{-4}`.

The variational and |PT2| energies of the iterations are stored in the
|EZFIO| database, in the :ref:`module_iterations` module.



Computation of the |PT2| energy
-------------------------------

At each iteration, the |PT2| energy is computed considering the Epstein-Nesbet
zeroth-order Hamiltonian:

.. math::

  E_{\text{PT2}} = \sum_{ \alpha }
    \frac{|\langle \Psi_S | \hat{H} | \alpha \rangle|^2}
         {E - \langle \alpha | \hat{H} | \alpha \rangle}

where the |kalpha| determinants are generated by applying all the single and
double excitation operators to all the determinants of the wave function
:math:`\Psi_G`.

When the hybrid-deterministic/stochastic algorithm is chosen
(default), :math:`Psi_G = \Psi_S = \Psi`, the full wavefunction expanded in the
internal space.
When the deterministic algorithm is chosen (:option:`perturbation do_pt2`
is set to |false|), :math:`Psi_G` is a truncation of |Psi| using
:option:`determinants threshold_generators`, and :math:`Psi_S` is a truncation
of |Psi| using :option:`determinants threshold_selectors`, and re-weighted
by :math:`1/\langle \Psi_s | \Psi_s \rangle`.

At every iteration, while computing the |PT2|, the variance of the wave
function is also computed:

.. math::

  \sigma^2 & = \langle \Psi | \hat{H}^2 | \Psi \rangle -
               \langle  \Psi | \hat{H}   | \Psi \rangle^2 \\
           & = \sum_{i \in \text{FCI}}
               \langle \Psi | \hat{H} | i \rangle
               \langle i | \hat{H} | \Psi \rangle -
               \langle  \Psi | \hat{H} | \Psi \rangle^2 \\
           & = \sum_{ \alpha }
               \langle |\Psi | \hat{H} | \alpha \rangle|^2.

The expression of the variance is the same as the expression of the |PT2|, with
a denominator of 1. It measures how far the wave function is from the |FCI|
solution. Note that the absence of denominator in the Heat-Bath selected |CI|
method is selection method by minimization of the variance, whereas |CIPSI| is
a selection method by minimization of the energy.


If :option:`perturbation do_pt2` is set to |false|, then the stochastic
|PT2| is not computed, and an approximate value is obtained from the |CIPSI|
selection. The calculation is faster, but the extrapolated |FCI| value is
less accurate. This way of running the code should be used when the only
goal is to generate a wave function, as for using |CIPSI| wave functions as
trial wave functions of |QMC| calculations for example.


The :command:`PT2` program reads the wave function of the |EZFIO| database
and computes the energy and the |PT2| contribution.


State-averaging
---------------

Extrapolated |FCI| energy
-------------------------

An estimate of the |FCI| energy is computed by extrapolating

.. math::

  E=E_\text{FCI} - \alpha\, E_\text{PT2}

This extrapolation is done for all the requested states, and excitation
energies are printed as energy differences between the extrapolated
energies of the excited states and the extrapolated energy of the ground
state.

The extrapolations are given considering the 2 last points, the 3 last points, ...,
the 7 last points. The extrapolated value should be chosen such that the extrpolated
value is stable with the number of points.