10
1
mirror of https://github.com/pfloos/quack synced 2024-11-04 21:23:55 +01:00
QuAcK/qcaml-tools/quack_input.ml

74 lines
1.8 KiB
OCaml
Raw Normal View History

2020-10-08 11:52:49 +02:00
let basis_file : string option ref = ref None
let nuclei_file : string option ref = ref None
let charge : int option ref = ref None
let multiplicity : int option ref = ref None
let speclist = [
( "-b" , Arg.String (fun x -> basis_file := Some x),
"File containing the atomic basis set") ;
( "-c" , Arg.Int (fun x -> charge := Some x),
"Total charge of the system") ;
( "-m" , Arg.Int (fun x -> multiplicity := Some x),
"Multiplicity of the system") ;
( "-x" , Arg.String (fun x -> nuclei_file := Some x),
"File containing the nuclear coordinates") ;
]
2020-10-10 11:30:40 +02:00
let print_basis nuclei basis =
(*
let open Printf in
*)
let g_basis = Qcaml.Gaussian.Basis.general_basis basis in
let dict =
Array.to_list nuclei
|> List.mapi (fun i (e, _) ->
(i+1), List.assoc e g_basis
)
in
List.iter (fun (i,b) ->
Format.printf "%d %d\n" i (Array.length b);
Array.iter (fun x ->
Format.printf "%a" Qcaml.Gaussian.General_basis.pp_gcs x) b
) dict
(*
List.iteri (fun atom_number (_element, _basis) ->
printf "%3d %3d\n" (atom_number+1) 0;
) basis
*)
2020-10-08 11:52:49 +02:00
let run () =
let 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 "Coordinate file should be specified with -x")
| Some x -> x
in
let nuclei =
2020-10-10 11:30:40 +02:00
Qcaml.Particles.Nuclei.of_xyz_file nuclei_file
2020-10-08 11:52:49 +02:00
in
let basis =
2020-10-10 11:30:40 +02:00
Qcaml.Gaussian.Basis.of_nuclei_and_basis_filename ~nuclei basis_file
2020-10-08 11:52:49 +02:00
in
(* Print basis *)
2020-10-10 11:30:40 +02:00
print_basis nuclei basis;
2020-10-08 11:52:49 +02:00
()
let () =
let usage_msg = "Available options:" in
Arg.parse speclist (fun _ -> ()) usage_msg;
run ()