mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-12-22 04:13:33 +01:00
Added Command_line module
This commit is contained in:
parent
ecf61058f9
commit
61c380f31e
2
_tags
2
_tags
@ -1,4 +1,4 @@
|
|||||||
true: package(str,unix,bigarray,lacaml,alcotest,zarith)
|
true: package(str,unix,bigarray,lacaml,alcotest,zarith,getopt)
|
||||||
<*.byte> : linkdep(Utils/math_functions.o), custom
|
<*.byte> : linkdep(Utils/math_functions.o), custom
|
||||||
<*.native>: linkdep(Utils/math_functions.o)
|
<*.native>: linkdep(Utils/math_functions.o)
|
||||||
<odoc-ltxhtml>: not_hygienic
|
<odoc-ltxhtml>: not_hygienic
|
||||||
|
@ -1,38 +1,50 @@
|
|||||||
let out_file : string option ref = ref None
|
let () =
|
||||||
let basis_file : string option ref = ref None
|
let open Command_line in
|
||||||
let nuclei_file : string option ref = ref None
|
begin
|
||||||
let charge : int ref = ref 0
|
set_header_doc (Sys.argv.(0) ^ " - QCaml command");
|
||||||
let multiplicity: int ref = ref 1
|
set_description_doc "Runs a Hartree-Fock calculation";
|
||||||
|
set_specs
|
||||||
|
[ { short='b' ; long="basis" ; opt=Mandatory;
|
||||||
|
arg=With_arg "<string>";
|
||||||
|
doc="Name of the file containing the basis set"; } ;
|
||||||
|
|
||||||
|
{ short='x' ; long="xyz" ; opt=Mandatory;
|
||||||
|
arg=With_arg "<string>";
|
||||||
|
doc="Name of the file containing the nuclear coordinates in xyz format"; } ;
|
||||||
|
|
||||||
let speclist = [
|
{ short='m' ; long="multiplicity" ; opt=Optional;
|
||||||
( "-b" , Arg.String (fun x -> basis_file := Some x),
|
arg=With_arg "<int>";
|
||||||
"File containing the atomic basis set") ;
|
doc="Spin multiplicity (2S+1). Default is singlet"; } ;
|
||||||
( "-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") ;
|
|
||||||
( "-charge" , Arg.Int (fun x -> charge := x),
|
|
||||||
"Charge of the system") ;
|
|
||||||
( "-mult" , Arg.Int (fun x -> multiplicity := x),
|
|
||||||
"Spin multiplicity of the system") ;
|
|
||||||
]
|
|
||||||
|
|
||||||
let run ~out =
|
{ short='c' ; long="charge" ; opt=Optional;
|
||||||
(*
|
arg=With_arg "<int>";
|
||||||
let gc = Gc.get () in
|
doc="Total charge of the molecule. Default is 0"; } ;
|
||||||
Gc.set { gc with minor_heap_size=(262144 / 16) };
|
]
|
||||||
*)
|
end;
|
||||||
|
|
||||||
|
(* Handle options *)
|
||||||
let basis_file =
|
let basis_file =
|
||||||
match !basis_file with
|
match Command_line.get "basis" with
|
||||||
| None -> raise (Invalid_argument "Basis set file should be specified with -b")
|
|
||||||
| Some x -> x
|
| Some x -> x
|
||||||
and nuclei_file =
|
| None -> assert false
|
||||||
match !nuclei_file with
|
in
|
||||||
| None -> raise (Invalid_argument "Coordinate file should be specified with -c")
|
|
||||||
|
let nuclei_file =
|
||||||
|
match Command_line.get "xyz" with
|
||||||
| Some x -> x
|
| Some x -> x
|
||||||
and charge = !charge
|
| None -> assert false
|
||||||
and multiplicity = !multiplicity
|
in
|
||||||
|
|
||||||
|
let charge =
|
||||||
|
match Command_line.get "charge" with
|
||||||
|
| Some x -> int_of_string x
|
||||||
|
| None -> 0
|
||||||
|
in
|
||||||
|
|
||||||
|
let multiplicity =
|
||||||
|
match Command_line.get "multiplicity" with
|
||||||
|
| Some x -> int_of_string x
|
||||||
|
| None -> 1
|
||||||
in
|
in
|
||||||
|
|
||||||
let s =
|
let s =
|
||||||
@ -44,8 +56,3 @@ let run ~out =
|
|||||||
|> print_endline
|
|> print_endline
|
||||||
|
|
||||||
|
|
||||||
let () =
|
|
||||||
let usage_msg = "Available options:" in
|
|
||||||
Arg.parse speclist (fun _ -> ()) usage_msg;
|
|
||||||
run ~out:!out_file
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user