10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-19 12:32:21 +01:00
QCaml/Utils/FourIdxStorage.mli

73 lines
2.2 KiB
OCaml
Raw Normal View History

2018-03-27 19:32:37 +02:00
(** Storage for four-index data (integrals, density matrices, ...).
There are two kinds of ordering of indices:
2018-03-28 01:50:19 +02:00
- Physicist's : {% $\langle i j | k l \rangle$ %}
- Chemist's : {% $(ij|kl)$ %}
2018-03-27 19:32:37 +02:00
*)
2019-03-21 00:44:10 +01:00
open Lacaml.D
2018-03-27 19:32:37 +02:00
type t
2018-06-28 14:43:24 +02:00
type element = (** Element for the stream *)
{
i_r1: int ;
j_r2: int ;
k_r1: int ;
l_r2: int ;
value: float
}
2019-03-29 17:38:19 +01:00
val create : size:int -> ?temp_dir:string -> [< `Dense | `Sparse ] -> t
2018-03-27 19:32:37 +02:00
(** 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
2018-06-29 16:04:40 +02:00
(** Get an integral using the Chemist's convention {% $(ij|kl)$ %}. *)
2018-03-27 19:32:37 +02:00
val get_phys : t -> int -> int -> int -> int -> float
2018-06-29 16:04:40 +02:00
(** Get an integral using the Physicist's convention {% $\langle ij|kl \rangle$ %}. *)
2018-03-27 19:32:37 +02:00
val set_chem : t -> int -> int -> int -> int -> float -> unit
2018-06-29 16:04:40 +02:00
(** Set an integral using the Chemist's convention {% $(ij|kl)$ %}. *)
2018-03-27 19:32:37 +02:00
val set_phys : t -> int -> int -> int -> int -> float -> unit
2018-06-29 16:04:40 +02:00
(** Set an integral using the Physicist's convention {% $\langle ij|kl \rangle$ %}. *)
2018-03-27 19:32:37 +02:00
2019-04-05 16:54:38 +02:00
val get_chem_all_i : t -> j:int -> k:int -> l:int -> Vec.t
(** Get all integrals in an array [a.{i} =] {% $(\cdot j|kl)$ %} . *)
2018-07-20 16:09:06 +02:00
2019-04-05 16:54:38 +02:00
val get_phys_all_i : t -> j:int -> k:int -> l:int -> Vec.t
(** Get all integrals in an array [a.{i} =] {% $\langle \cdot j|kl \rangle$ %} . *)
2018-07-20 16:09:06 +02:00
2019-04-05 16:54:38 +02:00
val get_chem_all_ij : t -> k:int -> l:int -> Mat.t
(** Get all integrals in an array [a.{i,j} =] {% $(\cdot \cdot|kl)$ %} . *)
2018-07-20 16:09:06 +02:00
2019-04-05 16:54:38 +02:00
val get_phys_all_ij : t -> k:int -> l:int -> Mat.t
(** Get all integrals in an array [a.{i,j} =] {% $\langle \cdot \cdot|kl \rangle$ %} . *)
2018-07-20 16:09:06 +02:00
2018-06-28 14:43:24 +02:00
val to_stream : t -> element Stream.t
2018-07-05 00:39:17 +02:00
(** Retrun the data structure as a stream. *)
val to_list : t -> element list
(** Retrun the data structure as a list. *)
2018-06-29 16:04:40 +02:00
2019-03-21 00:44:10 +01:00
val four_index_transform : Mat.t -> t -> t
(** Perform a four-index transformation *)
2018-06-28 14:43:24 +02:00
2018-03-27 19:32:37 +02:00
(** {2 I/O} *)
2018-06-29 16:04:40 +02:00
2018-03-27 19:32:37 +02:00
val to_file : ?cutoff:float -> filename:string -> t -> unit
(** Write the data to file, using the physicist's ordering. *)
2018-07-05 00:39:17 +02:00
val of_file : size:int -> sparsity:[< `Dense | `Sparse ]
-> Scanf.Scanning.file_name -> t
(** Read from a text file with format ["%d %d %d %d %f"]. *)
2019-03-29 17:38:19 +01:00
val broadcast : t -> t
(** Broadcast the data to the distributed processes. *)