mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-12-22 12:23:31 +01:00
Pretty printers for basis
This commit is contained in:
parent
39e1363a00
commit
c1433be7f8
@ -4,6 +4,7 @@
|
||||
(name qcaml_common)
|
||||
(public_name qcaml.common)
|
||||
(libraries
|
||||
str
|
||||
zarith
|
||||
getopt
|
||||
)
|
||||
|
@ -27,6 +27,7 @@ in quantum chemistry.")
|
||||
(depends
|
||||
(ocaml (>= 4.10))
|
||||
(dune (>= 1.10))
|
||||
str
|
||||
lacaml
|
||||
getopt
|
||||
zarith
|
||||
|
@ -143,3 +143,25 @@ let of_string input_string =
|
||||
|> Stream.of_list
|
||||
|> read_stream
|
||||
|
||||
|
||||
let pp_primitive ppf prim =
|
||||
Format.fprintf ppf "@[%17.10e %17.10e@]" prim.exponent prim.coefficient
|
||||
|
||||
|
||||
let pp_gcs ppf gcs =
|
||||
let (angular_momentum, prim_array) = gcs in
|
||||
Format.fprintf ppf "@[%a %d@]@."
|
||||
Angular_momentum.pp_string angular_momentum
|
||||
(Array.length prim_array);
|
||||
|
||||
Array.iteri (fun i prim -> Format.fprintf ppf "@[%3d %a@]@."
|
||||
(i+1) pp_primitive prim) prim_array
|
||||
|
||||
|
||||
let pp_element_basis ppf eb =
|
||||
let (element, basis) = eb in
|
||||
Format.fprintf ppf "@[%s@]@." (String.uppercase_ascii @@ Element.to_long_string element);
|
||||
Array.iter (fun b -> Format.fprintf ppf "@[%a@]" pp_gcs b) basis
|
||||
|
||||
let pp ppf t =
|
||||
List.iter (fun x -> Format.fprintf ppf "@[%a@]@." pp_element_basis x) t
|
||||
|
@ -129,3 +129,11 @@ val to_string : string * (general_contracted_shell array) -> string
|
||||
val of_string : string -> t
|
||||
(** Reads a GAMESS-formatted string. *)
|
||||
|
||||
|
||||
(** Pretty printers *)
|
||||
|
||||
val pp_primitive : Format.formatter -> primitive -> unit
|
||||
val pp_gcs : Format.formatter -> general_contracted_shell -> unit
|
||||
val pp_element_basis : Format.formatter -> element_basis -> unit
|
||||
|
||||
val pp : Format.formatter -> t -> unit
|
||||
|
@ -205,3 +205,8 @@ let small_core = function
|
||||
| Te -> 28 | I -> 28 | Xe -> 28 | Pt -> 60
|
||||
|
||||
|
||||
let pp ppf t =
|
||||
Format.fprintf ppf "@[%s@]" (to_string t)
|
||||
|
||||
let pp_long ppf t =
|
||||
Format.fprintf ppf "@[%s@]" (to_long_string t)
|
||||
|
@ -68,7 +68,13 @@ val mass : t -> Mass.t
|
||||
val small_core : t -> int
|
||||
(** Number of electrons in the small core model (all except the outermost two shells). *)
|
||||
|
||||
(* TODO
|
||||
(*
|
||||
val large_core : t -> int
|
||||
(** Number of electrons in the large core model (all except the outermost shell). *)
|
||||
*)
|
||||
|
||||
|
||||
(** Pretty printers *)
|
||||
val pp : Format.formatter -> t -> unit
|
||||
val pp_long : Format.formatter -> t -> unit
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user