# mo_two_e_erf_ints

Here, all two-electron integrals (\(erf({\mu}_{erf} * r_{12})/r_{12}\)) are computed. As they have 4 indices and many are zero, they are stored in a map, as defined in `Utils/map_module.f90`.

The range separation parameter \({\mu}_{erf}\) is the variable `ao_two_e_erf_ints mu_erf`.

To fetch an MO integral, use `get_mo_two_e_integral_erf(i,j,k,l,mo_integrals_map_erf)`

The conventions are:

- For MO integrals : <ij|kl> = <12|12>

Be aware that it might not be the same conventions for MO and AO integrals.

## EZFIO parameters

`io_mo_two_e_integrals_erf```

  Read/Write MO integrals with the long range interaction from/to disk [ Write | Read | None ]

  Default: None

## Providers

`core_energy_erf`

  File : `mo_two_e_erf_ints/core_quantities_erf.irp.f`

      double precision        :: core_energy_erf

  energy from the core : contains all core-core contributionswith the erf interaction

  Needs:

  `list_inact` `mo_one_e_integrals` | `mo_two_e_int_erf_jj` `n_core_orb` | `nuclear_repulsion`

`core_fock_operator_erf`

  File : `mo_two_e_erf_ints/core_quantities_erf.irp.f`

      double precision, allocatable   :: core_fock_operator_erf       (mo_num,mo_num)

  this is the contribution to the Fock operator from the core electrons with the erf interaction

  Needs:

  `list_inact` `mo_integrals_erf_cache` `mo_integrals_erf_cache_min` | `mo_integrals_erf_map` `mo_num` | `mo_two_e_integrals_erf_in_map` `n_core_orb`

`insert_into_mo_integrals_erf_map:`()

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

        subroutine insert_into_mo_integrals_erf_map(n_integrals,                 &
      buffer_i, buffer_values, thr)

  Create new entry into MO map, or accumulate in an existing entry

  Needs:

  `mo_integrals_erf_map` |  |

  Called by:

  `add_integrals_to_map_erf()` |  |

  Calls:

  `map_update()` |  |

`int_erf_3_index`

  File : `mo_two_e_erf_ints/ints_erf_3_index.irp.f`

      double precision, allocatable   :: int_erf_3_index      (mo_num,mo_num,mo_num)
      double precision, allocatable   :: int_erf_3_index_exc  (mo_num,mo_num,mo_num)

  int_erf_3_index(i,j) = <ij|ij> = (ii|jj) with the erf interaction

  int_erf_3_index_exc(i,j) = <ij|ji> = (ij|ij) with the erf interaction

  Needs:

  `mo_integrals_erf_cache` `mo_integrals_erf_cache_min` | `mo_integrals_erf_map` `mo_num` | `mo_two_e_integrals_erf_in_map`

`int_erf_3_index_exc`

  File : `mo_two_e_erf_ints/ints_erf_3_index.irp.f`

      double precision, allocatable   :: int_erf_3_index      (mo_num,mo_num,mo_num)
      double precision, allocatable   :: int_erf_3_index_exc  (mo_num,mo_num,mo_num)

  int_erf_3_index(i,j) = <ij|ij> = (ii|jj) with the erf interaction

  int_erf_3_index_exc(i,j) = <ij|ji> = (ij|ij) with the erf interaction

  Needs:

  `mo_integrals_erf_cache` `mo_integrals_erf_cache_min` | `mo_integrals_erf_map` `mo_num` | `mo_two_e_integrals_erf_in_map`

`mo_integrals_erf_cache`

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      double precision, allocatable   :: mo_integrals_erf_cache       (0:64*64*64*64)

  Cache of MO integrals for fast access

  Needs:

  `mo_integrals_erf_cache_min` | `mo_integrals_erf_map` | `mo_two_e_integrals_erf_in_map`

  Needed by:

  `core_fock_operator_erf` | `int_erf_3_index` | `mo_two_e_int_erf_jj`

`mo_integrals_erf_cache_max`

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      integer :: mo_integrals_erf_cache_min
      integer :: mo_integrals_erf_cache_max

  Min and max values of the MOs for which the integrals are in the cache

  Needs:

  `elec_alpha_num` | `mo_num` |

  Needed by:

  `core_fock_operator_erf` `int_erf_3_index` | `mo_integrals_erf_cache` | `mo_two_e_int_erf_jj`

`mo_integrals_erf_cache_min`

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      integer :: mo_integrals_erf_cache_min
      integer :: mo_integrals_erf_cache_max

  Min and max values of the MOs for which the integrals are in the cache

  Needs:

  `elec_alpha_num` | `mo_num` |

  Needed by:

  `core_fock_operator_erf` `int_erf_3_index` | `mo_integrals_erf_cache` | `mo_two_e_int_erf_jj`

`mo_integrals_erf_map`

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      type(map_type)  :: mo_integrals_erf_map

  MO integrals

  Needs:

  `mo_num` |  |

  Needed by:

  `core_fock_operator_erf` `int_erf_3_index` | `mo_integrals_erf_cache` `mo_two_e_int_erf_jj` | `mo_two_e_integrals_erf_in_map`

`mo_two_e_int_erf_jj`

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      double precision, allocatable   :: mo_two_e_int_erf_jj  (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_exchange (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_anti     (mo_num,mo_num)

  mo_two_e_integrals_jj(i,j) = J_ij mo_two_e_integrals_jj_exchange(i,j) = K_ij mo_two_e_integrals_jj_anti(i,j) = J_ij - K_ij

  Needs:

  `mo_integrals_erf_cache` `mo_integrals_erf_cache_min` | `mo_integrals_erf_map` `mo_num` | `mo_two_e_integrals_erf_in_map`

  Needed by:

  `core_energy_erf` |  |

`mo_two_e_int_erf_jj_anti`

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      double precision, allocatable   :: mo_two_e_int_erf_jj  (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_exchange (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_anti     (mo_num,mo_num)

  mo_two_e_integrals_jj(i,j) = J_ij mo_two_e_integrals_jj_exchange(i,j) = K_ij mo_two_e_integrals_jj_anti(i,j) = J_ij - K_ij

  Needs:

  `mo_integrals_erf_cache` `mo_integrals_erf_cache_min` | `mo_integrals_erf_map` `mo_num` | `mo_two_e_integrals_erf_in_map`

  Needed by:

  `core_energy_erf` |  |

`mo_two_e_int_erf_jj_anti_from_ao`

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      double precision, allocatable   :: mo_two_e_int_erf_jj_from_ao  (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_exchange_from_ao (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_anti_from_ao     (mo_num,mo_num)

  mo_two_e_integral_jj_from_ao(i,j) = J_ij mo_two_e_integrals_jj_exchange_from_ao(i,j) = J_ij mo_two_e_integrals_jj_anti_from_ao(i,j) = J_ij - K_ij

  Needs:

  `ao_integrals_erf_map` `ao_integrals_threshold` `ao_num` `ao_overlap_abs` | `ao_two_e_integral_erf_schwartz` `ao_two_e_integrals_erf_in_map` `do_direct_integrals` | `mo_coef` `mo_coef_transp` `mo_num`

`mo_two_e_int_erf_jj_exchange`

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      double precision, allocatable   :: mo_two_e_int_erf_jj  (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_exchange (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_anti     (mo_num,mo_num)

  mo_two_e_integrals_jj(i,j) = J_ij mo_two_e_integrals_jj_exchange(i,j) = K_ij mo_two_e_integrals_jj_anti(i,j) = J_ij - K_ij

  Needs:

  `mo_integrals_erf_cache` `mo_integrals_erf_cache_min` | `mo_integrals_erf_map` `mo_num` | `mo_two_e_integrals_erf_in_map`

  Needed by:

  `core_energy_erf` |  |

`mo_two_e_int_erf_jj_exchange_from_ao`

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      double precision, allocatable   :: mo_two_e_int_erf_jj_from_ao  (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_exchange_from_ao (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_anti_from_ao     (mo_num,mo_num)

  mo_two_e_integral_jj_from_ao(i,j) = J_ij mo_two_e_integrals_jj_exchange_from_ao(i,j) = J_ij mo_two_e_integrals_jj_anti_from_ao(i,j) = J_ij - K_ij

  Needs:

  `ao_integrals_erf_map` `ao_integrals_threshold` `ao_num` `ao_overlap_abs` | `ao_two_e_integral_erf_schwartz` `ao_two_e_integrals_erf_in_map` `do_direct_integrals` | `mo_coef` `mo_coef_transp` `mo_num`

`mo_two_e_int_erf_jj_from_ao`

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      double precision, allocatable   :: mo_two_e_int_erf_jj_from_ao  (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_exchange_from_ao (mo_num,mo_num)
      double precision, allocatable   :: mo_two_e_int_erf_jj_anti_from_ao     (mo_num,mo_num)

  mo_two_e_integral_jj_from_ao(i,j) = J_ij mo_two_e_integrals_jj_exchange_from_ao(i,j) = J_ij mo_two_e_integrals_jj_anti_from_ao(i,j) = J_ij - K_ij

  Needs:

  `ao_integrals_erf_map` `ao_integrals_threshold` `ao_num` `ao_overlap_abs` | `ao_two_e_integral_erf_schwartz` `ao_two_e_integrals_erf_in_map` `do_direct_integrals` | `mo_coef` `mo_coef_transp` `mo_num`

`mo_two_e_integrals_erf_in_map`

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      logical :: mo_two_e_integrals_erf_in_map

  If True, the map of MO two-electron integrals is provided

  Needs:

  `ao_num` `ao_two_e_integrals_erf_in_map` `ao_two_e_integrals_in_map` `ezfio_filename` | `full_ijkl_bitmask_4` `mo_coef` `mo_coef_transp` `mo_integrals_erf_map` | `mo_integrals_threshold` `mo_num` `n_int` `read_mo_two_e_integrals_erf`

  Needed by:

  `core_fock_operator_erf` `int_erf_3_index` | `mo_integrals_erf_cache` | `mo_two_e_int_erf_jj`

## Subroutines / functions

`add_integrals_to_map_erf:`()

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      subroutine add_integrals_to_map_erf(mask_ijkl)

  Adds integrals to tha MO map according to some bitmask

  Needs:

  `mo_coef` `mo_integrals_threshold` `mo_coef_transp` | `ao_num` `n_int` `mo_num` | `ao_two_e_integrals_in_map` `mo_integrals_erf_map`

  Called by:

  `mo_two_e_integrals_erf_in_map` |  |

  Calls:

  `bitstring_to_list()` `bitstring_to_str()` `cpu_time()` | `get_ao_two_e_integrals_erf()` `insert_into_mo_integrals_erf_map()` `map_merge()` | `mo_two_e_integrals_index()` `wall_time()`

`clear_mo_erf_map:`()

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      subroutine clear_mo_erf_map

  Frees the memory of the MO map

  Needs:

  `mo_integrals_erf_map` |  |

  Calls:

  `map_deinit()` |  |

`get_mo_erf_map_size:`()

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      integer*8 function get_mo_erf_map_size()

  Returns the number of elements in the MO map

  Needs:

  `mo_integrals_erf_map` |  |

`get_mo_two_e_integral_erf:`()

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      double precision function get_mo_two_e_integral_erf(i,j,k,l,map)

  Returns one integral $langle ij|kl rangle$ in the MO basis

  Needs:

  `mo_integrals_erf_cache` | `mo_integrals_erf_cache_min` | `mo_two_e_integrals_erf_in_map`

  Calls:

  `map_get()` | `two_e_integrals_index()` |

`get_mo_two_e_integrals_erf:`()

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      subroutine get_mo_two_e_integrals_erf(j,k,l,sze,out_val,map)

  Returns multiple integrals $langle ij|kl rangle$ in the MO basis, all i for j,k,l fixed.

  Needs:

  `mo_two_e_integrals_erf_in_map` |  |

  Calls:

  `map_get_many()` | `two_e_integrals_index()` |

`get_mo_two_e_integrals_erf_coulomb_ii:`()

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      subroutine get_mo_two_e_integrals_erf_coulomb_ii(k,l,sze,out_val,map)

  Returns multiple integrals $langle ki|li rangle$

  k(1)i(2) 1/r12 l(1)i(2) :: out_val(i1) for k,l fixed.

  Needs:

  `mo_two_e_integrals_erf_in_map` |  |

  Calls:

  `map_get_many()` | `two_e_integrals_index()` |

`get_mo_two_e_integrals_erf_exch_ii:`()

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      subroutine get_mo_two_e_integrals_erf_exch_ii(k,l,sze,out_val,map)

  Returns multiple integrals $langle ki|il rangle$

  $int k(1)i(2) frac{1}{r_{12}} i(1)l(2)$ :: out_val(i1) for k,l fixed.

  Needs:

  `mo_two_e_integrals_erf_in_map` |  |

  Calls:

  `map_get_many()` | `two_e_integrals_index()` |

`get_mo_two_e_integrals_erf_i1j1:`()

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      subroutine get_mo_two_e_integrals_erf_i1j1(k,l,sze,out_array,map)

  Returns multiple integrals $langle ik|jl rangle$ in the MO basis, all $int i(1)j(1) frac{erf(mu * r_{12})}{r_{12}} k(2)l(2)$ i, j for k,l fixed.

  Needs:

  `mo_two_e_integrals_erf_in_map` | `mo_integrals_erf_map` |

  Calls:

  `i2radix_sort()` `i8radix_sort()` | `iradix_sort()` `map_get_many()` | `two_e_integrals_index()`

`get_mo_two_e_integrals_erf_ij:`()

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      subroutine get_mo_two_e_integrals_erf_ij(k,l,sze,out_array,map)

  Returns multiple integrals $langle ij|kl rangle$ in the MO basis, all $int i(1)j(2) frac{1}{r_{12}} k(1)l(2)$ i, j for k,l fixed.

  Needs:

  `mo_two_e_integrals_erf_in_map` | `mo_integrals_erf_map` |

  Calls:

  `i2radix_sort()` `i8radix_sort()` | `iradix_sort()` `map_get_many()` | `two_e_integrals_index()`

`load_mo_integrals_erf:`()

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      integer function load_mo_integrals_erf(filename)

  Read from disk the MO erf integrals

  Needs:

  `mo_integrals_erf_map` |  |

  Calls:

  `cache_map_reallocate()` | `map_deinit()` | `map_sort()`

`mo_two_e_integral_erf:`()

  File : `mo_two_e_erf_ints/map_integrals_erf.irp.f`

      double precision function mo_two_e_integral_erf(i,j,k,l)

  Returns one integral $langle ij|kl rangle$ in the MO basis

  Needs:

  `mo_integrals_erf_cache` | `mo_integrals_erf_map` | `mo_two_e_integrals_erf_in_map`

`mo_two_e_integrals_erf_index:`()

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      subroutine mo_two_e_integrals_erf_index(i,j,k,l,i1)

  Computes an unique index for i,j,k,l integrals

`provide_all_mo_integrals_erf:`()

  File : `mo_two_e_erf_ints/mo_bi_integrals_erf.irp.f`

      subroutine provide_all_mo_integrals_erf

  Needs:

  `mo_two_e_integrals_erf_in_map` `mo_two_e_int_erf_jj` | `mo_two_e_int_erf_jj` `mo_integrals_erf_map` | `mo_two_e_int_erf_jj`

`save_erf_two_e_integrals_mo:`()

  File : `mo_two_e_erf_ints/routines_save_integrals_erf.irp.f`

      subroutine save_erf_two_e_integrals_mo

  Needs:

  `mo_two_e_integrals_erf_in_map` | `ezfio_filename` | `mo_integrals_erf_map`

  Called by:

  `routine()` |  |

  Calls:

  `ezfio_set_mo_two_e_erf_ints_io_mo_two_e_integrals_erf()` | `ezfio_set_work_empty()` | `map_save_to_disk()`

`save_erf_two_e_ints_mo_into_ints_mo:`()

  File : `mo_two_e_erf_ints/routines_save_integrals_erf.irp.f`

      subroutine save_erf_two_e_ints_mo_into_ints_mo

  Needs:

  `mo_two_e_integrals_erf_in_map` | `ezfio_filename` | `mo_integrals_erf_map`

  Calls:

  `ezfio_set_mo_two_e_ints_io_mo_two_e_integrals()` | `ezfio_set_work_empty()` | `map_save_to_disk()`