Topo
Command-line interface for preparing simulation topology files.
add_topo_subparser(subparsers)
¶
Adds the 'topo' subcommand to the Simlify CLI for preparing simulation topology files.
This function configures an argparse
subparser named 'topo' which allows
users to specify the path to a molecular structure file, an import string
pointing to a specific topology generation class, and optional YAML
configuration files to customize the topology generation process.
PARAMETER | DESCRIPTION |
---|---|
subparsers
|
An
|
RETURNS | DESCRIPTION |
---|---|
The configured |
The 'topo' subcommand accepts the following arguments:
structure
: Path to the molecular structure file (e.g., PDB, GRO) for which the topology will be generated.import_string
: Import string to a topology generation class. This string should specify the full path to a class that inherits fromTopoGen
and implements thedry_run
andrun
methods. For example:AmberTopoGen
.--yaml
: One or more paths to YAML configuration files. These files will be loaded in the order provided, with later files overriding settings from earlier ones. This allows users to configure various aspects of the topology generation process.--work
: Path to the work directory for preparing the topology calculations. This option overrides any work directory specified in the YAML configuration files. If not provided, the work directory will be determined by the configuration.
The function sets the default action for this subparser to be the
cli_topo
function, which will be called when the user invokes the 'topo'
subcommand.
cli_topo(args, parser)
¶
Command-line interface function to prepare simulation topology files.
This function serves as the entry point when the user executes the 'topo'
subcommand of the Simlify CLI. It receives the parsed command-line arguments
and the argument parser object. It initializes a
SimlifyConfig
object and loads configuration settings
from any YAML files provided via the --yaml
argument, with later files taking
precedence. It then checks if a work directory was specified using the --work
option and overrides the work directory in the
SimlifyConfig
if it was provided.
Finally, it calls run_gen_topo
to perform the topology generation.
PARAMETER | DESCRIPTION |
---|---|
args
|
An
TYPE:
|
parser
|
The argument parser object for the 'topo' subcommand, used to display help messages if necessary (though not explicitly used in this function).
TYPE:
|
The function retrieves the following arguments from the args
object:
structure
: Path to the input structure file.import_string
: Import string for the topology generation class.yaml
: A list of paths to YAML configuration files.work
: Optional path to the work directory.
It initializes a SimlifyConfig
, loads YAML configurations, overrides the
work directory if provided, and then calls run_gen_topo
with the structure
path, import string, and the configured SimlifyConfig
object.