Fixed options

This commit is contained in:
Anthony Scemama 2019-01-14 19:52:41 +01:00
parent 316fb508d5
commit cd7d0280d7
18 changed files with 429 additions and 232 deletions

View File

@ -15,12 +15,12 @@ Usage
.. code:: bash
qp_convert_output_to_ezfio <file.out> [-o EZFIO_DIR]
qp_convert_output_to_ezfio [-o EZFIO_DIR] FILE
.. option:: -o, --output=EZFIO_DIR
Renames the |EZFIO| directory. If this option is not present, the default
name fill be :file:`<FILE.out>.ezfio`
name fill be :file:`FILE.ezfio`
.. note::
All the parameters of the wave functgion need to be presente in the output

View File

@ -13,14 +13,9 @@ Usage
.. code:: bash
qp_create_ezfio_from_xyz [FLAGS] (<xyz_file> | <zmt_file>)
qp_create_ezfio_from_xyz [-a] -b <string> [-c <int>] [-d <float>]
[-h] [-m <int>] [-o EZFIO_DIR] [-p <string>] [-x] [--] FILE
Flags :
[-a|--au] [-b string|--basis=string]
[-c int|--charge=int] [-d float|--dummy=float] [-h|--help]
[-m int|--multiplicity=int] [-o file|--output=file]
[-p string|--pseudo=string] [-x|--cartesian]
.. option:: -a, --au
@ -37,6 +32,10 @@ Usage
-b "cc-pvtz | 1,H:sto-3g | 3,H:6-31g"
By default, the basis set is obtained from the local database of the |qp|.
This option is mandatory.
If ``<string>`` is set to ``show``, the list of all available basis sets is
displayed.
.. option:: -c, --charge=<int>

View File

@ -27,8 +27,7 @@ Usage
.. code:: bash
qp_edit [-c|--check] [-h|--help] [-n <int>|--ndet=<int>]
[-s <range>|--state=<range>] [--] EZFIO_DIR
qp_edit [-c] [-h] [-n <int>] [-s <range>] [--] EZFIO_DIR
.. option:: -c, --check

View File

@ -24,7 +24,7 @@ Usage
Prints the help message
.. note::
There can be conflicts due to the version of Glibc. The machine on which |QP| is
There can be conflicts due to the version of glibc. The machine on which |QP| is
compiled should be the oldest one.

View File

@ -15,11 +15,11 @@ Usage
.. code:: bash
qp_plugins list [ -i, --installed | -u, --uninstalled | -q, --repositories ]
qp_plugins list [-i] [-u] [-q]
qp_plugins download <url>
qp_plugins install <name>...
qp_plugins uninstall <name>
qp_plugins create -n <name> [-r, --repository=<repo>] [<needed_modules>...]
qp_plugins create -n <name> [-r <repo>] [<needed_modules>...]
.. option:: list
@ -37,7 +37,7 @@ Usage
List all the downloaded repositories.
.. option:: download URL
.. option:: download <url>
Download an external repository. The URL points to a tar.gz file or a
git repository, for example:

View File

@ -15,8 +15,7 @@ Usage
.. code:: bash
qp_run [-h|--help] [-p <string>|--prefix=<string>] [-s|--slave] [--]
PROGRAM EZFIO_DIR
qp_run [-h] [-p <string>] [-s] [--] PROGRAM EZFIO_DIR
``PROGRAM`` is the name of the |QP| program to be run, and ``EZFIO_DIR`` is
the name of the |EZFIO| directory containing the data.

View File

@ -21,7 +21,7 @@ Usage
.. code:: bash
qp_set_frozen_core [-q] <EZFIO_DIRECTORY>
qp_set_frozen_core [-q] EZFIO_DIR
.. option:: -q

View File

@ -38,38 +38,32 @@ Usage
.. code:: bash
qp_set_mo_class [FLAGS] <EZFIO_DIRECTORY>
Flags:
[-act range] [-core range] [-del range]
[-inact range] [-q] [-virt range]
[-help]
qp_set_mo_class [-a <range>] [-c <range>] [-d <range>] [-h] [-i <range>]
[-q] [-v <range>] [--] EZFIO_DIR
.. option:: -act <range>
.. option:: -a, --act=<range>
Range of active orbitals
.. option:: -core <range>
.. option:: -c, --core=<range>
Range of core orbitals
.. option:: -del <range>
.. option:: -d, --del=<range>
Range of deleted orbitals
.. option:: -inact <range>
.. option:: -i, --inact=<range>
Range of inactive orbitals
.. option:: -q
.. option:: -q, --query
Query: print the current masks
Print the |MO| classes
.. option:: -virt <range>
.. option:: -v, --virt=<range>
Range of virtual orbitals
.. option:: -help, -?

View File

@ -1,161 +1,199 @@
type argument = With_arg | Without_arg | With_opt_arg
type short_opt = char
type long_opt = string
type optional = Mandatory | Optional
type documentation = string
type argument = With_arg of string | Without_arg | With_opt_arg of string
let anon_args = ref []
type description = {
short: short_opt ;
long : long_opt ;
opt : optional ;
doc : documentation ;
arg : argument ;
}
let anon_args = ref []
and header_doc = ref ""
and description_doc = ref ""
and footer_doc = ref ""
and specs = ref []
and specs = ref []
let set_header_doc s = header_doc := s
let set_description_doc s = description_doc := s
let set_footer_doc s = footer_doc := s
let dict =
let d = Hashtbl.create 67 in
d
(* Hash table containing all the options *)
let dict = Hashtbl.create 67
let get_bool x = Hashtbl.mem dict x
let show_help () = get_bool "help"
let get x =
try Some (Hashtbl.find dict x)
with Not_found -> None
try Some (Hashtbl.find dict x)
with Not_found -> None
let get_bool x =
Hashtbl.mem dict x
let anonymous name opt doc =
{ short=' ' ; long=name; opt; doc; arg=Without_arg; }
let show_help () =
get_bool "help"
let output_text t =
Format.printf "@[<v 0>";
begin
match Str.split (Str.regexp "\n") t with
| x :: [] -> Format.printf "@[<hov 0>";
Str.split (Str.regexp " ") x
|> List.iter (fun y -> Format.printf "@[%s@]@ " y) ;
Format.printf "@]"
| t -> List.iter (fun x ->
Format.printf "@[<hov 0>";
Str.split (Str.regexp " ") x
|> List.iter (fun y -> Format.printf "@[%s@]@ " y) ;
Format.printf "@]@;") t
end;
Format.printf "@]"
;;
let output_short x =
match x.short, x.opt, x.arg with
| ' ', Mandatory, _ -> Format.printf "@[%s@]" x.long
| ' ', Optional , _ -> Format.printf "@[[%s]@]" x.long
| _ , Mandatory, Without_arg -> Format.printf "@[-%c@]" x.short
| _ , Optional , Without_arg -> Format.printf "@[[-%c]@]" x.short
| _ , Mandatory, With_arg arg -> Format.printf "@[-%c %s@]" x.short arg
| _ , Optional , With_arg arg -> Format.printf "@[[-%c %s]@]" x.short arg
| _ , Mandatory, With_opt_arg arg -> Format.printf "@[-%c [%s]@]" x.short arg
| _ , Optional , With_opt_arg arg -> Format.printf "@[[-%c [%s]]@]" x.short arg
let output_long max_width x =
let arg =
match x.short, x.arg with
| ' ' , _ -> x.long
| _ , Without_arg -> x.long
| _ , With_arg arg -> Printf.sprintf "%s=%s" x.long arg
| _ , With_opt_arg arg -> Printf.sprintf "%s[=%s]" x.long arg
in
let long =
let l = String.length arg in
arg^(String.make (max_width-l) ' ')
in
Format.printf "@[<v 0>";
begin
match x.short with
| ' ' -> Format.printf "@[%s @]" long
| short -> Format.printf "@[-%c --%s @]" short long
end;
Format.printf "@]";
output_text x.doc
let anonymous ?(optional=false) name doc =
( ' ', name, doc,
if optional then With_opt_arg else Without_arg
)
let help () =
Format.printf "@[%s@]@.@." !header_doc;
let get_param_from_doc doc =
match Str.split (Str.regexp "[ \n\r\x0c\t]+") doc with
| param :: doc -> param, (String.concat " " doc)
| _ -> failwith "Bad format for documentation"
in
(* Print the header *)
output_text !header_doc;
Format.printf "@.@.";
let anon =
List.filter (fun (x,_,_,_) -> x = ' ') !specs
|> List.map (fun x ->
match x with
| (_,name,doc,Without_arg) -> (name,doc,false)
| (_,name,doc,_) -> (name,doc,true)
)
in
(* Find the anonymous arguments *)
let anon =
List.filter (fun x -> x.short = ' ') !specs
in
let options =
List.filter (fun (x,_,_,_) -> x <> ' ') !specs
|> List.sort (fun (x,_,_,_) (y,_,_,_) -> Char.compare x y)
|> List.map (fun x ->
match x with
| (short,long,doc,With_arg) -> (* with arg *)
let param, doc = get_param_from_doc doc in
(Printf.sprintf "-%c %s" short param,
Printf.sprintf "--%s=%s" long param,
doc)
| (short,long,doc,Without_arg) -> (* without arg *)
(Printf.sprintf "-%c" short,
Printf.sprintf "--%s" long,
doc)
| (short,long,doc,With_opt_arg) -> (* with or without arg *)
let param, doc = get_param_from_doc doc in
(Printf.sprintf "-%c [%s]" short param,
Printf.sprintf "--%s[=%s]" long param,
doc)
)
in
(* Find the options *)
let options =
List.filter (fun x -> x.short <> ' ') !specs
|> List.sort (fun x y -> Char.compare x.short y.short)
in
let max_short =
List.map (fun (x,_,_) -> String.length x) options
|> List.fold_left max 0
in
let max_long =
List.map (fun (_,x,_) -> String.length x) options
|> List.fold_left max 0
in
let fmt_opt max_w o =
let l = String.length o in
o^(String.make (max_w-l) ' ')
in
(* Find column lengths *)
let max_width =
List.map (fun x ->
( match x.arg with
| Without_arg -> String.length x.long
| With_arg arg -> String.length x.long + String.length arg
| With_opt_arg arg -> String.length x.long + String.length arg + 2
)
+ ( if x.opt = Optional then 2 else 0)
) !specs
|> List.fold_left max 0
in
let output_option ?(fixed_width=false) (short, long, doc) =
if fixed_width then
Format.printf "@[%s %s@]"
(fmt_opt max_short short) (fmt_opt max_long long)
else
Format.printf "@[%s|%s@]" short long
in
(* Print usage *)
Format.printf "@[<v>@[<v 2>Usage:@,@,@[<hov 4>@[%s@]" Sys.argv.(0);
List.iter (fun x -> Format.printf "@ "; output_short x) options;
Format.printf "@ @[[--]@]";
List.iter (fun x -> Format.printf "@ "; output_short x;) anon;
Format.printf "@]@,@]@,";
let output_anon ?(fixed_width=false) (name, doc, optional) =
if optional then
Format.printf "@[[%s]@]" name
else
Format.printf "@[%s@]" name
in
Format.printf "@[<v>@[<v 2>Usage:@,@,@[<hov 4>@[%s@]" Sys.argv.(0);
List.iter (fun x ->
Format.printf "@ @[[";
output_option ~fixed_width:false x;
Format.printf "]@]"
) options;
Format.printf "@ @[[--]@]";
List.iter (fun x ->
Format.printf "@ @[";
output_anon ~fixed_width:false x;
Format.printf "@]"
) anon;
Format.printf "@]@]@,@,";
(* Print arguments and doc *)
Format.printf "@[<v 2>Arguments:@,";
Format.printf "@[<v 0>" ;
List.iter (fun x -> Format.printf "@ "; output_long max_width x) anon;
Format.printf "@]@,@]@,";
Format.printf "@[<v>Arguments:@,";
Format.printf "@[<v 2>@," ;
List.iter (fun (name,doc,optional) ->
Format.printf "@[<h>";
output_anon ~fixed_width:true (name,doc,optional);
Format.printf "@ @[<v 0>%s@]@]@," doc
) anon;
Format.printf "@]@;";
(* Print options and doc *)
Format.printf "@[<v 2>Options:@,";
Format.printf "@[<v>Options:@,";
Format.printf "@[<v 0>" ;
List.iter (fun x -> Format.printf "@ "; output_long max_width x) options;
Format.printf "@]@,@]@,";
(* Print footer *)
if !description_doc <> "" then
begin
Format.printf "@[<v 2>Description:@,@,";
output_text !description_doc;
Format.printf "@,"
end;
(* Print footer *)
output_text !footer_doc;
Format.printf "@."
Format.printf "@[<v 2>@," ;
List.iter (fun (short,long,doc) ->
Format.printf "@[<h>";
output_option ~fixed_width:true (short,long,doc);
Format.printf "@ @[<v 0>%s@]@]@," doc
) options;
Format.printf "@]@;";
Format.printf "@[%s@]@." !footer_doc
let set_specs specs_in =
specs := ( 'h', "help", "Prints the help message", Without_arg) :: specs_in;
specs := { short='h' ;
long ="help" ;
doc ="Prints the help message." ;
arg =Without_arg ;
opt =Optional ;
} :: specs_in;
let specs =
List.filter (fun (x,_,_,_) -> x != ' ') !specs
|> List.map (fun x ->
match x with
| (short, long, doc, With_arg) ->
(short, long, None, Some (fun x -> Hashtbl.replace dict long x) )
| (short, long, doc, Without_arg) ->
(short, long, Some (fun () -> Hashtbl.replace dict long ""), None)
| (short, long, doc, With_opt_arg) ->
(short, long, Some (fun () -> Hashtbl.replace dict long ""),
Some (fun x -> Hashtbl.replace dict long x) )
)
in
let cmd_specs =
List.filter (fun x -> x.short != ' ') !specs
|> List.map (fun { short ; long ; opt ; doc ; arg } ->
match arg with
| With_arg _ ->
(short, long, None, Some (fun x -> Hashtbl.replace dict long x) )
| Without_arg ->
(short, long, Some (fun () -> Hashtbl.replace dict long ""), None)
| With_opt_arg _ ->
(short, long, Some (fun () -> Hashtbl.replace dict long ""),
Some (fun x -> Hashtbl.replace dict long x) )
)
in
Getopt.parse_cmdline specs (fun x -> anon_args := !anon_args @ [x]);
Getopt.parse_cmdline cmd_specs (fun x -> anon_args := !anon_args @ [x]);
if show_help () then
(help () ; exit 0);
(* Check that all mandatory arguments are set *)
List.filter (fun x -> x.short <> ' ' && x.opt = Mandatory) !specs
|> List.iter (fun x ->
match get x.long with
| Some _ -> ()
| None -> failwith ("Error: --"^x.long^" option is missing.")
)
;;
if show_help () then
(help () ; exit 0)
let anon_args () = !anon_args

126
ocaml/Command_line.mli Normal file
View File

@ -0,0 +1,126 @@
(** Handles command-line arguments, using getopt.
Example:
let () =
(* Command-line specs *)
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - quantum_package command");
[ { short='c'; long="check"; opt=Optional;
doc="Checks the input data";
arg=Without_arg; };
{ short='n'; long="ndet"; opt=Optional;
doc="Truncate the wavefunction to the target number of determinants";
arg=With_arg "<int>"; };
{ short='s'; long="state"; opt=Optional;
doc="Extract selected states, for example \"[1,3-5]\"";
arg=With_arg "<range>"; };
anonymous "EZFIO_DIR" Mandatory "EZFIO directory";
]
|> set_specs ;
set_description_doc
"Opens a text editor to edit the parameters of a EZFIO directory.";
end;
(* Handle options *)
let ndet =
match Command_line.get "ndet" with
| None -> None
| Some s -> (try Some (int_of_string s)
with _ -> failwith "[-n|--ndet] expects an integer")
in
let state =
match Command_line.get "state" with
| None -> None
| Some s -> (try Some (Range.of_string s)
with _ -> failwith "[-s|--state] expects a range")
in
let c = Command_line.get_bool "check" in
let filename =
match Command_line.anon_args () with
| [x] -> x
| _ -> (Command_line.help () ; failwith "EZFIO_DIR is missing")
in
(* Run the program *)
run c ?ndet ?state filename
*)
type short_opt = char
type long_opt = string
type optional = Mandatory
| Optional
type documentation = string
type argument = With_arg of string
| Without_arg
| With_opt_arg of string
type description =
{
short : short_opt;
long : long_opt;
opt : optional;
doc : documentation;
arg : argument;
}
(** Sets the header of the help message. *)
val set_header_doc : string -> unit
(** Sets the description of the help message. *)
val set_description_doc : string -> unit
(** Sets the footer of the help message. *)
val set_footer_doc : string -> unit
(** Gets the value of an option. If the option is not set, returns [None]. If
the option is set, returns Some <string>. *)
val get : string -> string option
(** Gets the value of an option with no argument. If the option is set, returns [true]. *)
val get_bool : string -> bool
(** True if the '-h' or "--help" option was found. *)
val show_help : unit -> bool
(** Creates a specification of an anonymous argument. *)
val anonymous : long_opt -> optional -> documentation -> description
(** Prints the help message *)
val help : unit -> unit
(** Sets the specification list as a list of tuples:
( short option, long option, documentation, argument ) *)
val set_specs : description list -> unit
(** Returns the list of anonymous arguments *)
val anon_args : unit -> string list

View File

@ -69,7 +69,6 @@ let list_basis () =
)
in
List.sort basis_list ~compare:String.ascending
|> String.concat ~sep:"\n"
(** Run the program *)
@ -648,36 +647,54 @@ let run ?o b au c d m p cart xyz_file =
let () =
"=== Available basis sets ===
" ^ (list_basis ()) ^ "
let open Command_line in
begin
"Creates an EZFIO directory from a standard xyz file or from a z-matrix file in Gaussian format. The basis set is defined as a single string if all the atoms are taken from the same basis set, otherwise specific elements can be defined as follows:
============================
-b \"cc-pcvdz | H:cc-pvdz | C:6-31g\"
-b \"cc-pvtz | 1,H:sto-3g | 3,H:6-31g\"
Creates an EZFIO directory from a standard xyz file or from a z-matrix file
in Gaussian format. The basis set is defined as a single string if all the
atoms are taken from the same basis set, otherwise specific elements can be
defined as follows:
If a file with the same name as the basis set exists, this file will be read. Otherwise, the basis set is obtained from the database.
" |> set_description_doc ;
set_header_doc (Sys.argv.(0) ^ " - Quantum Package command");
-b \"cc-pcvdz | H:cc-pvdz | C:6-31g\"
-b \"cc-pvtz | 1,H:sto-3g | 3,H:6-31g\"
[ { opt=Optional ; short='o'; long="output";
arg=With_arg "EZFIO_DIR";
doc="Name of the created EZFIO directory."} ;
If a file with the same name as the basis set exists, this file will be read.
Otherwise, the basis set is obtained from the database.
{ opt=Mandatory; short='b'; long="basis";
arg=With_arg "<string>";
doc="Name of basis set. If <string>=show, the list of all basis sets is displayed."} ;
" |> Command_line.set_header_doc ;
{ opt=Optional ; short='a'; long="au";
arg=Without_arg;
doc="Input geometry is in atomic units."} ;
[ ( 'o', "output", "<file> Name of the created EZFIO file.", Command_line.With_arg) ;
( 'b', "basis", "<string> Name of basis set.", Command_line.With_arg) ;
( 'a', "au", "Input geometry is in atomic units.", Command_line.Without_arg) ;
( 'c', "charge", "<int> Total charge of the molecule. Default is 0.", Command_line.With_arg) ;
( 'd', "dummy", "<float> Add dummy atoms. x * (covalent radii of the atoms)", Command_line.With_arg);
( 'm', "multiplicity", "<int> Spin multiplicity (2S+1) of the molecule. Default is 1.", Command_line.With_arg);
( 'p', "pseudo", "<string> Name of the pseudopotential.", Command_line.With_arg);
( 'x', "cartesian", "Compute AOs in the Cartesian basis set (6d, 10f, ...)", Command_line.Without_arg);
Command_line.anonymous "(xyz_file|zmt_file)" "input file in xyz format or z-matrix."
]
|> Command_line.set_specs ;
{ opt=Optional ; short='c'; long="charge";
arg=With_arg "<int>";
doc="Total charge of the molecule. Default is 0."} ;
{ opt=Optional ; short='d'; long="dummy";
arg=With_arg "<float>";
doc="Add dummy atoms. x * (covalent radii of the atoms)."} ;
{ opt=Optional ; short='m'; long="multiplicity";
arg=With_arg "<int>";
doc="Spin multiplicity (2S+1) of the molecule. Default is 1."} ;
{ opt=Optional ; short='p'; long="pseudo";
arg=With_arg "<string>";
doc="Name of the pseudopotential."} ;
{ opt=Optional ; short='x'; long="cartesian";
arg=Without_arg;
doc="Compute AOs in the Cartesian basis set (6d, 10f, ...)."} ;
anonymous "FILE" Mandatory "Input file in xyz format or z-matrix.";
]
|> set_specs
end;
(* Handle options *)
@ -687,7 +704,7 @@ Otherwise, the basis set is obtained from the database.
let basis =
match Command_line.get "basis" with
| None -> (Command_line.help () ; failwith "Error: [-b|--basis] option is missing.")
| None -> assert false
| Some x -> x
in
@ -721,6 +738,13 @@ Otherwise, the basis set is obtained from the database.
Command_line.get_bool "cartesian"
in
if basis = "show" then
begin
list_basis ()
|> List.iter ~f:print_endline;
exit 0
end;
let xyz_filename =
match Command_line.anon_args () with
| [x] -> x

View File

@ -141,34 +141,32 @@ let run slave ?prefix exe ezfio_file =
let () =
(* Command-line specs *)
"Executes a Quantum Package binary file among these:\n\n"
^ (Lazy.force Qpackage.executables
|> List.map (fun (x,_) -> Printf.sprintf " * %s" x )
|> String.concat "\n"
) |> Command_line.set_header_doc;
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - Quantum Package command");
"Executes a Quantum Package binary file among these:\n\n"
^ (Lazy.force Qpackage.executables
|> List.map (fun (x,_) -> Printf.sprintf " * %s" x )
|> String.concat "\n")
|> set_description_doc;
[ ( 's', "slave", "Required to run slave tasks in distributed environments",
Command_line.Without_arg);
( 'p', "prefix", "<string> Prefix before running the program, like gdb or valgrind",
Command_line.With_arg );
Command_line.anonymous "PROGRAM" "Name of the QP program to be run";
Command_line.anonymous "EZFIO_DIR" "EZFIO directory";
[ { short='s'; long="slave"; opt=Optional;
doc="Required to run slave tasks in distributed environments.";
arg=Without_arg; };
{ short='p'; long="prefix"; opt=Optional;
doc="Prefix before running the program, like gdb or valgrind.";
arg=With_arg "<string>"; };
anonymous "PROGRAM" Mandatory "Name of the QP program to be run";
anonymous "EZFIO_DIR" Mandatory "EZFIO directory";
]
|> Command_line.set_specs ;
|> set_specs ;
end;
(* Handle options *)
if Command_line.show_help () then
exit 0;
let slave =
match Command_line.get "slave" with
| None -> false
| _ -> true
in
let prefix =
Command_line.get "prefix"
let slave = Command_line.get_bool "slave"
and prefix = Command_line.get "prefix"
in
(* Run the program *)

View File

@ -314,30 +314,50 @@ let default range =
let () =
"Set the orbital classes in an EZFIO directory.
The range of MOs has the form : \"[36-53,72-107,126-131]\"." |> Command_line.set_header_doc ;
let open Command_line in
begin
"Set the orbital classes in an EZFIO directory. The range of MOs has the form : \"[36-53,72-107,126-131]\"."
|> set_footer_doc ;
[ ( 'c', "core", "range Range of core MOs", Command_line.With_opt_arg);
( 'i', "inact", "range Range of inactive MOs", Command_line.With_opt_arg);
( 'a', "act", "range Range of active MOs", Command_line.With_opt_arg);
( 'v', "virt", "range Range of virtual MOs", Command_line.With_opt_arg);
( 'd', "del", "range Range of deleted MOs", Command_line.With_opt_arg);
( 'q', "query", "Print the current MOs classes", Command_line.Without_arg);
Command_line.anonymous "<EZFIO_FILE>" "EZFIO directory";
] |> Command_line.set_specs ;
[ { opt=Optional ; short='c'; long="core";
arg=With_arg "<range>";
doc="Range of core MOs." };
{ opt=Optional ; short='i'; long="inact";
arg=With_arg "<range>";
doc="Range of inactive MOs." };
{ opt=Optional ; short='a'; long="act";
arg=With_arg "<range>";
doc="Range of active MOs." };
{ opt=Optional ; short='v'; long="virt";
arg=With_arg "<range>";
doc="Range of virtual MOs." };
{ opt=Optional ; short='d'; long="del";
arg=With_arg "<range>";
doc="Range of deleted MOs." };
{ opt=Optional ; short='q'; long="query";
arg=Without_arg;
doc="Print the current MO classes." };
anonymous "EZFIO_DIR" Mandatory "EZFIO directory.";
] |> set_specs
end;
(* Handle options *)
if Command_line.show_help () then
exit 0;
let core = Command_line.get "core"
and inact = Command_line.get "inact"
and act = Command_line.get "act"
and virt = Command_line.get "virt"
and del = Command_line.get "del"
and q = Command_line.get_bool "q"
and q = Command_line.get_bool "query"
in
let ezfio_filename =
match Command_line.anon_args () with
| [x] -> x

View File

@ -39,10 +39,10 @@ do
done
if [[ $? -ne 0 ]] ; then
echo "==================================================" 1>& 2
echo "Unable to create temporary file $tmpfile" 1>& 2
echo "==================================================" 1>& 2
echo "ERROR"
>&2 echo "=================================================="
>&2 echo "Unable to create temporary file $tmpfile"
>&2 echo "=================================================="
>&2 echo "ERROR"
exit 1
fi

View File

@ -3,11 +3,11 @@
convert output of GAMESS/GAU$$IAN to ezfio
Usage:
qp_convert_output_to_ezfio [-o EZFIO_DIR|--output=EZFIO_DIR] <file.out>
qp_convert_output_to_ezfio [-o EZFIO_DIR] FILE
Options:
-o EZFIO_DIR --output=EZFIO_DIR Produced directory
by default is file.out.ezfio
-o --output=EZFIO_DIR Produced directory
by default is FILE.ezfio
"""
@ -342,7 +342,7 @@ def get_full_path(file_path):
if __name__ == '__main__':
ARGUMENTS = docopt(__doc__)
FILE = get_full_path(ARGUMENTS['<file.out>'])
FILE = get_full_path(ARGUMENTS['FILE'])
if ARGUMENTS["--output"]:
EZFIO_FILE = get_full_path(ARGUMENTS["--output"])

View File

@ -2,7 +2,7 @@
file=$1
if [[ -z ${QP_ROOT} ]] ; then
2>& echo "please source quantum_package.rc"
>&2 echo "please source quantum_package.rc"
exit 1
fi
source ${QP_ROOT}/quantum_package.rc

View File

@ -13,7 +13,7 @@ zero.
Usage:
qp_set_frozen_core [-q|--query] <EZFIO_DIRECTORY>
qp_set_frozen_core [-q|--query] EZFIO_DIR
Options:
-q --query Prints in the standard output the number of frozen MOs
@ -37,7 +37,7 @@ from ezfio import ezfio
def main(arguments):
"""Main function"""
filename = arguments["<EZFIO_DIRECTORY>"]
filename = arguments["EZFIO_DIR"]
ezfio.set_filename(filename)
n_frozen = 0

View File

@ -10,7 +10,7 @@
if [[ -n $1 ]] ; then
exec sed --in-place 's| *$||' $1
else
2>& echo "Usage: $0 FILE"
>&2 echo "Usage: $0 FILE"
exit 1
fi