.. _module_cipsi: 
 
.. program:: cipsi 
 
.. default-role:: option 
 
=====
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:`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.

 
 
 
Providers 
--------- 
 
.. c:var:: initialize_pt2_e0_denominator


    File : :file:`cipsi/energy.irp.f`

    .. code:: fortran

        logical	:: initialize_pt2_e0_denominator	


    If true, initialize pt2_E0_denominator

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_e0_denominator`

 
.. c:var:: nthreads_pt2


    File : :file:`cipsi/environment.irp.f`

    .. code:: fortran

        integer	:: nthreads_pt2	


    Number of threads for Davidson

    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`mpi_master`
       * :c:data:`nproc`


 
.. c:function:: pt2_collector:


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2, error,  &
  variance, norm, b, N_)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_j`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`n_states`
       * :c:data:`pt2_f`
       * :c:data:`pt2_w`
       * :c:data:`n_det_generators`
       * :c:data:`pt2_n_teeth`
       * :c:data:`pt2_u`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`zmq_pt2`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`add_to_selection_buffer`
       * :c:func:`check_mem`
       * :c:func:`create_selection_buffer`
       * :c:func:`delete_selection_buffer`
       * :c:func:`end_zmq_to_qp_run_socket`
       * :c:func:`pull_pt2_results`
       * :c:func:`sleep`
       * :c:func:`sort_selection_buffer`
       * :c:func:`wall_time`

 
.. c:var:: pt2_cw


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        double precision, allocatable	:: pt2_w	(N_det_generators)
        double precision, allocatable	:: pt2_cw	(0:N_det_generators)
        double precision	:: pt2_w_t	
        double precision	:: pt2_u_0	
        integer, allocatable	:: pt2_n_0	(pt2_N_teeth+1)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`
       * :c:data:`psi_det_sorted_gen`
       * :c:data:`pt2_n_teeth`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`qp_max_mem`

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_j`

 
.. c:var:: pt2_e0_denominator


    File : :file:`cipsi/energy.irp.f`

    .. code:: fortran

        double precision, allocatable	:: pt2_e0_denominator	(N_states)


    E0 in the denominator of the PT2

    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`barycentric_electronic_energy`
       * :c:data:`h0_type`
       * :c:data:`initialize_pt2_e0_denominator`
       * :c:data:`mpi_master`
       * :c:data:`n_states`
       * :c:data:`nuclear_repulsion`
       * :c:data:`psi_energy`


 
.. c:var:: pt2_f


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        integer, allocatable	:: pt2_f	(N_det_generators)
        integer	:: pt2_n_tasks_max	



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`elec_num`
       * :c:data:`n_core_orb`
       * :c:data:`n_det_generators`
       * :c:data:`n_det_selectors`
       * :c:data:`n_states`
       * :c:data:`psi_det_sorted_gen`


 
.. c:var:: pt2_j


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        integer, allocatable	:: pt2_j	(N_det_generators)
        integer, allocatable	:: pt2_r	(N_det_generators)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`
       * :c:data:`pt2_n_tasks`
       * :c:data:`pt2_n_teeth`
       * :c:data:`pt2_u`
       * :c:data:`pt2_w`
       * :c:data:`qp_max_mem`


 
.. c:var:: pt2_mindetinfirstteeth


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        integer	:: pt2_n_teeth	
        integer	:: pt2_mindetinfirstteeth	



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`mpi_master`
       * :c:data:`n_det_generators`
       * :c:data:`psi_det_sorted_gen`
       * :c:data:`pt2_stoch_istate`

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_j`
       * :c:data:`pt2_w`

 
.. c:var:: pt2_n_0


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        double precision, allocatable	:: pt2_w	(N_det_generators)
        double precision, allocatable	:: pt2_cw	(0:N_det_generators)
        double precision	:: pt2_w_t	
        double precision	:: pt2_u_0	
        integer, allocatable	:: pt2_n_0	(pt2_N_teeth+1)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`
       * :c:data:`psi_det_sorted_gen`
       * :c:data:`pt2_n_teeth`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`qp_max_mem`

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_j`

 
.. c:var:: pt2_n_tasks


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        integer	:: pt2_n_tasks	


    Number of parallel tasks for the Monte Carlo

    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_j`

 
.. c:var:: pt2_n_tasks_max


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        integer, allocatable	:: pt2_f	(N_det_generators)
        integer	:: pt2_n_tasks_max	



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`elec_num`
       * :c:data:`n_core_orb`
       * :c:data:`n_det_generators`
       * :c:data:`n_det_selectors`
       * :c:data:`n_states`
       * :c:data:`psi_det_sorted_gen`


 
.. c:var:: pt2_n_teeth


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        integer	:: pt2_n_teeth	
        integer	:: pt2_mindetinfirstteeth	



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`mpi_master`
       * :c:data:`n_det_generators`
       * :c:data:`psi_det_sorted_gen`
       * :c:data:`pt2_stoch_istate`

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_j`
       * :c:data:`pt2_w`

 
.. c:var:: pt2_r


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        integer, allocatable	:: pt2_j	(N_det_generators)
        integer, allocatable	:: pt2_r	(N_det_generators)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`
       * :c:data:`pt2_n_tasks`
       * :c:data:`pt2_n_teeth`
       * :c:data:`pt2_u`
       * :c:data:`pt2_w`
       * :c:data:`qp_max_mem`


 
.. c:var:: pt2_stoch_istate


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        integer	:: pt2_stoch_istate	


    State for stochatsic PT2

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_n_teeth`
       * :c:data:`pt2_w`

 
.. c:var:: pt2_u


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        double precision, allocatable	:: pt2_u	(N_det_generators)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_j`

 
.. c:var:: pt2_u_0


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        double precision, allocatable	:: pt2_w	(N_det_generators)
        double precision, allocatable	:: pt2_cw	(0:N_det_generators)
        double precision	:: pt2_w_t	
        double precision	:: pt2_u_0	
        integer, allocatable	:: pt2_n_0	(pt2_N_teeth+1)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`
       * :c:data:`psi_det_sorted_gen`
       * :c:data:`pt2_n_teeth`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`qp_max_mem`

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_j`

 
.. c:var:: pt2_w


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        double precision, allocatable	:: pt2_w	(N_det_generators)
        double precision, allocatable	:: pt2_cw	(0:N_det_generators)
        double precision	:: pt2_w_t	
        double precision	:: pt2_u_0	
        integer, allocatable	:: pt2_n_0	(pt2_N_teeth+1)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`
       * :c:data:`psi_det_sorted_gen`
       * :c:data:`pt2_n_teeth`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`qp_max_mem`

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_j`

 
.. c:var:: pt2_w_t


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        double precision, allocatable	:: pt2_w	(N_det_generators)
        double precision, allocatable	:: pt2_cw	(0:N_det_generators)
        double precision	:: pt2_w_t	
        double precision	:: pt2_u_0	
        integer, allocatable	:: pt2_n_0	(pt2_N_teeth+1)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`
       * :c:data:`psi_det_sorted_gen`
       * :c:data:`pt2_n_teeth`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`qp_max_mem`

    Needed by:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_j`

 
.. c:var:: selection_weight


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        double precision, allocatable	:: selection_weight	(N_states)


    Weights used in the selection criterion

    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`c0_weight`
       * :c:data:`n_states`


 
 
Subroutines / functions 
----------------------- 
 
.. c:function:: add_to_selection_buffer:


    File : :file:`cipsi/selection_buffer.irp.f`

    .. code:: fortran

        subroutine add_to_selection_buffer(b, det, val)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`fill_buffer_double`
       * :c:func:`pt2_collector`
       * :c:func:`selection_collector`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`sort_selection_buffer`

 
.. c:function:: bitstring_to_list_in_selection:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine bitstring_to_list_in_selection( string, list, n_elements, Nint)


    Gives the inidices(+1) of the bits set to 1 in the bit string

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`splash_pq`
       * :c:func:`spot_isinwf`

 
.. c:function:: create_selection_buffer:


    File : :file:`cipsi/selection_buffer.irp.f`

    .. code:: fortran

        subroutine create_selection_buffer(N, siz_, res)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`pt2_collector`
       * :c:func:`run_pt2_slave`
       * :c:func:`run_selection_slave`
       * :c:func:`selection_collector`
       * :c:func:`zmq_pt2`
       * :c:func:`zmq_selection`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`check_mem`

 
.. c:function:: delete_selection_buffer:


    File : :file:`cipsi/selection_buffer.irp.f`

    .. code:: fortran

        subroutine delete_selection_buffer(b)



    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`pt2_collector`
       * :c:func:`run_pt2_slave`
       * :c:func:`run_selection_slave`
       * :c:func:`selection_collector`
       * :c:func:`zmq_pt2`
       * :c:func:`zmq_selection`

 
.. c:function:: fill_buffer_double:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2, variance, norm, mat, buf)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`psi_occ_pattern_hii`
       * :c:data:`det_to_occ_pattern`
       * :c:data:`selection_weight`
       * :c:data:`mo_num`
       * :c:data:`n_states`
       * :c:data:`n_int`
       * :c:data:`psi_det_hii`
       * :c:data:`do_only_1h1p`
       * :c:data:`h0_type`
       * :c:data:`psi_det_generators`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`select_singles_and_doubles`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`add_to_selection_buffer`
       * :c:func:`apply_holes`
       * :c:func:`apply_particles`

 
.. c:function:: get_d0:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_states`
       * :c:data:`n_int`
       * :c:data:`mo_integrals_map`
       * :c:data:`mo_num`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`splash_pq`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`apply_particles`
       * :c:func:`get_mo_two_e_integrals`
       * :c:func:`i_h_j`

 
.. c:function:: get_d1:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_states`
       * :c:data:`n_int`
       * :c:data:`mo_integrals_map`
       * :c:data:`mo_num`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`splash_pq`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`apply_particles`
       * :c:func:`get_mo_two_e_integrals`
       * :c:func:`i_h_j`

 
.. c:function:: get_d2:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine get_d2(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_states`
       * :c:data:`n_int`
       * :c:data:`mo_num`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`splash_pq`

 
.. c:function:: get_mask_phase:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine get_mask_phase(det1, pm, Nint)



    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`splash_pq`

 
.. c:function:: get_phase_bi:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        double precision function get_phase_bi(phasemask, s1, s2, h1, p1, h2, p2, Nint)



 
.. c:function:: make_selection_buffer_s2:


    File : :file:`cipsi/selection_buffer.irp.f`

    .. code:: fortran

        subroutine make_selection_buffer_s2(b)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`elec_alpha_num`
       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`zmq_pt2`
       * :c:func:`zmq_selection`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`check_mem`
       * :c:func:`dsort`
       * :c:func:`i8sort`
       * :c:func:`occ_pattern_to_dets`
       * :c:func:`occ_pattern_to_dets_size`

 
.. c:function:: merge_selection_buffers:


    File : :file:`cipsi/selection_buffer.irp.f`

    .. code:: fortran

        subroutine merge_selection_buffers(b1, b2)


    Merges the selection buffers b1 and b2 into b2

    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`run_pt2_slave`
       * :c:func:`run_selection_slave`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`check_mem`

 
.. c:function:: past_d1:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine past_d1(bannedOrb, p)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`mo_num`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`splash_pq`

 
.. c:function:: past_d2:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine past_d2(banned, p, sp)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`mo_num`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`splash_pq`

 
.. c:function:: provide_everything:


    File : :file:`cipsi/slave_cipsi.irp.f`

    .. code:: fortran

        subroutine provide_everything



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`generators_bitmask`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`psi_selectors`
       * :c:data:`psi_det`
       * :c:data:`zmq_state`
       * :c:data:`psi_coef`
       * :c:data:`mpi_master`
       * :c:data:`n_det`
       * :c:data:`zmq_context`
       * :c:data:`n_det_selectors`
       * :c:data:`state_average_weight`
       * :c:data:`mo_num`
       * :c:data:`mo_two_e_integrals_in_map`
       * :c:data:`pt2_e0_denominator`
       * :c:data:`ci_energy`
       * :c:data:`n_states_diag`
       * :c:data:`threshold_generators`
       * :c:data:`psi_det_sorted_bit`
       * :c:data:`n_states`
       * :c:data:`h_apply_buffer_allocated`
       * :c:data:`n_det_generators`
       * :c:data:`psi_det_generators`
       * :c:data:`n_int`
       * :c:data:`psi_det_generators`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`run_slave_cipsi`

 
.. c:function:: pt2_find_sample:


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        integer function pt2_find_sample(v, w)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`

 
.. c:function:: pt2_find_sample_lr:


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        integer function pt2_find_sample_lr(v, w, l_in, r_in)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`

 
.. c:function:: pt2_slave_inproc:


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        subroutine pt2_slave_inproc(i)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_e0_denominator`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`zmq_pt2`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`run_pt2_slave`

 
.. c:function:: pull_pt2_results:


    File : :file:`cipsi/run_pt2_slave.irp.f`

    .. code:: fortran

        subroutine pull_pt2_results(zmq_socket_pull, index, pt2, variance, norm, task_id, n_tasks, b)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_states`
       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`pt2_collector`

 
.. c:function:: pull_selection_results:


    File : :file:`cipsi/run_selection_slave.irp.f`

    .. code:: fortran

        subroutine pull_selection_results(zmq_socket_pull, pt2, variance, norm, val, det, N, task_id, ntask)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_states`
       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`selection_collector`

 
.. c:function:: push_pt2_results:


    File : :file:`cipsi/run_pt2_slave.irp.f`

    .. code:: fortran

        subroutine push_pt2_results(zmq_socket_push, index, pt2, variance, norm, b, task_id, n_tasks)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_states`
       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`run_pt2_slave`

 
.. c:function:: push_selection_results:


    File : :file:`cipsi/run_selection_slave.irp.f`

    .. code:: fortran

        subroutine push_selection_results(zmq_socket_push, pt2, variance, norm, b, task_id, ntask)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_states`
       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`run_selection_slave`

 
.. c:function:: remove_duplicates_in_selection_buffer:


    File : :file:`cipsi/selection_buffer.irp.f`

    .. code:: fortran

        subroutine remove_duplicates_in_selection_buffer(b)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`zmq_pt2`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`check_mem`
       * :c:func:`i8sort`

 
.. c:function:: run_cipsi:


    File : :file:`cipsi/cipsi.irp.f`

    .. code:: fortran

        subroutine run_cipsi


    Selected Full Configuration Interaction with deterministic selection and
    stochastic PT2.

    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`correlation_energy_ratio_max`
       * :c:data:`n_iter`
       * :c:data:`psi_energy_with_nucl_rep`
       * :c:data:`psi_occ_pattern`
       * :c:data:`n_det_max`
       * :c:data:`n_states`
       * :c:data:`h_apply_buffer_allocated`
       * :c:data:`n_det`
       * :c:data:`s2_eig`
       * :c:data:`do_pt2`
       * :c:data:`psi_energy`
       * :c:data:`pt2_relative_error`
       * :c:data:`ref_bitmask_energy`
       * :c:data:`psi_det`
       * :c:data:`n_states_diag`
       * :c:data:`psi_coef`
       * :c:data:`psi_det_sorted`
       * :c:data:`pt2_max`
       * :c:data:`threshold_generators`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`fci`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`check_mem`
       * :c:func:`diagonalize_ci`
       * :c:func:`ezfio_get_hartree_fock_energy`
       * :c:func:`ezfio_has_hartree_fock_energy`
       * :c:func:`make_s2_eigenfunction`
       * :c:func:`print_extrapolated_energy`
       * :c:func:`print_summary`
       * :c:func:`save_energy`
       * :c:func:`save_iterations`
       * :c:func:`save_wavefunction`
       * :c:func:`write_double`
       * :c:func:`zmq_pt2`
       * :c:func:`zmq_selection`

    Touches:

    .. hlist::
       :columns: 3

       * :c:data:`ci_electronic_energy`
       * :c:data:`ci_electronic_energy`
       * :c:data:`ci_energy`
       * :c:data:`ci_electronic_energy`
       * :c:data:`n_det`
       * :c:data:`psi_occ_pattern`
       * :c:data:`c0_weight`
       * :c:data:`psi_coef`
       * :c:data:`psi_det_sorted_bit`
       * :c:data:`psi_det`
       * :c:data:`psi_det_size`
       * :c:data:`psi_det_sorted_bit`
       * :c:data:`psi_occ_pattern`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`state_average_weight`
       * :c:data:`threshold_generators`

 
.. c:function:: run_pt2_slave:


    File : :file:`cipsi/run_pt2_slave.irp.f`

    .. code:: fortran

        subroutine run_pt2_slave(thread,iproc,energy)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_states_diag`
       * :c:data:`n_states`
       * :c:data:`pt2_f`
       * :c:data:`nproc`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`pt2_slave_inproc`
       * :c:func:`run_slave_main`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`check_mem`
       * :c:func:`create_selection_buffer`
       * :c:func:`delete_selection_buffer`
       * :c:func:`end_zmq_push_socket`
       * :c:func:`end_zmq_to_qp_run_socket`
       * :c:func:`merge_selection_buffers`
       * :c:func:`push_pt2_results`
       * :c:func:`select_connected`
       * :c:func:`sleep`
       * :c:func:`sort_selection_buffer`
       * :c:func:`wall_time`

 
.. c:function:: run_selection_slave:


    File : :file:`cipsi/run_selection_slave.irp.f`

    .. code:: fortran

        subroutine run_selection_slave(thread,iproc,energy)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`psi_det_beta_unique`
       * :c:data:`psi_bilinear_matrix_values`
       * :c:data:`psi_bilinear_matrix_transp_values`
       * :c:data:`psi_bilinear_matrix_transp_rows_loc`
       * :c:data:`n_states`
       * :c:data:`pt2_f`
       * :c:data:`psi_bilinear_matrix_values`
       * :c:data:`psi_bilinear_matrix_transp_values`
       * :c:data:`n_int`
       * :c:data:`psi_det_alpha_unique`
       * :c:data:`psi_det_sorted`
       * :c:data:`psi_det_sorted`
       * :c:data:`psi_bilinear_matrix_columns_loc`
       * :c:data:`psi_selectors_coef_transp`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`run_slave_main`
       * :c:func:`selection_slave_inproc`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`create_selection_buffer`
       * :c:func:`delete_selection_buffer`
       * :c:func:`end_zmq_push_socket`
       * :c:func:`end_zmq_to_qp_run_socket`
       * :c:func:`merge_selection_buffers`
       * :c:func:`push_selection_results`
       * :c:func:`select_connected`
       * :c:func:`sleep`
       * :c:func:`sort_selection_buffer`

 
.. c:function:: run_slave_cipsi:


    File : :file:`cipsi/slave_cipsi.irp.f`

    .. code:: fortran

        subroutine run_slave_cipsi


    Helper program for distributed parallelism

    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`read_wf`
       * :c:data:`distributed_davidson`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`fci`
       * :c:func:`pt2`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`omp_set_nested`
       * :c:func:`provide_everything`
       * :c:func:`run_slave_main`
       * :c:func:`switch_qp_run_to_master`

    Touches:

    .. hlist::
       :columns: 3

       * :c:data:`distributed_davidson`
       * :c:data:`pt2_e0_denominator`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`read_wf`
       * :c:data:`state_average_weight`
       * :c:data:`threshold_generators`

 
.. c:function:: run_slave_main:


    File : :file:`cipsi/slave_cipsi.irp.f`

    .. code:: fortran

        subroutine run_slave_main



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`psi_coef`
       * :c:data:`mpi_rank`
       * :c:data:`zmq_state`
       * :c:data:`state_average_weight`
       * :c:data:`mpi_master`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`n_states`
       * :c:data:`n_det`
       * :c:data:`pt2_e0_denominator`
       * :c:data:`n_det_selectors`
       * :c:data:`n_det_generators`
       * :c:data:`psi_det`
       * :c:data:`n_states_diag`
       * :c:data:`zmq_context`
       * :c:data:`threshold_generators`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`run_slave_cipsi`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`davidson_slave_tcp`
       * :c:func:`mpi_print`
       * :c:func:`omp_set_nested`
       * :c:func:`run_pt2_slave`
       * :c:func:`run_selection_slave`
       * :c:func:`sleep`
       * :c:func:`wait_for_states`
       * :c:func:`wall_time`
       * :c:func:`write_double`

    Touches:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_e0_denominator`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`state_average_weight`
       * :c:data:`threshold_generators`

 
.. c:function:: run_stochastic_cipsi:


    File : :file:`cipsi/stochastic_cipsi.irp.f`

    .. code:: fortran

        subroutine run_stochastic_cipsi


    Selected Full Configuration Interaction with Stochastic selection and PT2.

    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`correlation_energy_ratio_max`
       * :c:data:`n_iter`
       * :c:data:`psi_energy_with_nucl_rep`
       * :c:data:`psi_occ_pattern`
       * :c:data:`n_det_max`
       * :c:data:`n_states`
       * :c:data:`h_apply_buffer_allocated`
       * :c:data:`n_det`
       * :c:data:`s2_eig`
       * :c:data:`psi_energy`
       * :c:data:`pt2_relative_error`
       * :c:data:`ref_bitmask_energy`
       * :c:data:`psi_det`
       * :c:data:`n_states_diag`
       * :c:data:`psi_coef`
       * :c:data:`psi_det_sorted`
       * :c:data:`pt2_max`
       * :c:data:`threshold_generators`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`fci`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`check_mem`
       * :c:func:`copy_h_apply_buffer_to_wf`
       * :c:func:`diagonalize_ci`
       * :c:func:`ezfio_get_hartree_fock_energy`
       * :c:func:`ezfio_has_hartree_fock_energy`
       * :c:func:`make_s2_eigenfunction`
       * :c:func:`print_extrapolated_energy`
       * :c:func:`print_summary`
       * :c:func:`save_energy`
       * :c:func:`save_iterations`
       * :c:func:`save_wavefunction`
       * :c:func:`write_double`
       * :c:func:`zmq_pt2`

    Touches:

    .. hlist::
       :columns: 3

       * :c:data:`ci_electronic_energy`
       * :c:data:`ci_electronic_energy`
       * :c:data:`ci_energy`
       * :c:data:`ci_electronic_energy`
       * :c:data:`n_det`
       * :c:data:`psi_occ_pattern`
       * :c:data:`c0_weight`
       * :c:data:`psi_coef`
       * :c:data:`psi_det_sorted_bit`
       * :c:data:`psi_det`
       * :c:data:`psi_det_size`
       * :c:data:`psi_det_sorted_bit`
       * :c:data:`psi_occ_pattern`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`state_average_weight`
       * :c:data:`threshold_generators`

 
.. c:function:: select_connected:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine select_connected(i_generator,E0,pt2,variance,norm,b,subset,csubset)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`generators_bitmask`
       * :c:data:`mo_num`
       * :c:data:`n_states`
       * :c:data:`n_int`
       * :c:data:`n_generators_bitmask`
       * :c:data:`psi_det_generators`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`run_pt2_slave`
       * :c:func:`run_selection_slave`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`build_fock_tmp`
       * :c:func:`select_singles_and_doubles`

 
.. c:function:: select_singles_and_doubles:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,pt2,variance,norm,buf,subset,csubset)


    WARNING /!\ : It is assumed that the generators and selectors are psi_det_sorted

    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`psi_det_beta_unique`
       * :c:data:`psi_bilinear_matrix_values`
       * :c:data:`psi_bilinear_matrix_transp_values`
       * :c:data:`mo_num`
       * :c:data:`psi_bilinear_matrix_transp_rows_loc`
       * :c:data:`n_states`
       * :c:data:`n_det`
       * :c:data:`psi_bilinear_matrix_transp_values`
       * :c:data:`elec_alpha_num`
       * :c:data:`n_det_selectors`
       * :c:data:`psi_bilinear_matrix_transp_values`
       * :c:data:`psi_bilinear_matrix_values`
       * :c:data:`n_int`
       * :c:data:`psi_det_generators`
       * :c:data:`psi_bilinear_matrix_values`
       * :c:data:`psi_det_alpha_unique`
       * :c:data:`psi_det_sorted`
       * :c:data:`psi_det_sorted`
       * :c:data:`psi_bilinear_matrix_columns_loc`
       * :c:data:`psi_selectors_coef_transp`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`select_connected`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`apply_hole`
       * :c:func:`bitstring_to_list_ab`
       * :c:func:`check_mem`
       * :c:func:`fill_buffer_double`
       * :c:func:`get_excitation_degree_spin`
       * :c:func:`isort`
       * :c:func:`splash_pq`
       * :c:func:`spot_isinwf`

 
.. c:function:: selection_collector:


    File : :file:`cipsi/zmq_selection.irp.f`

    .. code:: fortran

        subroutine selection_collector(zmq_socket_pull, b, N, pt2, variance, norm)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_det_generators`
       * :c:data:`n_states`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`zmq_selection`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`add_to_selection_buffer`
       * :c:func:`check_mem`
       * :c:func:`create_selection_buffer`
       * :c:func:`delete_selection_buffer`
       * :c:func:`end_zmq_to_qp_run_socket`
       * :c:func:`pull_selection_results`
       * :c:func:`sort_selection_buffer`

 
.. c:function:: selection_slave_inproc:


    File : :file:`cipsi/zmq_selection.irp.f`

    .. code:: fortran

        subroutine selection_slave_inproc(i)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_e0_denominator`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`zmq_selection`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`run_selection_slave`

 
.. c:function:: sort_selection_buffer:


    File : :file:`cipsi/selection_buffer.irp.f`

    .. code:: fortran

        subroutine sort_selection_buffer(b)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`add_to_selection_buffer`
       * :c:func:`pt2_collector`
       * :c:func:`run_pt2_slave`
       * :c:func:`run_selection_slave`
       * :c:func:`selection_collector`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`check_mem`
       * :c:func:`dsort`

 
.. c:function:: splash_pq:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, interesting)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`psi_selectors_coef_transp`
       * :c:data:`n_states`
       * :c:data:`psi_det_sorted`
       * :c:data:`n_int`
       * :c:data:`mo_num`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`select_singles_and_doubles`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`bitstring_to_list_in_selection`
       * :c:func:`get_d0`
       * :c:func:`get_d1`
       * :c:func:`get_d2`
       * :c:func:`get_mask_phase`
       * :c:func:`past_d1`
       * :c:func:`past_d2`

 
.. c:function:: spot_isinwf:


    File : :file:`cipsi/selection.irp.f`

    .. code:: fortran

        subroutine spot_isinwf(mask, det, i_gen, N, banned, fullMatch, interesting)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`n_int`
       * :c:data:`mo_num`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`select_singles_and_doubles`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`bitstring_to_list_in_selection`

 
.. c:function:: testteethbuilding:


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        logical function testTeethBuilding(minF, N)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`pt2_stoch_istate`
       * :c:data:`n_det_generators`
       * :c:data:`psi_det_sorted_gen`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`check_mem`

 
.. c:function:: zmq_pt2:


    File : :file:`cipsi/pt2_stoch_routines.irp.f`

    .. code:: fortran

        subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`psi_det_sorted`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`psi_selectors`
       * :c:data:`psi_bilinear_matrix_values`
       * :c:data:`psi_det_alpha_unique`
       * :c:data:`pt2_e0_denominator`
       * :c:data:`pt2_n_teeth`
       * :c:data:`psi_selectors_coef_transp`
       * :c:data:`n_det`
       * :c:data:`s2_eig`
       * :c:data:`pt2_j`
       * :c:data:`mo_two_e_integrals_in_map`
       * :c:data:`psi_bilinear_matrix_transp_values`
       * :c:data:`state_average_weight`
       * :c:data:`mo_num`
       * :c:data:`nthreads_pt2`
       * :c:data:`psi_bilinear_matrix_values`
       * :c:data:`mo_one_e_integrals`
       * :c:data:`elec_alpha_num`
       * :c:data:`nproc`
       * :c:data:`psi_bilinear_matrix_columns_loc`
       * :c:data:`threshold_generators`
       * :c:data:`psi_det_beta_unique`
       * :c:data:`qp_max_mem`
       * :c:data:`psi_bilinear_matrix_transp_rows_loc`
       * :c:data:`n_states`
       * :c:data:`pt2_f`
       * :c:data:`n_det_generators`
       * :c:data:`psi_bilinear_matrix_transp_values`
       * :c:data:`n_int`
       * :c:data:`pt2_j`
       * :c:data:`psi_det_sorted`
       * :c:data:`pt2_w`
       * :c:data:`pt2_u`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`run_cipsi`
       * :c:func:`run_stochastic_cipsi`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`check_mem`
       * :c:func:`create_selection_buffer`
       * :c:func:`delete_selection_buffer`
       * :c:func:`end_parallel_job`
       * :c:func:`fill_h_apply_buffer_no_selection`
       * :c:func:`make_selection_buffer_s2`
       * :c:func:`new_parallel_job`
       * :c:func:`omp_set_nested`
       * :c:func:`pt2_collector`
       * :c:func:`pt2_slave_inproc`
       * :c:func:`remove_duplicates_in_selection_buffer`
       * :c:func:`resident_memory`
       * :c:func:`write_double`
       * :c:func:`write_int`
       * :c:func:`zmq_selection`

    Touches:

    .. hlist::
       :columns: 3

       * :c:data:`n_det`
       * :c:data:`c0_weight`
       * :c:data:`psi_coef`
       * :c:data:`psi_det_sorted_bit`
       * :c:data:`psi_det`
       * :c:data:`psi_det_size`
       * :c:data:`psi_det_sorted_bit`
       * :c:data:`pt2_stoch_istate`
       * :c:data:`state_average_weight`

 
.. c:function:: zmq_selection:


    File : :file:`cipsi/zmq_selection.irp.f`

    .. code:: fortran

        subroutine ZMQ_selection(N_in, pt2, variance, norm)



    Needs:

    .. hlist::
       :columns: 3

       * :c:data:`psi_det_sorted`
       * :c:data:`psi_selectors`
       * :c:data:`psi_bilinear_matrix_values`
       * :c:data:`n_det`
       * :c:data:`psi_bilinear_matrix_columns_loc`
       * :c:data:`n_det_selectors`
       * :c:data:`psi_det_alpha_unique`
       * :c:data:`psi_bilinear_matrix_transp_values`
       * :c:data:`state_average_weight`
       * :c:data:`psi_bilinear_matrix_values`
       * :c:data:`pt2_e0_denominator`
       * :c:data:`do_pt2`
       * :c:data:`nproc`
       * :c:data:`s2_eig`
       * :c:data:`threshold_generators`
       * :c:data:`psi_det_beta_unique`
       * :c:data:`qp_max_mem`
       * :c:data:`psi_bilinear_matrix_transp_rows_loc`
       * :c:data:`n_states`
       * :c:data:`pt2_f`
       * :c:data:`n_det_generators`
       * :c:data:`psi_bilinear_matrix_transp_values`
       * :c:data:`n_int`

    Called by:

    .. hlist::
       :columns: 3

       * :c:func:`run_cipsi`
       * :c:func:`zmq_pt2`

    Calls:

    .. hlist::
       :columns: 3

       * :c:func:`copy_h_apply_buffer_to_wf`
       * :c:func:`create_selection_buffer`
       * :c:func:`delete_selection_buffer`
       * :c:func:`end_parallel_job`
       * :c:func:`fill_h_apply_buffer_no_selection`
       * :c:func:`make_selection_buffer_s2`
       * :c:func:`new_parallel_job`
       * :c:func:`save_wavefunction`
       * :c:func:`selection_collector`
       * :c:func:`selection_slave_inproc`
       * :c:func:`write_double`

    Touches:

    .. hlist::
       :columns: 3

       * :c:data:`n_det`
       * :c:data:`c0_weight`
       * :c:data:`psi_coef`
       * :c:data:`psi_det_sorted_bit`
       * :c:data:`psi_det`
       * :c:data:`psi_det_size`
       * :c:data:`psi_det_sorted_bit`

