10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-09 07:33:40 +01:00
QCaml/Basis/ERI.ml

56 lines
1.5 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.);
2020-03-26 16:24:41 +01:00
let expo_pq = 1. /. expo_pq_inv in
2019-03-12 14:07:59 +01:00
let t =
if z.norm_pq_sq > integrals_cutoff then
2020-03-26 16:24:41 +01:00
z.norm_pq_sq *. expo_pq
2019-03-12 14:07:59 +01:00
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;
2020-03-26 16:24:41 +01:00
let new_accu = -. accu *. expo_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
2020-03-26 16:24:41 +01:00
let f = two_over_sq_pi *. (sqrt expo_pq) in
aux f 0 maxm;
result
2018-06-01 14:42:47 +02:00
2020-05-08 01:12:31 +02:00
let class_of_contracted_shell_pair_couple ~basis shell_pair_couple =
2019-10-24 11:25:49 +02:00
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
2020-05-08 01:12:31 +02:00
~basis ~zero_m shell_pair_couple
2019-10-24 11:25:49 +02:00
else
TwoElectronRRVectorized.contracted_class_shell_pairs
2020-05-08 01:12:31 +02:00
~basis ~zero_m shell_p shell_q
2019-10-24 11:25:49 +02:00
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