From 39d2c77243b8bed0e9990604135c12f7351230d1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 30 Dec 2017 19:12:20 +0100 Subject: [PATCH] Update Angular_momentum --- Angular_momentum.ml | 64 ++++++++++++++++++++++++++++----------------- Basis_lexer.mll | 2 ++ Basis_parser.mly | 2 ++ Makefile | 2 +- 4 files changed, 45 insertions(+), 25 deletions(-) diff --git a/Angular_momentum.ml b/Angular_momentum.ml index 8287d12..7ec8dd9 100644 --- a/Angular_momentum.ml +++ b/Angular_momentum.ml @@ -4,34 +4,50 @@ type t = | S | P | D | F | G | H | I | J | K | L | M | N | O let of_char = function - | 's' | 'S' -> S - | 'p' | 'P' -> P - | 'd' | 'D' -> D - | 'f' | 'F' -> F - | 'g' | 'G' -> G - | 'h' | 'H' -> H - | 'i' | 'I' -> I - | 'j' | 'J' -> J - | 'k' | 'K' -> K - | 'l' | 'L' -> L - | 'm' | 'M' -> M - | 'n' | 'N' -> N + | 's' | 'S' -> S | 'p' | 'P' -> P + | 'd' | 'D' -> D | 'f' | 'F' -> F + | 'g' | 'G' -> G | 'h' | 'H' -> H + | 'i' | 'I' -> I | 'j' | 'J' -> J + | 'k' | 'K' -> K | 'l' | 'L' -> L + | 'm' | 'M' -> M | 'n' | 'N' -> N | 'o' | 'O' -> O | c -> raise (AngularMomentumError c) let to_string = function - | S -> "S" - | P -> "P" - | D -> "D" - | F -> "F" - | G -> "G" - | H -> "H" - | I -> "I" - | J -> "J" - | K -> "K" - | L -> "L" - | M -> "M" - | N -> "N" + | S -> "S" | P -> "P" + | D -> "D" | F -> "F" + | G -> "G" | H -> "H" + | I -> "I" | J -> "J" + | K -> "K" | L -> "L" + | M -> "M" | N -> "N" | O -> "O" +let to_char = function + | S -> 'S' | P -> 'P' + | D -> 'D' | F -> 'F' + | G -> 'G' | H -> 'H' + | I -> 'I' | J -> 'J' + | K -> 'K' | L -> 'L' + | M -> 'M' | N -> 'N' + | O -> 'O' + +let to_int = function + | S -> 0 | P -> 1 + | D -> 2 | F -> 3 + | G -> 4 | H -> 5 + | I -> 6 | J -> 7 + | K -> 8 | L -> 9 + | M -> 10 | N -> 11 + | O -> 12 + +let of_int = function + | 0 -> S | 1 -> P + | 2 -> D | 3 -> F + | 4 -> G | 5 -> H + | 6 -> I | 7 -> J + | 8 -> K | 9 -> L + | 10 -> M | 11 -> N + | 12 -> O + + diff --git a/Basis_lexer.mll b/Basis_lexer.mll index 803da50..691f708 100644 --- a/Basis_lexer.mll +++ b/Basis_lexer.mll @@ -3,6 +3,8 @@ exception SyntaxError of string open Basis_parser +} + let eol = ['\n'] let white = [' ' '\t']+ let element = ['A'-'Z' 'a'-'z']+ white? eol diff --git a/Basis_parser.mly b/Basis_parser.mly index 3fc3f7a..61d4f00 100644 --- a/Basis_parser.mly +++ b/Basis_parser.mly @@ -1,3 +1,5 @@ +/* Parses basis sets in GAMESS format */ + %{ %} diff --git a/Makefile b/Makefile index a69b928..b55ad70 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ LIBS= PKGS= OCAMLCFLAGS="-g" -OCAMLBUILD=ocamlbuild -use-menhir -j 0 -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) +OCAMLBUILD=ocamlbuild -j 0 -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) MLLFILES=$(wildcard *.mll) MLYFILES=$(wildcard *.mly) MLFILES=$(wildcard *.ml)