10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-22 04:13:33 +01:00
This commit is contained in:
Anthony Scemama 2018-01-19 18:18:11 +01:00
parent fde8ef7d8c
commit 0e694adf84
5 changed files with 50 additions and 10 deletions

View File

@ -63,7 +63,7 @@ let create ~indice ~expo ~coef ~center ~totAngMom =
assert (Array.length expo > 0); assert (Array.length expo > 0);
let tmp = let tmp =
{ indice ; expo ; coef ; center ; totAngMom ; size=Array.length expo ; norm_coef = [||]; { indice ; expo ; coef ; center ; totAngMom ; size=Array.length expo ; norm_coef = [||];
powers = Angular_momentum.zkey_array (Angular_momentum.Kind_1 totAngMom) } powers = Angular_momentum.zkey_array (Angular_momentum.Singlet totAngMom) }
in in
{ tmp with norm_coef = compute_norm_coef tmp } { tmp with norm_coef = compute_norm_coef tmp }

View File

@ -185,7 +185,7 @@ let contracted_class ~zero_m shell_a shell_b shell_c shell_d : float Zmap.t =
(* Pre-computation of integral class indices *) (* Pre-computation of integral class indices *)
let class_indices = let class_indices =
Angular_momentum.zkey_array Angular_momentum.zkey_array
(Angular_momentum.Kind_4 (Angular_momentum.Quartet
Contracted_shell.(totAngMom shell_a, totAngMom shell_b, Contracted_shell.(totAngMom shell_a, totAngMom shell_b,
totAngMom shell_c, totAngMom shell_d)) totAngMom shell_c, totAngMom shell_d))
in in

View File

@ -53,9 +53,10 @@ let of_int = function
type kind = type kind =
| Kind_1 of t | Singlet of t
| Kind_2 of (t*t) | Doublet of (t*t)
| Kind_4 of (t*t*t*t) | Triplet of (t*t*t)
| Quartet of (t*t*t*t)
let n_functions a = let n_functions a =
@ -92,7 +93,7 @@ let zkey_array a =
begin begin
match a with match a with
| Kind_1 l1 -> | Singlet l1 ->
let a = Array.init 3 (fun _ -> 0) in let a = Array.init 3 (fun _ -> 0) in
List.map (fun (cx,cy,cz) -> List.map (fun (cx,cy,cz) ->
@ -100,7 +101,7 @@ let zkey_array a =
Zkey.(of_int_array Kind_3 a) Zkey.(of_int_array Kind_3 a)
) (keys_1d @@ to_int l1) ) (keys_1d @@ to_int l1)
| Kind_2 (l1, l2) -> | Doublet (l1, l2) ->
let a = Array.init 6 (fun _ -> 0) in let a = Array.init 6 (fun _ -> 0) in
List.map (fun (cx,cy,cz) -> List.map (fun (cx,cy,cz) ->
@ -110,9 +111,25 @@ let zkey_array a =
Zkey.(of_int_array Kind_6 a) Zkey.(of_int_array Kind_6 a)
) (keys_1d @@ to_int l1) ) (keys_1d @@ to_int l1)
) (keys_1d @@ to_int l2) ) (keys_1d @@ to_int l2)
|> List.concat |> List.concat
| Kind_4 (l1, l2, l3, l4) -> | Triplet (l1, l2, l3) ->
let a = Array.init 9 (fun _ -> 0) in
List.map (fun (ax,ay,az) ->
a.(0) <- ax ; a.(1) <- ay ; a.(2) <- az ;
List.map (fun (bx,by,bz) ->
a.(3) <- bx ; a.(4) <- by ; a.(5) <- bz ;
List.map (fun (cx,cy,cz) ->
a.(6) <- cx ; a.(7) <- cy ; a.(8) <- cz ;
Zkey.(of_int_array Kind_9 a)
) (keys_1d @@ to_int l3)
) (keys_1d @@ to_int l2)
|> List.concat
) (keys_1d @@ to_int l1)
|> List.concat
| Quartet (l1, l2, l3, l4) ->
let a = Array.init 12 (fun _ -> 0) in let a = Array.init 12 (fun _ -> 0) in
List.map (fun (ax,ay,az) -> List.map (fun (ax,ay,az) ->

View File

@ -5,6 +5,11 @@ val to_string : t -> string
val to_char : t -> char val to_char : t -> char
val to_int : t -> int val to_int : t -> int
val of_int : int -> t val of_int : int -> t
type kind = Kind_1 of t | Kind_2 of (t * t) | Kind_4 of (t * t * t * t) type kind =
| Singlet of t
| Doublet of (t*t)
| Triplet of (t*t*t)
| Quartet of (t*t*t*t)
val n_functions : t -> int val n_functions : t -> int
val zkey_array : kind -> Z.t array val zkey_array : kind -> Z.t array

View File

@ -6,6 +6,7 @@ type kind =
| Kind_3 | Kind_3
| Kind_6 | Kind_6
| Kind_12 | Kind_12
| Kind_9
| Kind_4 | Kind_4
| Kind_2 | Kind_2
| Kind_1 | Kind_1
@ -34,6 +35,14 @@ let of_int_array ~kind a =
(Int64.of_int a.(6)) << a.(7) << a.(8) << a.(9) << a.(10) << a.(11) (Int64.of_int a.(6)) << a.(7) << a.(8) << a.(9) << a.(10) << a.(11)
|> Z.of_int64 |> Z.of_int64
in a <| b in a <| b
| Kind_9 ->
let a =
(Int64.of_int a.(0)) << a.(1) << a.(2) << a.(3) << a.(4) << a.(5)
|> Z.of_int64
and b =
(Int64.of_int a.(6)) << a.(7) << a.(8)
|> Z.of_int64
in a <| b
| Kind_4 -> (Int64.of_int a.(0)) <+ a.(1) <+ a.(2) <+ a.(3) |> Z.of_int64 | Kind_4 -> (Int64.of_int a.(0)) <+ a.(1) <+ a.(2) <+ a.(3) |> Z.of_int64
| Kind_2 -> (Int64.of_int a.(0)) <+ a.(1) |> Z.of_int64 | Kind_2 -> (Int64.of_int a.(0)) <+ a.(1) |> Z.of_int64
| Kind_1 -> Z.of_int a.(0) | Kind_1 -> Z.of_int a.(0)
@ -63,6 +72,15 @@ let to_int_array ~kind a =
Z.to_int @@ Z.extract a 20 10 ; Z.to_int @@ Z.extract a 20 10 ;
Z.to_int @@ Z.extract a 10 10 ; Z.to_int @@ Z.extract a 10 10 ;
Z.to_int @@ Z.extract a 0 10 |] Z.to_int @@ Z.extract a 0 10 |]
| Kind_9 -> [| Z.to_int @@ Z.extract a 84 10 ;
Z.to_int @@ Z.extract a 74 10 ;
Z.to_int @@ Z.extract a 64 10 ;
Z.to_int @@ Z.extract a 50 10 ;
Z.to_int @@ Z.extract a 40 10 ;
Z.to_int @@ Z.extract a 30 10 ;
Z.to_int @@ Z.extract a 20 10 ;
Z.to_int @@ Z.extract a 10 10 ;
Z.to_int @@ Z.extract a 0 10 |]
| Kind_4 -> [| Z.to_int @@ Z.extract a 48 16 ; | Kind_4 -> [| Z.to_int @@ Z.extract a 48 16 ;
Z.to_int @@ Z.extract a 32 16 ; Z.to_int @@ Z.extract a 32 16 ;
Z.to_int @@ Z.extract a 16 16 ; Z.to_int @@ Z.extract a 16 16 ;