mda_openbabel_converter.OpenBabelParser
OpenBabel topology parser — mda_openbabel_converter.OpenBabel
Converts an
OpenBabel
openbabel.openbabel.OBMol into a MDAnalysis.core.Topology.
See also
Classes
- class mda_openbabel_converter.OpenBabelParser.OpenBabelParser(filename)[source]
For OpenBabel structure
Inherits from TopologyReaderBase and converts an OpenBabel OBMol to a MDAnalysis Topology or adds it to a pre-existing Topology. This parser does not work in the reverse direction.
For use examples, please see
mda_openbabel_converter.OpenBabel- Creates the following Attributes:
Atomids
Atomtypes
Aromaticities
Elements
Masses
Bonds
Resids
Resnums
Segids
- Depending on OpenBabel’s input, the following Attributes might be present:
Charges
Resnames
ICodes
- Guesses the following:
Atomnames
- Missing Attributes unable to be retrieved from OpenBabel:
Chiralities
RSChirality
Occupancies
Tempfactors
ChainIDs
AltLocs
Attributes table:
OpenBabel attribute
MDAnalysis equivalent
altLocs
atom.IsAromatic()
aromaticities
chainIDs
atom.GetPartialCharge()
charges
GetSymbol(atom.GetAtomicNum())
elements
atom.GetResidue().GetInsertionCode()
icodes
atom.GetIdx()
indices
atom.GetExactMass()
masses
“%s%d” % (GetSymbol(atom.GetAtomicNum()), atom.GetIdx())
names
chiralities
occupancies
atom.GetResidue().GetName()
resnames
atom.GetResidue().GetNum()
resnums
tempfactors
atom.GetType()
types
- Raises:
ValueError – If only some of the atoms have ResidueInfo, from resid.GetNum(), available
- close()
Close the trajectory file.
- convert_forces_from_native(force, inplace=True)
Conversion of forces array force from native to base units
- Parameters:
force (array_like) – Forces to transform
inplace (bool (optional)) – Whether to modify the array inplace, overwriting previous data
Note
By default, the input force is modified in place and also returned. In-place operations improve performance because allocating new arrays is avoided.
Added in version 0.7.7.
- convert_forces_to_native(force, inplace=True)
Conversion of force array force from base to native units.
- Parameters:
force (array_like) – Forces to transform
inplace (bool (optional)) – Whether to modify the array inplace, overwriting previous data
Note
By default, the input force is modified in place and also returned. In-place operations improve performance because allocating new arrays is avoided.
Added in version 0.7.7.
- convert_pos_from_native(x, inplace=True)
Conversion of coordinate array x from native units to base units.
- Parameters:
x (array_like) – Positions to transform
inplace (bool (optional)) – Whether to modify the array inplace, overwriting previous data
Note
By default, the input x is modified in place and also returned. In-place operations improve performance because allocating new arrays is avoided.
Changed in version 0.7.5: Keyword inplace can be set to
Falseso that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
- convert_pos_to_native(x, inplace=True)
Conversion of coordinate array x from base units to native units.
- Parameters:
x (array_like) – Positions to transform
inplace (bool (optional)) – Whether to modify the array inplace, overwriting previous data
Note
By default, the input x is modified in place and also returned. In-place operations improve performance because allocating new arrays is avoided.
Changed in version 0.7.5: Keyword inplace can be set to
Falseso that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
- convert_time_from_native(t, inplace=True)
Convert time t from native units to base units.
- Parameters:
t (array_like) – Time values to transform
inplace (bool (optional)) – Whether to modify the array inplace, overwriting previous data
Note
By default, the input t is modified in place and also returned (although note that scalar values t are passed by value in Python and hence an in-place modification has no effect on the caller.) In-place operations improve performance because allocating new arrays is avoided.
Changed in version 0.7.5: Keyword inplace can be set to
Falseso that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
- convert_time_to_native(t, inplace=True)
Convert time t from base units to native units.
- Parameters:
t (array_like) – Time values to transform
inplace (bool, optional) – Whether to modify the array inplace, overwriting previous data
Note
By default, the input t is modified in place and also returned. (Also note that scalar values t are passed by value in Python and hence an in-place modification has no effect on the caller.)
Changed in version 0.7.5: Keyword inplace can be set to
Falseso that a modified copy is returned unless no conversion takes place, in which case the reference to the unmodified x is returned.
- convert_velocities_from_native(v, inplace=True)
Conversion of velocities array v from native to base units
- Parameters:
v (array_like) – Velocities to transform
inplace (bool (optional)) – Whether to modify the array inplace, overwriting previous data
Note
By default, the input v is modified in place and also returned. In-place operations improve performance because allocating new arrays is avoided.
Added in version 0.7.5.
- convert_velocities_to_native(v, inplace=True)
Conversion of coordinate array v from base to native units
- Parameters:
v (array_like) – Velocities to transform
inplace (bool (optional)) – Whether to modify the array inplace, overwriting previous data
Note
By default, the input v is modified in place and also returned. In-place operations improve performance because allocating new arrays is avoided.
Added in version 0.7.5.
- parse(**kwargs)[source]
Accepts an OpenBabel OBMol and returns a MDAnalysis Topology. Will need to extract the number of atoms, number of residues, number of segments, atom_residue index, residue_segment index and all of the atom’s relevant attributes from the OBMol to initialise a new Topology.
- units = {'length': None, 'time': None, 'velocity': None}
dict with units of of time and length (and velocity, force, … for formats that support it)
Classes
|
For OpenBabel structure |