Common information

Atom selections

You may either select atoms using a subset of the CHARMM selection commands or by specifying (zero-based) atom ids. Please refer to the complete list of Selection Commands.

For the atom ids, which are defined as the order of occurrence of the atom in the topology file, there are several options. You can give a list of numbers or ranges separated by commas or spaces or a mixture of both. Repeated indices are ignored. This arguments would be perfectly valid:

id 1,2,3, 6-8,1-5

You may also use python style range selections start:stop:step. In this case, stop will not be included. The following selections are identical.

id 1:10:2
id 1,3,5,7,9
id 1-3, ^2, 5, 7-9, ^8

Spaces in this slice syntax are not allowed. To exclude atoms from the selection, prefix their ids with a caret. For example, these two specifications are identical.

id 1-10,^2-5,4
id 1,4,6-10

The list is built in order. Therefore, the last occurrence has precedence.

Note

When mixing id selection commands with regular MDAnalysis selection commands, spaces are not allowed.

For those commands that accept the --indexfile option, you may also use named groups from GROMACS-style index files. If you want to select the union of multiple groups, you can give a comma-separated list that is not allowed to contain spaces. If your index file looks like

[ group_A ]
1, 2, 4
[ group_B ]
1, 2, 3

then all of the following selection commands would yield identical results

groups group_A,group_B
groups group_A or groups group_B
id 1-4,^3,1-3
id 1-4

f_core

Common functions of the finley toolkit.

class f_core.ExtendedSelectionParser[source]

Extends the MDAnalysis selection parser.

Note

Has to be an old-style class for compatibility to MDAnalysis.

Methods

GROUP = 'groups'

Selection token for named groups

ID = 'id'

Selection token for atom ids

_SelectionParser__parse_subexp()[source]

Intercepts parsing of subexpressions and deals with the newly defined selection commands.

__init__()[source]

Adds the newly defined keywords to the keywords mda.core.Selection.SelectionParser supports.

class f_core.GroupSelection(groups)[source]

Parser for named group selection.

Methods

__init__(groups)[source]

Accepts the data to be parsed.

Parameters:

groups : String

Comma-separated group names without any spaces.

_apply(group)[source]

Parses the data given.

Parameters:

group : MDAnalysis.core.AtomGroup

Atoms to select from.

Returns:

Set :

Selected Atoms.

Raises:

TypeError :

If the atom group has not been initially selected from an UniverseWrapper instance.

ValueError :

If any group is unknown or no group was given.

class f_core.IdSelection(ids)[source]

Parser for id selection.

Methods

__init__(ids)[source]

Accepts the data to be parsed.

Parameters:

ids : String

Ids. See Atom selections.

_apply(group)[source]

Parses the data given.

Parameters:

group : MDAnalysis.core.AtomGroup

Atoms to select from.

Returns:

Set :

Selected Atoms.

Raises:

ValueError :

If the selection was unparseable.

class f_core.PDBFile(stream, output=None)[source]

Holds information about a single protein database file.

Methods

__deepcopy__(memo)[source]

Helper method for copying a whole PDB file including any depending PSF.

Parameters:

memo : dictionary

Contains all objects that have been copied already.

Returns:

:class:`PDBFile` :

A new and completely independent instance.

__init__(stream, output=None)[source]

Prepares internal data structures.

Parameters:

stream : List of strings, file object

Input file as list of the input lines or a file object.

output : output_tracker or None

Error reporting. If parameter value is None, error reporting is disabled.

_add_atom_name(residue, atom_name, line)[source]
Internal helper updating the data structures to accomodate for another atom.
Returns:

String or `None` :

The previous definition line with the same atom name and the same residue. If no such line has been stored yet, the function returns None.

_add_residue(key)[source]

Internal helper updating the data structures to accomodate for another residue.

Parameters:

key : String

Residue name. May be replaced by anything that has a residue name as string representation.

Returns:

self :

Allows for fluent interface.

_check_HETATM()[source]

Strict lint of all HETATM lines in the input data in _lines.

Prints messages on invalid lines via _output.

Returns:

Boolean :

True if everything is correct.

_check_keywords()[source]

Checks all keywords in the input data in _lines for validity.

Returns:

Boolean :

True if everything is correct.

_delete_residues_except(residue)[source]

Removes all entries that are related to all but a single residue.

Parameters:

residue : String

Residue name of the only residue that is to be kept.

Returns:

self :

Allows for fluent interface.

_found_error(idx, msg, got)[source]

Helper function for error handling.

Parameters:

idx : Integer

One based line number.

msg : String

Hint on what is wrong with this line.

got : String

Hint on what was expected by the parser in this line.

Returns:

False :

_get_atom_lines()[source]

Extracts all lines that form an atom description from the given source lines in _lines.

Returns:

List :

Strings containing atom definitions in plain PDB format. Lines contain terminal newline characters.

_is_left_justified(str)[source]

Checks whether a string is left-justified.

Parameters:

str : String

Input to check.

Returns:

Boolean :

_is_right_justified(str)[source]

Checks whether a string is right-justified.

Parameters:

str : String

Input to check.

Returns:

Boolean :

_strip_bom()[source]

Removes any BOM from the beginning of the input file data in _lines.

Returns:

self :

Allows for fluent interface.

check_all()[source]

Checks the input lines in _lines for syntactic errors.

Returns:

Boolean :

True if everything is correct.

extract_residue(residue)[source]

Builds a new PDBFile instance only containing a single residue.

Parameters:

residue : String

Residue name of the only residue that is to be kept.

Returns:

:class:`PDBFile` :

An independent instance.

find_atoms(residue_name=None, atom_name=None)[source]

Creates a list of the atoms in this PDB file only containing the atoms with a certain residue name or atom name.

Parameters:

residue_name : String

The residue name to filter for. None matches all atoms.

atom_name : String

The atom name to filter for. None matches all atoms.

Returns:

List of :class:`~toto.atom.atom` :

Instances that fulfill all specified criteria.

get_all_atom_types()[source]

Extracts a list of all atom types without any duplicates.

Returns:

Set :

Unique enumeration of all atom types.

get_atom(index)[source]

Access method.

Parameters:

index : Integer

Zero based index of the selected atom in _atoms.

Returns:

:class:`~toto.atom.atom` :

Requested instance.

get_atom_count(atom_type=None)[source]

Counts the atoms with a specific atom type.

If atom_type is None, the total atom number is returned. For atom type filtering, a PSF file has to be loaded. The total number of all atoms can be determined without having a matching PSF file.

Parameters:

atom_type : String or None

The atom type to filter for.

Returns:

Integer :

Atom type occurrence.

get_bond(bond)[source]

Extracts the atoms that form a specific bond.

Todo

Check whether the two atoms are in fact bonded.

Parameters:

bond : String

Format: RESIDUE_NAME.ATOM_NAME-RESIDUE_NAME.ATOM_NAME. The residue name may be omitted in case the atom name is unique to the whole file.

Returns:

List of :class:`~toto.atom.atom`. :

Length two. Instances that match the request.

get_bond_vector(f, t, crucial=False)[source]

Calculates the direction of a bond.

Parameters:

f : Integer

First atom index.

t : Integer

Last atom index.

crucial : Boolean

If False, calling this function with two nonbonded atoms will only raise a warning. If True, an error will occur in this case.

Returns:

Tuple of floats :

Bond vector in three dimensions.

get_index(name, residue=None)[source]

Extracts the index of a certain atom by atom name and residue.

Parameters:

name : String

Atom name

residue : String

Residue name

Returns:

Integer :

Zero based index of the selected atom in _atoms.

get_pdb_string(renumber=False, clean=False)[source]

Creates a new PDB string representation that could be written to a file.

Todo

Currently, this ignores changes in atom count and bond topology.

Parameters:

renumber : Boolean

In case any of the atoms are removed, the atom number should be changes such that all atoms are numbered starting from one and in a contiguous fashion. As this alters the references in the specific file and potentially makes the new PDB file incompatible with other external resources, this behavior is deactivated by default.

Returns:

String :

Lines separated by newline characters.

get_psf_string()[source]

Interface method for creation of a string representation of the PSF file that is related to the given PDB file. Essentially calls PSFFile.get_psf_string().

Returns:

String :

Lines separated by newline characters.

get_residues()[source]

Lists all residue names given in the input lines held in _lines. Parsing applies relaxed standards.

Returns:

Set :

Unique collection of residue names.

get_total_charge()[source]

Calculates the total charge of all atoms.

Returns:

Float :

Charge in electron charges.

get_total_mass()[source]

Calculate the total mass of all atoms.

Returns:

Float :

Mass in amu.

parse()[source]

Reads the input lines in _lines.

Returns:

self :

Allows for fluent interface.

purge_metadata(except_first=False)[source]

Removes all lines from the internal representation that do not contain atom definitions.

Practically, this means removing all lines that do not contain a ATOM or HETATM definition.

Parameters:

except_first : Boolean

Whether to keep the first contiguous set of non-atom lines that precedes any atom definition.

Returns:

self : :

Allows for fluent interface.

read_psf(stream)[source]

Creates a new psffile from the data given in stream. The new internal psffile instance is connected to the same output_tracker as self. Parsing applies relaxed standards.

Parameters:

stream : List of strings, file object.

Input lines in either format.

Returns:

self :

Allows for fluent interface.

rotate(n, angle, residues=None)[source]
Rotates all atoms.
Parameters:

n : Iterable of floats

The normal vector of the rotation.

angle : Float

The angle to rotate by in radians.

residues : Iterable of strings, None

Rotate only atoms that are part of the given residues. If None, all residues are rotated.

Returns:

self :

Allows for fluent interface.

set_center_atom(a, residues=None)[source]

Moves all atoms such that a specific atom is in the origin of the internal coordinate system.

Parameters:

a : String, Integer, atom instance or list of floats. If string, the value is assumed to be a unique atom name. If integer, the value denotes the zero based index of the atom in _atoms. In case a list of floats is given as input, the vector defined by these three values is assumed to be the correct translation to perform.

residues : Iterable of strings.

Contains the residue names that are movable. If None, all atoms are selected for translation.

Returns:

self :

Allows for fluent interface.

set_charge(atom_type, charge)[source]

Changes the internal value of the charge of a certain atom type.

Parameters:

atom_type : String

The atom type to filter for.

charge : Float

New value in electron charges.

Returns:

self :

Allows for fluent interface.

to_pdb_file(filename)[source]

Write string representation of the parsed PDB information to file.

Todo

Error checking on file opening.

Parameters:

filename : String

The target filename.

Returns:

self :

Allows for fluent interface.

to_psf_file(filename)[source]

Write string representation of the parsed PSF information to file.

Todo

Error checking on file opening.

Parameters:

filename : String

The target filename.

Returns:

self :

Allows for fluent interface.

translate(vector)[source]

Shifts all atoms.

Parameters:

vector : Iterable of floats

Iterable of length 3.

Returns:

self :

Allows for fluent interface.

translate_residue(residue_name, vector)[source]

Shifts all atoms for a specific residue after consistency checks.

Parameters:

residue_name : String

The residue that should be translated.

vector : Iterable of floats

Iterable of length 3.

Returns:

self :

Allows for fluent interface.

class f_core.PSFFile(stream, output=None)[source]

Holds information about a single protein structure format file. Implements a fluent interface.

Methods

__deepcopy__(memo)[source]

Creates a completely independent instance of psffile that essentially is identical to the current one.

Parameters:

memo : Dictionary

Dictionary of objects already copied.

Returns:

:class:`psffile` :

The copy.

__init__(stream, output=None)[source]

Prepares data structures.

Todo

Check for attribute documentation.

Parameters:

stream : List of strings or file object.

Input data.

output : output_tracker or None

Error reporting. If parameter value is None, error reporting is disabled.

_delete_residues_except(residue)[source]

Removes all entries that are related to all but a single residue.

Parameters:

residue : String

Residue name of the only residue that is to be kept.

Returns:

self : :

Allows for fluent interface.

_parse_angles()[source]
Extracts all data from _lines that is related to angles.
Returns:

self :

Allows for fluent interface.

_parse_atoms()[source]

Extracts all data from _lines that is related to atoms.

Returns:

self :

Allows for fluent interface.

_parse_bonds()[source]

Extracts all data from _lines that is related to bonds.

Returns:

self :

Allows for fluent interface.

_parse_dihedrals()[source]

Extracts all data from _lines that is related to dihedrals.

Returns:

self :

Allows for fluent interface.

_parse_impropers()[source]

Extracts all data from _lines that is related to improper dihedrals.

Returns:

self :

Allows for fluent interface.

_scan_section(header)[source]

Reads all lines for a given section of a PSF file.

This routine performs no checks whatsoever on this header entry.
Parameters:

header : String

The header section to search for.

Returns:

Tuple :

Tuple of the number of entries that should be in the file and a list of strings holding all input lines for this section. Please note that empty entries can occurr in case no lines for this section could be found.

delete_atom(idx)[source]
Removes all data related to a specific atom from the internal representation.
Parameters:

idx : Integer

The list index of the atom instances in _atoms.

Returns:

self :

Allows for fluent interface.

extract_residue(residue)[source]

Builds a new psffile instance only containing a single residue.

Parameters:

residue : String

Residue name.

Returns:

:class:`psffile` :

A completely independent instance.

get_atom(idx)[source]

Access method for a single atom.

Parameters:

idx : Integer

Zero-based index of the atom to retrieve.

Returns:

:class:`~toto.atom.atom` :

The atom instance.

Note

Please keep in mind that this atom instance is still related to the psffile instance you got it from. In case you want to modify the atom properties but leave the PSF file unchanged, you have to call __deepcopy__().

get_atom_count()[source]

Returns the number of atoms that are described in this PSF file.

get_psf_string()[source]

Builds a string representation of the whole file.

Returns:

String :

Whole file a single string. Lines are separated by newline characters.

get_total_charge()[source]

Calculates the total charge of all atoms.

Returns:

Float :

Charge in electron charges.

get_total_mass()[source]

Calculates the total mass of all atoms.

Returns:

Float :

Mass in amu.

is_angle(f, v, t)[source]

Checks whether an angle between three atom instances is defined in this instance.

Ordering does matter. Either f-v-t or t-v-f have to exist in case this function evaluates to True.

Parameters:

f : atom

First atom of the angle.

v : atom

Middle atom of the angle.

t : atom

Last atom of the angle.

Returns:

Boolean :

is_bonded(f, t)[source]

Checks whether a bond between two atom instances is defined in this instance.

Ordering does not matter.

Parameters:

f : atom

First atom of the bond.

t : atom

Last atom of the bond.

Returns:

Boolean :

is_compatible(atomlist)[source]

Checks whether there is a unique one-to-one mapping of all atoms in the internal data structures.

For the definition of compatible, see compatible_to().

Parameters:

atomlist : List of atom instances

The atoms to compare to. The ordering of the atoms is of relevance to the result as the PSF indices are projected onto this list.

Returns:

Boolean :

True only if no inconsistencies occurred during the check.

is_dihedral(f, v1, v2, t)[source]
Checks whether a torsional angle between four atom instances is defined in this instance.

Ordering does matter. Either f-v1-v2-t or t-v2-v1-f have to exist in case this function evaluates to True.

Parameters:

f : atom

First atom of the angle.

v1 : atom

Middle atom of the angle.

v2 : atom

Middle atom of the angle.

t : atom

Last atom of the angle.

Returns:

Boolean :

is_improper(f, v1, v2, t)[source]
Checks whether an improper torsional angle between four atom instances is defined in this instance.

Ordering does matter. Either f-v1-v2-t or t-v2-v1-f have to exist in case this function evaluates to True.

Parameters:

f : atom

First atom of the angle.

v1 : atom

Middle atom of the angle.

v2 : atom

Middle atom of the angle.

t : atom

Last atom of the angle.

Returns:

Boolean :

iteratoms()[source]

Generator for iterating over the atoms of this PSF file.

parse()[source]

Cached parsing of the given source lines.

Returns:

self :

Allows for fluent interface.

set_charge(atom_type, charge)[source]

Changes the internal value of the charge of a certain atom type.

Parameters:

atom_type : String

Atom type selection of the relevant atoms.

charge : Float

New charge in electron charges.

Returns:

self :

Allows for fluent interface.

class f_core.UniverseWrapper(*args, **kwargs)[source]

Allows for additional information to be connected to an MDAnalysis Universe.

Methods

_index_groups = {}

Named groups. Keys: Strings of group names, Values: List of one-based atom indices

add_index_groups(groups)[source]

Adds multiple named atom groups to the topology definition.

Parameters:

groups : Dictionary

Keys are group names, Values are iterables of one-based atom indices.

get_index_groups()[source]

Retrieves named atom groups.

Returns:

Dictionary :

Keys are group names, Values are iterables of one-based atom indices.

remove_index_groups(groups, require_existing=False)[source]

Removes multiple named atom groups from the topology definition.

Parameters:

groups : Iterable

Group names to remove.

require_existing : Boolean

Whether to raise an exception if any of the specified groups has not been defined so far.

f_core._parse_colon_range(command, output)[source]

Parses range specification in python syntax.

Parameters:

command : String

The selection to parse.

output : output_tracker instance

Error reporting.

Returns:

Iterable : :

List of integers.

Examples

>>> _parse_colon_range('2:5:2')
[2, 4]
f_core._parse_dash_range(command, output)[source]

Parses range specification based on dash-separated limits.

Parameters:

command : String

The selection to parse.

output : output_tracker instance

Error reporting.

Returns:

Iterable : :

List of integers.

Examples

>>> _parse_dash_range('2-3')
[2, 3]
f_core._parse_ids(command, output)[source]

Parses id selections including mixed range specifications, exclusions and precedence.

Ranges can be given either by dash separated limits (includes the upper bound) or by python-like colon separated limits (does not include the upper limit). Stride syntax supported for the latter. Open ranges are not allowed.

Parameters:

command : String

The selection to parse

output : output_tracker instance

Error reporting.

Returns:

Iterable : :

Sorted list of integers.

Examples

>>> _parse_ids('3-6')
[3, 4, 5, 6]
>>> _parse_ids('3-6,^4-5')
[3, 6]
>>> _parse_ids('2-3,4:7:2')
[2, 3, 4, 6]
f_core._parse_indexfile(lines, groups, output)[source]

Graceful parser for GROMACS-style index files. In GROMACS, atom numbering is one-based. This routine works only on one-based indices.

Parameters:

lines : List of strings

Input lines of the file

groups : Dictionary

Group data like the return format of this function.

output : output_tracker instance

Error reporting.

Returns:

Dictionary :

Keys are case-sensitive group names as strings. Values are lists of integers.

f_core._require_mda(output)[source]

Makes sure that MDAnalysis is loaded and prints an error message otherwise.

Returns:

module :

MDAnalysis module instance.

Raises:

Exception :

If MDAnalysis is unavailable.

f_core.angle(a, b, output)[source]

Calculates the angle between two vectors of arbitrary dimensionality.

Parameters:

a, b : iterable, numeric

Vectors.

output : output_tracker instance

Error reporting.

Returns:

The angle in radians. :

Raises:

Exception: :

When the vectors have different dimensions.

Exception: :

When at least one of the vectors is the null vector.

f_core.dot_product(a, b, output)[source]

Calculates the dot product of two vectors of arbitrary dimensionality.

Parameters:

a, b : iterable, numeric

Vectors.

output : output_tracker instance

Error reporting.

Returns:

The dot product. :

Raises:

Exception: :

When the vectors have different dimensions.

f_core.join_pdb(one, another, purge_metadata=False)[source]

Joins two PDB files while maintaining topology information from associated PSF files.

Parameters:

one : PDBFile

Instance to be merged that will occurr first in the resulting file.

another : PDBFile

Instance to be merged that will come second in the output file.

purge_metadata : Boolean

Whether to remove any entries from the output file that does not describe an atom position except the ones that precede any atom definition. Usually, this purges any metadata from another.

Returns:

:class:`PDBFile` :

Combined file with corrected PSF topology data.

Raises:

ValueError : :

If any of the associated topologies contain unrecoverable errors.

f_core.mda_get_framecount(universe, selection, output, complain_empty=False)[source]

Calculates the number of frames selected by a slice for MDAnalysis trajectories.

Parameters:

universe : MDAnalysis.core.AtomGroup.Universe

The universe which trajectory is to be analyzed.

selection : slice

A frame selection.

output : output_tracker instance

Error reporting.

complain_empty: Boolean, optional :

Whether to report a fatal error on empty selection.

Returns:

Integer :

The number of frames.

Raises:

Exception :

If MDAnalysis is unavailable.

Exception :

If the slice is of length zero and complain_empty is True.

f_core.mda_goto(universe, target_frame, output)[source]

Seeks to a specific frame in the trajectory.

Parameters:

universe : MDAnalysis.core.AtomGroup.Universe

The universe which trajectory is to be analyzed.

target_frame : integer

Zero-based index of the frame to select.

output : output_tracker instance

Error reporting.

Returns:

integer: :

Zero-based index of the frame that was selected when this function was called.

f_core.mda_load_universe(topology, coordinates, output)[source]

Creates a MDAnalysis.Universe from a trajectory with error checks.

Parameters:

topology : String

Topology file name. Supported file formats: see MDAnalysis. May be compressed with gzip or bzip2.

coordinates : String

Coordinate file name. Supported file formats: see MDAnalysis. May be compressed with gzip or bzip2.

output : output_tracker instance

Error reporting.

Returns:

universe :

The created UniverseWrapper which is essentially identical to MDAnalysis.core.AtomGroup.Universe.

Raises:

Exception :

If MDAnalysis is unavailable.

Exception :

If the import failed.

f_core.mda_patch_parser(enable=True)[source]

Patches the loaded MDAnalysis selection parser to incorporate group and id keywords.

Parameters:

enable : Boolean

Whether to activate the extended parser. If False, the original state will be recovered.

f_core.mda_select(universe, selection, output, selection_frame=None)[source]

Selects an atom group by CHARMM selection or atom selection syntax.

Parameters:

universe : MDAnalysis.core.AtomGroup.Universe

The universe which trajectory is to be analyzed.

selection : String

The CHARMM-style selection request.

output : output_tracker instance

Error reporting.

selection_frame : Integer, optional

If set, the selection command will be performed using the coordinates of this frame.

Returns:

MDAnalysis.atomGroup :

Atom group which is valid for all frames of the loaded trajectory of the given universe.

Raises:

Exception :

If MDAnalysis is unavailable.

f_core.mda_select_id(universe, selection, output)[source]

Extends the MDAnalysis CHARMM selection parser by a keyword for selection by id.

Atom ids are one-based (as usual for MDAnalysis).

Parameters:

universe : MDAnalysis.core.AtomGroup.Universe

The universe which trajectory is to be analyzed.

selection : String

The CHARMM-style selection request.

output : output_tracker instance

Error reporting.

Returns:

MDAnalysis.atomGroup :

Atom group which is valid for all frames of the loaded trajectory of the given universe.

f_core.mda_set_periodic(value, output)[source]

Sets the flag whether to respect periodic boundary conditions in MDAnalysis calculations.

Parameters:

value : Boolean

Flag value

Raises:

Exception :

If MDAnalysis is unavailable.

class f_core.messages[source]

Error and warning messages. Used to make error codes unique throughout all tools of the finley toolkit.

BINS_2D_SPEC = (41, 'Bins for the x axis and the y axis for 2D data have to be separated by a semicolon.')
BINS_SORTED = (42, 'Bins were not sorted.')
BIN_COUNT_LEQ_Z = (35, 'Number of bins has to be at least one.')
BOUNDS_DIMENSION = (39, 'Bound specification has to have the same dimension as the input data.')
BOUNDS_EQUAL = (34, 'Lower and upper limits are identical.')
BOUNDS_IGNORED = (40, 'Bound specification ignored.')
BOUNDS_REVERSED = (33, 'Lower limit is higher than the upper one.')
CHARMM_SELECTION = (7, 'Unable to parse CHARMM selection.')
CONVERT_FAILED = (37, 'Got non-numeric data.')
DASH_RANGE_NONNEG = (30, 'Negative indices not supported for dash range syntax.')
DASH_RANGE_SYNTAX = (31, 'Syntax error for dash range selection.')
DIM_MISMATCH = (29, 'Elements have mismatching dimensions.')
EMPTY_LINE = (36, 'Empty or ill-formatted input line.')
EMPTY_SELECTION = (14, 'No atoms selected.')
IDENTICAL_GROUPS = (53, 'Unable to evaluate the forces between identical groups.')
IDX_EMPTY_GROUP = (46, 'GROMACS-style index file has empty index group name.')
IDX_GROUP_OVERRIDE = (49, 'Multiple definition of index group.')
IDX_GROUP_SPACE = (47, 'GROMACS-style index file has index group name containing whitespace.')
IDX_MINVAL = (48, 'GROMACS-style index files do not allow for indices lower than 1.')
IDX_SYNTAX_ERROR = (45, 'GROMACS-style index file has syntax errors.')
IMPORT_FAILED = (1, 'Unable to import topology and coordinate files.')
INT_CONVERSION = (15, 'Could not convert data to integer.')
INVALID_FRAME_SEL = (9, 'Frame not within trajectory.')
INVALID_ORIGIN = (21, 'Cannot parse specified origin.')
MANUAL_SEEK = (10, 'Performing stepwise seek in file for frame selection.')
MDA_DEP = (12, 'MDAnalysis is required for this routine. You may continue after its installation.')
NEGATIVE_ATOM_NUM = (17, 'No negative atom numbers supported.')
NEGATIVE_LENGTH = (50, 'Unable to accept negative length specification.')
NOT_CONSUMED = (24, 'RPN stack not fully consumed. Perhaps you left out an operator.')
NOT_EXIST = (44, 'File does not exist or is not readable.')
NO_CMD = (22, 'You have to specify at least one command to get any output.')
NO_DUPLICATE = (19, 'All atom numbers in the selection have to be unique.')
NO_FRAME = (5, 'No frame selected.')
NO_NULL_VECTOR = (32, 'Null vectors are not allowed for this operation.')
NO_SLICE = (2, 'Slice indices have to be either integers or have to be of zero-length.')
ORIGIN_LENGTH = (20, 'Origin has to be tuple of length three.')
OUTPUT_EXISTS = (6, 'Output file already exists.')
OUTPUT_FAILED = (8, 'Unable to write to output file.')
OUT_OF_BOUNDS = (38, 'Data out of bounds.')
RANGE_ATOM_NUM = (18, 'Atom number is out of range.')
REVERSE_BOUNDS = (26, 'Reverse bounds for range.')
SEEK_PAST_FILE = (11, 'End of file occurred during seeking. File may be corrupted.')
SELECT_FAILED = (16, 'Unable to select requested atoms.')
SLICE_START_RANGE = (3, 'Slice start selects frames that are not part of the source trajectory.')
SLICE_STOP_RANGE = (4, 'Slice stop selects frames that are not part of the source trajectory.')
STACK_DIMENSION = (28, 'Elements on stack have wrong dimension for this operator.')
STACK_POP = (27, 'Stack does not hold enough elements for this operator.')
TERNARY_CMD = (23, 'All commands require at most two colon-separated sections, got more.')
UNDEF_DIHEDRAL = (51, 'Dihedral definition requires four atoms to be selected.')
UNDEF_PLANE = (43, 'At least three points in space required for plane definition.')
UNKNOWN_CMD = (25, 'Unknown command.')
UNKNOWN_LENGTH = (13, 'Unable to estimate the total length of a trajectory.')
VEL_COORD_MISMATCH = (52, 'Different number of frames for velocities and coordinates.')
f_core.parse_frame_selection(frames, output)[source]

Takes a pythonic selection syntax as string and converts it to a slice() object.

Parameters:

frames : String

Selection command for integer ranges.

output : output_tracker instance

Error reporting.

Returns:

slice :

A slice() object.

Examples

>>> parse_frame_selection('1:2:10', output)
slice(1, 2, 10)
>>> parse_frame_selection('', output)
slice(None, None, None)
>>> parse_frame_selection('-1', output)
slice(-1, None, 1)
>>> parse_frame_selection('::10', output)
slice(None, None, 10)
f_core.parse_indexfiles(filenames, output)[source]

Graceful parser of GROMACS-style index files.

Parameters:

filenames : List of strings

Input filenames.

output : output_tracker instance

Error reporting.

Returns:

Dictionary :

Keys are case-sensitive group names as strings. Values are lists of integers. Atom indices are one-based.

Table Of Contents

Previous topic

f_timeseries.py

Next topic

Test results

This Page