QCaml/run_integrals.ml

57 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
2020-03-26 16:24:41 +01:00
let mu_erf : float 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") ;
2019-04-05 14:33:31 +02:00
( "-x" , Arg.String (fun x -> nuclei_file := Some x),
2018-01-19 03:14:06 +01:00
"File containing the nuclear coordinates") ;
2020-03-26 16:24:41 +01:00
( "-m" , Arg.Float (fun x -> mu_erf := Some x),
"Value of mu, the range separation factor.") ;
2018-01-18 00:21:05 +01:00
]
2020-01-17 10:51:11 +01:00
let run () =
let basis_file =
2018-02-09 00:37:25 +01:00
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-04-05 14:33:31 +02:00
| None -> raise (Invalid_argument "Coordinate file should be specified with -x")
2018-02-09 00:37:25 +01:00
| Some x -> x
2020-03-26 16:24:41 +01:00
and mu_erf = !mu_erf
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 =
2020-03-26 16:24:41 +01:00
Simulation.of_filenames ?mu_erf ~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
2020-01-17 10:51:11 +01:00
Overlap.to_file ~filename:("Ov.dat") overlap;
NucInt.to_file ~filename:("Nuc.dat") eN_ints;
KinInt.to_file ~filename:("Kin.dat") kin_ints;
2020-03-26 16:24:41 +01:00
ERI.to_file ~filename:("ERI.dat") ee_ints;
match mu_erf with
| Some mu_erf ->
ERI_lr.to_file ~filename:("ERI_lr.dat") (AOBasis.ee_lr_ints ao_basis)
| None -> ()
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;
2020-01-17 10:51:11 +01:00
run ()
2018-01-19 03:14:06 +01:00