mirror of https://gitlab.com/scemama/QCaml.git
Improved GAMESS/US parser
This commit is contained in:
parent
a2859ad69c
commit
13fcc8e6fa
|
@ -22,7 +22,9 @@ let read_shell ic =
|
|||
|
||||
let shell, n =
|
||||
try
|
||||
Scanf.sscanf (input_line ic) " %c %d " (fun shell n -> shell, n)
|
||||
let line = input_line ic in
|
||||
if String.trim line = "$END" then raise End_of_file;
|
||||
Scanf.sscanf line "%c %d " (fun shell n -> shell, n)
|
||||
with
|
||||
| End_of_file -> raise No_shell
|
||||
| Scanf.Scan_failure m -> raise (Malformed_shell m)
|
||||
|
@ -63,19 +65,21 @@ let read_element ic =
|
|||
Some (element, Array.of_list (loop ()) )
|
||||
|
||||
with
|
||||
| Element.ElementError _ -> None
|
||||
| End_of_file -> None
|
||||
|
||||
|
||||
|
||||
let read filename =
|
||||
let ic = open_in filename in
|
||||
let rec loop () =
|
||||
let rec loop accu =
|
||||
try
|
||||
match read_element ic with
|
||||
| Some e -> e :: loop ()
|
||||
| None -> []
|
||||
| Some e -> loop (e :: accu)
|
||||
| None -> accu
|
||||
with
|
||||
Element.ElementError _ -> loop accu
|
||||
in
|
||||
loop ()
|
||||
loop []
|
||||
|
||||
|
||||
let combine basis_list =
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue