mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-10 16:13:39 +01:00
48 lines
782 B
OCaml
48 lines
782 B
OCaml
(** Type *)
|
|
|
|
type kind =
|
|
| All_electron
|
|
| Small
|
|
| Large
|
|
type t = int array
|
|
|
|
|
|
(** Creation *)
|
|
|
|
let make_ae nuclei =
|
|
Array.map (fun _ -> 0) nuclei
|
|
|
|
let make_small nuclei =
|
|
Array.map (fun (e,_) -> Particles.Element.small_core e) nuclei
|
|
|
|
let make_large nuclei =
|
|
Array.map (fun (e,_) -> Particles.Element.large_core e) nuclei
|
|
|
|
let make = function
|
|
| All_electron -> make_ae
|
|
| Small -> make_small
|
|
| Large -> make_large
|
|
|
|
|
|
external of_int_array : int array -> t = "%identity"
|
|
|
|
let of_int_list = Array.of_list
|
|
|
|
|
|
(** Access *)
|
|
|
|
let num_elec t =
|
|
Array.fold_left ( + ) 0 t
|
|
|
|
let num_mos t =
|
|
(num_elec t) / 2
|
|
|
|
|
|
(** Printers *)
|
|
|
|
let pp ppf t =
|
|
Format.fprintf ppf "@[[|";
|
|
Array.iter (fun x -> Format.fprintf ppf "@,@[%d@]" x) t;
|
|
Format.fprintf ppf "|]@]";
|
|
|