mdtraj.formats.LAMMPSTrajectoryFile¶
- 
class mdtraj.formats.LAMMPSTrajectoryFile(filename, mode='r', force_overwrite=True)¶
- Interface for reading and writing to a LAMMPS lammpstrj files. This is a file-like object, that both reading or writing depending on the mode flag. It implements the context manager protocol, so you can also use it with the python ‘with’ statement. - Parameters
- filenamepath-like
- The filename to open. A path to a file on disk. 
- mode{‘r’, ‘w’}
- The mode in which to open the file, either ‘r’ for read or ‘w’ for write. 
- force_overwritebool
- If opened in write mode, and a file by the name of filename already exists on disk, should we overwrite it? 
 
 - Methods - close()- Close the lammpstrj file. - parse_box(style)- Extract lengths and angles from a frame. - read([n_frames, stride, atom_indices])- Read data from a lammpstrj file. - read_as_traj(topology[, n_frames, stride, …])- Read a trajectory from a lammpstrj file - seek(offset[, whence])- Move to a new file position. - tell()- Current file position. - write(xyz, cell_lengths[, cell_angles, …])- Write one or more frames of data to a lammpstrj file. - write_box(lengths, angles, mins)- Write the box lines in the header of a frame. - 
__init__(filename, mode='r', force_overwrite=True)¶
- Open a LAMMPS lammpstrj file for reading/writing. 
 - Methods - __init__(filename[, mode, force_overwrite])- Open a LAMMPS lammpstrj file for reading/writing. - close()- Close the lammpstrj file. - parse_box(style)- Extract lengths and angles from a frame. - read([n_frames, stride, atom_indices])- Read data from a lammpstrj file. - read_as_traj(topology[, n_frames, stride, …])- Read a trajectory from a lammpstrj file - seek(offset[, whence])- Move to a new file position. - tell()- Current file position. - write(xyz, cell_lengths[, cell_angles, …])- Write one or more frames of data to a lammpstrj file. - write_box(lengths, angles, mins)- Write the box lines in the header of a frame. - Attributes - distance_unit