2019-03-07 16:29:06 +01:00
.. _module_determinants:
.. program :: determinants
.. default-role :: option
============
determinants
============
Contains everything for the computation of the Hamiltonian matrix elements in the basis of orthogonal Slater determinants built on a restricted spin-orbitals basis.
The main providers for this module are:
* :option: `determinants n_states` : number of states to be computed
* :c:data: `psi_det` : list of determinants in the wave function used in many routines/providers of the |QP|.
* :c:data: `psi_coef` : list of coefficients, for all :option: `determinants n_states` states, and all determinants.
The main routines for this module are:
* :c:func: `i_H_j` : computes the Hamiltonian matrix element between two arbitrary Slater determinants.
* :c:func: `i_H_j_s2` : computes the Hamiltonian and (|S^2|) matrix element between two arbitrary Slater determinants.
* :c:func: `i_H_j_verbose` : returns the decomposition in terms of one- and two-body components of the Hamiltonian matrix elements between two arbitrary Slater determinants. Also return the fermionic phase factor.
* :c:func: `i_H_psi` : computes the Hamiltonian matrix element between an arbitrary Slater determinant and a wave function composed of a sum of arbitrary Slater determinants.
For an example of how to use these routines and providers, take a look at :file: `example.irp.f` .
EZFIO parameters
----------------
.. option :: n_det_max
Maximum number of determinants in the wave function
Default: 1000000
.. option :: n_det_print_wf
Maximum number of determinants to be printed with the program print_wf
Default: 10000
.. option :: n_states
Number of states to consider
Default: 1
.. option :: read_wf
If |true|, read the wave function from the |EZFIO| file
Default: False
2020-12-06 22:58:30 +01:00
.. option :: pruning
If p>0., remove p*Ndet determinants at every iteration
Default: 0.
2019-03-07 16:29:06 +01:00
.. option :: s2_eig
Force the wave function to be an eigenfunction of |S^2|
Default: True
2019-06-15 00:20:35 +02:00
.. option :: weight_one_e_dm
2019-03-07 16:29:06 +01:00
Weight used in the calculation of the one-electron density matrix. 0: 1./(c_0^2), 1: 1/N_states, 2: input state-average weight, 3: 1/(Norm_L3(Psi))
2020-12-06 22:58:30 +01:00
Default: 2
2019-03-07 16:29:06 +01:00
2019-06-15 00:20:35 +02:00
.. option :: weight_selection
2020-12-06 22:58:30 +01:00
Weight used in the selection. 0: input state-average weight, 1: 1./(c_0^2), 2: rPT2 matching, 3: variance matching, 4: variance and rPT2 matching, 5: variance minimization and matching, 6: CI coefficients
2019-06-15 00:20:35 +02:00
Default: 2
2019-03-07 16:29:06 +01:00
.. option :: threshold_generators
Thresholds on generators (fraction of the square of the norm)
2019-05-28 10:23:50 +02:00
Default: 0.999
2019-03-07 16:29:06 +01:00
.. option :: n_int
Number of integers required to represent bitstrings (set in module :ref: `module_bitmask` )
.. option :: bit_kind
(set in module :ref: `module_bitmask` )
.. option :: mo_label
Label of the |MOs| on which the determinants are expressed
.. option :: n_det
Number of determinants in the current wave function
2020-12-06 22:58:30 +01:00
.. option :: n_det_qp_edit
Number of determinants to print in qp_edit
2019-03-07 16:29:06 +01:00
.. option :: psi_coef
Coefficients of the wave function
.. option :: psi_det
Determinants of the variational space
2020-12-06 22:58:30 +01:00
.. option :: psi_coef_qp_edit
Coefficients of the wave function
.. option :: psi_det_qp_edit
Determinants of the variational space
2019-03-07 16:29:06 +01:00
.. option :: expected_s2
Expected value of |S^2|
.. option :: target_energy
Energy that should be obtained when truncating the wave function (optional)
Default: 0.
.. option :: state_average_weight
Weight of the states in state-average calculations.
2019-06-15 00:20:35 +02:00
.. option :: selection_factor
f such that the number of determinants to add is f * N_det * sqrt(N_states)
Default: 1.
2019-05-28 10:23:50 +02:00
.. option :: thresh_sym
Thresholds to check if a determinant is connected with HF
Default: 1.e-15
.. option :: pseudo_sym
If |true|, discard any Slater determinants with an interaction smaller than thresh_sym with HF.
Default: False
2019-03-07 16:29:06 +01:00
Providers
---------
.. c:var :: abs_psi_coef_max
File : :file: `determinants/determinants.irp.f`
.. code :: fortran
double precision, allocatable :: psi_coef_max (N_states)
double precision, allocatable :: psi_coef_min (N_states)
double precision, allocatable :: abs_psi_coef_max (N_states)
double precision, allocatable :: abs_psi_coef_min (N_states)
Max and min values of the coefficients
Needs:
.. hlist ::
:columns: 3
* :c:data: `mpi_master`
* :c:data: `n_states`
* :c:data: `psi_coef`
.. c:var :: abs_psi_coef_min
File : :file: `determinants/determinants.irp.f`
.. code :: fortran
double precision, allocatable :: psi_coef_max (N_states)
double precision, allocatable :: psi_coef_min (N_states)
double precision, allocatable :: abs_psi_coef_max (N_states)
double precision, allocatable :: abs_psi_coef_min (N_states)
Max and min values of the coefficients
Needs:
.. hlist ::
:columns: 3
* :c:data: `mpi_master`
* :c:data: `n_states`
* :c:data: `psi_coef`
.. c:var :: barycentric_electronic_energy
File : :file: `determinants/energy.irp.f`
.. code :: fortran
double precision, allocatable :: barycentric_electronic_energy (N_states)
:math: `E_n = \sum_i {c_i^{(n)}}^2 H_{ii}`
Needs:
.. hlist ::
:columns: 3
* :c:data: `diagonal_h_matrix_on_psi_det`
* :c:data: `n_det`
* :c:data: `n_states`
* :c:data: `psi_coef`
.. c:var :: c0_weight
File : :file: `determinants/density_matrix.irp.f`
.. code :: fortran
double precision, allocatable :: c0_weight (N_states)
Weight of the states in the selection : :math: `\frac{1}{c_0^2}` .
Needs:
.. hlist ::
:columns: 3
* :c:data: `n_states`
* :c:data: `psi_coef`
Needed by:
.. hlist ::
:columns: 3
* :c:data: `state_average_weight`
.. c:var :: det_alpha_norm
File : :file: `determinants/spindeterminants.irp.f`
.. code :: fortran
double precision, allocatable :: det_alpha_norm (N_det_alpha_unique)
double precision, allocatable :: det_beta_norm (N_det_beta_unique)
Norm of the :math: `\alpha` and :math: `\beta` spin determinants in the wave function:
:math: `||D_\alpha||_i = \sum_j C_{ij}^2`
Needs:
.. hlist ::
:columns: 3
* :c:data: `n_det`
* :c:data: `n_states`
* :c:data: `psi_bilinear_matrix_values`
* :c:data: `psi_det_alpha_unique`
* :c:data: `psi_det_beta_unique`
* :c:data: `state_average_weight`
.. c:var :: det_beta_norm
File : :file: `determinants/spindeterminants.irp.f`
.. code :: fortran
double precision, allocatable :: det_alpha_norm (N_det_alpha_unique)
double precision, allocatable :: det_beta_norm (N_det_beta_unique)
Norm of the :math: `\alpha` and :math: `\beta` spin determinants in the wave function:
:math: `||D_\alpha||_i = \sum_j C_{ij}^2`
Needs:
.. hlist ::
:columns: 3
* :c:data: `n_det`
* :c:data: `n_states`
* :c:data: `psi_bilinear_matrix_values`
* :c:data: `psi_det_alpha_unique`
* :c:data: `psi_det_beta_unique`
* :c:data: `state_average_weight`
.. c:var :: det_to_occ_pattern
File : :file: `determinants/occ_pattern.irp.f`
.. code :: fortran
integer, allocatable :: det_to_occ_pattern (N_det)
Returns the index of the occupation pattern for each determinant
Needs:
.. hlist ::
:columns: 3
* :c:data: `elec_alpha_num`
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `psi_det`
* :c:data: `psi_occ_pattern`
Needed by:
.. hlist ::
:columns: 3
2020-12-06 22:58:30 +01:00
* :c:data: `pruned`
2019-03-07 16:29:06 +01:00
* :c:data: `psi_occ_pattern_hii`
* :c:data: `weight_occ_pattern`
2020-12-06 22:58:30 +01:00
* :c:data: `weight_occ_pattern_average`
2019-03-07 16:29:06 +01:00
.. c:var :: diagonal_h_matrix_on_psi_det
File : :file: `determinants/energy.irp.f`
.. code :: fortran
double precision, allocatable :: diagonal_h_matrix_on_psi_det (N_det)
Diagonal of the Hamiltonian ordered as psi_det
Needs:
.. hlist ::
:columns: 3
2020-12-06 22:58:30 +01:00
* :c:data: `elec_alpha_num`
* :c:data: `elec_beta_num`
2019-03-07 16:29:06 +01:00
* :c:data: `elec_num`
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `psi_det`
* :c:data: `ref_bitmask`
* :c:data: `ref_bitmask_energy`
Needed by:
.. hlist ::
:columns: 3
* :c:data: `barycentric_electronic_energy`
.. c:var :: double_exc_bitmask
File : :file: `determinants/determinants_bitmasks.irp.f`
.. code :: fortran
integer(bit_kind), allocatable :: double_exc_bitmask (N_int,4,N_double_exc_bitmasks)
double_exc_bitmask(:,1,i) is the bitmask for holes of excitation 1
double_exc_bitmask(:,2,i) is the bitmask for particles of excitation 1
double_exc_bitmask(:,3,i) is the bitmask for holes of excitation 2
double_exc_bitmask(:,4,i) is the bitmask for particles of excitation 2
for a given couple of hole/particle excitations i.
Needs:
.. hlist ::
:columns: 3
* :c:data: `hf_bitmask`
* :c:data: `n_double_exc_bitmasks`
* :c:data: `n_int`
.. c:var :: expected_s2
File : :file: `determinants/s2.irp.f`
.. code :: fortran
double precision :: expected_s2
Expected value of |S^2| : S*(S+1)
Needs:
.. hlist ::
:columns: 3
* :c:data: `elec_alpha_num`
* :c:data: `elec_beta_num`
Needed by:
.. hlist ::
:columns: 3
* :c:data: `ci_electronic_energy`
.. c:var :: fock_operator_closed_shell_ref_bitmask
File : :file: `determinants/single_excitations.irp.f`
.. code :: fortran
double precision, allocatable :: fock_operator_closed_shell_ref_bitmask (mo_num,mo_num)
Needs:
.. hlist ::
:columns: 3
* :c:data: `full_ijkl_bitmask`
* :c:data: `mo_integrals_map`
* :c:data: `mo_num`
* :c:data: `mo_one_e_integrals`
* :c:data: `mo_two_e_integrals_in_map`
* :c:data: `n_int`
* :c:data: `ref_closed_shell_bitmask`
.. c:var :: fock_wee_closed_shell
File : :file: `determinants/single_excitation_two_e.irp.f`
.. code :: fortran
double precision, allocatable :: fock_wee_closed_shell (mo_num,mo_num)
Needs:
.. hlist ::
:columns: 3
* :c:data: `full_ijkl_bitmask`
* :c:data: `mo_integrals_map`
* :c:data: `mo_num`
* :c:data: `mo_two_e_integrals_in_map`
* :c:data: `n_int`
* :c:data: `ref_closed_shell_bitmask`
.. c:var :: h_apply_buffer_allocated
File : :file: `determinants/h_apply.irp.f`
.. code :: fortran
logical :: h_apply_buffer_allocated
integer(omp_lock_kind), allocatable :: h_apply_buffer_lock (64,0:nproc-1)
Buffer of determinants/coefficients/perturbative energy for H_apply.
Uninitialized. Filled by H_apply subroutines.
Needs:
.. hlist ::
:columns: 3
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `n_states`
* :c:data: `nproc`
.. c:var :: h_apply_buffer_lock
File : :file: `determinants/h_apply.irp.f`
.. code :: fortran
logical :: h_apply_buffer_allocated
integer(omp_lock_kind), allocatable :: h_apply_buffer_lock (64,0:nproc-1)
Buffer of determinants/coefficients/perturbative energy for H_apply.
Uninitialized. Filled by H_apply subroutines.
Needs:
.. hlist ::
:columns: 3
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `n_states`
* :c:data: `nproc`
.. c:var :: h_matrix_all_dets
File : :file: `determinants/utils.irp.f`
.. code :: fortran
double precision, allocatable :: h_matrix_all_dets (N_det,N_det)
|H| matrix on the basis of the Slater determinants defined by psi_det
Needs:
.. hlist ::
:columns: 3
* :c:data: `big_array_coulomb_integrals`
* :c:data: `big_array_coulomb_integrals`
2020-12-06 22:58:30 +01:00
* :c:data: `elec_alpha_num`
* :c:data: `elec_beta_num`
2019-03-07 16:29:06 +01:00
* :c:data: `mo_integrals_map`
* :c:data: `mo_two_e_integrals_in_map`
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `psi_det`
Needed by:
.. hlist ::
:columns: 3
* :c:data: `ci_electronic_energy`
* :c:data: `psi_energy`
.. c:var :: h_matrix_cas
File : :file: `determinants/psi_cas.irp.f`
.. code :: fortran
double precision, allocatable :: h_matrix_cas (N_det_cas,N_det_cas)
Needs:
.. hlist ::
:columns: 3
* :c:data: `big_array_coulomb_integrals`
* :c:data: `big_array_coulomb_integrals`
2020-12-06 22:58:30 +01:00
* :c:data: `elec_alpha_num`
* :c:data: `elec_beta_num`
2019-03-07 16:29:06 +01:00
* :c:data: `mo_integrals_map`
* :c:data: `mo_two_e_integrals_in_map`
* :c:data: `n_int`
* :c:data: `psi_cas`
Needed by:
.. hlist ::
:columns: 3
* :c:data: `psi_cas_energy`
* :c:data: `psi_coef_cas_diagonalized`
.. c:var :: idx_cas
File : :file: `determinants/psi_cas.irp.f`
.. code :: fortran
integer(bit_kind), allocatable :: psi_cas (N_int,2,psi_det_size)
double precision, allocatable :: psi_cas_coef (psi_det_size,n_states)
integer, allocatable :: idx_cas (psi_det_size)
integer :: n_det_cas
|CAS| wave function, defined from the application of the |CAS| bitmask on the
determinants. idx_cas gives the indice of the |CAS| determinant in psi_det.
Needs:
.. hlist ::
:columns: 3
2020-12-06 22:58:30 +01:00
* :c:data: `act_bitmask`
2019-03-07 16:29:06 +01:00
* :c:data: `hf_bitmask`
* :c:data: `mpi_master`
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `n_states`
* :c:data: `psi_coef`
* :c:data: `psi_det`
* :c:data: `psi_det_size`
Needed by:
.. hlist ::
:columns: 3
* :c:data: `h_matrix_cas`
* :c:data: `psi_cas_energy`
* :c:data: `psi_cas_sorted_bit`
* :c:data: `psi_coef_cas_diagonalized`
* :c:data: `psi_non_cas`
* :c:data: `psi_non_cas_sorted_bit`
.. c:var :: idx_non_cas
File : :file: `determinants/psi_cas.irp.f`
.. code :: fortran
integer(bit_kind), allocatable :: psi_non_cas (N_int,2,psi_det_size)
double precision, allocatable :: psi_non_cas_coef (psi_det_size,n_states)
integer, allocatable :: idx_non_cas (psi_det_size)
integer :: n_det_non_cas
Set of determinants which are not part of the |CAS|, defined from the application
of the |CAS| bitmask on the determinants.
idx_non_cas gives the indice of the determinant in psi_det.
Needs:
.. hlist ::
:columns: 3
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `n_states`
* :c:data: `psi_cas`
* :c:data: `psi_coef`
* :c:data: `psi_det`
* :c:data: `psi_det_size`
Needed by:
.. hlist ::
:columns: 3
* :c:data: `psi_non_cas_sorted_bit`
.. c:var :: max_degree_exc
File : :file: `determinants/determinants.irp.f`
.. code :: fortran
integer :: max_degree_exc
Maximum degree of excitation in the wave function with respect to the Hartree-Fock
determinant.
Needs:
.. hlist ::
:columns: 3
* :c:data: `hf_bitmask`
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `psi_det`
.. c:var :: n_det
File : :file: `determinants/determinants.irp.f`
.. code :: fortran
integer :: n_det
Number of determinants in the wave function
Needs:
.. hlist ::
:columns: 3
* :c:data: `ezfio_filename`
* :c:data: `mo_label`
* :c:data: `mpi_master`
* :c:data: `nproc`
* :c:data: `read_wf`
Needed by:
.. hlist ::
:columns: 3
2020-12-06 22:58:30 +01:00
* :c:data: `act_2_rdm_aa_mo`
* :c:data: `act_2_rdm_ab_mo`
* :c:data: `act_2_rdm_bb_mo`
* :c:data: `act_2_rdm_spin_trace_mo`
2019-03-07 16:29:06 +01:00
* :c:data: `barycentric_electronic_energy`
* :c:data: `ci_electronic_energy`
* :c:data: `ci_energy`
* :c:data: `det_alpha_norm`
* :c:data: `det_to_occ_pattern`
* :c:data: `diag_algorithm`
* :c:data: `diagonal_h_matrix_on_psi_det`
* :c:data: `dressed_column_idx`
* :c:data: `dressing_column_h`
* :c:data: `h_apply_buffer_allocated`
* :c:data: `h_matrix_all_dets`
* :c:data: `max_degree_exc`
2020-12-06 22:58:30 +01:00
* :c:data: `n_det_qp_edit`
2019-03-07 16:29:06 +01:00
* :c:data: `one_e_dm_mo_alpha`
2020-12-06 22:58:30 +01:00
* :c:data: `pruned`
2019-03-07 16:29:06 +01:00
* :c:data: `psi_average_norm_contrib`
* :c:data: `psi_bilinear_matrix`
* :c:data: `psi_bilinear_matrix_columns_loc`
* :c:data: `psi_bilinear_matrix_order_reverse`
* :c:data: `psi_bilinear_matrix_order_transp_reverse`
* :c:data: `psi_bilinear_matrix_transp_rows_loc`
* :c:data: `psi_bilinear_matrix_transp_values`
* :c:data: `psi_bilinear_matrix_values`
* :c:data: `psi_cas`
* :c:data: `psi_coef`
* :c:data: `psi_det`
* :c:data: `psi_det_alpha`
* :c:data: `psi_det_alpha_unique`
* :c:data: `psi_det_beta`
* :c:data: `psi_det_beta_unique`
* :c:data: `psi_det_hii`
* :c:data: `psi_det_sorted`
* :c:data: `psi_det_sorted_bit`
* :c:data: `psi_energy`
* :c:data: `psi_energy_two_e`
* :c:data: `psi_non_cas`
* :c:data: `psi_occ_pattern`
* :c:data: `psi_occ_pattern_hii`
* :c:data: `s2_matrix_all_dets`
* :c:data: `s2_values`
2020-12-06 22:58:30 +01:00
* :c:data: `state_av_act_2_rdm_aa_mo`
* :c:data: `state_av_act_2_rdm_ab_mo`
* :c:data: `state_av_act_2_rdm_bb_mo`
* :c:data: `state_av_act_2_rdm_spin_trace_mo`
2019-03-07 16:29:06 +01:00
* :c:data: `weight_occ_pattern`
2020-12-06 22:58:30 +01:00
* :c:data: `weight_occ_pattern_average`
2019-03-07 16:29:06 +01:00
.. c:var :: n_det_alpha_unique
File : :file: `determinants/spindeterminants.irp.f_template_144`
.. code :: fortran
integer(bit_kind), allocatable :: psi_det_alpha_unique (N_int,psi_det_size)
integer :: n_det_alpha_unique
Unique :math: `\alpha` determinants
Needs:
.. hlist ::
:columns: 3
* :c:data: `mpi_master`
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `psi_det_alpha`
* :c:data: `psi_det_size`
Needed by:
.. hlist ::
:columns: 3
* :c:data: `det_alpha_norm`
* :c:data: `one_e_dm_mo_alpha`
* :c:data: `psi_bilinear_matrix`
* :c:data: `psi_bilinear_matrix_transp_rows_loc`
2020-12-06 22:58:30 +01:00
* :c:data: `psi_bilinear_matrix_transp_values`
2019-03-07 16:29:06 +01:00
* :c:data: `psi_bilinear_matrix_values`
* :c:data: `singles_alpha_csc`
* :c:data: `singles_alpha_csc_idx`
.. c:var :: n_det_beta_unique
File : :file: `determinants/spindeterminants.irp.f_template_144`
.. code :: fortran
integer(bit_kind), allocatable :: psi_det_beta_unique (N_int,psi_det_size)
integer :: n_det_beta_unique
Unique :math: `\beta` determinants
Needs:
.. hlist ::
:columns: 3
* :c:data: `mpi_master`
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `psi_det_beta`
* :c:data: `psi_det_size`
Needed by:
.. hlist ::
:columns: 3
* :c:data: `det_alpha_norm`
* :c:data: `one_e_dm_mo_alpha`
* :c:data: `psi_bilinear_matrix`
* :c:data: `psi_bilinear_matrix_columns_loc`
* :c:data: `psi_bilinear_matrix_transp_values`
* :c:data: `psi_bilinear_matrix_values`
* :c:data: `singles_beta_csc`
* :c:data: `singles_beta_csc_idx`
.. c:var :: n_det_cas
File : :file: `determinants/psi_cas.irp.f`
.. code :: fortran
integer(bit_kind), allocatable :: psi_cas (N_int,2,psi_det_size)
double precision, allocatable :: psi_cas_coef (psi_det_size,n_states)
integer, allocatable :: idx_cas (psi_det_size)
integer :: n_det_cas
|CAS| wave function, defined from the application of the |CAS| bitmask on the
determinants. idx_cas gives the indice of the |CAS| determinant in psi_det.
Needs:
.. hlist ::
:columns: 3
2020-12-06 22:58:30 +01:00
* :c:data: `act_bitmask`
2019-03-07 16:29:06 +01:00
* :c:data: `hf_bitmask`
* :c:data: `mpi_master`
* :c:data: `n_det`
* :c:data: `n_int`
* :c:data: `n_states`
* :c:data: `psi_coef`
* :c:data: `psi_det`