10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-06-02 03:15:19 +02:00
QCaml/Utils/FourIdxStorage.mli
2018-06-29 16:04:40 +02:00

47 lines
1.3 KiB
OCaml

(** 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 : {% $(ij|kl)$ %}
*)
type t
type element = (** Element for the stream *)
{
i_r1: int ;
j_r2: int ;
k_r1: int ;
l_r2: int ;
value: float
}
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
(** Get an integral using the Chemist's convention {% $(ij|kl)$ %}. *)
val get_phys : t -> int -> int -> int -> int -> float
(** Get an integral using the Physicist's convention {% $\langle ij|kl \rangle$ %}. *)
val set_chem : t -> int -> int -> int -> int -> float -> unit
(** Set an integral using the Chemist's convention {% $(ij|kl)$ %}. *)
val set_phys : t -> int -> int -> int -> int -> float -> unit
(** Set an integral using the Physicist's convention {% $\langle ij|kl \rangle$ %}. *)
val to_stream : t -> element Stream.t
(** Fetch all integrals from a stream. *)
(** {2 I/O} *)
val to_file : ?cutoff:float -> filename:string -> t -> unit
(** Write the data to file, using the physicist's ordering. *)