10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-07 14:43:41 +01:00
QCaml/common/lib/angular_momentum.mli

116 lines
2.0 KiB
OCaml
Raw Normal View History

2018-03-06 18:25:48 +01:00
(** Azimuthal quantum number, represented as {% $s,p,d,\dots$ %} *)
2018-02-24 23:57:38 +01:00
2018-03-15 15:25:49 +01:00
type t =
| S | P | D | F | G | H | I | J | K | L | M | N | O
| Int of int
2018-02-24 23:57:38 +01:00
2020-09-26 12:02:53 +02:00
exception Angular_momentum_error of string
(** Raised when the {!Angular_momentum.t} element can't be created.
2018-02-24 23:57:38 +01:00
*)
2018-03-16 00:23:47 +01:00
2018-02-24 23:57:38 +01:00
val of_char : char -> t
2020-09-26 12:02:53 +02:00
(** Returns an {!Angular_momentum.t} when a shell is given as a character (case
2018-02-24 23:57:38 +01:00
insensitive).
Example:
2018-03-16 00:23:47 +01:00
{[
2020-09-26 12:02:53 +02:00
Angular_momentum.of_char 'p' -> Angular_momentum.P
2018-03-16 00:23:47 +01:00
]}
2018-02-24 23:57:38 +01:00
*)
val to_string : t -> string
(**
2018-03-16 00:23:47 +01:00
{[
2020-09-26 12:02:53 +02:00
Angular_momentum.(to_string D) -> "D"
2018-03-16 00:23:47 +01:00
]}
2018-02-24 23:57:38 +01:00
*)
val to_char : t -> char
(**
2018-03-16 00:23:47 +01:00
{[
2020-09-26 12:02:53 +02:00
Angular_momentum.(to_char D) -> 'D'
2018-03-16 00:23:47 +01:00
]}
2018-02-24 23:57:38 +01:00
*)
val to_int : t -> int
(**
Returns the l{_max} value of the shell.
Example:
2018-03-16 00:23:47 +01:00
{[
2020-09-26 12:02:53 +02:00
Angular_momentum.to_int D -> 2
2018-03-16 00:23:47 +01:00
]}
2018-02-24 23:57:38 +01:00
*)
val of_int : int -> t
(**
Opposite of {!of_int}.
Example:
2018-03-16 00:23:47 +01:00
{[
2020-09-26 12:02:53 +02:00
Angular_momentum.of_int 3 -> Angular_momentum.F
2018-03-16 00:23:47 +01:00
]}
2018-02-24 23:57:38 +01:00
*)
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:
2018-03-16 00:23:47 +01:00
{[
2020-09-26 12:02:53 +02:00
Angular_momentum.n_functions D -> 6
2018-03-16 00:23:47 +01:00
]}
2018-02-24 23:57:38 +01:00
*)
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:
2018-03-16 00:23:47 +01:00
{[
2020-09-26 12:02:53 +02:00
Angular_momentum.( zkey_array Doublet (P,S) ) ->
2018-02-24 23:57:38 +01:00
[| {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) |]
2018-03-16 00:23:47 +01:00
]}
2018-02-24 23:57:38 +01:00
2018-03-16 00:23:47 +01:00
*)
2018-03-14 21:58:55 +01:00
val ( + ) : t -> t -> t
val ( - ) : t -> t -> t
2018-03-15 15:25:49 +01:00
(** {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, ... *)