mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-12-22 04:13:33 +01:00
Cleaning
This commit is contained in:
parent
29d568a47b
commit
1ca670e4b7
195
Basis/ERI.ml
195
Basis/ERI.ml
@ -41,14 +41,6 @@ let zero_m ~maxm ~expo_pq_inv ~norm_pq_sq =
|
||||
result
|
||||
|
||||
|
||||
(** Compute all the integrals of a contracted class *)
|
||||
(*
|
||||
let contracted_class shell_a shell_b shell_c shell_d : float Zmap.t =
|
||||
TwoElectronRRVectorized.contracted_class ~zero_m shell_a shell_b shell_c shell_d
|
||||
*)
|
||||
let contracted_class shell_a shell_b shell_c shell_d : float Zmap.t =
|
||||
TwoElectronRR.contracted_class ~zero_m shell_a shell_b shell_c shell_d
|
||||
|
||||
(** Compute all the integrals of a contracted class *)
|
||||
let contracted_class_shell_pairs_vec ?schwartz_p ?schwartz_q shell_p shell_q : float Zmap.t =
|
||||
TwoElectronRRVectorized.contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
||||
@ -253,190 +245,3 @@ let to_file ~filename eri_array =
|
||||
done;
|
||||
close_out oc
|
||||
|
||||
(*
|
||||
|
||||
module IntegralMap = Zmap
|
||||
let index i j k l =
|
||||
Zkey.of_int_array Zkey.Kind_4 [| i;j;k;l |]
|
||||
|
||||
|
||||
module Key = struct
|
||||
type t=int
|
||||
let equal (x:int) (y:int) = x = y
|
||||
let hash (x:int) = x
|
||||
end
|
||||
module IntegralMap = Hashtbl.Make(Key)
|
||||
let index i j k l =
|
||||
let f i k =
|
||||
let (p,r) =
|
||||
if i <= k then (i,k) else (k,i)
|
||||
in p+ (r*r-r)/2
|
||||
in
|
||||
let p = f i k and q = f j l in
|
||||
f p q
|
||||
|
||||
|
||||
let to_file ~filename basis =
|
||||
let oc = open_out filename in
|
||||
let zkey = Array.map (fun b ->
|
||||
let result =
|
||||
Angular_momentum.(zkey_array (Kind_1 b.totAngMom))
|
||||
in
|
||||
{ n=Array.length result ; cls=result }
|
||||
) basis
|
||||
in
|
||||
|
||||
let key_array = Array.make 12 0 in
|
||||
let result = ref [] in
|
||||
|
||||
let i_shift = ref 1 in
|
||||
for i=0 to (Array.length basis) - 1 do
|
||||
print_int !i_shift ; print_newline ();
|
||||
let j_shift = ref 1 in
|
||||
for j=0 to i do
|
||||
let k_shift = ref 1 in
|
||||
for k=0 to i do
|
||||
let l_shift = ref 1 in
|
||||
for l=0 to k do
|
||||
let cls =
|
||||
contracted_class basis.(i) basis.(j) basis.(k) basis.(l)
|
||||
in
|
||||
|
||||
for i_c = 0 to zkey.(i).n - 1 do
|
||||
let x = Zkey.(to_int_array Kind_3 zkey.(i).cls.(i_c)) in
|
||||
key_array.(0) <- x.(0);
|
||||
key_array.(1) <- x.(1);
|
||||
key_array.(2) <- x.(2);
|
||||
for j_c = 0 to zkey.(j).n - 1 do
|
||||
let x = Zkey.(to_int_array Kind_3 zkey.(j).cls.(j_c)) in
|
||||
key_array.(3) <- x.(0);
|
||||
key_array.(4) <- x.(1);
|
||||
key_array.(5) <- x.(2);
|
||||
for k_c = 0 to zkey.(k).n - 1 do
|
||||
let x = Zkey.(to_int_array Kind_3 zkey.(k).cls.(k_c)) in
|
||||
key_array.(6) <- x.(0);
|
||||
key_array.(7) <- x.(1);
|
||||
key_array.(8) <- x.(2);
|
||||
for l_c = 0 to zkey.(l).n - 1 do
|
||||
let x = Zkey.(to_int_array Kind_3 zkey.(l).cls.(l_c)) in
|
||||
key_array.( 9) <- x.(0);
|
||||
key_array.(10) <- x.(1);
|
||||
key_array.(11) <- x.(2);
|
||||
let key =
|
||||
Zkey.(of_int_array Kind_12 key_array)
|
||||
in
|
||||
let value =
|
||||
Zmap.find cls key
|
||||
in
|
||||
if (abs_float value > cutoff) then
|
||||
let key =
|
||||
index (!i_shift+i_c) (!j_shift+j_c) (!k_shift+k_c) (!l_shift+l_c)
|
||||
in
|
||||
result := (key, value) :: !result
|
||||
done
|
||||
done
|
||||
done
|
||||
done;
|
||||
l_shift := !l_shift + zkey.(l).n
|
||||
done;
|
||||
k_shift := !k_shift + zkey.(k).n
|
||||
done;
|
||||
j_shift := !j_shift + zkey.(j).n
|
||||
done;
|
||||
i_shift := !i_shift + zkey.(i).n
|
||||
done
|
||||
;
|
||||
print_endline "Computation Done";
|
||||
|
||||
let result = Array.of_list !result in
|
||||
let result =
|
||||
let a = IntegralMap.create (Array.length result) in
|
||||
Array.iter (fun (k,v) -> IntegralMap.add a k v) result;
|
||||
a
|
||||
in
|
||||
print_endline "Map formed";
|
||||
|
||||
for i=1 to !i_shift - 1 do
|
||||
for k=1 to !i_shift - 1 do
|
||||
for j=1 to !i_shift - 1 do
|
||||
for l=1 to !i_shift - 1 do
|
||||
let key =
|
||||
index i j k l
|
||||
in
|
||||
try
|
||||
let value =
|
||||
IntegralMap.find result key
|
||||
in
|
||||
Printf.fprintf oc " %5d %5d %5d %5d%20.15f\n" i j k l value
|
||||
with Not_found -> ()
|
||||
done
|
||||
done
|
||||
done
|
||||
done;
|
||||
close_out oc
|
||||
|
||||
let xto_file ~filename basis =
|
||||
let zkey = Array.map (fun b ->
|
||||
let result =
|
||||
Angular_momentum.(zkey_array (Kind_1 b.totAngMom))
|
||||
in
|
||||
{ n=Array.length result ; cls=result }
|
||||
) basis
|
||||
in
|
||||
|
||||
let key_array = Array.make 12 0 in
|
||||
let result = ref [] in
|
||||
|
||||
let (i,j,k,l) = (1,1,1,18) in
|
||||
let (i,j,k,l) = (i-1,j-1,k-1,l-1) in
|
||||
basis.(i) |> Cs.to_string |> print_endline;
|
||||
basis.(j) |> Cs.to_string |> print_endline;
|
||||
basis.(k) |> Cs.to_string |> print_endline;
|
||||
basis.(l) |> Cs.to_string |> print_endline;
|
||||
let bi, bj, bk, bl =
|
||||
basis.(i), basis.(j), basis.(k), basis.(l)
|
||||
in
|
||||
let cls =
|
||||
(*contracted_class basis.(i) basis.(j) basis.(k) basis.(l) *)
|
||||
contracted_class bi bj bk bl
|
||||
in
|
||||
Zmap.iter (fun k v -> Printf.printf "%50s %20e\n" Zkey.(to_string Kind_12 k) v) cls;
|
||||
|
||||
for i_c = 0 to zkey.(i).n - 1 do
|
||||
let x = Zkey.(to_int_array Kind_3 zkey.(i).cls.(i_c)) in
|
||||
key_array.(0) <- x.(0);
|
||||
key_array.(1) <- x.(1);
|
||||
key_array.(2) <- x.(2);
|
||||
for j_c = 0 to zkey.(j).n - 1 do
|
||||
let x = Zkey.(to_int_array Kind_3 zkey.(j).cls.(j_c)) in
|
||||
key_array.(3) <- x.(0);
|
||||
key_array.(4) <- x.(1);
|
||||
key_array.(5) <- x.(2);
|
||||
for k_c = 0 to zkey.(k).n - 1 do
|
||||
let x = Zkey.(to_int_array Kind_3 zkey.(k).cls.(k_c)) in
|
||||
key_array.(6) <- x.(0);
|
||||
key_array.(7) <- x.(1);
|
||||
key_array.(8) <- x.(2);
|
||||
for l_c = 0 to zkey.(l).n - 1 do
|
||||
let x = Zkey.(to_int_array Kind_3 zkey.(l).cls.(l_c)) in
|
||||
key_array.( 9) <- x.(0);
|
||||
key_array.(10) <- x.(1);
|
||||
key_array.(11) <- x.(2);
|
||||
let key =
|
||||
Zkey.(of_int_array Kind_12 key_array)
|
||||
in
|
||||
let value =
|
||||
Zmap.find cls key
|
||||
in
|
||||
if (abs_float value > cutoff) then
|
||||
result := (key, value) :: !result
|
||||
done
|
||||
done
|
||||
done
|
||||
done;
|
||||
|
||||
List.iter (fun (k,v) -> Printf.printf "%60s %e\n" Zkey.(to_string Kind_12 k) v) !result
|
||||
;
|
||||
*)
|
||||
|
||||
|
||||
|
@ -421,16 +421,3 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
||||
result
|
||||
|
||||
|
||||
|
||||
(** Computes all the two-electron integrals of the contracted shell quartet *)
|
||||
let contracted_class ~zero_m shell_a shell_b shell_c shell_d : float Zmap.t =
|
||||
|
||||
let shell_p = Csp.make ~cutoff shell_a shell_b
|
||||
and shell_q = Csp.make ~cutoff shell_c shell_d
|
||||
in
|
||||
match shell_p, shell_q with
|
||||
| Some shell_p, Some shell_q ->
|
||||
contracted_class_shell_pairs ~zero_m shell_p shell_q
|
||||
| _ -> Zmap.create 0
|
||||
|
||||
|
||||
|
@ -855,14 +855,3 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
||||
|
||||
|
||||
|
||||
(** Computes all the two-electron integrals of the contracted shell quartet *)
|
||||
let contracted_class ~zero_m shell_a shell_b shell_c shell_d : float Zmap.t =
|
||||
|
||||
let shell_p = Csp.make ~cutoff shell_a shell_b
|
||||
and shell_q = Csp.make ~cutoff shell_c shell_d
|
||||
in
|
||||
match shell_p, shell_q with
|
||||
| Some shell_p, Some shell_q ->
|
||||
contracted_class_shell_pairs ~zero_m shell_p shell_q
|
||||
| _ -> Zmap.create 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user