10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-19 12:32:21 +01:00
QCaml/Basis/ERI.ml

56 lines
1.4 KiB
OCaml
Raw Normal View History

2018-01-19 03:14:06 +01:00
(** Electron-electron repulsion integrals *)
2018-02-02 01:25:10 +01:00
open Constants
open Util
2018-03-26 19:15:09 +02:00
2019-10-24 11:25:49 +02:00
module Csp = ContractedShellPair
module Cspc = ContractedShellPairCouple
2019-03-12 14:07:59 +01:00
2019-10-24 11:25:49 +02:00
module T = struct
2018-06-01 14:42:47 +02:00
let name = "Electron repulsion integrals"
2018-10-23 13:39:06 +02:00
2019-03-12 14:07:59 +01:00
open Zero_m_parameters
let zero_m z =
let expo_pq_inv = z.expo_p_inv +. z.expo_q_inv in
assert (expo_pq_inv <> 0.);
let exp_pq = 1. /. expo_pq_inv in
2019-03-12 14:07:59 +01:00
let t =
if z.norm_pq_sq > integrals_cutoff then
z.norm_pq_sq *. exp_pq
else 0.
in
let maxm = z.maxm in
let result = boys_function ~maxm t in
let rec aux accu k = function
| 0 -> result.(k) <- result.(k) *. accu
| l ->
begin
result.(k) <- result.(k) *. accu;
let new_accu = -. accu *. exp_pq in
2019-09-10 18:39:14 +02:00
(aux [@tailcall]) new_accu (k+1) (l-1)
end
2018-06-01 14:42:47 +02:00
in
2019-03-12 14:07:59 +01:00
let f = two_over_sq_pi *. (sqrt exp_pq) in
aux f 0 maxm;
result
2018-06-01 14:42:47 +02:00
2019-10-24 11:25:49 +02:00
let class_of_contracted_shell_pair_couple shell_pair_couple =
let shell_p = Cspc.shell_pair_p shell_pair_couple
and shell_q = Cspc.shell_pair_q shell_pair_couple
in
if Array.length (Csp.shell_pairs shell_p) +
(Array.length (Csp.shell_pairs shell_q)) < 4 then
TwoElectronRR.contracted_class_shell_pair_couple
~zero_m shell_pair_couple
else
TwoElectronRRVectorized.contracted_class_shell_pairs
~zero_m shell_p shell_q
end
2018-10-23 13:39:06 +02:00
2019-10-24 11:25:49 +02:00
module M = TwoElectronIntegrals.Make(T)
include M
2018-02-02 10:10:05 +01:00