5.1.3. gromacs.environment – Run time modification of behaviour

Some aspects of GromacsWrapper can be determined globally. The corresponding flags Flag are set in the environment (think of them like environment variables). They are accessible through the pseudo-dictionary gromacs.environment.flags.

The entries appear as ‘name’-‘value’ pairs. Flags check values and illegal ones raise a ValueError. Documentation on all flags can be obtained with

print gromacs.environment.flags.doc()

5.1.3.1. List of GromacsWrapper flags with default values

class gromacs.environment.flagsDocs[source]

capture_output = False

Select if Gromacs command output is always captured.

>>> flags['capture_output'] = False

By default a GromacsCommand will direct STDOUT and STDERR output from the command itself to the screen (through /dev/stdout and /dev/stderr). When running the command, this can be changed with the keywords stdout and stderr as described in gromacs.core and Command.

If this flag is set to True then by default STDOUT and STDERR are captured as if one had set

stdout=False, stderr=False

Explicitly setting stdout and/or stderr overrides the behaviour described above.

If set to the special keyword "file"` then the command writes to the file whose name is given by ``flags['capture_output_filename']. This file is over-written for each command. In this way one can investigate the output from the last command (presumably because it failed). STDOUT and STDERR are captured into this file by default. STDERR is printed first and then STDOUT, which does not necessarily reflect the order of output one would see on the screen.

The default is False.

capture_output_filename = ‘gromacs_captured_output.txt’

Name of the file that captures output if flags['capture_output'] = "file"

>>> flags['capture_output_filename'] = 'gromacs_captured_output.txt'

This is an experimental feature. The default is ‘gromacs_captured_output.txt’.

5.1.3.2. Classes

gromacs.environment.flags
class gromacs.environment.Flags(*args)[source]

Global registry of flags. Acts like a dict for item access.

There are a number flags defined that influence how GromacsWrapper behaves. They are accessible through the pseudo-dictionary

The entries appear as ‘name’-‘value’ pairs. Flags check values and illegal ones raise a ValueError. Documentation on all flags can be obtained with

print gromacs.environment.flags.__doc__

New flags are added with the Flags.register() method which takes a new Flag instance as an argument.

For developers: Initialize Flags registry with a list of Flag instances.

doc()[source]

Shows doc strings for all flags.

items() a set-like object providing a view on D's items[source]
register(flag)[source]

Register a new Flag instance with the Flags registry.

setdefault(k, d=None)[source]

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update(*flags)[source]

Update Flags registry with a list of Flag instances.

values() an object providing a view on D's values[source]
class gromacs.environment.Flag(name, default, mapping=None, doc=None)[source]

A Flag, essentially a variable that knows its default and legal values.

Create a new flag which will be registered with Flags.

Usage

newflag = Flag(name, default, mapping, doc)
Arguments:
name

name of the flag, must be a legal python name

default

default value

mapping

dict that maps allowed input values to canonical values; if None then no argument checking will be performed and all values are directly set.

doc

doc string; may contain string interpolation mappings for:

%%(name)s        name of the flag
%%(default)r     default value
%%(value)r       current value
%%(mapping)r     mapping

Doc strings are generated dynamically and reflect the current state.

prop()[source]

Use this for property(**flag.prop())