4.16. LAMMPSParser¶
The parse()
function reads a LAMMPS data file to build a system
topology.
4.16.1. Classes¶
-
class
MDAnalysis.topology.LAMMPSParser.
DATAParser
(filename, universe=None, **kwargs)[source]¶ Parse a LAMMPS DATA file for topology and coordinates.
Note that LAMMPS DATA files can be used standalone.
Both topology and coordinate parsing functionality is kept in this class as the topology and coordinate reader share many common functions
The parser implements the LAMMPS DATA file format but only for the LAMMPS atom_style full (numeric ids 7, 10) and molecular (6, 9).
New in version 0.9.0.
Standard arguments for a TopologyReader:
Arguments: - filename
name of the topology file
Keywords: - universe
Supply a Universe to the Parser. This then passes it to the atom instances that are created within parsers.
- kwargs
Other keyword arguments that can vary with the specific format. These are stored as self.kwargs
-
close
()¶ Close the trajectory file.
-
convert_forces_from_native
(force, inplace=True)¶ In-place conversion of forces array force from native units to base units.
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)¶ In-place conversion of force array force from base units to native units.
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)¶ In-place conversion of coordinate array x from native units to base units.
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.
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.
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.
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)¶ In-place conversion of velocities array v from native units to base units.
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)¶ In-place conversion of coordinate array v from base units to native units.
By default, the input v is modified in place and also returned.
New in version 0.7.5.
4.16.2. Deprecated classes¶
-
class
MDAnalysis.topology.LAMMPSParser.
LAMMPSDataConverter
(filename=None)[source]¶ Class to parse a LAMMPS DATA file and convert it to PSF/PDB.
The DATA file contains both topology and coordinate information.
The
LAMMPSDataConverter
class can extract topology information and coordinates from a LAMMPS data file. For instance, in order to produce a PSF file of the topology and a PDB file of the coordinates from a data file “lammps.data” you can use:from MDAnalysis.topology.LAMMPSParser import LAMPPSData d = LAMMPSDataConverter("lammps.data") d.writePSF("lammps.psf") d.writePDB("lammps.pdb")
You can then read a trajectory (e.g. a LAMMPS DCD, see
MDAnalysis.coordinates.LAMMPS.DCDReader
) withu = MDAnalysis.Unverse("lammps.psf", "lammps.dcd", format="LAMMPS")
Deprecated since version 0.9.0.
Changed in version 0.9.0: Renamed from
LAMMPSData
toLAMMPSDataConverter
.