Previous topic

4.1. Topology readers — MDAnalysis.topology

Next topic

4.3. MDAnalysis topology tables

This Page

4.2. Common functions for topology building — MDAnalysis.topology.core

The various topology parsers make use of functions and classes in this module. They are mostly of use to developers.

See also

MDAnalysis.topology.tables for some hard-coded atom information that is used by functions such as guess_atom_type() and guess_atom_mass().

class MDAnalysis.topology.core.Bond(a1, a2)

A bond between two Atom instances.

length()

Length of the bond.

MDAnalysis.topology.core.build_bondlists(atoms, bonds)

Construct the bond list of each Atom.

The bond list is stored in the attribute MDAnalysis.core.AtomGroup.Atom.bonds and consists of a list of Bond instances.

MDAnalysis.topology.core.build_segments(atoms)

Create all Segment instancess from a list of Atom instances.

The function also builds the Residue instances by tracking residue numbers.

MDAnalysis.topology.core.get_atom_mass(element)

Return the atomic mass in u for element.

Masses are looked up in MDAnalysis.topology.tables.masses.

Warning

Unknown masses are set to 0.

MDAnalysis.topology.core.get_parser_for(filename, permissive=False, format=None)

Return the appropriate topology parser for filename.

Automatic detection is disabled when an explicit format is provided.

MDAnalysis.topology.core.guess_atom_charge(atomname)

Guess atom charge from the name.

Warning

Not implemented; simply returns 0.

MDAnalysis.topology.core.guess_atom_element(atomname)

Guess the element of the atom from the name.

Looks in dict to see if element is found, otherwise it uses the first character in the atomname. The table comes from CHARMM and AMBER atom types, where the first character is not sufficient to determine the atom type. Some GROMOS ions have also been added.

See also

guess_atom_type() and MDAnalysis.topology.tables (where the data are stored)

MDAnalysis.topology.core.guess_atom_mass(atomname)

Guess a mass based on the atom name.

guess_atom_element() is used to determine the kind of atom.

Warning

Anything not recognized is simply set to 0; if you rely on the masses you might want to double check.

MDAnalysis.topology.core.guess_atom_type(atomname)

Guess atom type from the name.

At the moment, this function simply returns the element, as guessed by guess_atom_element().

MDAnalysis.topology.core.guess_format(filename, format=None)

Returns the type of topology file filename.

The current heuristic simply looks at the filename extension but more complicated probes could be implemented here or in the individual packages (e.g. as static methods).

If format is supplied then it overrides the auto detection.