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

Changed integral storage to Float32

This commit is contained in:
Anthony Scemama 2018-03-27 19:32:37 +02:00
parent b5b6010bbf
commit f4f31db614
3 changed files with 29 additions and 3 deletions

View File

@ -77,7 +77,7 @@ let filter_contracted_shell_pairs ?(cutoff=integrals_cutoff) shell_pairs =
| Some cspc ->
let cls = class_of_contracted_shell_pair_couple cspc in
(pair, Zmap.fold (fun key value accu -> max (abs_float value) accu) cls 0. )
| None -> (pair, -1.)
| None -> (pair, -1.)
) shell_pairs
|> List.filter (fun (_, schwartz_p_max) -> schwartz_p_max >= cutoff)
|> List.map fst

View File

@ -2,8 +2,9 @@ let max_index = 1 lsl 14
type index_pair = { first : int ; second : int }
type storage_t =
| Dense of (float, Bigarray.float64_elt, Bigarray.fortran_layout) Bigarray.Genarray.t
| Dense of (float, Bigarray.float32_elt, Bigarray.fortran_layout) Bigarray.Genarray.t
| Sparse of (int, float) Hashtbl.t
type t =
@ -81,7 +82,7 @@ let create ~size sparsity =
match sparsity with
| `Dense ->
let result =
Bigarray.Genarray.create Float64 Bigarray.fortran_layout [| size ; size ; size ; size |]
Bigarray.Genarray.create Float32 Bigarray.fortran_layout [| size ; size ; size ; size |]
in
Bigarray.Genarray.fill result 0.;
Dense result

25
Utils/FourIdxStorage.mli Normal file
View File

@ -0,0 +1,25 @@
(** Storage for four-index data (integrals, density matrices, ...).
There are two kinds of ordering of indices:
- Physicist's : { \[ \langle i j | k l \rangle \] }
- Chemist's : { \[ ( i j | k l ) \] }
*)
type t
val create : size:int -> [< `Dense | `Sparse ] -> t
(** If [`Dense] is chosen, internally the data is stored as a 4-dimensional
[Bigarray]. Else, it is stored as a hash table.
*)
(** {2 Accessors} *)
val get_chem : t -> int -> int -> int -> int -> float
val get_phys : t -> int -> int -> int -> int -> float
val set_chem : t -> int -> int -> int -> int -> float -> unit
val set_phys : t -> int -> int -> int -> int -> float -> unit
(** {2 I/O} *)
val to_file : ?cutoff:float -> filename:string -> t -> unit
(** Write the data to file, using the physicist's ordering. *)