2018-01-22 23:19:24 +01:00
|
|
|
open Util
|
2018-02-03 23:26:20 +01:00
|
|
|
open Constants
|
2018-01-22 23:19:24 +01:00
|
|
|
|
|
|
|
(** Computes all the overlap integrals of the contracted shell pair *)
|
2018-01-23 00:48:45 +01:00
|
|
|
let contracted_class shell_a shell_b : float Zmap.t =
|
2018-01-22 23:19:24 +01:00
|
|
|
|
|
|
|
let shell_p =
|
2018-02-06 17:39:14 +01:00
|
|
|
Shell_pair.create_array shell_a shell_b
|
2018-01-22 23:19:24 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
(* Pre-computation of integral class indices *)
|
|
|
|
let class_indices =
|
|
|
|
Angular_momentum.zkey_array (Angular_momentum.Doublet
|
2018-02-06 17:39:14 +01:00
|
|
|
Contracted_shell.(totAngMom shell_a, totAngMom shell_b))
|
2018-01-22 23:19:24 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
let contracted_class =
|
|
|
|
Array.make (Array.length class_indices) 0.
|
|
|
|
in
|
|
|
|
|
|
|
|
(* Compute all integrals in the shell for each pair of significant shell pairs *)
|
|
|
|
|
|
|
|
for ab=0 to (Array.length shell_p - 1)
|
|
|
|
do
|
2018-02-06 17:39:14 +01:00
|
|
|
let coef_prod =
|
|
|
|
shell_p.(ab).Shell_pair.coef
|
|
|
|
in
|
|
|
|
(** Screening on thr product of coefficients *)
|
|
|
|
if (abs_float coef_prod) > 1.e-4*.cutoff then
|
|
|
|
begin
|
|
|
|
let center_ab =
|
|
|
|
shell_p.(ab).Shell_pair.center_ab
|
|
|
|
in
|
|
|
|
let center_pa =
|
|
|
|
shell_p.(ab).Shell_pair.center_a
|
|
|
|
in
|
|
|
|
let expo_inv =
|
|
|
|
shell_p.(ab).Shell_pair.expo_inv
|
|
|
|
in
|
|
|
|
let norm_coef_scale =
|
|
|
|
shell_p.(ab).Shell_pair.norm_coef_scale
|
|
|
|
in
|
|
|
|
|
|
|
|
Array.iteri (fun i key ->
|
|
|
|
let (angMomA,angMomB) =
|
|
|
|
let a = Zkey.to_int_array Zkey.Kind_6 key in
|
|
|
|
( [| a.(0) ; a.(1) ; a.(2) |],
|
|
|
|
[| a.(3) ; a.(4) ; a.(5) |] )
|
2018-01-22 23:19:24 +01:00
|
|
|
in
|
2018-02-06 17:39:14 +01:00
|
|
|
let f k =
|
|
|
|
Overlap_primitives.hvrr (angMomA.(k), angMomB.(k))
|
|
|
|
expo_inv
|
|
|
|
(Coordinate.coord center_ab k,
|
|
|
|
Coordinate.coord center_pa k)
|
2018-01-22 23:19:24 +01:00
|
|
|
in
|
2018-02-06 17:39:14 +01:00
|
|
|
let norm = norm_coef_scale.(i) in
|
|
|
|
let integral = chop norm (fun () -> (f 0)*.(f 1)*.(f 2)) in
|
|
|
|
contracted_class.(i) <- contracted_class.(i) +. coef_prod *. integral
|
|
|
|
) class_indices
|
|
|
|
end
|
2018-01-22 23:19:24 +01:00
|
|
|
done;
|
|
|
|
let result =
|
|
|
|
Zmap.create (Array.length contracted_class)
|
|
|
|
in
|
|
|
|
Array.iteri (fun i key -> Zmap.add result key contracted_class.(i)) class_indices;
|
|
|
|
result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(** Write all overlap integrals to a file *)
|
|
|
|
let to_file ~filename basis =
|
|
|
|
let to_int_tuple x =
|
|
|
|
let open Zkey in
|
|
|
|
match to_int_tuple Kind_3 x with
|
|
|
|
| Three x -> x
|
|
|
|
| _ -> assert false
|
|
|
|
in
|
|
|
|
|
|
|
|
let oc = open_out filename in
|
|
|
|
for i=0 to (Array.length basis) - 1 do
|
2018-02-06 18:12:19 +01:00
|
|
|
print_int (Contracted_shell.index basis.(i)) ; print_newline ();
|
2018-01-22 23:19:24 +01:00
|
|
|
for j=0 to i do
|
|
|
|
(* Compute all the integrals of the class *)
|
|
|
|
let cls =
|
|
|
|
contracted_class basis.(i) basis.(j)
|
|
|
|
in
|
|
|
|
|
|
|
|
(* Write the data in the output file *)
|
|
|
|
Array.iteri (fun i_c powers_i ->
|
2018-02-06 18:12:19 +01:00
|
|
|
let i_c = Contracted_shell.index basis.(i) + i_c + 1 in
|
2018-01-22 23:19:24 +01:00
|
|
|
let xi = to_int_tuple powers_i in
|
|
|
|
Array.iteri (fun j_c powers_j ->
|
2018-02-06 18:12:19 +01:00
|
|
|
let j_c = Contracted_shell.index basis.(j) + j_c + 1 in
|
2018-01-22 23:19:24 +01:00
|
|
|
let xj = to_int_tuple powers_j in
|
|
|
|
let key =
|
|
|
|
Zkey.of_int_tuple (Zkey.Six (xi,xj))
|
|
|
|
in
|
|
|
|
let value =
|
|
|
|
try
|
|
|
|
Zmap.find cls key
|
|
|
|
with Not_found -> failwith "Bug in overlap integrals"
|
|
|
|
in
|
|
|
|
if (abs_float value > cutoff) then
|
|
|
|
Printf.fprintf oc "%4d %4d %20.12e\n"
|
|
|
|
i_c j_c value
|
2018-02-06 18:12:19 +01:00
|
|
|
) (Contracted_shell.powers basis.(j))
|
|
|
|
) (Contracted_shell.powers basis.(i));
|
2018-01-22 23:19:24 +01:00
|
|
|
done;
|
|
|
|
done;
|
|
|
|
close_out oc
|
|
|
|
|