10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-06 22:23:42 +01:00
QCaml/run_integrals.ml
2018-01-19 20:20:19 +01:00

61 lines
1.5 KiB
OCaml

let basis_file : string option ref = ref None
let coord_file : string option ref = ref None
let out_file : string option ref = ref None
let speclist = [
( "-b" , Arg.String (fun x -> basis_file := Some x) ,
"File containing the atomic basis set") ;
( "-c" , Arg.String (fun x -> coord_file := Some x) ,
"File containing the nuclear coordinates") ;
( "-o" , Arg.String (fun x -> out_file := Some x) ,
"Output file") ;
]
let run ~coord ~basis ~out =
let coord_file =
match coord with
| None -> raise (Invalid_argument "Coordinate file should be specified with -c")
| Some x -> x
and basis_file =
match basis with
| None -> raise (Invalid_argument "Basis set file should be specified with -b")
| Some x -> x
and out_file =
match out with
| None -> raise (Invalid_argument "Output file should be specified with -o")
| Some x -> x
in
let nuclei =
Nuclei.of_xyz_file ~filename:coord_file
in
print_endline @@ Nuclei.to_string nuclei;
let basis =
let general_basis =
Gamess_reader.read ~filename:basis_file
in
Basis.of_nuclei_and_general_basis nuclei general_basis
in
print_endline @@ Basis.to_string basis;
ERI.to_file ~filename:out_file basis
let () =
let usage_msg = "Available options:" in
Arg.parse speclist (fun _ -> ()) usage_msg;
run ~coord:!coord_file ~basis:!basis_file ~out:!out_file
(*
try
with
| Invalid_argument e ->
begin
print_string "Error: " ; print_endline e; print_newline ();
Arg.usage speclist usage_msg
end
*)