10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-22 04:13:33 +01:00

Introducing unique shell pairs

This commit is contained in:
Anthony Scemama 2018-02-07 13:33:25 +01:00
parent 5b4d49773d
commit d7c3c9f6b7
3 changed files with 29 additions and 19 deletions

View File

@ -1,17 +1,5 @@
type t
(*
type t = {
expo : float array;
coef : float array;
center : Coordinate.t;
totAngMom : Angular_momentum.t;
size : int;
norm_coef : float array;
norm_coef_scale : float array;
indice : int;
powers : Zkey.t array;
}
*)
(** Returns the number of contracted Gaussians *)
val size : t -> int

View File

@ -72,11 +72,7 @@ let to_file ~filename basis =
(* Pre-compute all shell pairs *)
let shell_pairs =
Array.mapi (fun i shell_a -> Array.map (fun shell_b ->
(*
Shell_pair.create_array shell_a shell_b) (Array.sub basis 0 (i+1)) ) basis
*)
Shell_pair.create_array shell_a shell_b) (basis) ) basis
Shell_pair.shell_pairs basis
in
Printf.printf "%d shells\n" (Array.length basis);
@ -128,6 +124,11 @@ let to_file ~filename basis =
let
shell_p = shell_pairs.(i).(j)
in
(*
Printf.printf "%d %d : " i j;
Array.iter (fun i -> Printf.printf "%d " (Shell_pair.hash i)) shell_p;
print_newline ();
*)
for k=0 to i do
for l=0 to k do

View File

@ -103,5 +103,26 @@ let create_array ?cutoff p_a p_b =
|> List.map (function Some x -> x | None -> assert false)
|> Array.of_list
open Util
let hash a =
Hashtbl.hash (a.expo, a.center_a, a.center_ab, a.coef)
let cmp a b =
hash a - hash b
let shell_pairs basis =
Array.mapi (fun i shell_a -> Array.map (fun shell_b ->
create_array shell_a shell_b) (Array.sub basis 0 (i+1)) ) basis
let unique_shell_pairs basis =
let map =
Hashtbl.create 129
in
Array.iter (fun spa ->
Array.iter (fun value ->
let key = hash value in
Hashtbl.add map key value) spa) basis;
map