mirror of
https://gitlab.com/scemama/QCaml.git
synced 2025-01-03 01:55:40 +01:00
Optimized Zkey
This commit is contained in:
parent
1eadca79b3
commit
e4786b7765
@ -57,7 +57,6 @@ let compute_norm_coef s =
|
|||||||
result
|
result
|
||||||
) s.expo
|
) s.expo
|
||||||
|
|
||||||
|
|
||||||
let create ~indice ~expo ~coef ~center ~totAngMom =
|
let create ~indice ~expo ~coef ~center ~totAngMom =
|
||||||
assert (Array.length expo = Array.length coef);
|
assert (Array.length expo = Array.length coef);
|
||||||
assert (Array.length expo > 0);
|
assert (Array.length expo > 0);
|
||||||
|
@ -206,7 +206,7 @@ let contracted_class ~zero_m shell_a shell_b shell_c shell_d : float Zmap.t =
|
|||||||
shell_p.(ab).Shell_pair.coef *. shell_q.(cd).Shell_pair.coef
|
shell_p.(ab).Shell_pair.coef *. shell_q.(cd).Shell_pair.coef
|
||||||
in
|
in
|
||||||
(** Screening on thr product of coefficients *)
|
(** Screening on thr product of coefficients *)
|
||||||
if (abs_float coef_prod) > cutoff then
|
if (abs_float coef_prod) > 1.e-4*.cutoff then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
let expo_pq_inv =
|
let expo_pq_inv =
|
||||||
|
5
Makefile
5
Makefile
@ -4,7 +4,8 @@ INCLUDE_DIRS=Nuclei,Utils,Basis
|
|||||||
LIBS=
|
LIBS=
|
||||||
PKGS=
|
PKGS=
|
||||||
OCAMLCFLAGS="-g -warn-error A"
|
OCAMLCFLAGS="-g -warn-error A"
|
||||||
OCAMLBUILD=ocamlbuild -j 0 -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) -Is $(INCLUDE_DIRS)
|
OCAMLCFLAGS="-g"
|
||||||
|
OCAMLBUILD=ocamlbuild -j 0 -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) -Is $(INCLUDE_DIRS) #-ocamlopt "opt -rounds 2"
|
||||||
MLLFILES=$(wildcard */*.mll) $(wildcard *.mll)
|
MLLFILES=$(wildcard */*.mll) $(wildcard *.mll)
|
||||||
MLYFILES=$(wildcard */*.mly) $(wildcard *.mly)
|
MLYFILES=$(wildcard */*.mly) $(wildcard *.mly)
|
||||||
MLFILES= $(wildcard */*.ml) $(wildcard *.ml)
|
MLFILES= $(wildcard */*.ml) $(wildcard *.ml)
|
||||||
@ -32,7 +33,7 @@ doc: qpackage.odocl
|
|||||||
$(OCAMLBUILD) $*.byte -use-ocamlfind $(PKGS)
|
$(OCAMLBUILD) $*.byte -use-ocamlfind $(PKGS)
|
||||||
ln -s $*.byte $*
|
ln -s $*.byte $*
|
||||||
|
|
||||||
%.native: $(MLFILES) $(MLIFILES) $(MLLFILES) $(MLYFILES) %.byte
|
%.native: $(MLFILES) $(MLIFILES) $(MLLFILES) $(MLYFILES)
|
||||||
rm -f -- $*
|
rm -f -- $*
|
||||||
$(OCAMLBUILD) $*.native -use-ocamlfind $(PKGS)
|
$(OCAMLBUILD) $*.native -use-ocamlfind $(PKGS)
|
||||||
ln -s $*.native $*
|
ln -s $*.native $*
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
(** Key for hastables that contain tuples of integers encoded in a Zarith integer *)
|
(** Key for hastables that contain tuples of integers encoded in a Zarith integer *)
|
||||||
|
|
||||||
include Z
|
|
||||||
|
|
||||||
type kind_array =
|
type kind_array =
|
||||||
| Kind_3
|
| Kind_3
|
||||||
@ -89,46 +88,59 @@ let of_int_tuple a =
|
|||||||
in a <| b
|
in a <| b
|
||||||
|
|
||||||
|
|
||||||
|
let mask10 = Int64.of_int 0x3ff
|
||||||
|
and mask16 = Int64.of_int 0xffff
|
||||||
(** Transform the Zkey into an int array *)
|
(** Transform the Zkey into an int array *)
|
||||||
let to_int_array ~kind a =
|
let to_int_array ~kind a =
|
||||||
|
let open Int64 in
|
||||||
match kind with
|
match kind with
|
||||||
| Kind_3 -> [| Z.to_int @@ Z.extract a 20 10 ;
|
| Kind_3 -> let x = Z.to_int64 a in
|
||||||
Z.to_int @@ Z.extract a 10 10 ;
|
[| to_int ( logand mask10 (shift_right x 20)) ;
|
||||||
Z.to_int @@ Z.extract a 0 10 |]
|
to_int ( logand mask10 (shift_right x 10)) ;
|
||||||
| Kind_6 -> [| Z.to_int @@ Z.extract a 50 10 ;
|
to_int ( logand mask10 x) |]
|
||||||
Z.to_int @@ Z.extract a 40 10 ;
|
| Kind_6 -> let x = Z.to_int64 a in
|
||||||
Z.to_int @@ Z.extract a 30 10 ;
|
[| to_int ( logand mask10 (shift_right x 50)) ;
|
||||||
Z.to_int @@ Z.extract a 20 10 ;
|
to_int ( logand mask10 (shift_right x 40)) ;
|
||||||
Z.to_int @@ Z.extract a 10 10 ;
|
to_int ( logand mask10 (shift_right x 30)) ;
|
||||||
Z.to_int @@ Z.extract a 0 10 |]
|
to_int ( logand mask10 (shift_right x 20)) ;
|
||||||
| Kind_12 -> [| Z.to_int @@ Z.extract a 114 10 ;
|
to_int ( logand mask10 (shift_right x 10)) ;
|
||||||
Z.to_int @@ Z.extract a 104 10 ;
|
to_int ( logand mask10 x) |]
|
||||||
Z.to_int @@ Z.extract a 94 10 ;
|
| Kind_12 -> let x = Z.to_int64 @@ Z.extract a 0 60
|
||||||
Z.to_int @@ Z.extract a 84 10 ;
|
and y = Z.to_int64 @@ Z.extract a 64 60
|
||||||
Z.to_int @@ Z.extract a 74 10 ;
|
in
|
||||||
Z.to_int @@ Z.extract a 64 10 ;
|
[| to_int ( logand mask10 (shift_right y 114)) ;
|
||||||
Z.to_int @@ Z.extract a 50 10 ;
|
to_int ( logand mask10 (shift_right y 104)) ;
|
||||||
Z.to_int @@ Z.extract a 40 10 ;
|
to_int ( logand mask10 (shift_right y 94)) ;
|
||||||
Z.to_int @@ Z.extract a 30 10 ;
|
to_int ( logand mask10 (shift_right y 84)) ;
|
||||||
Z.to_int @@ Z.extract a 20 10 ;
|
to_int ( logand mask10 (shift_right y 74)) ;
|
||||||
Z.to_int @@ Z.extract a 10 10 ;
|
to_int ( logand mask10 (shift_right y 64)) ;
|
||||||
Z.to_int @@ Z.extract a 0 10 |]
|
to_int ( logand mask10 (shift_right x 50)) ;
|
||||||
| Kind_9 -> [| Z.to_int @@ Z.extract a 84 10 ;
|
to_int ( logand mask10 (shift_right x 40)) ;
|
||||||
Z.to_int @@ Z.extract a 74 10 ;
|
to_int ( logand mask10 (shift_right x 30)) ;
|
||||||
Z.to_int @@ Z.extract a 64 10 ;
|
to_int ( logand mask10 (shift_right x 20)) ;
|
||||||
Z.to_int @@ Z.extract a 50 10 ;
|
to_int ( logand mask10 (shift_right x 10)) ;
|
||||||
Z.to_int @@ Z.extract a 40 10 ;
|
to_int ( logand mask10 x) |]
|
||||||
Z.to_int @@ Z.extract a 30 10 ;
|
| Kind_9 -> let x = Z.to_int64 @@ Z.extract a 0 60
|
||||||
Z.to_int @@ Z.extract a 20 10 ;
|
and y = Z.to_int64 @@ Z.extract a 64 60
|
||||||
Z.to_int @@ Z.extract a 10 10 ;
|
in
|
||||||
Z.to_int @@ Z.extract a 0 10 |]
|
[| to_int ( logand mask10 (shift_right y 84)) ;
|
||||||
| Kind_4 -> [| Z.to_int @@ Z.extract a 48 16 ;
|
to_int ( logand mask10 (shift_right y 74)) ;
|
||||||
Z.to_int @@ Z.extract a 32 16 ;
|
to_int ( logand mask10 (shift_right y 64)) ;
|
||||||
Z.to_int @@ Z.extract a 16 16 ;
|
to_int ( logand mask10 (shift_right x 50)) ;
|
||||||
Z.to_int @@ Z.extract a 0 16 |]
|
to_int ( logand mask10 (shift_right x 40)) ;
|
||||||
| Kind_2 -> [| Z.to_int @@ Z.extract a 16 16 ;
|
to_int ( logand mask10 (shift_right x 30)) ;
|
||||||
Z.to_int @@ Z.extract a 0 16 |]
|
to_int ( logand mask10 (shift_right x 20)) ;
|
||||||
| Kind_1 -> [| Z.to_int a |]
|
to_int ( logand mask10 (shift_right x 10)) ;
|
||||||
|
to_int ( logand mask10 x) |]
|
||||||
|
| Kind_4 -> let x = Z.to_int64 a in
|
||||||
|
[| to_int ( logand mask16 (shift_right x 48)) ;
|
||||||
|
to_int ( logand mask16 (shift_right x 32)) ;
|
||||||
|
to_int ( logand mask16 (shift_right x 16)) ;
|
||||||
|
to_int ( logand mask16 x) |]
|
||||||
|
| Kind_2 -> let x = Z.to_int64 a in
|
||||||
|
[| to_int ( logand mask16 (shift_right x 16)) ;
|
||||||
|
to_int ( logand mask16 x) |]
|
||||||
|
| Kind_1 -> [| Z.to_int a |]
|
||||||
|
|
||||||
|
|
||||||
let to_string ~kind a =
|
let to_string ~kind a =
|
||||||
@ -187,6 +199,9 @@ let to_int_tuple ~kind a =
|
|||||||
|
|
||||||
| Kind_1 -> One ( Z.to_int a )
|
| Kind_1 -> One ( Z.to_int a )
|
||||||
|
|
||||||
|
|
||||||
|
include Z
|
||||||
|
|
||||||
(*
|
(*
|
||||||
let debug () =
|
let debug () =
|
||||||
let k2 = of_int_array Kind_2 [| 1 ; 2 |]
|
let k2 = of_int_array Kind_2 [| 1 ; 2 |]
|
||||||
|
Loading…
Reference in New Issue
Block a user