10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-09 07:33:49 +01:00
QuantumPackage/ocaml/MO_label.ml

36 lines
758 B
OCaml
Raw Normal View History

2019-03-13 11:35:21 +01:00
open Sexplib.Std
2019-01-25 11:39:31 +01:00
type t =
| Guess
| Canonical
| Natural
| Localized
| Orthonormalized
2019-04-11 17:04:49 +02:00
| MCSCF
2019-01-25 11:39:31 +01:00
| None
[@@deriving sexp]
2019-03-13 11:35:21 +01:00
2019-01-25 11:39:31 +01:00
let to_string = function
| Guess -> "Guess"
| Canonical -> "Canonical"
| Orthonormalized -> "Orthonormalized"
| Natural -> "Natural"
| Localized -> "Localized"
2019-04-11 17:04:49 +02:00
| MCSCF -> "MCSCF"
2019-01-25 11:39:31 +01:00
| None -> "None"
;;
let of_string s =
2019-03-13 11:35:21 +01:00
match String.lowercase_ascii (String.trim s) with
2019-01-25 11:39:31 +01:00
| "guess" -> Guess
| "canonical" -> Canonical
| "natural" -> Natural
| "localized" -> Localized
| "orthonormalized" -> Orthonormalized
2019-04-11 17:04:49 +02:00
| "mcscf" -> MCSCF
2019-01-25 11:39:31 +01:00
| "none" -> None
| _ -> (print_endline s ; failwith "MO_label should be one of:
2019-04-11 17:04:49 +02:00
Guess | Orthonormalized | Canonical | Natural | Localized | MCSCF | None.")
2019-01-25 11:39:31 +01:00
;;