mirror of
https://github.com/LCPQ/quantum_package
synced 2024-11-08 15:13:52 +01:00
35 lines
702 B
OCaml
35 lines
702 B
OCaml
|
open Core.Std;;
|
||
|
|
||
|
type t = Gto.t list;;
|
||
|
|
||
|
(** Read all the basis functions of an element *)
|
||
|
let read in_channel =
|
||
|
let rec read result =
|
||
|
try
|
||
|
let gto = Gto.read_one in_channel in
|
||
|
read (gto::result)
|
||
|
with
|
||
|
| Gto.End_Of_Basis -> List.rev result
|
||
|
in read []
|
||
|
;;
|
||
|
|
||
|
(** Find an element in the basis set file *)
|
||
|
let find in_channel element =
|
||
|
let element_read = ref Element.X in
|
||
|
while !element_read <> element
|
||
|
do
|
||
|
let buffer = input_line in_channel in
|
||
|
try
|
||
|
element_read := Element.of_string buffer
|
||
|
with
|
||
|
| Element.ElementError _ -> ()
|
||
|
done ;
|
||
|
!element_read
|
||
|
;;
|
||
|
|
||
|
let read_element in_channel element =
|
||
|
ignore (find in_channel element) ;
|
||
|
read in_channel ;
|
||
|
;;
|
||
|
|