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

54 lines
1.7 KiB
OCaml
Raw Normal View History

2018-02-09 00:37:25 +01:00
let out_file : string option ref = ref None
let basis_file : string option ref = ref None
let nuclei_file : string option ref = ref None
2018-01-18 00:21:05 +01:00
let speclist = [
2018-02-09 00:37:25 +01:00
( "-b" , Arg.String (fun x -> basis_file := Some x),
2018-01-19 03:14:06 +01:00
"File containing the atomic basis set") ;
2018-02-09 00:37:25 +01:00
( "-c" , Arg.String (fun x -> nuclei_file := Some x),
2018-01-19 03:14:06 +01:00
"File containing the nuclear coordinates") ;
( "-o" , Arg.String (fun x -> out_file := Some x) ,
"Output file") ;
2018-01-18 00:21:05 +01:00
]
2018-01-22 23:19:24 +01:00
let run ~out =
let out_file =
2018-01-19 03:14:06 +01:00
match out with
| None -> raise (Invalid_argument "Output file should be specified with -o")
2018-01-18 00:21:05 +01:00
| Some x -> x
2018-02-09 00:37:25 +01:00
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
2018-01-18 00:21:05 +01:00
in
2018-01-19 03:14:06 +01:00
2018-02-09 00:37:25 +01:00
let s =
2018-02-22 18:20:45 +01:00
Simulation.of_filenames ~nuclei:nuclei_file basis_file
2018-02-09 00:37:25 +01:00
in
2018-01-19 03:14:06 +01:00
2018-02-09 00:37:25 +01:00
print_endline @@ Nuclei.to_string s.Simulation.nuclei;
2018-02-20 23:54:48 +01:00
print_endline "Nuclear repulsion : ";
print_float s.Simulation.nuclear_repulsion; print_newline ();
2018-02-09 00:37:25 +01:00
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
2018-01-18 00:21:05 +01:00
let () =
2018-01-18 14:56:08 +01:00
let usage_msg = "Available options:" in
2018-01-18 00:21:05 +01:00
Arg.parse speclist (fun _ -> ()) usage_msg;
2018-01-22 23:19:24 +01:00
run ~out:!out_file
2018-01-19 03:14:06 +01:00