10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-18 12:03:40 +01:00
QCaml/common/angular_momentum.org

7.3 KiB

Angular Momentum

Azimuthal quantum number, repsesented as \( s,p,d,\dots \) .

Type

<<<~Angular_momentum.t~>>>

type t =
| S | P | D | F | G | H | I | J | K | L | M | N | O
| Int of int

exception Angular_momentum_error of string

type kind =
 Singlet of t
| Doublet of (t * t)
| Triplet of (t * t * t)
| Quartet of (t * t * t * t)

An exception is raised when the Angular_momentum.t element can't be created.

The kind is used to build shells, shell doublets, triplets or quartets, use in the two-electron operators.

Conversions

val of_char : char -> t
val to_char : t -> char

val to_int : t -> int
val of_int : int -> t

val to_string : t -> string
of_char Returns an Angular_momentum.t when a shell is given as a character (case insensitive)
to_char Converts the angular momentum into a char
of_int Returns a shell given an $l$ value.
to_int Returns the $l_{max}$ value of the shell
to_string Converts the angular momentum into a string

Example:

Angular_momentum.of_char 'p';;
- : Angular_momentum.t = P

Angular_momentum.(to_char P);;
- : char = 'P'

Angular_momentum.of_int 2;;
- : Angular_momentum.t = D

Angular_momentum.(to_int D);;
- : int = 2

Angular_momentum.(to_string D);;
- : string = "D"

Shell functions

val n_functions : t -> int
val zkey_array  : kind -> Zkey.t array
n_functions Returns the number of cartesian functions in a shell.
zkey_array Array of Zkey.t, where each element is a a key associated with the the powers of $x,y,z$.

Example:

Angular_momentum.(n_functions D) ;;
- : int = 6

Angular_momentum.( zkey_array (Doublet (P,S)) );;
- : Zkey.t array =
[|< 01125899906842624 | 1, 0, 0, 0, 0, 0 >;
< 01099511627776 | 0, 1, 0, 0, 0, 0 >;
< 01073741824 | 0, 0, 1, 0, 0, 0 >|]

Arithmetic

val ( + ) : t -> t -> t
val ( - ) : t -> t -> t

Example:

Angular_momentum.(D + P);;
- : Angular_momentum.t = F

Angular_momentum.(F - P);;
- : Angular_momentum.t = D

Printers

Printers can print as a string (default) or as an integer.

val pp        : Format.formatter -> t -> unit
val pp_string : Format.formatter -> t -> unit
val pp_int    : Format.formatter -> t -> unit

TODO Tests