2020-12-26 01:47:55 +01:00
|
|
|
(* Type
|
|
|
|
*
|
|
|
|
* #+NAME: types *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* [[file:../angular_momentum.org::types][types]] *)
|
2018-03-15 15:25:49 +01:00
|
|
|
type t =
|
2020-12-26 01:47:55 +01:00
|
|
|
| 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
|
2018-02-24 23:57:38 +01:00
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
type kind =
|
|
|
|
Singlet of t
|
|
|
|
| Doublet of (t * t)
|
|
|
|
| Triplet of (t * t * t)
|
|
|
|
| Quartet of (t * t * t * t)
|
|
|
|
(* types ends here *)
|
|
|
|
|
|
|
|
(* ~of_char~
|
|
|
|
*
|
|
|
|
* Returns an ~Angular_momentum.t~ when a shell is given as a character
|
|
|
|
* (case insensitive):
|
|
|
|
*
|
|
|
|
* #+begin_example
|
|
|
|
* Angular_momentum.of_char 'p' -> Angular_momentum.P
|
|
|
|
* #+end_example *)
|
2018-03-16 00:23:47 +01:00
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
|
|
|
|
(* [[file:../angular_momentum.org::*~of_char~][~of_char~:1]] *)
|
2018-02-24 23:57:38 +01:00
|
|
|
val of_char : char -> t
|
2020-12-26 01:47:55 +01:00
|
|
|
(* ~of_char~:1 ends here *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* ~to_string~
|
|
|
|
*
|
|
|
|
* Converts the angular momentum into a string:
|
|
|
|
*
|
|
|
|
* #+begin_example
|
|
|
|
* Angular_momentum.(to_string D) -> "D"
|
|
|
|
* #+end_example *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* [[file:../angular_momentum.org::*~to_string~][~to_string~:1]] *)
|
2018-02-24 23:57:38 +01:00
|
|
|
val to_string : t -> string
|
2020-12-26 01:47:55 +01:00
|
|
|
(* ~to_string~:1 ends here *)
|
|
|
|
|
|
|
|
(* ~to_char~
|
|
|
|
*
|
|
|
|
* Converts the angular momentum into a char:
|
|
|
|
*
|
|
|
|
* #+begin_example
|
|
|
|
* Angular_momentum.(to_char D) -> 'D'
|
|
|
|
* #+end_example *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* [[file:../angular_momentum.org::*~to_char~][~to_char~:1]] *)
|
2018-02-24 23:57:38 +01:00
|
|
|
val to_char : t -> char
|
2020-12-26 01:47:55 +01:00
|
|
|
(* ~to_char~:1 ends here *)
|
|
|
|
|
|
|
|
(* ~to_int~
|
|
|
|
*
|
|
|
|
* Returns the $l_{max}$ value of the shell:
|
|
|
|
*
|
|
|
|
* #+begin_example
|
|
|
|
* Angular_momentum.(to_char D) -> 2
|
|
|
|
* #+end_example *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* [[file:../angular_momentum.org::*~to_int~][~to_int~:1]] *)
|
2018-02-24 23:57:38 +01:00
|
|
|
val to_int : t -> int
|
2020-12-26 01:47:55 +01:00
|
|
|
(* ~to_int~:1 ends here *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* ~of_int~
|
|
|
|
*
|
|
|
|
* Returns a shell given an $l$ value.
|
|
|
|
*
|
|
|
|
* #+begin_example
|
|
|
|
* Angular_momentum.of_int 3 -> Angular_momentum.F
|
|
|
|
* #+end_example *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* [[file:../angular_momentum.org::*~of_int~][~of_int~:1]] *)
|
2018-02-24 23:57:38 +01:00
|
|
|
val of_int : int -> t
|
2020-12-26 01:47:55 +01:00
|
|
|
(* ~of_int~:1 ends here *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* ~n_functions~
|
|
|
|
*
|
|
|
|
* Returns the number of cartesian functions in a shell.
|
|
|
|
*
|
|
|
|
* #+begin_example
|
|
|
|
* Angular_momentum.n_functions D -> 6
|
|
|
|
* #+end_example *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* [[file:../angular_momentum.org::*~n_functions~][~n_functions~:1]] *)
|
2018-02-24 23:57:38 +01:00
|
|
|
val n_functions : t -> int
|
2020-12-26 01:47:55 +01:00
|
|
|
(* ~n_functions~:1 ends here *)
|
|
|
|
|
|
|
|
(* ~zkey_array~
|
|
|
|
*
|
|
|
|
* Array of ~Zkey.t~, where each element is a a key associated with the
|
|
|
|
* the powers of $x,y,z$.
|
|
|
|
*
|
|
|
|
* #+begin_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) |]
|
|
|
|
*
|
|
|
|
* #+end_example *)
|
|
|
|
|
|
|
|
|
|
|
|
(* [[file:../angular_momentum.org::*~zkey_array~][~zkey_array~:1]] *)
|
|
|
|
val zkey_array : kind -> Zkey.t array
|
|
|
|
(* ~zkey_array~:1 ends here *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* Arithmetic *)
|
2018-02-24 23:57:38 +01:00
|
|
|
|
2018-03-14 21:58:55 +01:00
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* [[file:../angular_momentum.org::*Arithmetic][Arithmetic:1]] *)
|
2018-03-14 21:58:55 +01:00
|
|
|
val ( + ) : t -> t -> t
|
|
|
|
val ( - ) : t -> t -> t
|
2020-12-26 01:47:55 +01:00
|
|
|
(* Arithmetic:1 ends here *)
|
2018-03-14 21:58:55 +01:00
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* Printers
|
|
|
|
*
|
|
|
|
* Printers can print as a string (~pp_string~) or as an integer (~pp_int~). *)
|
2018-03-15 15:25:49 +01:00
|
|
|
|
|
|
|
|
2020-12-26 01:47:55 +01:00
|
|
|
(* [[file:../angular_momentum.org::*Printers][Printers:1]] *)
|
|
|
|
val pp_string : Format.formatter -> t -> unit
|
2018-03-15 15:25:49 +01:00
|
|
|
val pp_int : Format.formatter -> t -> unit
|
2020-12-26 01:47:55 +01:00
|
|
|
(* Printers:1 ends here *)
|