10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-23 04:43:32 +01:00
QCaml/gaussian_integrals/lib/eri.ml

59 lines
1.6 KiB
OCaml
Raw Normal View History

2020-09-27 23:55:42 +02:00
(** Electron-electron repulsion integrals *)
2024-01-17 10:30:24 +01:00
[@@@landmark "auto-off"]
2020-10-09 09:47:57 +02:00
open Common
2020-10-10 10:59:09 +02:00
open Gaussian
2020-09-27 23:55:42 +02:00
module Csp = Contracted_shell_pair
module Cspc = Contracted_shell_pair_couple
module T = struct
let name = "Electron repulsion integrals"
open Zero_m_parameters
2024-01-17 10:30:24 +01:00
let rec aux_zero_m result expo_pq accu k = function
| 0 -> result.(k) <- result.(k) *. accu
| l ->
begin
result.(k) <- result.(k) *. accu;
let new_accu = -. accu *. expo_pq in
(aux_zero_m [@tailcall]) result expo_pq new_accu (k+1) (l-1)
end
let[@landmark] zero_m z =
2020-09-27 23:55:42 +02:00
let expo_pq_inv = z.expo_p_inv +. z.expo_q_inv in
assert (expo_pq_inv <> 0.);
let expo_pq = 1. /. expo_pq_inv in
let t =
if z.norm_pq_sq > Constants.integrals_cutoff then
z.norm_pq_sq *. expo_pq
else 0.
in
let maxm = z.maxm in
let result = Util.boys_function ~maxm t in
let f = Constants.two_over_sq_pi *. (sqrt expo_pq) in
2024-01-17 10:30:24 +01:00
aux_zero_m result expo_pq f 0 maxm;
2020-09-27 23:55:42 +02:00
result
2024-01-17 10:30:24 +01:00
let[@landmark] class_of_contracted_shell_pair_couple ?operator shell_pair_couple =
2020-09-27 23:55:42 +02:00
assert (operator = None);
let shell_p = Cspc.shell_pair_p shell_pair_couple
2024-01-17 10:30:24 +01:00
and shell_q = Cspc.shell_pair_q shell_pair_couple
2020-09-27 23:55:42 +02:00
in
if Array.length (Csp.shell_pairs shell_p) +
(Array.length (Csp.shell_pairs shell_q)) < 4 then
Two_electron_rr.contracted_class_shell_pair_couple
~zero_m shell_pair_couple
else
Two_electron_rr_vectorized.contracted_class_shell_pairs
~zero_m shell_p shell_q
end
2024-01-17 10:30:24 +01:00
module M = Two_electron_integrals.Make(T)
2020-09-27 23:55:42 +02:00
include M