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

58 lines
1.8 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
2019-02-22 19:19:11 +01:00
| None -> raise (Invalid_argument "Coordinate file should be specified with -c")
2018-02-09 00:37:25 +01:00
| 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
2019-02-20 18:15:15 +01:00
print_endline @@ Nuclei.to_string @@ Simulation.nuclei s;
2018-02-20 23:54:48 +01:00
print_endline "Nuclear repulsion : ";
2019-02-20 18:15:15 +01:00
print_float @@ Simulation.nuclear_repulsion s; print_newline ();
print_endline @@ Basis.to_string @@ Simulation.basis s;
2018-02-09 00:37:25 +01:00
2019-02-20 18:15:15 +01:00
let ao_basis = Simulation.ao_basis s in
2019-02-20 18:24:44 +01:00
let overlap = AOBasis.overlap ao_basis in
let eN_ints = AOBasis.eN_ints ao_basis in
let kin_ints = AOBasis.kin_ints ao_basis in
let ee_ints = AOBasis.ee_ints ao_basis in
2019-03-13 22:02:08 +01:00
let f12_ints = AOBasis.f12_ints ao_basis in
2018-02-09 00:37:25 +01:00
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;
2019-03-13 22:02:08 +01:00
ERI.to_file ~filename:(out_file^".eri") ee_ints;
F12.to_file ~filename:(out_file^".f12") f12_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