10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-23 04:43:32 +01:00
QCaml/particles/lib/element.mli

81 lines
2.0 KiB
OCaml

(** Chemical elements. *)
open Common
exception ElementError of string
type t =
|X
|H |He
|Li|Be |B |C |N |O |F |Ne
|Na|Mg |Al|Si|P |S |Cl|Ar
|K |Ca|Sc|Ti|V |Cr|Mn|Fe|Co|Ni|Cu|Zn|Ga|Ge|As|Se|Br|Kr
|Rb|Sr|Y |Zr|Nb|Mo|Tc|Ru|Rh|Pd|Ag|Cd|In|Sn|Sb|Te|I |Xe
|Pt
val of_string : string -> t
(** Creates an {!Element.t} from a chemical symbol or from the full name of the
element (case insensitive).
@raise ElementError upon failure
Examples:
{[
Element.of_string "Fe" -> Element.Fe
Element.of_string "hydrogen" -> Element.H
Element.of_string "pouet" -> ElementError "Element pouet unknown"
]}
*)
val to_string : t -> string
(** Gets the chemical symbol of the {!Element.t} in a string.
Example:
[Element.(to_string Fe) -> "Fe"]
*)
val to_long_string : t -> string
(** Gets the full name of the {!Element.t} in a string.
Example:
[Element.(to_long_string Fe) -> "Iron"]
*)
val to_int : t -> int
(** Convert to the atomic charge, with [int] type. *)
val of_int : int -> t
(** Create from the atomic charge, with [int] type. *)
val to_charge : t -> Charge.t
(** Convert to the atomic charge, with {!Charge.t} type. *)
val of_charge : Charge.t -> t
(** Create from the atomic charge, with {!Charge.t} type. *)
val covalent_radius : t -> Non_negative_float.t
(** Covalent radii of the elements, in atomic units. *)
val vdw_radius : t -> Non_negative_float.t
(** Van der Waals radii of the elements, in atomic units. *)
val mass : t -> Mass.t
(** Atomic mass of the elements, in atomic units. *)
val small_core : t -> int
(** Number of electrons in the small core model (all except the outermost two shells). *)
(*
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