mirror of
https://gitlab.com/scemama/QCaml.git
synced 2025-01-03 01:55:40 +01:00
Working {x;y;z;tot}
This commit is contained in:
parent
27d775614f
commit
34edda6317
16
Basis/ERI.ml
16
Basis/ERI.ml
@ -70,9 +70,9 @@ let index i j k l =
|
|||||||
|
|
||||||
|
|
||||||
let of_basis basis =
|
let of_basis basis =
|
||||||
let to_int_tuple x =
|
let to_powers x =
|
||||||
let open Zkey in
|
let open Zkey in
|
||||||
match to_int_tuple Kind_3 x with
|
match to_powers Kind_3 x with
|
||||||
| Three x -> x
|
| Three x -> x
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
@ -173,21 +173,21 @@ let of_basis basis =
|
|||||||
(* Write the data in the output file *)
|
(* Write the data in the output file *)
|
||||||
Array.iteri (fun i_c powers_i ->
|
Array.iteri (fun i_c powers_i ->
|
||||||
let i_c = (Contracted_shell.index shell.(i)) + i_c + 1 in
|
let i_c = (Contracted_shell.index shell.(i)) + i_c + 1 in
|
||||||
let xi = to_int_tuple powers_i in
|
let xi = to_powers powers_i in
|
||||||
Array.iteri (fun j_c powers_j ->
|
Array.iteri (fun j_c powers_j ->
|
||||||
let j_c = (Contracted_shell.index shell.(j)) + j_c + 1 in
|
let j_c = (Contracted_shell.index shell.(j)) + j_c + 1 in
|
||||||
let xj = to_int_tuple powers_j in
|
let xj = to_powers powers_j in
|
||||||
Array.iteri (fun k_c powers_k ->
|
Array.iteri (fun k_c powers_k ->
|
||||||
let k_c = (Contracted_shell.index shell.(k)) + k_c + 1 in
|
let k_c = (Contracted_shell.index shell.(k)) + k_c + 1 in
|
||||||
let xk = to_int_tuple powers_k in
|
let xk = to_powers powers_k in
|
||||||
Array.iteri (fun l_c powers_l ->
|
Array.iteri (fun l_c powers_l ->
|
||||||
let l_c = (Contracted_shell.index shell.(l)) + l_c + 1 in
|
let l_c = (Contracted_shell.index shell.(l)) + l_c + 1 in
|
||||||
let xl = to_int_tuple powers_l in
|
let xl = to_powers powers_l in
|
||||||
let key =
|
let key =
|
||||||
if swap then
|
if swap then
|
||||||
Zkey.of_int_tuple (Zkey.Twelve (xk,xl,xi,xj))
|
Zkey.of_powers (Zkey.Twelve (xk,xl,xi,xj))
|
||||||
else
|
else
|
||||||
Zkey.of_int_tuple (Zkey.Twelve (xi,xj,xk,xl))
|
Zkey.of_powers (Zkey.Twelve (xi,xj,xk,xl))
|
||||||
in
|
in
|
||||||
let value =
|
let value =
|
||||||
Zmap.find cls key
|
Zmap.find cls key
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
open Util
|
open Util
|
||||||
open Constants
|
open Constants
|
||||||
open Lacaml.D
|
open Lacaml.D
|
||||||
|
open Powers
|
||||||
open Coordinate
|
open Coordinate
|
||||||
|
|
||||||
type t = Mat.t
|
type t = Mat.t
|
||||||
@ -108,9 +109,9 @@ let contracted_class shell_a shell_b : float Zmap.t =
|
|||||||
|
|
||||||
(** Create kinetic energy matrix *)
|
(** Create kinetic energy matrix *)
|
||||||
let of_basis basis =
|
let of_basis basis =
|
||||||
let to_int_tuple x =
|
let to_powers x =
|
||||||
let open Zkey in
|
let open Zkey in
|
||||||
match to_int_tuple Kind_3 x with
|
match to_powers Kind_3 x with
|
||||||
| Three x -> x
|
| Three x -> x
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
@ -131,12 +132,12 @@ let of_basis basis =
|
|||||||
|
|
||||||
Array.iteri (fun j_c powers_j ->
|
Array.iteri (fun j_c powers_j ->
|
||||||
let j_c = Contracted_shell.index shell.(j) + j_c + 1 in
|
let j_c = Contracted_shell.index shell.(j) + j_c + 1 in
|
||||||
let xj = to_int_tuple powers_j in
|
let xj = to_powers powers_j in
|
||||||
Array.iteri (fun i_c powers_i ->
|
Array.iteri (fun i_c powers_i ->
|
||||||
let i_c = Contracted_shell.index shell.(i) + i_c + 1 in
|
let i_c = Contracted_shell.index shell.(i) + i_c + 1 in
|
||||||
let xi = to_int_tuple powers_i in
|
let xi = to_powers powers_i in
|
||||||
let key =
|
let key =
|
||||||
Zkey.of_int_tuple (Zkey.Six (xi,xj))
|
Zkey.of_powers (Zkey.Six (xi,xj))
|
||||||
in
|
in
|
||||||
let value =
|
let value =
|
||||||
try Zmap.find cls key
|
try Zmap.find cls key
|
||||||
|
@ -36,9 +36,9 @@ exception NullIntegral
|
|||||||
|
|
||||||
|
|
||||||
let of_basis_nuclei basis nuclei =
|
let of_basis_nuclei basis nuclei =
|
||||||
let to_int_tuple x =
|
let to_powers x =
|
||||||
let open Zkey in
|
let open Zkey in
|
||||||
match to_int_tuple Kind_3 x with
|
match to_powers Kind_3 x with
|
||||||
| Three x -> x
|
| Three x -> x
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
@ -72,12 +72,12 @@ let of_basis_nuclei basis nuclei =
|
|||||||
(* Write the data in the output file *)
|
(* Write the data in the output file *)
|
||||||
Array.iteri (fun i_c powers_i ->
|
Array.iteri (fun i_c powers_i ->
|
||||||
let i_c = (Contracted_shell.index shell.(i)) + i_c + 1 in
|
let i_c = (Contracted_shell.index shell.(i)) + i_c + 1 in
|
||||||
let xi = to_int_tuple powers_i in
|
let xi = to_powers powers_i in
|
||||||
Array.iteri (fun j_c powers_j ->
|
Array.iteri (fun j_c powers_j ->
|
||||||
let j_c = (Contracted_shell.index shell.(j)) + j_c + 1 in
|
let j_c = (Contracted_shell.index shell.(j)) + j_c + 1 in
|
||||||
let xj = to_int_tuple powers_j in
|
let xj = to_powers powers_j in
|
||||||
let key =
|
let key =
|
||||||
Zkey.of_int_tuple (Zkey.Six (xi,xj))
|
Zkey.of_powers (Zkey.Six (xi,xj))
|
||||||
in
|
in
|
||||||
let value =
|
let value =
|
||||||
Zmap.find cls key
|
Zmap.find cls key
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
open Util
|
open Util
|
||||||
open Constants
|
open Constants
|
||||||
|
open Powers
|
||||||
open Coordinate
|
open Coordinate
|
||||||
|
|
||||||
exception NullPair
|
exception NullPair
|
||||||
@ -12,56 +13,57 @@ let chop f g =
|
|||||||
|
|
||||||
|
|
||||||
(** Horizontal and Vertical Recurrence Relations (HVRR) *)
|
(** Horizontal and Vertical Recurrence Relations (HVRR) *)
|
||||||
let hvrr_one_e
|
let hvrr_one_e (angMom_a, angMom_b)
|
||||||
(angMom_a, angMom_b) (totAngMom_a, totAngMom_b)
|
zero_m_array (expo_b) (expo_inv_p) (center_ab, center_pa, center_pc)
|
||||||
(maxm, zero_m_array) (expo_b) (expo_inv_p) (center_ab, center_pa, center_pc)
|
|
||||||
map
|
map
|
||||||
=
|
=
|
||||||
|
|
||||||
let totAngMom_a = Angular_momentum.to_int totAngMom_a
|
let maxm = angMom_a.tot + angMom_b.tot in
|
||||||
and totAngMom_b = Angular_momentum.to_int totAngMom_b
|
|
||||||
in
|
|
||||||
let maxm = totAngMom_a+totAngMom_b in
|
|
||||||
let maxsze = maxm+1 in
|
let maxsze = maxm+1 in
|
||||||
let empty = Array.make maxsze 0. in
|
let empty = Array.make maxsze 0. in
|
||||||
|
|
||||||
|
let get_xyz angMom =
|
||||||
|
match angMom with
|
||||||
|
| { y=0 ; z=0 ; _ } -> X
|
||||||
|
| { z=0 ; _ } -> Y
|
||||||
|
| _ -> Z
|
||||||
|
in
|
||||||
|
|
||||||
|
|
||||||
(** Vertical recurrence relations *)
|
(** Vertical recurrence relations *)
|
||||||
let rec vrr angMom_a totAngMom_a =
|
let rec vrr angMom_a =
|
||||||
let ax,ay,az = angMom_a in
|
let { x=ax ; y=ay ; z=az } = angMom_a in
|
||||||
if ax < 0 || ay < 0 || az < 0 then
|
if ax < 0 || ay < 0 || az < 0 then raise Exit
|
||||||
empty
|
|
||||||
else
|
else
|
||||||
match totAngMom_a with
|
match angMom_a.tot with
|
||||||
| 0 -> zero_m_array
|
| 0 -> zero_m_array
|
||||||
| _ ->
|
| _ ->
|
||||||
let key = Zkey.of_int_tuple (Zkey.Three angMom_a) in
|
let key = Zkey.of_powers (Zkey.Three angMom_a) in
|
||||||
|
|
||||||
try Zmap.find map key with
|
try Zmap.find map key with
|
||||||
| Not_found ->
|
| Not_found ->
|
||||||
let result =
|
let result =
|
||||||
let am, amm, amxyz, xyz =
|
let xyz = get_xyz angMom_a in
|
||||||
match angMom_a with
|
let am = Powers.decr xyz angMom_a in
|
||||||
| (x,0,0) -> (x-1,0,0),(x-2,0,0), x-1, X
|
let amxyz = Powers.get xyz am in
|
||||||
| (x,y,0) -> (x,y-1,0),(x,y-2,0), y-1, Y
|
|
||||||
| (x,y,z) -> (x,y,z-1),(x,y,z-2), z-1, Z
|
|
||||||
in
|
|
||||||
if amxyz < 0 then empty else
|
if amxyz < 0 then empty else
|
||||||
let f1 = Coordinate.get xyz center_pa
|
let f1 = Coordinate.get xyz center_pa
|
||||||
and f2 = expo_inv_p *. (Coordinate.get xyz center_pc)
|
and f2 = expo_inv_p *. (Coordinate.get xyz center_pc)
|
||||||
in
|
in
|
||||||
if amxyz < 1 then
|
if amxyz < 1 then
|
||||||
let v1 =
|
let v1 =
|
||||||
vrr am (totAngMom_a-1)
|
vrr am
|
||||||
in
|
in
|
||||||
Array.init maxsze (fun m ->
|
Array.init maxsze (fun m ->
|
||||||
if m = maxm then (f1 *. v1.(m) ) else
|
if m = maxm then (f1 *. v1.(m) ) else
|
||||||
(f1 *. v1.(m) ) -. f2 *. v1.(m+1) )
|
(f1 *. v1.(m) ) -. f2 *. v1.(m+1) )
|
||||||
else
|
else
|
||||||
let v3 =
|
let v3 =
|
||||||
vrr amm (totAngMom_a-2)
|
let amm = Powers.decr xyz am in
|
||||||
|
vrr amm
|
||||||
in
|
in
|
||||||
let v1 =
|
let v1 =
|
||||||
vrr am (totAngMom_a-1)
|
vrr am
|
||||||
in
|
in
|
||||||
let f3 = (float_of_int amxyz) *. expo_inv_p *. 0.5 in
|
let f3 = (float_of_int amxyz) *. expo_inv_p *. 0.5 in
|
||||||
Array.init maxsze (fun m -> f1 *. v1.(m) -.
|
Array.init maxsze (fun m -> f1 *. v1.(m) -.
|
||||||
@ -75,43 +77,33 @@ let hvrr_one_e
|
|||||||
|
|
||||||
|
|
||||||
(** Horizontal recurrence relations *)
|
(** Horizontal recurrence relations *)
|
||||||
and hrr angMom_a angMom_b totAngMom_a totAngMom_b =
|
and hrr angMom_a angMom_b =
|
||||||
|
|
||||||
let bx,by,bz = angMom_b in
|
let { x=bx ; y=by ; z=bz } = angMom_b in
|
||||||
if bx < 0 || by < 0 || bz < 0 then 0.
|
if bx < 0 || by < 0 || bz < 0 then raise Exit
|
||||||
else
|
else
|
||||||
match totAngMom_b with
|
match angMom_b.tot with
|
||||||
| 0 -> (vrr angMom_a totAngMom_a).(0)
|
| 0 -> (vrr angMom_a).(0)
|
||||||
| _ ->
|
| _ ->
|
||||||
let angMom_ax, angMom_ay, angMom_az = angMom_a
|
let xyz = get_xyz angMom_b in
|
||||||
and angMom_bx, angMom_by, angMom_bz = angMom_b in
|
let bxyz = Powers.get xyz angMom_b in
|
||||||
let bxyz, xyz =
|
|
||||||
match angMom_b with
|
|
||||||
| (_,0,0) -> angMom_bx, X
|
|
||||||
| (_,_,0) -> angMom_by, Y
|
|
||||||
| (_,_,_) -> angMom_bz, Z
|
|
||||||
in
|
|
||||||
if (bxyz < 1) then 0. else
|
if (bxyz < 1) then 0. else
|
||||||
let ap, bm =
|
let ap = Powers.incr xyz angMom_a in
|
||||||
match xyz with
|
let bm = Powers.decr xyz angMom_b in
|
||||||
| X -> (angMom_ax+1,angMom_ay,angMom_az),(angMom_bx-1,angMom_by,angMom_bz)
|
|
||||||
| Y -> (angMom_ax,angMom_ay+1,angMom_az),(angMom_bx,angMom_by-1,angMom_bz)
|
|
||||||
| Z -> (angMom_ax,angMom_ay,angMom_az+1),(angMom_bx,angMom_by,angMom_bz-1)
|
|
||||||
in
|
|
||||||
let h1 =
|
let h1 =
|
||||||
hrr ap bm (totAngMom_a+1) (totAngMom_b-1)
|
hrr ap bm
|
||||||
in
|
in
|
||||||
let f2 =
|
let f2 =
|
||||||
Coordinate.get xyz center_ab
|
Coordinate.get xyz center_ab
|
||||||
in
|
in
|
||||||
if abs_float f2 < cutoff then h1 else
|
if abs_float f2 < cutoff then h1 else
|
||||||
let h2 =
|
let h2 =
|
||||||
hrr angMom_a bm totAngMom_a (totAngMom_b-1)
|
hrr angMom_a bm
|
||||||
in
|
in
|
||||||
h1 +. f2 *. h2
|
h1 +. f2 *. h2
|
||||||
|
|
||||||
in
|
in
|
||||||
hrr angMom_a angMom_b totAngMom_a totAngMom_b
|
hrr angMom_a angMom_b
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +191,7 @@ let contracted_class_shell_pair ~zero_m shell_p geometry : float Zmap.t =
|
|||||||
class_indices
|
class_indices
|
||||||
|> Array.iteri (fun i key ->
|
|> Array.iteri (fun i key ->
|
||||||
let (angMomA,angMomB) =
|
let (angMomA,angMomB) =
|
||||||
match Zkey.to_int_tuple ~kind:Zkey.Kind_6 key with
|
match Zkey.to_powers ~kind:Zkey.Kind_6 key with
|
||||||
| Zkey.Six x -> x
|
| Zkey.Six x -> x
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
@ -207,8 +199,7 @@ let contracted_class_shell_pair ~zero_m shell_p geometry : float Zmap.t =
|
|||||||
let coef_prod = coef_prod *. norm in
|
let coef_prod = coef_prod *. norm in
|
||||||
let integral =
|
let integral =
|
||||||
hvrr_one_e (angMomA, angMomB)
|
hvrr_one_e (angMomA, angMomB)
|
||||||
(Contracted_shell.totAngMom shell_a, Contracted_shell.totAngMom shell_b)
|
zero_m_array
|
||||||
(maxm, zero_m_array)
|
|
||||||
(Contracted_shell.expo shell_b b)
|
(Contracted_shell.expo shell_b b)
|
||||||
(shell_p.ContractedShellPair.expo_inv.(ab))
|
(shell_p.ContractedShellPair.expo_inv.(ab))
|
||||||
(center_ab, center_pa, center_pc)
|
(center_ab, center_pa, center_pc)
|
||||||
|
@ -82,9 +82,9 @@ let contracted_class shell_a shell_b : float Zmap.t =
|
|||||||
|
|
||||||
(** Create overlap matrix *)
|
(** Create overlap matrix *)
|
||||||
let of_basis basis =
|
let of_basis basis =
|
||||||
let to_int_tuple x =
|
let to_powers x =
|
||||||
let open Zkey in
|
let open Zkey in
|
||||||
match to_int_tuple Kind_3 x with
|
match to_powers Kind_3 x with
|
||||||
| Three x -> x
|
| Three x -> x
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
@ -105,12 +105,12 @@ let of_basis basis =
|
|||||||
|
|
||||||
Array.iteri (fun j_c powers_j ->
|
Array.iteri (fun j_c powers_j ->
|
||||||
let j_c = Contracted_shell.index shell.(j) + j_c + 1 in
|
let j_c = Contracted_shell.index shell.(j) + j_c + 1 in
|
||||||
let xj = to_int_tuple powers_j in
|
let xj = to_powers powers_j in
|
||||||
Array.iteri (fun i_c powers_i ->
|
Array.iteri (fun i_c powers_i ->
|
||||||
let i_c = Contracted_shell.index shell.(i) + i_c + 1 in
|
let i_c = Contracted_shell.index shell.(i) + i_c + 1 in
|
||||||
let xi = to_int_tuple powers_i in
|
let xi = to_powers powers_i in
|
||||||
let key =
|
let key =
|
||||||
Zkey.of_int_tuple (Zkey.Six (xi,xj))
|
Zkey.of_powers (Zkey.Six (xi,xj))
|
||||||
in
|
in
|
||||||
let value =
|
let value =
|
||||||
try Zmap.find cls key
|
try Zmap.find cls key
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
open Util
|
open Util
|
||||||
open Constants
|
open Constants
|
||||||
|
open Powers
|
||||||
open Coordinate
|
open Coordinate
|
||||||
|
|
||||||
let debug=false
|
let debug=false
|
||||||
@ -10,34 +11,37 @@ exception NullQuartet
|
|||||||
|
|
||||||
(** Horizontal and Vertical Recurrence Relations (HVRR) *)
|
(** Horizontal and Vertical Recurrence Relations (HVRR) *)
|
||||||
let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
||||||
(totAngMom_a_in, totAngMom_b_in, totAngMom_c_in, totAngMom_d_in)
|
zero_m_array
|
||||||
(maxm, zero_m_array)
|
|
||||||
(expo_b, expo_d)
|
(expo_b, expo_d)
|
||||||
(expo_inv_p, expo_inv_q)
|
(expo_inv_p, expo_inv_q)
|
||||||
(center_ab, center_cd, center_pq)
|
(center_ab, center_cd, center_pq)
|
||||||
map_1d map_2d map_1d' map_2d'
|
map_1d map_2d map_1d' map_2d'
|
||||||
=
|
=
|
||||||
|
|
||||||
let maxsze = maxm+1 in
|
|
||||||
let totAngMom_a = Angular_momentum.to_int totAngMom_a_in
|
|
||||||
and totAngMom_b = Angular_momentum.to_int totAngMom_b_in
|
|
||||||
and totAngMom_c = Angular_momentum.to_int totAngMom_c_in
|
|
||||||
and totAngMom_d = Angular_momentum.to_int totAngMom_d_in
|
|
||||||
in
|
|
||||||
|
|
||||||
(* Swap electrons 1 and 2 so that the max angular momentum is on 1 *)
|
(* Swap electrons 1 and 2 so that the max angular momentum is on 1 *)
|
||||||
if (totAngMom_a+totAngMom_b < totAngMom_c+totAngMom_d) then
|
if angMom_a.tot + angMom_b.tot < angMom_c.tot + angMom_d.tot then
|
||||||
hvrr_two_e (angMom_c, angMom_d, angMom_a, angMom_b)
|
hvrr_two_e (angMom_c, angMom_d, angMom_a, angMom_b)
|
||||||
(totAngMom_c_in, totAngMom_d_in, totAngMom_a_in, totAngMom_b_in)
|
zero_m_array
|
||||||
(maxm, zero_m_array)
|
|
||||||
(expo_d, expo_b)
|
(expo_d, expo_b)
|
||||||
(expo_inv_q, expo_inv_p)
|
(expo_inv_q, expo_inv_p)
|
||||||
(center_cd, center_ab, (Coordinate.neg center_pq) )
|
(center_cd, center_ab, (Coordinate.neg center_pq) )
|
||||||
map_1d' map_2d' map_1d map_2d
|
map_1d' map_2d' map_1d map_2d
|
||||||
|
|
||||||
else
|
else
|
||||||
let maxm = totAngMom_a + totAngMom_b + totAngMom_c + totAngMom_d in
|
|
||||||
let empty = Array.make (maxm+1) 0.
|
let maxm = angMom_a.tot + angMom_b.tot + angMom_c.tot + angMom_d.tot in
|
||||||
|
let maxsze = maxm+1 in
|
||||||
|
|
||||||
|
let empty = Array.make (maxm+1) 0. in
|
||||||
|
|
||||||
|
let get_xyz angMom =
|
||||||
|
match angMom with
|
||||||
|
| { y=0 ; z=0 ; _ } -> X
|
||||||
|
| { z=0 ; _ } -> Y
|
||||||
|
| _ -> Z
|
||||||
in
|
in
|
||||||
|
|
||||||
|
(*
|
||||||
if debug then begin
|
if debug then begin
|
||||||
Printf.printf "\n---- %d %d %d %d ----\n" totAngMom_a totAngMom_b totAngMom_c totAngMom_d;
|
Printf.printf "\n---- %d %d %d %d ----\n" totAngMom_a totAngMom_b totAngMom_c totAngMom_d;
|
||||||
let (x,y,z) = angMom_a in Printf.printf "%d %d %d\n" x y z;
|
let (x,y,z) = angMom_a in Printf.printf "%d %d %d\n" x y z;
|
||||||
@ -50,29 +54,30 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
(get X center_cd) (get Y center_cd) (get Z center_cd)
|
(get X center_cd) (get Y center_cd) (get Z center_cd)
|
||||||
(get X center_pq) (get Y center_pq) (get Z center_pq)
|
(get X center_pq) (get Y center_pq) (get Z center_pq)
|
||||||
end;
|
end;
|
||||||
|
*)
|
||||||
|
|
||||||
(** Vertical recurrence relations *)
|
(** Vertical recurrence relations *)
|
||||||
let rec vrr0 angMom_a totAngMom_a =
|
let rec vrr0 angMom_a =
|
||||||
|
(*
|
||||||
if debug then
|
if debug then
|
||||||
begin
|
begin
|
||||||
let (x,y,z) = angMom_a in
|
let (x,y,z) = angMom_a in
|
||||||
Printf.printf "vrr0: %d : %d %d %d\n" totAngMom_a x y z
|
Printf.printf "vrr0: %d : %d %d %d\n" angMom_a.tot x y z
|
||||||
end;
|
end;
|
||||||
|
*)
|
||||||
|
|
||||||
match totAngMom_a with
|
match angMom_a.tot with
|
||||||
| 0 -> zero_m_array
|
| 0 -> zero_m_array
|
||||||
| _ ->
|
| _ ->
|
||||||
let key = Zkey.of_int_tuple (Zkey.Three angMom_a) in
|
let key = Zkey.of_powers (Zkey.Three angMom_a) in
|
||||||
|
|
||||||
try Zmap.find map_1d key with
|
try Zmap.find map_1d key with
|
||||||
| Not_found ->
|
| Not_found ->
|
||||||
let result =
|
let result =
|
||||||
let am, amm, amxyz, xyz =
|
let xyz = get_xyz angMom_a in
|
||||||
match angMom_a with
|
let am = Powers.decr xyz angMom_a in
|
||||||
| (x,0,0) -> (x-1,0,0),(x-2,0,0), x-1, X
|
let amxyz = Powers.get xyz am in
|
||||||
| (x,y,0) -> (x,y-1,0),(x,y-2,0), y-1, Y
|
|
||||||
| (x,y,z) -> (x,y,z-1),(x,y,z-2), z-1, Z
|
|
||||||
in
|
|
||||||
if amxyz < 0 then empty else
|
if amxyz < 0 then empty else
|
||||||
let f1 = expo_inv_p *. (Coordinate.get xyz center_pq)
|
let f1 = expo_inv_p *. (Coordinate.get xyz center_pq)
|
||||||
and f2 = expo_b *. expo_inv_p *. (Coordinate.get xyz center_ab)
|
and f2 = expo_b *. expo_inv_p *. (Coordinate.get xyz center_ab)
|
||||||
@ -81,7 +86,7 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
if amxyz < 1 then
|
if amxyz < 1 then
|
||||||
begin
|
begin
|
||||||
let v1 =
|
let v1 =
|
||||||
vrr0 am (totAngMom_a-1)
|
vrr0 am
|
||||||
in
|
in
|
||||||
for m=0 to maxm-1 do
|
for m=0 to maxm-1 do
|
||||||
result.(m) <- f1 *. v1.(m+1) -. f2 *. v1.(m)
|
result.(m) <- f1 *. v1.(m+1) -. f2 *. v1.(m)
|
||||||
@ -90,12 +95,9 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
let v3 =
|
let amm = Powers.decr xyz am in
|
||||||
vrr0 amm (totAngMom_a-2)
|
let v3 = vrr0 amm in
|
||||||
in
|
let v1 = vrr0 am in
|
||||||
let v1 =
|
|
||||||
vrr0 am (totAngMom_a-1)
|
|
||||||
in
|
|
||||||
let f3 = (float_of_int amxyz) *. expo_inv_p *. 0.5 in
|
let f3 = (float_of_int amxyz) *. expo_inv_p *. 0.5 in
|
||||||
for m=0 to maxm-1 do
|
for m=0 to maxm-1 do
|
||||||
result.(m) <- f1 *. v1.(m+1) -. f2 *. v1.(m)
|
result.(m) <- f1 *. v1.(m+1) -. f2 *. v1.(m)
|
||||||
@ -108,51 +110,38 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
result
|
result
|
||||||
|
|
||||||
|
|
||||||
and vrr angMom_a angMom_c totAngMom_a totAngMom_c =
|
and vrr angMom_a angMom_c =
|
||||||
|
|
||||||
|
(*
|
||||||
if debug then
|
if debug then
|
||||||
begin
|
begin
|
||||||
let angMom_ax, angMom_ay, angMom_az = angMom_a in
|
let angMom_ax, angMom_ay, angMom_az = angMom_a in
|
||||||
let angMom_cx, angMom_cy, angMom_cz = angMom_c in
|
let angMom_cx, angMom_cy, angMom_cz = angMom_c in
|
||||||
Printf.printf "vrr : %d %d : %d %d %d %d %d %d\n" totAngMom_a totAngMom_c
|
Printf.printf "vrr : %d %d : %d %d %d %d %d %d\n" angMom_a.tot angMom_c.tot
|
||||||
angMom_ax angMom_ay angMom_az angMom_cx angMom_cy angMom_cz
|
angMom_ax angMom_ay angMom_az angMom_cx angMom_cy angMom_cz
|
||||||
end;
|
end;
|
||||||
|
*)
|
||||||
|
|
||||||
match (totAngMom_a, totAngMom_c) with
|
match (angMom_a.tot, angMom_c.tot) with
|
||||||
| (i,0) -> if (i>0) then
|
| (i,0) -> if (i>0) then
|
||||||
vrr0 angMom_a totAngMom_a
|
vrr0 angMom_a
|
||||||
(*
|
(*
|
||||||
OneElectronRR.hvrr_one_e (angMom_a, angMom_b) (totAngMom_a_in, totAngMom_b_in)
|
OneElectronRR.hvrr_one_e (angMom_a, angMom_b) (angMom_a.tot, angMom_b.tot)
|
||||||
(maxm, zero_m_array) (expo_b) (expo_inv_p) (center_ab, center_pq, center_ab)
|
(maxm, zero_m_array) (expo_b) (expo_inv_p) (center_ab, center_pq, center_ab)
|
||||||
map_1d
|
map_1d
|
||||||
*)
|
*)
|
||||||
else zero_m_array
|
else zero_m_array
|
||||||
| (_,_) ->
|
| (_,_) ->
|
||||||
let key = Zkey.of_int_tuple (Zkey.Six (angMom_a, angMom_c) ) in
|
let key = Zkey.of_powers (Zkey.Six (angMom_a, angMom_c)) in
|
||||||
|
|
||||||
try Zmap.find map_2d key with
|
try Zmap.find map_2d key with
|
||||||
| Not_found ->
|
| Not_found ->
|
||||||
let result =
|
let result =
|
||||||
let am, cm, cmm, axyz, cmxyz, xyz =
|
let xyz = get_xyz angMom_c in
|
||||||
let angMom_ax, angMom_ay, angMom_az = angMom_a
|
let cm = Powers.decr xyz angMom_c in
|
||||||
and angMom_cx, angMom_cy, angMom_cz = angMom_c in
|
let cmxyz = Powers.get xyz cm in
|
||||||
match angMom_c with
|
let axyz = Powers.get xyz angMom_a in
|
||||||
| (_,0,0) ->
|
|
||||||
(angMom_ax-1, angMom_ay, angMom_az),
|
|
||||||
(angMom_cx-1, angMom_cy, angMom_cz),
|
|
||||||
(angMom_cx-2, angMom_cy, angMom_cz),
|
|
||||||
angMom_ax,angMom_cx-1, X
|
|
||||||
| (_,_,0) ->
|
|
||||||
(angMom_ax, angMom_ay-1, angMom_az),
|
|
||||||
(angMom_cx, angMom_cy-1, angMom_cz),
|
|
||||||
(angMom_cx, angMom_cy-2, angMom_cz),
|
|
||||||
angMom_ay,angMom_cy-1, Y
|
|
||||||
| _ ->
|
|
||||||
(angMom_ax, angMom_ay, angMom_az-1),
|
|
||||||
(angMom_cx, angMom_cy, angMom_cz-1),
|
|
||||||
(angMom_cx, angMom_cy, angMom_cz-2),
|
|
||||||
angMom_az,angMom_cz-1, Z
|
|
||||||
in
|
|
||||||
if cmxyz < 0 then empty
|
if cmxyz < 0 then empty
|
||||||
else
|
else
|
||||||
let f1 =
|
let f1 =
|
||||||
@ -164,7 +153,7 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
if ( (abs_float f1 > cutoff) || (abs_float f2 > cutoff) ) then
|
if ( (abs_float f1 > cutoff) || (abs_float f2 > cutoff) ) then
|
||||||
begin
|
begin
|
||||||
let v1 =
|
let v1 =
|
||||||
vrr angMom_a cm totAngMom_a (totAngMom_c-1)
|
vrr angMom_a cm
|
||||||
in
|
in
|
||||||
for m=0 to maxm-1 do
|
for m=0 to maxm-1 do
|
||||||
result.(m) <- f1 *. v1.(m) -. f2 *. v1.(m+1) ;
|
result.(m) <- f1 *. v1.(m) -. f2 *. v1.(m+1) ;
|
||||||
@ -180,7 +169,8 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
(abs_float (f3 *. expo_inv_q) > cutoff) then
|
(abs_float (f3 *. expo_inv_q) > cutoff) then
|
||||||
begin
|
begin
|
||||||
let v3 =
|
let v3 =
|
||||||
vrr angMom_a cmm totAngMom_a (totAngMom_c-2)
|
let cmm = Powers.decr xyz cm in
|
||||||
|
vrr angMom_a cmm
|
||||||
in
|
in
|
||||||
for m=0 to maxm-1 do
|
for m=0 to maxm-1 do
|
||||||
result.(m) <- result.(m) +.
|
result.(m) <- result.(m) +.
|
||||||
@ -191,12 +181,13 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
end;
|
end;
|
||||||
if (axyz > 0) && (cmxyz >= 0) then
|
if (axyz > 0) && (cmxyz >= 0) then
|
||||||
begin
|
begin
|
||||||
|
let am = Powers.decr xyz angMom_a in
|
||||||
let f5 =
|
let f5 =
|
||||||
(float_of_int axyz) *. expo_inv_p *. expo_inv_q *. 0.5
|
(float_of_int axyz) *. expo_inv_p *. expo_inv_q *. 0.5
|
||||||
in
|
in
|
||||||
if (abs_float f5 > cutoff) then
|
if (abs_float f5 > cutoff) then
|
||||||
let v5 =
|
let v5 =
|
||||||
vrr am cm (totAngMom_a-1) (totAngMom_c-1)
|
vrr am cm
|
||||||
in
|
in
|
||||||
for m=0 to maxm-1 do
|
for m=0 to maxm-1 do
|
||||||
result.(m) <- result.(m) -. f5 *. v5.(m+1)
|
result.(m) <- result.(m) -. f5 *. v5.(m+1)
|
||||||
@ -211,8 +202,7 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
|
|
||||||
|
|
||||||
(** Horizontal recurrence relations *)
|
(** Horizontal recurrence relations *)
|
||||||
and hrr0 angMom_a angMom_b angMom_c
|
and hrr0 angMom_a angMom_b angMom_c =
|
||||||
totAngMom_a totAngMom_b totAngMom_c =
|
|
||||||
|
|
||||||
(*
|
(*
|
||||||
if debug then
|
if debug then
|
||||||
@ -221,93 +211,70 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
and angMom_bx, angMom_by, angMom_bz = angMom_b
|
and angMom_bx, angMom_by, angMom_bz = angMom_b
|
||||||
and angMom_cx, angMom_cy, angMom_cz = angMom_c in
|
and angMom_cx, angMom_cy, angMom_cz = angMom_c in
|
||||||
Printf.printf "hrr0: %d %d %d : %d %d %d %d %d %d %d %d %d\n"
|
Printf.printf "hrr0: %d %d %d : %d %d %d %d %d %d %d %d %d\n"
|
||||||
totAngMom_a totAngMom_b totAngMom_c
|
|
||||||
angMom_ax angMom_ay angMom_az
|
angMom_ax angMom_ay angMom_az
|
||||||
angMom_bx angMom_by angMom_bz
|
angMom_bx angMom_by angMom_bz
|
||||||
angMom_cx angMom_cy angMom_cz
|
angMom_cx angMom_cy angMom_cz
|
||||||
end;
|
end;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
match totAngMom_b with
|
match angMom_b.tot with
|
||||||
| 0 -> (vrr angMom_a angMom_c totAngMom_a totAngMom_c).(0)
|
| 0 -> (vrr angMom_a angMom_c).(0)
|
||||||
| 1 ->
|
| 1 ->
|
||||||
let angMom_ax, angMom_ay, angMom_az = angMom_a in
|
let xyz = get_xyz angMom_b in
|
||||||
let ap, xyz =
|
let ap = Powers.incr xyz angMom_a in
|
||||||
match angMom_b with
|
|
||||||
| (1,_,_) -> (angMom_ax+1,angMom_ay,angMom_az), X
|
|
||||||
| (_,1,_) -> (angMom_ax,angMom_ay+1,angMom_az), Y
|
|
||||||
| _ -> (angMom_ax,angMom_ay,angMom_az+1), Z
|
|
||||||
in
|
|
||||||
let v1 =
|
let v1 =
|
||||||
vrr ap angMom_c (totAngMom_a+1) totAngMom_c
|
vrr ap angMom_c
|
||||||
in
|
in
|
||||||
let f2 =
|
let f2 =
|
||||||
(Coordinate.get xyz center_ab)
|
(Coordinate.get xyz center_ab)
|
||||||
in
|
in
|
||||||
if (abs_float f2 < cutoff) then v1.(0) else
|
if (abs_float f2 < cutoff) then v1.(0) else
|
||||||
let v2 =
|
let v2 =
|
||||||
vrr angMom_a angMom_c totAngMom_a totAngMom_c
|
vrr angMom_a angMom_c
|
||||||
in
|
in
|
||||||
v1.(0) +. f2 *. v2.(0)
|
v1.(0) +. f2 *. v2.(0)
|
||||||
| _ ->
|
| _ ->
|
||||||
let angMom_ax, angMom_ay, angMom_az = angMom_a
|
let xyz = get_xyz angMom_b in
|
||||||
and angMom_bx, angMom_by, angMom_bz = angMom_b in
|
let bxyz = Powers.get xyz angMom_b in
|
||||||
let bxyz, xyz =
|
|
||||||
match angMom_b with
|
|
||||||
| (_,0,0) -> angMom_bx, X
|
|
||||||
| (_,_,0) -> angMom_by, Y
|
|
||||||
| (_,_,_) -> angMom_bz, Z
|
|
||||||
in
|
|
||||||
if (bxyz < 1) then 0. else
|
if (bxyz < 1) then 0. else
|
||||||
let ap, bm =
|
let ap = Powers.incr xyz angMom_a in
|
||||||
match xyz with
|
let bm = Powers.decr xyz angMom_b in
|
||||||
| X -> (angMom_ax+1,angMom_ay,angMom_az),(angMom_bx-1,angMom_by,angMom_bz)
|
|
||||||
| Y -> (angMom_ax,angMom_ay+1,angMom_az),(angMom_bx,angMom_by-1,angMom_bz)
|
|
||||||
| Z -> (angMom_ax,angMom_ay,angMom_az+1),(angMom_bx,angMom_by,angMom_bz-1)
|
|
||||||
in
|
|
||||||
let h1 =
|
let h1 =
|
||||||
hrr0 ap bm angMom_c (totAngMom_a+1) (totAngMom_b-1) totAngMom_c
|
hrr0 ap bm angMom_c
|
||||||
in
|
in
|
||||||
let f2 =
|
let f2 =
|
||||||
(Coordinate.get xyz center_ab)
|
(Coordinate.get xyz center_ab)
|
||||||
in
|
in
|
||||||
if (abs_float f2 < cutoff) then h1 else
|
if (abs_float f2 < cutoff) then h1 else
|
||||||
let h2 =
|
let h2 =
|
||||||
hrr0 angMom_a bm angMom_c totAngMom_a (totAngMom_b-1) totAngMom_c
|
hrr0 angMom_a bm angMom_c
|
||||||
in
|
in
|
||||||
h1 +. f2 *. h2
|
h1 +. f2 *. h2
|
||||||
|
|
||||||
|
|
||||||
and hrr angMom_a angMom_b angMom_c angMom_d
|
and hrr angMom_a angMom_b angMom_c angMom_d =
|
||||||
totAngMom_a totAngMom_b totAngMom_c totAngMom_d =
|
|
||||||
|
|
||||||
match (totAngMom_b, totAngMom_d) with
|
match (angMom_b.tot, angMom_d.tot) with
|
||||||
| (_,0) -> if (totAngMom_b = 0) then
|
| (_,0) -> if (angMom_b.tot = 0) then
|
||||||
(vrr angMom_a angMom_c totAngMom_a totAngMom_c).(0)
|
(vrr angMom_a angMom_c).(0)
|
||||||
else
|
else
|
||||||
hrr0 angMom_a angMom_b angMom_c totAngMom_a totAngMom_b totAngMom_c
|
hrr0 angMom_a angMom_b angMom_c
|
||||||
| (_,_) ->
|
| (_,_) ->
|
||||||
let (angMom_cx, angMom_cy, angMom_cz) = angMom_c
|
let xyz = get_xyz angMom_d in
|
||||||
and (angMom_dx, angMom_dy, angMom_dz) = angMom_d in
|
let cp = Powers.incr xyz angMom_c in
|
||||||
let cp, dm, xyz =
|
let dm = Powers.decr xyz angMom_d in
|
||||||
match angMom_d with
|
|
||||||
| (_,0,0) -> (angMom_cx+1, angMom_cy, angMom_cz), (angMom_dx-1, angMom_dy, angMom_dz), X
|
|
||||||
| (_,_,0) -> (angMom_cx, angMom_cy+1, angMom_cz), (angMom_dx, angMom_dy-1, angMom_dz), Y
|
|
||||||
| _ -> (angMom_cx, angMom_cy, angMom_cz+1), (angMom_dx, angMom_dy, angMom_dz-1), Z
|
|
||||||
in
|
|
||||||
let h1 =
|
let h1 =
|
||||||
hrr angMom_a angMom_b cp dm totAngMom_a totAngMom_b (totAngMom_c+1) (totAngMom_d-1)
|
hrr angMom_a angMom_b cp dm
|
||||||
in
|
in
|
||||||
let f2 = Coordinate.get xyz center_cd in
|
let f2 = Coordinate.get xyz center_cd in
|
||||||
if (abs_float f2 < cutoff) then h1 else
|
if (abs_float f2 < cutoff) then h1 else
|
||||||
let h2 =
|
let h2 =
|
||||||
hrr angMom_a angMom_b angMom_c dm totAngMom_a totAngMom_b totAngMom_c (totAngMom_d-1)
|
hrr angMom_a angMom_b angMom_c dm
|
||||||
in
|
in
|
||||||
h1 +. f2 *. h2
|
h1 +. f2 *. h2
|
||||||
|
|
||||||
in
|
in
|
||||||
hrr angMom_a angMom_b angMom_c angMom_d
|
hrr angMom_a angMom_b angMom_c angMom_d
|
||||||
totAngMom_a totAngMom_b totAngMom_c totAngMom_d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -400,25 +367,21 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
(* Compute the integral class from the primitive shell quartet *)
|
(* Compute the integral class from the primitive shell quartet *)
|
||||||
class_indices
|
class_indices
|
||||||
|> Array.iteri (fun i key ->
|
|> Array.iteri (fun i key ->
|
||||||
let (angMomA,angMomB,angMomC,angMomD) =
|
let (angMom_a,angMom_b,angMom_c,angMom_d) =
|
||||||
match Zkey.to_int_tuple ~kind:Zkey.Kind_12 key with
|
match Zkey.to_powers ~kind:Zkey.Kind_12 key with
|
||||||
| Zkey.Twelve x -> x
|
| Zkey.Twelve x -> x
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
try
|
try
|
||||||
if monocentric then
|
if monocentric then
|
||||||
begin
|
begin
|
||||||
let ax,ay,az = angMomA
|
if ( ((1 land angMom_a.x+angMom_b.x+angMom_c.x+angMom_d.x)=1) ||
|
||||||
and bx,by,bz = angMomB
|
((1 land angMom_a.y+angMom_b.y+angMom_c.y+angMom_d.y)=1) ||
|
||||||
and cx,cy,cz = angMomC
|
((1 land angMom_a.z+angMom_b.z+angMom_c.z+angMom_d.z)=1)
|
||||||
and dx,dy,dz = angMomD
|
|
||||||
in
|
|
||||||
if ( ((1 land ax+bx+cx+dx)=1) ||
|
|
||||||
((1 land ay+by+cy+dy)=1) ||
|
|
||||||
((1 land az+bz+cz+dz)=1)
|
|
||||||
) then
|
) then
|
||||||
raise NullQuartet
|
raise NullQuartet
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(*
|
(*
|
||||||
(* Schwartz screening *)
|
(* Schwartz screening *)
|
||||||
if (maxm > 2) then
|
if (maxm > 2) then
|
||||||
@ -448,10 +411,8 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
let norm = norm_coef_scale.(i) in
|
let norm = norm_coef_scale.(i) in
|
||||||
let coef_prod = coef_prod *. norm in
|
let coef_prod = coef_prod *. norm in
|
||||||
let integral =
|
let integral =
|
||||||
hvrr_two_e (angMomA, angMomB, angMomC, angMomD)
|
hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
||||||
(Contracted_shell.totAngMom shell_a, Contracted_shell.totAngMom shell_b,
|
zero_m_array
|
||||||
Contracted_shell.totAngMom shell_c, Contracted_shell.totAngMom shell_d)
|
|
||||||
(maxm, zero_m_array)
|
|
||||||
(Contracted_shell.expo shell_b b, Contracted_shell.expo shell_d d)
|
(Contracted_shell.expo shell_b b, Contracted_shell.expo shell_d d)
|
||||||
(shell_p.ContractedShellPair.expo_inv.(ab),
|
(shell_p.ContractedShellPair.expo_inv.(ab),
|
||||||
shell_q.ContractedShellPair.expo_inv.(cd) )
|
shell_q.ContractedShellPair.expo_inv.(cd) )
|
||||||
|
@ -18,25 +18,13 @@ let at_least_one_valid arr =
|
|||||||
|
|
||||||
(** Horizontal and Vertical Recurrence Relations (HVRR) *)
|
(** Horizontal and Vertical Recurrence Relations (HVRR) *)
|
||||||
let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
||||||
(totAngMom_a, totAngMom_b, totAngMom_c, totAngMom_d)
|
zero_m_array
|
||||||
(maxm, zero_m_array)
|
|
||||||
(expo_b, expo_d)
|
(expo_b, expo_d)
|
||||||
(expo_inv_p, expo_inv_q)
|
(expo_inv_p, expo_inv_q)
|
||||||
(center_ab, center_cd, center_pq)
|
(center_ab, center_cd, center_pq)
|
||||||
map_1d map_2d np nq
|
map_1d map_2d np nq
|
||||||
=
|
=
|
||||||
|
|
||||||
let angMom_a = Powers.of_int_tuple angMom_a
|
|
||||||
and angMom_b = Powers.of_int_tuple angMom_b
|
|
||||||
and angMom_c = Powers.of_int_tuple angMom_c
|
|
||||||
and angMom_d = Powers.of_int_tuple angMom_d
|
|
||||||
in
|
|
||||||
let totAngMom_a = angMom_a.tot
|
|
||||||
and totAngMom_b = angMom_b.tot
|
|
||||||
and totAngMom_c = angMom_c.tot
|
|
||||||
and totAngMom_d = angMom_d.tot
|
|
||||||
in
|
|
||||||
|
|
||||||
let get_xyz angMom =
|
let get_xyz angMom =
|
||||||
match angMom with
|
match angMom with
|
||||||
| { y=0 ; z=0 ; _ } -> X
|
| { y=0 ; z=0 ; _ } -> X
|
||||||
@ -45,126 +33,115 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
in
|
in
|
||||||
|
|
||||||
(** Vertical recurrence relations *)
|
(** Vertical recurrence relations *)
|
||||||
let rec vrr0_v m angMom_a = function
|
let rec vrr0_v m angMom_a =
|
||||||
|
match angMom_a.tot with
|
||||||
| 0 -> Some zero_m_array.(m)
|
| 0 -> Some zero_m_array.(m)
|
||||||
| totAngMom_a ->
|
| _ ->
|
||||||
let key = Zkey.of_int_tuple (Zkey.Three (Powers.to_int_tuple angMom_a))
|
let key = Zkey.of_powers (Zkey.Three angMom_a)
|
||||||
in
|
in
|
||||||
|
|
||||||
try Zmap.find map_1d.(m) key with
|
try Zmap.find map_1d.(m) key with
|
||||||
| Not_found ->
|
| Not_found ->
|
||||||
let result =
|
let result =
|
||||||
try
|
let xyz = get_xyz angMom_a in
|
||||||
let xyz = get_xyz angMom_a in
|
let am = Powers.decr xyz angMom_a in
|
||||||
let am =
|
let amxyz = Powers.get xyz am in
|
||||||
try Powers.decr xyz angMom_a
|
if amxyz >= 0 then
|
||||||
with Invalid_argument _ -> raise Exit
|
begin
|
||||||
|
let cab = Coordinate.get xyz center_ab in
|
||||||
|
let v1_top, p1_top =
|
||||||
|
if abs_float cab < cutoff then
|
||||||
|
None,
|
||||||
|
vrr0_v (m+1) am
|
||||||
|
else
|
||||||
|
vrr0_v m am, vrr0_v (m+1) am
|
||||||
|
in
|
||||||
|
let v1_top2, p1_top2 =
|
||||||
|
if amxyz < 1 then None, None else
|
||||||
|
let amm = Powers.decr xyz am in
|
||||||
|
vrr0_v m amm, vrr0_v (m+1) amm
|
||||||
in
|
in
|
||||||
(*
|
|
||||||
if amxyz < 0 then
|
|
||||||
raise Exit
|
|
||||||
else
|
|
||||||
*)
|
|
||||||
begin
|
|
||||||
let cab = Coordinate.get xyz center_ab in
|
|
||||||
let v1_top, p1_top =
|
|
||||||
if abs_float cab < cutoff then
|
|
||||||
None,
|
|
||||||
vrr0_v (m+1) am (totAngMom_a-1)
|
|
||||||
else
|
|
||||||
vrr0_v m am (totAngMom_a-1),
|
|
||||||
vrr0_v (m+1) am (totAngMom_a-1)
|
|
||||||
in
|
|
||||||
let v1_top2, p1_top2 =
|
|
||||||
try
|
|
||||||
(*
|
|
||||||
if amxyz < 1 then None, None else
|
|
||||||
*)
|
|
||||||
let amm = Powers.decr xyz am in
|
|
||||||
vrr0_v m amm (totAngMom_a-2),
|
|
||||||
vrr0_v (m+1) amm (totAngMom_a-2)
|
|
||||||
with Invalid_argument _ -> None, None
|
|
||||||
in
|
|
||||||
|
|
||||||
let result = Array.make_matrix np nq 0. in
|
let result = Array.make_matrix np nq 0. in
|
||||||
let p0 =
|
let p0 =
|
||||||
match p1_top with
|
match p1_top with
|
||||||
| Some p1_top -> p1_top
|
| Some p1_top -> p1_top
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
begin
|
begin
|
||||||
match v1_top with
|
match v1_top with
|
||||||
| None -> ()
|
| None -> ()
|
||||||
| Some v0 ->
|
| Some v0 ->
|
||||||
Array.iteri (fun l result_l ->
|
Array.iteri (fun l result_l ->
|
||||||
let f0 = -. expo_b.(l) *. expo_inv_p.(l) *. cab
|
let f0 = -. expo_b.(l) *. expo_inv_p.(l) *. cab
|
||||||
and v0_l = v0.(l)
|
and v0_l = v0.(l)
|
||||||
in
|
in
|
||||||
Array.iteri (fun k v0_lk ->
|
Array.iteri (fun k v0_lk ->
|
||||||
result_l.(k) <- v0_lk *. f0) v0_l ) result
|
result_l.(k) <- v0_lk *. f0) v0_l ) result
|
||||||
end;
|
end;
|
||||||
let amxyz = Powers.get xyz am in
|
let amxyz = Powers.get xyz am in
|
||||||
if amxyz < 1 then
|
if amxyz < 1 then
|
||||||
Array.iteri (fun l result_l ->
|
Array.iteri (fun l result_l ->
|
||||||
let expo_inv_p_l = expo_inv_p.(l)
|
let expo_inv_p_l = expo_inv_p.(l)
|
||||||
and center_pq_xyz_l = (center_pq xyz).(l)
|
and center_pq_xyz_l = (center_pq xyz).(l)
|
||||||
and result_l = result.(l)
|
and result_l = result.(l)
|
||||||
and p0_l = p0.(l)
|
and p0_l = p0.(l)
|
||||||
in
|
in
|
||||||
Array.iteri (fun k p0_lk ->
|
Array.iteri (fun k p0_lk ->
|
||||||
result_l.(k) <- result_l.(k)
|
result_l.(k) <- result_l.(k)
|
||||||
+. expo_inv_p_l *. center_pq_xyz_l.(k) *. p0_lk
|
+. expo_inv_p_l *. center_pq_xyz_l.(k) *. p0_lk
|
||||||
) p0_l ) result
|
) p0_l ) result
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
let v1 =
|
let v1 =
|
||||||
match v1_top2 with
|
match v1_top2 with
|
||||||
| Some v1_top2 -> v1_top2
|
| Some v1_top2 -> v1_top2
|
||||||
| None -> assert false
|
| None -> assert false
|
||||||
|
in
|
||||||
|
let v2 =
|
||||||
|
match p1_top2 with
|
||||||
|
| Some p1_top2 -> p1_top2
|
||||||
|
| None -> assert false
|
||||||
|
in
|
||||||
|
Array.iteri (fun l result_l ->
|
||||||
|
let f = float_of_int amxyz *. expo_inv_p.(l) *. 0.5
|
||||||
|
and expo_inv_p_l = expo_inv_p.(l)
|
||||||
|
and center_pq_xyz_l = (center_pq xyz).(l)
|
||||||
|
and v1_l = v1.(l)
|
||||||
|
and v2_l = v2.(l)
|
||||||
|
and result_l = result.(l)
|
||||||
in
|
in
|
||||||
let v2 =
|
Array.iteri (fun k p0_lk ->
|
||||||
match p1_top2 with
|
|
||||||
| Some p1_top2 -> p1_top2
|
|
||||||
| None -> assert false
|
|
||||||
in
|
|
||||||
Array.iteri (fun l result_l ->
|
|
||||||
let f = float_of_int amxyz *. expo_inv_p.(l) *. 0.5
|
|
||||||
and expo_inv_p_l = expo_inv_p.(l)
|
|
||||||
and center_pq_xyz_l = (center_pq xyz).(l)
|
|
||||||
and v1_l = v1.(l)
|
|
||||||
and v2_l = v2.(l)
|
|
||||||
and result_l = result.(l)
|
|
||||||
in
|
|
||||||
Array.iteri (fun k p0_lk ->
|
|
||||||
result_l.(k) <- result_l.(k) +.
|
result_l.(k) <- result_l.(k) +.
|
||||||
expo_inv_p_l *. center_pq_xyz_l.(k) *. p0_lk +.
|
expo_inv_p_l *. center_pq_xyz_l.(k) *. p0_lk +.
|
||||||
f *. (v1_l.(k) +. v2_l.(k) *. expo_inv_p_l)
|
f *. (v1_l.(k) +. v2_l.(k) *. expo_inv_p_l)
|
||||||
) p0.(l)
|
) p0.(l)
|
||||||
) result
|
) result
|
||||||
end;
|
end;
|
||||||
Some result
|
Some result
|
||||||
end
|
end
|
||||||
with Exit -> None
|
else
|
||||||
in
|
None
|
||||||
Zmap.add map_1d.(m) key result;
|
in
|
||||||
result
|
Zmap.add map_1d.(m) key result;
|
||||||
|
result
|
||||||
|
|
||||||
and vrr_v m angMom_a angMom_c totAngMom_a totAngMom_c =
|
and vrr_v m angMom_a angMom_c =
|
||||||
|
|
||||||
match (totAngMom_a, totAngMom_c) with
|
match (angMom_a.tot, angMom_c.tot) with
|
||||||
| (i,0) -> vrr0_v m angMom_a totAngMom_a
|
| (i,0) -> vrr0_v m angMom_a
|
||||||
| (_,_) ->
|
| (_,_) ->
|
||||||
|
|
||||||
let key = Zkey.of_int_tuple (Zkey.Six Powers.(to_int_tuple angMom_a, to_int_tuple angMom_c))
|
let key = Zkey.of_powers (Zkey.Six (angMom_a, angMom_c))
|
||||||
in
|
in
|
||||||
|
|
||||||
try Zmap.find map_2d.(m) key with
|
try Zmap.find map_2d.(m) key with
|
||||||
| Not_found ->
|
| Not_found ->
|
||||||
let result =
|
let result =
|
||||||
begin
|
begin
|
||||||
let xyz = get_xyz angMom_c in
|
let xyz = get_xyz angMom_c in
|
||||||
let cm = Powers.decr xyz angMom_c in
|
let cm = Powers.decr xyz angMom_c in
|
||||||
let axyz = Powers.get xyz angMom_a in
|
let axyz = Powers.get xyz angMom_a in
|
||||||
|
|
||||||
let do_compute = ref false in
|
let do_compute = ref false in
|
||||||
let v1 =
|
let v1 =
|
||||||
@ -172,56 +149,56 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
|
|
||||||
let f1 =
|
let f1 =
|
||||||
Array.init nq (fun k ->
|
Array.init nq (fun k ->
|
||||||
let x = expo_d.(k) *. expo_inv_q.(k) *. f in
|
let x = expo_d.(k) *. expo_inv_q.(k) *. f in
|
||||||
if ( (not !do_compute) && (abs_float x > cutoff) ) then
|
if ( (not !do_compute) && (abs_float x > cutoff) ) then
|
||||||
do_compute := true;
|
do_compute := true;
|
||||||
x)
|
x)
|
||||||
in
|
in
|
||||||
if (!do_compute) then
|
if (!do_compute) then
|
||||||
match vrr_v m angMom_a cm totAngMom_a (totAngMom_c-1) with
|
match vrr_v m angMom_a cm with
|
||||||
| None -> None
|
| None -> None
|
||||||
| Some v1 ->
|
| Some v1 ->
|
||||||
begin
|
begin
|
||||||
let result = Array.make_matrix np nq 0. in
|
let result = Array.make_matrix np nq 0. in
|
||||||
for l=0 to np-1 do
|
for l=0 to np-1 do
|
||||||
for k=0 to nq-1 do
|
for k=0 to nq-1 do
|
||||||
result.(l).(k) <- v1.(l).(k) *. f1.(k)
|
result.(l).(k) <- v1.(l).(k) *. f1.(k)
|
||||||
done
|
done
|
||||||
done;
|
done;
|
||||||
Some (
|
Some (
|
||||||
Array.init np (fun l ->
|
Array.init np (fun l ->
|
||||||
let v1_l = v1.(l) in
|
let v1_l = v1.(l) in
|
||||||
Array.init nq (fun k -> v1_l.(k) *. f1.(k))
|
Array.init nq (fun k -> v1_l.(k) *. f1.(k))
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
else None
|
else None
|
||||||
in
|
in
|
||||||
|
|
||||||
let v2 =
|
let v2 =
|
||||||
let f2 =
|
let f2 =
|
||||||
Array.init np (fun l ->
|
Array.init np (fun l ->
|
||||||
let cpq_l = (center_pq xyz).(l) in
|
let cpq_l = (center_pq xyz).(l) in
|
||||||
Array.init nq (fun k ->
|
Array.init nq (fun k ->
|
||||||
let x = expo_inv_q.(k) *. cpq_l.(k) in
|
let x = expo_inv_q.(k) *. cpq_l.(k) in
|
||||||
if (!do_compute) then x
|
if (!do_compute) then x
|
||||||
else (if abs_float x > cutoff then do_compute := true ; x)
|
else (if abs_float x > cutoff then do_compute := true ; x)
|
||||||
) )
|
) )
|
||||||
in
|
in
|
||||||
if (!do_compute) then
|
if (!do_compute) then
|
||||||
match vrr_v (m+1) angMom_a cm totAngMom_a (totAngMom_c-1) with
|
match vrr_v (m+1) angMom_a cm with
|
||||||
| None -> None
|
| None -> None
|
||||||
| Some v2 ->
|
| Some v2 ->
|
||||||
begin
|
begin
|
||||||
for l=0 to np-1 do
|
for l=0 to np-1 do
|
||||||
let f2_l = f2.(l)
|
let f2_l = f2.(l)
|
||||||
and v2_l = v2.(l)
|
and v2_l = v2.(l)
|
||||||
in
|
in
|
||||||
for k=0 to nq-1 do
|
for k=0 to nq-1 do
|
||||||
f2_l.(k) <- -. v2_l.(k) *. f2_l.(k)
|
f2_l.(k) <- -. v2_l.(k) *. f2_l.(k)
|
||||||
done
|
done
|
||||||
done;
|
done;
|
||||||
Some f2
|
Some f2
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
None
|
None
|
||||||
in
|
in
|
||||||
@ -232,81 +209,75 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
| None, Some v2 -> Some v2
|
| None, Some v2 -> Some v2
|
||||||
| Some v1, None -> Some v1
|
| Some v1, None -> Some v1
|
||||||
| Some v1, Some v2 ->
|
| Some v1, Some v2 ->
|
||||||
begin
|
begin
|
||||||
for l=0 to np-1 do
|
for l=0 to np-1 do
|
||||||
let v1_l = v1.(l)
|
let v1_l = v1.(l)
|
||||||
and v2_l = v2.(l)
|
and v2_l = v2.(l)
|
||||||
in
|
in
|
||||||
for k=0 to nq-1 do
|
for k=0 to nq-1 do
|
||||||
v2_l.(k) <- v2_l.(k) +. v1_l.(k)
|
v2_l.(k) <- v2_l.(k) +. v1_l.(k)
|
||||||
done
|
done
|
||||||
done;
|
done;
|
||||||
Some v2
|
Some v2
|
||||||
end
|
end
|
||||||
in
|
in
|
||||||
|
|
||||||
let cxyz = Powers.get xyz angMom_c in
|
let cxyz = Powers.get xyz angMom_c in
|
||||||
let p2 =
|
let p2 =
|
||||||
try
|
if cxyz < 2 then p1 else
|
||||||
let cmm =
|
let cmm = Powers.decr xyz cm in
|
||||||
try Powers.decr xyz cm
|
|
||||||
with Invalid_argument _ -> raise Exit
|
|
||||||
in
|
|
||||||
if Powers.get xyz cmm < 0 then
|
|
||||||
raise Exit;
|
|
||||||
|
|
||||||
let fcm = (float_of_int (cxyz-1)) *. 0.5 in
|
let fcm = (float_of_int (cxyz-1)) *. 0.5 in
|
||||||
let f1 =
|
let f1 =
|
||||||
Array.init nq (fun k ->
|
Array.init nq (fun k ->
|
||||||
let x = fcm *. expo_inv_q.(k) in
|
let x = fcm *. expo_inv_q.(k) in
|
||||||
if (!do_compute) then x
|
if (!do_compute) then x
|
||||||
else (if abs_float x > cutoff then do_compute := true ; x)
|
else (if abs_float x > cutoff then do_compute := true ; x)
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
let v1 =
|
let v1 =
|
||||||
if (!do_compute) then
|
if (!do_compute) then
|
||||||
match vrr_v m angMom_a cmm totAngMom_a (totAngMom_c-2) with
|
match vrr_v m angMom_a cmm with
|
||||||
| None -> None
|
| None -> None
|
||||||
| Some v1 ->
|
| Some v1 ->
|
||||||
begin
|
begin
|
||||||
let result = Array.make_matrix np nq 0. in
|
let result = Array.make_matrix np nq 0. in
|
||||||
for l=0 to np-1 do
|
for l=0 to np-1 do
|
||||||
let v1_l = v1.(l)
|
let v1_l = v1.(l)
|
||||||
and result_l = result.(l)
|
and result_l = result.(l)
|
||||||
in
|
in
|
||||||
for k=0 to nq-1 do
|
for k=0 to nq-1 do
|
||||||
result_l.(k) <- v1_l.(k) *. f1.(k)
|
result_l.(k) <- v1_l.(k) *. f1.(k)
|
||||||
done;
|
|
||||||
done;
|
done;
|
||||||
Some result
|
done;
|
||||||
end
|
Some result
|
||||||
|
end
|
||||||
else None
|
else None
|
||||||
in
|
in
|
||||||
|
|
||||||
let v3 =
|
let v3 =
|
||||||
let f2 =
|
let f2 =
|
||||||
Array.init nq (fun k ->
|
Array.init nq (fun k ->
|
||||||
let x = expo_inv_q.(k) *. f1.(k) in
|
let x = expo_inv_q.(k) *. f1.(k) in
|
||||||
if (!do_compute) then x
|
if (!do_compute) then x
|
||||||
else (if abs_float x > cutoff then do_compute := true ; x)
|
else (if abs_float x > cutoff then do_compute := true ; x)
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
if (!do_compute) then
|
if (!do_compute) then
|
||||||
match vrr_v (m+1) angMom_a cmm totAngMom_a (totAngMom_c-2) with
|
match vrr_v (m+1) angMom_a cmm with
|
||||||
| None -> None
|
| None -> None
|
||||||
| Some v3 ->
|
| Some v3 ->
|
||||||
begin
|
begin
|
||||||
let result = Array.make_matrix np nq 0. in
|
let result = Array.make_matrix np nq 0. in
|
||||||
for l=0 to np-1 do
|
for l=0 to np-1 do
|
||||||
let v3_l = v3.(l)
|
let v3_l = v3.(l)
|
||||||
and result_l = result.(l)
|
and result_l = result.(l)
|
||||||
in
|
in
|
||||||
for k=0 to nq-1 do
|
for k=0 to nq-1 do
|
||||||
result_l.(k) <- v3_l.(k) *. f2.(k)
|
result_l.(k) <- v3_l.(k) *. f2.(k)
|
||||||
done
|
done
|
||||||
done;
|
done;
|
||||||
Some result
|
Some result
|
||||||
end
|
end
|
||||||
else None
|
else None
|
||||||
in
|
in
|
||||||
match p1, v1, v3 with
|
match p1, v1, v3 with
|
||||||
@ -315,88 +286,81 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
| None, Some v1, None -> Some v1
|
| None, Some v1, None -> Some v1
|
||||||
| None, None, Some v3 -> Some v3
|
| None, None, Some v3 -> Some v3
|
||||||
| Some p1, Some v1, Some v3 ->
|
| Some p1, Some v1, Some v3 ->
|
||||||
begin
|
begin
|
||||||
for l=0 to np-1 do
|
for l=0 to np-1 do
|
||||||
let v3_l = v3.(l)
|
let v3_l = v3.(l)
|
||||||
and v1_l = v1.(l)
|
and v1_l = v1.(l)
|
||||||
and p1_l = p1.(l)
|
and p1_l = p1.(l)
|
||||||
in
|
|
||||||
for k=0 to nq-1 do
|
|
||||||
v3_l.(k) <- p1_l.(k) +. v1_l.(k) +. v3_l.(k)
|
|
||||||
done
|
|
||||||
done;
|
|
||||||
Some v3
|
|
||||||
end
|
|
||||||
| Some p1, Some v1, None ->
|
|
||||||
begin
|
|
||||||
for l=0 to np-1 do
|
|
||||||
let v1_l = v1.(l)
|
|
||||||
and p1_l = p1.(l)
|
|
||||||
in
|
|
||||||
for k=0 to nq-1 do
|
|
||||||
p1_l.(k) <- v1_l.(k) +. p1_l.(k)
|
|
||||||
done
|
|
||||||
done;
|
|
||||||
Some p1
|
|
||||||
end
|
|
||||||
| Some p1, None, Some v3 ->
|
|
||||||
begin
|
|
||||||
for l=0 to np-1 do
|
|
||||||
let v3_l = v3.(l)
|
|
||||||
and p1_l = p1.(l)
|
|
||||||
in
|
|
||||||
for k=0 to nq-1 do
|
|
||||||
p1_l.(k) <- p1_l.(k) +. v3_l.(k)
|
|
||||||
done
|
|
||||||
done;
|
|
||||||
Some p1
|
|
||||||
end
|
|
||||||
| None , Some v1, Some v3 ->
|
|
||||||
begin
|
|
||||||
for l=0 to np-1 do
|
|
||||||
let v3_l = v3.(l)
|
|
||||||
and v1_l = v1.(l)
|
|
||||||
in
|
|
||||||
for k=0 to nq-1 do
|
|
||||||
v3_l.(k) <- v1_l.(k) +. v3_l.(k)
|
|
||||||
done
|
|
||||||
done;
|
|
||||||
Some v3
|
|
||||||
end
|
|
||||||
with Exit -> p1
|
|
||||||
in
|
|
||||||
try
|
|
||||||
let am =
|
|
||||||
try Powers.decr xyz angMom_a
|
|
||||||
with Invalid_argument _ -> raise Exit
|
|
||||||
in
|
|
||||||
if (axyz < 1) || (cxyz < 1) then
|
|
||||||
raise Exit;
|
|
||||||
let v =
|
|
||||||
vrr_v (m+1) am cm (totAngMom_a-1) (totAngMom_c-1)
|
|
||||||
in
|
|
||||||
match (p2, v) with
|
|
||||||
| None, None -> None
|
|
||||||
| Some p2, None -> Some p2
|
|
||||||
| _, Some v ->
|
|
||||||
begin
|
|
||||||
let p2 =
|
|
||||||
match p2 with
|
|
||||||
| None -> Array.make_matrix np nq 0.
|
|
||||||
| Some p2 -> p2
|
|
||||||
in
|
in
|
||||||
for l=0 to np-1 do
|
for k=0 to nq-1 do
|
||||||
let fa = (float_of_int axyz) *. expo_inv_p.(l) *. 0.5 in
|
v3_l.(k) <- p1_l.(k) +. v1_l.(k) +. v3_l.(k)
|
||||||
let p2_l = p2.(l)
|
done
|
||||||
and v_l = v.(l)
|
done;
|
||||||
in
|
Some v3
|
||||||
for k=0 to nq-1 do
|
end
|
||||||
p2_l.(k) <- p2_l.(k) -. fa *. expo_inv_q.(k) *. v_l.(k)
|
| Some p1, Some v1, None ->
|
||||||
done
|
begin
|
||||||
done;
|
for l=0 to np-1 do
|
||||||
Some p2
|
let v1_l = v1.(l)
|
||||||
end
|
and p1_l = p1.(l)
|
||||||
with Exit -> p2
|
in
|
||||||
|
for k=0 to nq-1 do
|
||||||
|
p1_l.(k) <- v1_l.(k) +. p1_l.(k)
|
||||||
|
done
|
||||||
|
done;
|
||||||
|
Some p1
|
||||||
|
end
|
||||||
|
| Some p1, None, Some v3 ->
|
||||||
|
begin
|
||||||
|
for l=0 to np-1 do
|
||||||
|
let v3_l = v3.(l)
|
||||||
|
and p1_l = p1.(l)
|
||||||
|
in
|
||||||
|
for k=0 to nq-1 do
|
||||||
|
p1_l.(k) <- p1_l.(k) +. v3_l.(k)
|
||||||
|
done
|
||||||
|
done;
|
||||||
|
Some p1
|
||||||
|
end
|
||||||
|
| None , Some v1, Some v3 ->
|
||||||
|
begin
|
||||||
|
for l=0 to np-1 do
|
||||||
|
let v3_l = v3.(l)
|
||||||
|
and v1_l = v1.(l)
|
||||||
|
in
|
||||||
|
for k=0 to nq-1 do
|
||||||
|
v3_l.(k) <- v1_l.(k) +. v3_l.(k)
|
||||||
|
done
|
||||||
|
done;
|
||||||
|
Some v3
|
||||||
|
end
|
||||||
|
in
|
||||||
|
if (axyz < 1) || (cxyz < 1) then p2 else
|
||||||
|
let am = Powers.decr xyz angMom_a in
|
||||||
|
let v =
|
||||||
|
vrr_v (m+1) am cm
|
||||||
|
in
|
||||||
|
match (p2, v) with
|
||||||
|
| None, None -> None
|
||||||
|
| Some p2, None -> Some p2
|
||||||
|
| _, Some v ->
|
||||||
|
begin
|
||||||
|
let p2 =
|
||||||
|
match p2 with
|
||||||
|
| None -> Array.make_matrix np nq 0.
|
||||||
|
| Some p2 -> p2
|
||||||
|
in
|
||||||
|
for l=0 to np-1 do
|
||||||
|
let fa = (float_of_int axyz) *. expo_inv_p.(l) *. 0.5 in
|
||||||
|
let p2_l = p2.(l)
|
||||||
|
and v_l = v.(l)
|
||||||
|
in
|
||||||
|
for k=0 to nq-1 do
|
||||||
|
p2_l.(k) <- p2_l.(k) -. fa *. expo_inv_q.(k) *. v_l.(k)
|
||||||
|
done
|
||||||
|
done;
|
||||||
|
Some p2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
in Zmap.add map_2d.(m) key result;
|
in Zmap.add map_2d.(m) key result;
|
||||||
result
|
result
|
||||||
@ -405,18 +369,17 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
|
|
||||||
|
|
||||||
(** Horizontal recurrence relations *)
|
(** Horizontal recurrence relations *)
|
||||||
and hrr0_v angMom_a angMom_b angMom_c
|
and hrr0_v angMom_a angMom_b angMom_c =
|
||||||
totAngMom_a totAngMom_b totAngMom_c =
|
|
||||||
|
|
||||||
match totAngMom_b with
|
match angMom_b.tot with
|
||||||
| 0 ->
|
| 0 ->
|
||||||
begin
|
begin
|
||||||
match (totAngMom_a, totAngMom_c) with
|
match (angMom_a.tot, angMom_c.tot) with
|
||||||
| (0,0) -> Array.fold_left (fun accu c ->
|
| (0,0) -> Array.fold_left (fun accu c ->
|
||||||
accu +. Array.fold_left (+.) 0. c) 0. zero_m_array.(0)
|
accu +. Array.fold_left (+.) 0. c) 0. zero_m_array.(0)
|
||||||
| (_,_) ->
|
| (_,_) ->
|
||||||
begin
|
begin
|
||||||
match vrr_v 0 angMom_a angMom_c totAngMom_a totAngMom_c with
|
match vrr_v 0 angMom_a angMom_c with
|
||||||
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
||||||
| None -> 0.
|
| None -> 0.
|
||||||
end
|
end
|
||||||
@ -426,69 +389,60 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
let ap = Powers.incr xyz angMom_a in
|
let ap = Powers.incr xyz angMom_a in
|
||||||
let f = Coordinate.get xyz center_ab in
|
let f = Coordinate.get xyz center_ab in
|
||||||
let v1 =
|
let v1 =
|
||||||
match vrr_v 0 ap angMom_c (totAngMom_a+1) totAngMom_c with
|
match vrr_v 0 ap angMom_c with
|
||||||
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
||||||
| None -> 0.
|
| None -> 0.
|
||||||
in
|
in
|
||||||
if (abs_float f < cutoff) then v1 else
|
if (abs_float f < cutoff) then v1 else
|
||||||
let v2 =
|
let v2 =
|
||||||
match vrr_v 0 angMom_a angMom_c totAngMom_a totAngMom_c with
|
match vrr_v 0 angMom_a angMom_c with
|
||||||
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
||||||
| None -> 0.
|
| None -> 0.
|
||||||
in
|
in
|
||||||
v1 +. v2 *. f
|
v1 +. v2 *. f
|
||||||
| _ ->
|
| _ ->
|
||||||
let xyz = get_xyz angMom_b in
|
let xyz = get_xyz angMom_b in
|
||||||
let bxyz = Powers.get xyz angMom_b in
|
let bxyz = Powers.get xyz angMom_b in
|
||||||
if (bxyz < 1) then 0. else
|
if (bxyz < 0) then 0. else
|
||||||
let ap = Powers.incr xyz angMom_a in
|
let ap = Powers.incr xyz angMom_a in
|
||||||
let bm =
|
let bm = Powers.decr xyz angMom_b in
|
||||||
try Powers.decr xyz angMom_b
|
|
||||||
with Invalid_argument _ -> raise Exit
|
|
||||||
in
|
|
||||||
|
|
||||||
let h1 =
|
let h1 =
|
||||||
hrr0_v ap bm angMom_c (totAngMom_a+1) (totAngMom_b-1) totAngMom_c
|
hrr0_v ap bm angMom_c
|
||||||
in
|
in
|
||||||
let f = Coordinate.get xyz center_ab in
|
let f = Coordinate.get xyz center_ab in
|
||||||
if abs_float f < cutoff then h1 else
|
if abs_float f < cutoff then h1 else
|
||||||
let h2 =
|
let h2 =
|
||||||
hrr0_v angMom_a bm angMom_c totAngMom_a (totAngMom_b-1) totAngMom_c
|
hrr0_v angMom_a bm angMom_c
|
||||||
in
|
in
|
||||||
h1 +. h2 *. f
|
h1 +. h2 *. f
|
||||||
|
|
||||||
and hrr_v angMom_a angMom_b angMom_c angMom_d
|
and hrr_v angMom_a angMom_b angMom_c angMom_d =
|
||||||
totAngMom_a totAngMom_b totAngMom_c totAngMom_d =
|
|
||||||
|
|
||||||
match (totAngMom_b, totAngMom_d) with
|
match (angMom_b.tot, angMom_d.tot) with
|
||||||
| (_,0) -> if totAngMom_b = 0 then
|
| (_,0) -> if angMom_b.tot = 0 then
|
||||||
begin
|
begin
|
||||||
match vrr_v 0 angMom_a angMom_c totAngMom_a totAngMom_c with
|
match vrr_v 0 angMom_a angMom_c with
|
||||||
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
||||||
| None -> 0.
|
| None -> 0.
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
hrr0_v angMom_a angMom_b angMom_c totAngMom_a totAngMom_b totAngMom_c
|
hrr0_v angMom_a angMom_b angMom_c
|
||||||
| (_,_) ->
|
| (_,_) ->
|
||||||
let xyz = get_xyz angMom_d in
|
let xyz = get_xyz angMom_d in
|
||||||
let cp = Powers.incr xyz angMom_c in
|
let cp = Powers.incr xyz angMom_c in
|
||||||
let dm =
|
let dm = Powers.decr xyz angMom_d in
|
||||||
try Powers.decr xyz angMom_d
|
|
||||||
with Invalid_argument _ -> raise Exit
|
|
||||||
in
|
|
||||||
let h1 =
|
let h1 =
|
||||||
hrr_v angMom_a angMom_b cp dm totAngMom_a totAngMom_b (totAngMom_c+1) (totAngMom_d-1)
|
hrr_v angMom_a angMom_b cp dm
|
||||||
in
|
in
|
||||||
let f = Coordinate.get xyz center_cd in
|
let f = Coordinate.get xyz center_cd in
|
||||||
if abs_float f < cutoff then
|
if abs_float f < cutoff then
|
||||||
h1
|
h1
|
||||||
else
|
else
|
||||||
let h2 =
|
let h2 =
|
||||||
hrr_v angMom_a angMom_b angMom_c dm totAngMom_a totAngMom_b totAngMom_c (totAngMom_d-1)
|
hrr_v angMom_a angMom_b angMom_c dm
|
||||||
in h1 +. f *. h2
|
in h1 +. f *. h2
|
||||||
in
|
in
|
||||||
hrr_v angMom_a angMom_b angMom_c angMom_d
|
hrr_v angMom_a angMom_b angMom_c angMom_d
|
||||||
totAngMom_a totAngMom_b totAngMom_c totAngMom_d
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -711,32 +665,27 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
in
|
in
|
||||||
(* Compute the integral class from the primitive shell quartet *)
|
(* Compute the integral class from the primitive shell quartet *)
|
||||||
Array.iteri (fun i key ->
|
Array.iteri (fun i key ->
|
||||||
let (angMomA,angMomB,angMomC,angMomD) =
|
let (angMom_a,angMom_b,angMom_c,angMom_d) =
|
||||||
match Zkey.to_int_tuple ~kind:Zkey.Kind_12 key with
|
match Zkey.to_powers ~kind:Zkey.Kind_12 key with
|
||||||
| Zkey.Twelve x -> x
|
| Zkey.Twelve x -> x
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
try
|
try
|
||||||
if monocentric then
|
if monocentric then
|
||||||
begin
|
begin
|
||||||
let ax,ay,az = angMomA
|
if ( ((1 land angMom_a.x + angMom_b.x + angMom_c.x + angMom_d.x) =1) ||
|
||||||
and bx,by,bz = angMomB
|
((1 land angMom_a.y + angMom_b.y + angMom_c.y + angMom_d.y) =1) ||
|
||||||
and cx,cy,cz = angMomC
|
((1 land angMom_a.z + angMom_b.z + angMom_c.z + angMom_d.z) =1)
|
||||||
and dx,dy,dz = angMomD
|
) then
|
||||||
in
|
raise NullQuartet
|
||||||
if ( ((1 land ax+bx+cx+dx)=1) ||
|
end;
|
||||||
((1 land ay+by+cy+dy)=1) ||
|
|
||||||
((1 land az+bz+cz+dz)=1)
|
|
||||||
) then
|
|
||||||
raise NullQuartet
|
|
||||||
end;
|
|
||||||
|
|
||||||
(* Schwartz screening *)
|
(* Schwartz screening *)
|
||||||
if (np+nq> 24) then
|
if (np+nq> 24) then
|
||||||
(
|
(
|
||||||
let schwartz_p =
|
let schwartz_p =
|
||||||
let key = Zkey.of_int_tuple (Zkey.Twelve
|
let key = Zkey.of_powers (Zkey.Twelve
|
||||||
(angMomA, angMomB, angMomA, angMomB) )
|
(angMom_a, angMom_b, angMom_a, angMom_b) )
|
||||||
in
|
in
|
||||||
match schwartz_p with
|
match schwartz_p with
|
||||||
| None -> 1.
|
| None -> 1.
|
||||||
@ -744,8 +693,8 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
in
|
in
|
||||||
if schwartz_p < cutoff then raise NullQuartet;
|
if schwartz_p < cutoff then raise NullQuartet;
|
||||||
let schwartz_q =
|
let schwartz_q =
|
||||||
let key = Zkey.of_int_tuple (Zkey.Twelve
|
let key = Zkey.of_powers (Zkey.Twelve
|
||||||
(angMomC, angMomD, angMomC, angMomD) )
|
(angMom_c, angMom_d, angMom_c, angMom_d) )
|
||||||
in
|
in
|
||||||
match schwartz_q with
|
match schwartz_q with
|
||||||
| None -> 1.
|
| None -> 1.
|
||||||
@ -755,10 +704,8 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
);
|
);
|
||||||
|
|
||||||
let integral =
|
let integral =
|
||||||
hvrr_two_e_vector (angMomA, angMomB, angMomC, angMomD)
|
hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
||||||
(Contracted_shell.totAngMom shell_a, Contracted_shell.totAngMom shell_b,
|
zero_m_array
|
||||||
Contracted_shell.totAngMom shell_c, Contracted_shell.totAngMom shell_d)
|
|
||||||
(maxm, zero_m_array)
|
|
||||||
(expo_b, expo_d)
|
(expo_b, expo_d)
|
||||||
(expo_inv_p, expo_inv_q)
|
(expo_inv_p, expo_inv_q)
|
||||||
(shell_p.ContractedShellPair.center_ab,
|
(shell_p.ContractedShellPair.center_ab,
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
open Powers
|
||||||
|
|
||||||
exception AngularMomentumError of string
|
exception AngularMomentumError of string
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
@ -69,37 +71,37 @@ let n_functions a =
|
|||||||
(** Returns an array of Zkeys corresponding to all possible angular momenta *)
|
(** Returns an array of Zkeys corresponding to all possible angular momenta *)
|
||||||
let zkey_array a =
|
let zkey_array a =
|
||||||
let keys_1d l =
|
let keys_1d l =
|
||||||
let create_z (x,y,_) =
|
let create_z { x ; y ; _ } =
|
||||||
(x,y,l-(x+y))
|
Powers.of_int_tuple (x,y,l-(x+y))
|
||||||
in
|
in
|
||||||
let rec create_y accu xyz =
|
let rec create_y accu xyz =
|
||||||
let (x,y,z) = xyz in
|
let { x ; y ; z } = xyz in
|
||||||
match y with
|
match y with
|
||||||
| 0 -> (create_z xyz)::accu
|
| 0 -> (create_z xyz)::accu
|
||||||
| i -> let ynew = y-1 in
|
| i -> let ynew = y-1 in
|
||||||
create_y ( (create_z xyz)::accu) (x,ynew,z)
|
create_y ( (create_z xyz)::accu) (Powers.of_int_tuple (x,ynew,z))
|
||||||
in
|
in
|
||||||
let rec create_x accu xyz =
|
let rec create_x accu xyz =
|
||||||
let (x,y,z) = xyz in
|
let { x ; y ; z } = xyz in
|
||||||
match x with
|
match x with
|
||||||
| 0 -> (create_y [] xyz)@accu
|
| 0 -> (create_y [] xyz)@accu
|
||||||
| i -> let xnew = x-1 in
|
| i -> let xnew = x-1 in
|
||||||
let ynew = l-xnew in
|
let ynew = l-xnew in
|
||||||
create_x ((create_y [] xyz)@accu) (xnew, ynew, z)
|
create_x ((create_y [] xyz)@accu) (Powers.of_int_tuple (xnew, ynew, z))
|
||||||
in
|
in
|
||||||
create_x [] (l,0,0)
|
create_x [] (Powers.of_int_tuple (l,0,0))
|
||||||
|> List.rev
|
|> List.rev
|
||||||
in
|
in
|
||||||
|
|
||||||
begin
|
begin
|
||||||
match a with
|
match a with
|
||||||
| Singlet l1 ->
|
| Singlet l1 ->
|
||||||
List.map (fun x -> Zkey.of_int_tuple (Zkey.Three x)) (keys_1d @@ to_int l1)
|
List.map (fun x -> Zkey.of_powers (Zkey.Three x)) (keys_1d @@ to_int l1)
|
||||||
|
|
||||||
| Doublet (l1, l2) ->
|
| Doublet (l1, l2) ->
|
||||||
List.map (fun a ->
|
List.map (fun a ->
|
||||||
List.map (fun b ->
|
List.map (fun b ->
|
||||||
Zkey.of_int_tuple (Zkey.Six (a,b))) (keys_1d @@ to_int l2)
|
Zkey.of_powers (Zkey.Six (a,b))) (keys_1d @@ to_int l2)
|
||||||
) (keys_1d @@ to_int l1)
|
) (keys_1d @@ to_int l1)
|
||||||
|> List.concat
|
|> List.concat
|
||||||
|
|
||||||
@ -108,7 +110,7 @@ let zkey_array a =
|
|||||||
List.map (fun a ->
|
List.map (fun a ->
|
||||||
List.map (fun b ->
|
List.map (fun b ->
|
||||||
List.map (fun c ->
|
List.map (fun c ->
|
||||||
Zkey.of_int_tuple (Zkey.Nine (a,b,c))) (keys_1d @@ to_int l3)
|
Zkey.of_powers (Zkey.Nine (a,b,c))) (keys_1d @@ to_int l3)
|
||||||
) (keys_1d @@ to_int l2)
|
) (keys_1d @@ to_int l2)
|
||||||
|> List.concat
|
|> List.concat
|
||||||
) (keys_1d @@ to_int l1)
|
) (keys_1d @@ to_int l1)
|
||||||
@ -120,7 +122,7 @@ let zkey_array a =
|
|||||||
List.map (fun b ->
|
List.map (fun b ->
|
||||||
List.map (fun c ->
|
List.map (fun c ->
|
||||||
List.map (fun d ->
|
List.map (fun d ->
|
||||||
Zkey.of_int_tuple (Zkey.Twelve (a,b,c,d))) (keys_1d @@ to_int l4)
|
Zkey.of_powers (Zkey.Twelve (a,b,c,d))) (keys_1d @@ to_int l4)
|
||||||
) (keys_1d @@ to_int l3)
|
) (keys_1d @@ to_int l3)
|
||||||
|> List.concat
|
|> List.concat
|
||||||
) (keys_1d @@ to_int l2)
|
) (keys_1d @@ to_int l2)
|
||||||
|
@ -18,22 +18,15 @@ let get coord t =
|
|||||||
|
|
||||||
let incr coord t =
|
let incr coord t =
|
||||||
match coord with
|
match coord with
|
||||||
| Coordinate.X -> { t with x = t.x+1 ; tot = t.tot+1 }
|
| Coordinate.X -> let r = t.x+1 in { t with x = r ; tot = t.tot+1 }
|
||||||
| Coordinate.Y -> { t with y = t.y+1 ; tot = t.tot+1 }
|
| Coordinate.Y -> let r = t.y+1 in { t with y = r ; tot = t.tot+1 }
|
||||||
| Coordinate.Z -> { t with z = t.z+1 ; tot = t.tot+1 }
|
| Coordinate.Z -> let r = t.z+1 in { t with z = r ; tot = t.tot+1 }
|
||||||
|
|
||||||
let decr coord t =
|
let decr coord t =
|
||||||
(*
|
|
||||||
let test _ = ()
|
|
||||||
*)
|
|
||||||
let test x =
|
|
||||||
if x < 1 then
|
|
||||||
invalid_arg "Angular_momentum.Powers.decr";
|
|
||||||
in
|
|
||||||
match coord with
|
match coord with
|
||||||
| Coordinate.X -> (test t.x ; { t with x = t.x-1 ; tot = t.tot-1 })
|
| Coordinate.X -> let r = t.x-1 in { t with x = r ; tot = t.tot-1 }
|
||||||
| Coordinate.Y -> (test t.y ; { t with y = t.y-1 ; tot = t.tot-1 })
|
| Coordinate.Y -> let r = t.y-1 in { t with y = r ; tot = t.tot-1 }
|
||||||
| Coordinate.Z -> (test t.z ; { t with z = t.z-1 ; tot = t.tot-1 })
|
| Coordinate.Z -> let r = t.z-1 in { t with z = r ; tot = t.tot-1 }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
|
open Powers
|
||||||
|
|
||||||
(** Key for hastables that contain tuples of integers encoded in small integers *)
|
(** Key for hastables that contain tuples of integers encoded in small integers *)
|
||||||
type kind_array =
|
type kind_array =
|
||||||
| Kind_3
|
| Kind_3
|
||||||
| Kind_6
|
| Kind_6
|
||||||
| Kind_12
|
| Kind_12
|
||||||
| Kind_9
|
| Kind_9
|
||||||
| Kind_4
|
|
||||||
| Kind_2
|
|
||||||
| Kind_1
|
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
{
|
{
|
||||||
@ -40,32 +39,23 @@ let of_int_array ~kind a =
|
|||||||
| Kind_9 ->
|
| Kind_9 ->
|
||||||
of_int a.(0) << a.(1) << a.(2) << a.(3) << a.(4) << a.(5)
|
of_int a.(0) << a.(1) << a.(2) << a.(3) << a.(4) << a.(5)
|
||||||
<| a.(6) << a.(7) << a.(8)
|
<| a.(6) << a.(7) << a.(8)
|
||||||
| Kind_4 -> of_int a.(0) <+ a.(1) <+ a.(2) <+ a.(3)
|
|
||||||
| Kind_2 -> of_int a.(0) <+ a.(1)
|
|
||||||
| Kind_1 -> of_int a.(0)
|
|
||||||
|
|
||||||
|
|
||||||
type kind =
|
type kind =
|
||||||
| One of (int)
|
| Three of Powers.t
|
||||||
| Two of (int*int)
|
| Six of (Powers.t * Powers.t)
|
||||||
| Three of (int*int*int)
|
| Nine of (Powers.t * Powers.t * Powers.t)
|
||||||
| Four of ((int*int)*(int*int))
|
| Twelve of (Powers.t * Powers.t * Powers.t * Powers.t)
|
||||||
| Six of ((int*int*int)*(int*int*int))
|
|
||||||
| Nine of ((int*int*int)*(int*int*int)*(int*int*int))
|
|
||||||
| Twelve of ((int*int*int)*(int*int*int)*(int*int*int)*(int*int*int))
|
|
||||||
|
|
||||||
let of_int_tuple a =
|
let of_powers a =
|
||||||
match a with
|
match a with
|
||||||
| One (a) -> of_int a
|
| Three { x=a ; y=b ; z=c ; _ } -> of_int a <+ b <+ c
|
||||||
| Two (a,b) -> of_int a <+ b
|
| Six ({ x=a ; y=b ; z=c },{ x=d ; y=e ; z=f }) ->
|
||||||
| Three (a,b,c) -> of_int a <+ b <+ c
|
|
||||||
| Four ((a,b),(c,d)) -> of_int a <+ b <+ c <+ d
|
|
||||||
| Six ((a,b,c),(d,e,f)) ->
|
|
||||||
of_int a << b << c << d << e << f
|
of_int a << b << c << d << e << f
|
||||||
| Twelve ((a,b,c),(d,e,f),(g,h,i),(j,k,l)) ->
|
| Twelve ({ x=a ; y=b ; z=c },{ x=d ; y=e ; z=f },{ x=g ; y=h ; z=i },{ x=j ; y=k ; z=l }) ->
|
||||||
of_int a << b << c << d << e << f
|
of_int a << b << c << d << e << f
|
||||||
<| g << h << i << j << k << l
|
<| g << h << i << j << k << l
|
||||||
| Nine ((a,b,c),(d,e,f),(g,h,i)) ->
|
| Nine ({ x=a ; y=b ; z=c },{ x=d ; y=e ; z=f },{ x=g ; y=h ; z=i }) ->
|
||||||
of_int a << b << c << d << e << f
|
of_int a << b << c << d << e << f
|
||||||
<| g << h << i
|
<| g << h << i
|
||||||
|
|
||||||
@ -118,80 +108,59 @@ let to_int_array ~kind { left ; right } =
|
|||||||
mask10 land right
|
mask10 land right
|
||||||
|]
|
|]
|
||||||
|
|
||||||
| Kind_4 -> [|
|
|
||||||
mask15 land (right lsr 45) ;
|
|
||||||
mask15 land (right lsr 30) ;
|
|
||||||
mask15 land (right lsr 15) ;
|
|
||||||
mask15 land right
|
|
||||||
|]
|
|
||||||
|
|
||||||
| Kind_2 -> [|
|
|
||||||
mask15 land (right lsr 15) ;
|
|
||||||
mask15 land right
|
|
||||||
|]
|
|
||||||
|
|
||||||
| Kind_1 -> [| right |]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(** Transform the Zkey into an int tuple *)
|
(** Transform the Zkey into an int tuple *)
|
||||||
let to_int_tuple ~kind { left ; right } =
|
let to_powers ~kind { left ; right } =
|
||||||
match kind with
|
match kind with
|
||||||
| Kind_3 -> Three (
|
| Kind_3 -> Three (Powers.of_int_tuple (
|
||||||
mask15 land (right lsr 30) ,
|
mask15 land (right lsr 30) ,
|
||||||
mask15 land (right lsr 15) ,
|
mask15 land (right lsr 15) ,
|
||||||
mask15 land right
|
mask15 land right
|
||||||
)
|
))
|
||||||
|
|
||||||
| Kind_6 -> Six (
|
| Kind_6 -> Six (Powers.of_int_tuple
|
||||||
( mask10 land (right lsr 50) ,
|
( mask10 land (right lsr 50) ,
|
||||||
mask10 land (right lsr 40) ,
|
mask10 land (right lsr 40) ,
|
||||||
mask10 land (right lsr 30)),
|
mask10 land (right lsr 30)),
|
||||||
|
Powers.of_int_tuple
|
||||||
( mask10 land (right lsr 20) ,
|
( mask10 land (right lsr 20) ,
|
||||||
mask10 land (right lsr 10) ,
|
mask10 land (right lsr 10) ,
|
||||||
mask10 land right )
|
mask10 land right )
|
||||||
)
|
)
|
||||||
|
|
||||||
| Kind_12 -> Twelve (
|
| Kind_12 -> Twelve (Powers.of_int_tuple
|
||||||
( mask10 land (left lsr 50) ,
|
( mask10 land (left lsr 50) ,
|
||||||
mask10 land (left lsr 40) ,
|
mask10 land (left lsr 40) ,
|
||||||
mask10 land (left lsr 30)),
|
mask10 land (left lsr 30)),
|
||||||
|
Powers.of_int_tuple
|
||||||
( mask10 land (left lsr 20) ,
|
( mask10 land (left lsr 20) ,
|
||||||
mask10 land (left lsr 10) ,
|
mask10 land (left lsr 10) ,
|
||||||
mask10 land left ) ,
|
mask10 land left ) ,
|
||||||
|
Powers.of_int_tuple
|
||||||
( mask10 land (right lsr 50) ,
|
( mask10 land (right lsr 50) ,
|
||||||
mask10 land (right lsr 40) ,
|
mask10 land (right lsr 40) ,
|
||||||
mask10 land (right lsr 30)),
|
mask10 land (right lsr 30)),
|
||||||
|
Powers.of_int_tuple
|
||||||
( mask10 land (right lsr 20) ,
|
( mask10 land (right lsr 20) ,
|
||||||
mask10 land (right lsr 10) ,
|
mask10 land (right lsr 10) ,
|
||||||
mask10 land right )
|
mask10 land right )
|
||||||
)
|
)
|
||||||
|
|
||||||
| Kind_9 -> Nine (
|
| Kind_9 -> Nine (Powers.of_int_tuple
|
||||||
( mask10 land (left lsr 20) ,
|
( mask10 land (left lsr 20) ,
|
||||||
mask10 land (left lsr 10) ,
|
mask10 land (left lsr 10) ,
|
||||||
mask10 land left ) ,
|
mask10 land left ) ,
|
||||||
|
Powers.of_int_tuple
|
||||||
( mask10 land (right lsr 50) ,
|
( mask10 land (right lsr 50) ,
|
||||||
mask10 land (right lsr 40) ,
|
mask10 land (right lsr 40) ,
|
||||||
mask10 land (right lsr 30)),
|
mask10 land (right lsr 30)),
|
||||||
|
Powers.of_int_tuple
|
||||||
( mask10 land (right lsr 20) ,
|
( mask10 land (right lsr 20) ,
|
||||||
mask10 land (right lsr 10) ,
|
mask10 land (right lsr 10) ,
|
||||||
mask10 land right )
|
mask10 land right )
|
||||||
)
|
)
|
||||||
|
|
||||||
| Kind_4 -> Four (
|
|
||||||
( mask15 land (right lsr 45) ,
|
|
||||||
mask15 land (right lsr 30)),
|
|
||||||
( mask15 land (right lsr 15) ,
|
|
||||||
mask15 land right )
|
|
||||||
)
|
|
||||||
|
|
||||||
| Kind_2 -> Two (
|
|
||||||
mask15 land (right lsr 15) ,
|
|
||||||
mask15 land right
|
|
||||||
)
|
|
||||||
|
|
||||||
| Kind_1 -> One right
|
|
||||||
|
|
||||||
|
|
||||||
let hash = Hashtbl.hash
|
let hash = Hashtbl.hash
|
||||||
@ -220,15 +189,11 @@ let to_string ~kind { left ; right } =
|
|||||||
|
|
||||||
(*
|
(*
|
||||||
let debug () =
|
let debug () =
|
||||||
let k2 = of_int_array Kind_2 [| 1 ; 2 |]
|
|
||||||
and k3 = of_int_array Kind_3 [| 1 ; 2 ; 3 |]
|
and k3 = of_int_array Kind_3 [| 1 ; 2 ; 3 |]
|
||||||
and k4 = of_int_array Kind_4 [| 1 ; 2 ; 3; 4 |]
|
|
||||||
and k6 = of_int_array Kind_6 [| 1 ; 2 ; 3; 4 ; 5; 6|]
|
and k6 = of_int_array Kind_6 [| 1 ; 2 ; 3; 4 ; 5; 6|]
|
||||||
and k12 = of_int_array Kind_12 [| 1 ; 2 ; 3; 4 ; 5; 6 ; 7 ; 8 ; 9 ; 10 ; 11; 12|]
|
and k12 = of_int_array Kind_12 [| 1 ; 2 ; 3; 4 ; 5; 6 ; 7 ; 8 ; 9 ; 10 ; 11; 12|]
|
||||||
in
|
in
|
||||||
print_endline @@ to_string Kind_2 k2 ;
|
|
||||||
print_endline @@ to_string Kind_3 k3 ;
|
print_endline @@ to_string Kind_3 k3 ;
|
||||||
print_endline @@ to_string Kind_4 k4 ;
|
|
||||||
print_endline @@ to_string Kind_6 k6 ;
|
print_endline @@ to_string Kind_6 k6 ;
|
||||||
print_endline @@ to_string Kind_12 k12
|
print_endline @@ to_string Kind_12 k12
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user