4.18. HOOMD XML topology parser¶
New in version 0.11.0.
The HoomdXMLParser
generates a topology from files for the HOOMD code.
Read a list of atoms from a HOOMD XML file to build a basic topology. Atom names are set to atom type if not present (which they probably aren’t). Elements are guessed based on atom types. Masses and charges are set to zero if not present in the XML file. Hoomd XML does not identify molecules or residues, so placeholder values are used for residue numbers and residue names. Bonds and angles are read if present.
4.18.1. Classes¶
-
class
MDAnalysis.topology.HoomdXMLParser.
HoomdXMLParser
(filename, universe=None, **kwargs)[source]¶ -
__delattr__
¶ x.__delattr__(‘name’) <==> del x.name
-
__format__
()¶ default object formatter
-
__getattribute__
¶ x.__getattribute__(‘name’) <==> x.name
-
__hash__
¶
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶
-
__setattr__
¶ x.__setattr__(‘name’, value) <==> x.name = value
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶
-
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.
New 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.
New 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.
Changed in version 0.7.5: Keyword inplace can be set to
False
so 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.
Changed in version 0.7.5: Keyword inplace can be set to
False
so 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.)
Changed in version 0.7.5: Keyword inplace can be set to
False
so 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
False
so 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.
New 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.
New in version 0.7.5.
-
parse
()[source]¶ Parse Hoomd XML file filename and return the dict structure.
Hoomd XML format does not contain a node for names. The parser will look for a name node anyway, and if it doesn’t find one, it will use the atom types as names. If the Hoomd XML file doesn’t contain a type node (it should), then all atom types will be ‘none’. Similar to the names, the parser will try to read element, mass, and charge from the XML file, but it will use placeholder values if they are not present.
Because Hoomd uses unitless mass, charge, etc., if they are not present they will not be guessed - they will be set to zero.
Returns: MDAnalysis internal structure dict See also
The structure dict is defined in
MDAnalysis.topology.base()
.New in version 0.11.0.
-