__init__(self,
*args,
**kwargs)
(Constructor)
| source code
|
Set up the command with gromacs flags as keyword arguments.
The following are generic instructions; refer to the Gromacs
command usage information that should have appeared before
this generic documentation.
As an example, a generic Gromacs command could use the following flags::
cmd = GromacsCommand('v', f=['md1.xtc','md2.xtc'], o='processed.xtc', t=200, ...)
which would correspond to running the command in the shell as ::
GromacsCommand -v -f md1.xtc md2.xtc -o processed.xtc -t 200
**Gromacs command line arguments**
Gromacs boolean switches (such as ``-v``) are given as python
positional arguments (``'v'``) or as keyword argument (``v=True``);
note the quotes in the first case. Negating a boolean switch can be
done with ``'nov'``, ``nov=True`` or ``v=False`` (and even ``nov=False``
works as expected: it is the same as ``v=True``).
Any Gromacs options that take parameters are handled as keyword
arguments. If an option takes multiple arguments (such as the
multi-file input ``-f file1 file2 ...``) then the list of files must be
supplied as a python list.
If a keyword has the python value ``None`` then it will *not* be
added to the Gromacs command line; this allows for flexible
scripting if it is not known in advance if an input file is
needed. In this case the default value of the gromacs tool
is used.
Keywords must be legal python keywords or the interpreter raises a
:exc:`SyntaxError` but of course Gromacs commandline arguments are
not required to be legal python. In this case "quote" the option
with an underscore (``_``) and the underscore will be silently
stripped. For instance, ``-or`` translates to the illegal keyword
``or`` so it must be underscore-quoted::
cmd(...., _or='mindistres.xvg')
**Command execution**
The command is executed with the :meth:`~GromacsCommand.run` method or by
calling it as a function. The two next lines are equivalent::
cmd(...)
cmd.run(...)
When the command is run one can override options that were given at
initialization or one can add additional ones. The same rules for
supplying Gromacs flags apply as described above.
**Non-Gromacs keyword arguments**
The other keyword arguments (listed below) are not passed on to the
Gromacs tool but determine how the command class behaves. They are
only useful when instantiating a class. This is mostly of interest
to developers.
:Keywords:
*failure*
determines how a failure of the gromacs command is treated; it
can be one of the following:
'raise'
raises GromacsError if command fails
'warn'
issue a :exc:`GromacsFailureWarning`
``None``
just continue silently
*doc* : string
additional documentation []
- Overrides:
object.__init__
|