10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-14 18:13:40 +01:00
QCaml/run_integrals.ml

56 lines
1.7 KiB
OCaml

let out_file : string option ref = ref None
let basis_file : string option ref = ref None
let nuclei_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 -> nuclei_file := Some x),
"File containing the nuclear coordinates") ;
( "-o" , Arg.String (fun x -> out_file := Some x) ,
"Output file") ;
]
let run ~out =
(*
let gc = Gc.get () in
Gc.set { gc with minor_heap_size=(262144 / 16) };
*)
let out_file =
match out with
| None -> raise (Invalid_argument "Output file should be specified with -o")
| Some x -> x
and basis_file =
match !basis_file with
| None -> raise (Invalid_argument "Basis set file should be specified with -b")
| Some x -> x
and nuclei_file =
match !nuclei_file with
| None -> raise (Invalid_argument "Basis set file should be specified with -c")
| Some x -> x
in
let s =
Simulation.of_filenames ~nuclei:nuclei_file ~basis:basis_file
in
print_endline @@ Nuclei.to_string s.Simulation.nuclei;
print_endline @@ Basis.to_string s.Simulation.basis;
let overlap = Lazy.force s.Simulation.overlap in
let eN_ints = Lazy.force s.Simulation.eN_ints in
let kin_ints = Lazy.force s.Simulation.kin_ints in
let ee_ints = Lazy.force s.Simulation.ee_ints in
Overlap.to_file ~filename:(out_file^".overlap") overlap;
NucInt.to_file ~filename:(out_file^".nuc") eN_ints;
KinInt.to_file ~filename:(out_file^".kin") kin_ints;
ERI.to_file ~filename:(out_file^".eri") ee_ints
let () =
let usage_msg = "Available options:" in
Arg.parse speclist (fun _ -> ()) usage_msg;
run ~out:!out_file