10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-19 12:32:21 +01:00
QCaml/common/lib/angular_momentum.mli
2020-09-26 12:02:53 +02:00

116 lines
2.0 KiB
OCaml

(** Azimuthal quantum number, represented as {% $s,p,d,\dots$ %} *)
type t =
| S | P | D | F | G | H | I | J | K | L | M | N | O
| Int of int
exception Angular_momentum_error of string
(** Raised when the {!Angular_momentum.t} element can't be created.
*)
val of_char : char -> t
(** Returns an {!Angular_momentum.t} when a shell is given as a character (case
insensitive).
Example:
{[
Angular_momentum.of_char 'p' -> Angular_momentum.P
]}
*)
val to_string : t -> string
(**
{[
Angular_momentum.(to_string D) -> "D"
]}
*)
val to_char : t -> char
(**
{[
Angular_momentum.(to_char D) -> 'D'
]}
*)
val to_int : t -> int
(**
Returns the l{_max} value of the shell.
Example:
{[
Angular_momentum.to_int D -> 2
]}
*)
val of_int : int -> t
(**
Opposite of {!of_int}.
Example:
{[
Angular_momentum.of_int 3 -> Angular_momentum.F
]}
*)
type kind =
Singlet of t
| Doublet of (t * t)
| Triplet of (t * t * t)
| Quartet of (t * t * t * t)
val n_functions : t -> int
(** Number of cartesian functions in shell.
Example:
{[
Angular_momentum.n_functions D -> 6
]}
*)
val zkey_array : kind -> Zkey.t array
(** Array of {!Zkey.t}, where each element is a a key associated with the
the powers of x,y,z.
Example:
{[
Angular_momentum.( zkey_array Doublet (P,S) ) ->
[| {Zkey.left = 0; right = 1125899906842624} ;
{Zkey.left = 0; right = 1099511627776} ;
{Zkey.left = 0; right = 1073741824} |]
=
let s,x,y,z =
Powers.( of_int_tuple (0,0,0),
of_int_tuple (1,0,0),
of_int_tuple (0,1,0),
of_int_tuple (0,0,1) )
in
Array.map (fun (a,b) -> {!Zkey.of_powers_six} a b)
[| (x,s) ; (y,s) ; (z,s) |]
]}
*)
val ( + ) : t -> t -> t
val ( - ) : t -> t -> t
(** {2 Printers} *)
val pp_string : Format.formatter -> t -> unit
(** Prints as a string S, P, D, ... *)
val pp_int : Format.formatter -> t -> unit
(** Prints as an integer 0, 1, 2, ... *)