schrodinger.application.desmond.starter.ui.cmdline module¶
Common command line arguments Lightweight framework for defining new command line arguments.
Copyright Schrodinger, LLC. All rights reserved.
- schrodinger.application.desmond.starter.ui.cmdline.get_sim_time_message(default_time: float, leg_type: Optional[str] = None, default_arg: Optional[str] = None)¶
Get the help message for the sim time arguments to the FEP interfaces
- class schrodinger.application.desmond.starter.ui.cmdline.Option(name, default, help, dest)¶
Bases:
tuple
- name: Union[str, List]¶
Alias for field number 0
- default: object¶
Alias for field number 1
- help: str¶
Alias for field number 2
- dest: Dict¶
Alias for field number 3
- __contains__(key, /)¶
Return key in self.
- __len__()¶
Return len(self).
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class schrodinger.application.desmond.starter.ui.cmdline.SingleOptionAction(*args, **kwargs)¶
Bases:
argparse.Action
Argparse action handler that only allows a flag to be used once.
- __init__(*args, **kwargs)¶
- schrodinger.application.desmond.starter.ui.cmdline.define_options(parser: argparse.ArgumentParser, options: List[schrodinger.application.desmond.starter.ui.cmdline.Option])¶
Define the options on a specified parser.
- Parameters
parser – Add options to this parser.
options – List of options in the format (name, default, help, dest).
- schrodinger.application.desmond.starter.ui.cmdline.auto_int(string)¶
- schrodinger.application.desmond.starter.ui.cmdline.get_common_options() List[schrodinger.application.desmond.starter.ui.cmdline.Option] ¶
Return list of options common to all scripts.
- schrodinger.application.desmond.starter.ui.cmdline.get_common_fep_options() List[schrodinger.application.desmond.starter.ui.cmdline.Option] ¶
Return list of options common to all fep scripts.
- schrodinger.application.desmond.starter.ui.cmdline.suppress_options(options: List[schrodinger.application.desmond.starter.ui.cmdline.Option], excluded: Set[str])¶
Modify the options as specified by
excluded
by replacing the help text withargparse.SUPPRESS
, which will effectively hide the specified options in the command line. No effects if eitheroptions
orexcluded
is an empty container.
- schrodinger.application.desmond.starter.ui.cmdline.get_parser(usage: str, options: List[schrodinger.application.desmond.starter.ui.cmdline.Option], add_help: bool = True, add_subhost: bool = True) argparse.ArgumentParser ¶
Return a command-line parser with the given options.
- Parameters
usage – Usage to display if no arguments given.
options – List of options
add_help – Whether to add help flag to the parser
- Returns
Configured command-line parser
- schrodinger.application.desmond.starter.ui.cmdline.parse_known_options(usage: str, options: List[schrodinger.application.desmond.starter.ui.cmdline.Option], argv: List[str], add_subhost: bool = True) Tuple[argparse.Namespace, List[str], argparse.ArgumentParser] ¶
Parse and return the parsed options.
- Parameters
usage – Usage to display if no arguments given.
options – List of options in the format (name, default, help, destination).
argv – List of input arguments.
- Returns
(Known parsed options, unknown options)
- Raises
SystemExit – If no arguments given, show the usage and exit.
- schrodinger.application.desmond.starter.ui.cmdline.parse_options(usage: str, options: List[schrodinger.application.desmond.starter.ui.cmdline.Option], argv: List[str], add_subhost: bool = True) argparse.Namespace ¶
Parse and return the parsed options.
- Parameters
usage – Usage to display if no arguments given.
options – List of options in the format (name, default, help, dest).
argv – List of input arguments
add_subhost – Add the -SUBHOST option?
- Returns
Parsed options
- Raises
SystemExit – If no arguments given or if there is unknown arguments, show the usage and exit.
- schrodinger.application.desmond.starter.ui.cmdline.check_discontinued_args(args: List[str])¶
Check for the presence of arguments that have been removed and exit if any are used.
- schrodinger.application.desmond.starter.ui.cmdline.check_jobname(jobname: str) Optional[str] ¶
Check whether the given job name contains problematic characters. It cannot start with a “-” or contain a “=”.
- class schrodinger.application.desmond.starter.ui.cmdline.BaseArgs(opt: argparse.Namespace)¶
Bases:
object
Base class for arguments. A subclass of this class contains all the command-line arguments. The jobcontrol-related arguments, which are consumed by the toplevel script, are recovered.
- __init__(opt: argparse.Namespace)¶
- Parameters
opt – Command line options with corresponding values.
- property mode: schrodinger.application.desmond.constants.UiMode¶
- validate() List[str] ¶
Validate the parameters.
- Returns
a list of error messages for invalid parameters
- copy_parser_attributes(opt: argparse.Namespace)¶
Copy parser options (e.g: time, buffer, …) from
opt
toself
. Subclass needs to call this method in __init__
- generate_jobname()¶
If the JOBNAME was not set and this is a new job, automatically generate a job name.
- set_mps_factor(val)¶
Set the mps oversubcription factor. If val is
auto
, the mps factor will be determined automatically. Otherwise it is set directly, and should have anint
value.0
is treated equivalently to the value1
.
- class schrodinger.application.desmond.starter.ui.cmdline.FepArgs(opt: argparse.Namespace)¶
Bases:
schrodinger.application.desmond.starter.ui.cmdline.BaseArgs
- PROGRAM_NAME: str¶
- SUPPORTED_FEP_TYPES: List[str]¶
- property mode: schrodinger.application.desmond.constants.UiMode¶
- copy_parser_attributes(opt: argparse.Namespace)¶
Copy parser options (e.g: time, buffer, …) from
opt
toself
. Subclass needs to call this method in __init__
- validate() List[str] ¶
Validate the parameters.
- Returns
a list of error messages for invalid parameters
- check_ppj()¶
Raise a warning if restarting and trying to set ppj.
- Raises
UserWarning – If ppj set for a restarted job.
- check_duplicate_titles(sts: List[schrodinger.structure._structure.Structure])¶
- get_time_for_leg(leg_type: str) Optional[float] ¶
Get simulation time for FEP leg. Implemented in subclasses of FepArgs.
- __init__(opt: argparse.Namespace)¶
- Parameters
opt – Command line options with corresponding values.
- generate_jobname()¶
If the JOBNAME was not set and this is a new job, automatically generate a job name.
- set_mps_factor(val)¶
Set the mps oversubcription factor. If val is
auto
, the mps factor will be determined automatically. Otherwise it is set directly, and should have anint
value.0
is treated equivalently to the value1
.
- schrodinger.application.desmond.starter.ui.cmdline.verify_args_validate(args_obj: schrodinger.application.desmond.starter.ui.cmdline.BaseArgs)¶
Verifies that no validation error occurs
- Parameters
args_obj – instance of
BaseArgs
or its subclass- Raises
SystemExit – for invalid arguments