# pymatgen.io.lammps.output module¶

class LammpsDump(filename, parse_box=True, dtype=<class 'float'>)[source]

Bases: monty.json.MSONable

Dump file parser.

steps

All steps in the dump as a list of {“timestep”: current timestep,

“natoms”: no. of atoms, “box”: simulation box (optional), “atoms_data”: dumped data for atoms as 2D np.array}
timesteps

List of timesteps in sequence.

Parameters: filename (str) – Filename to parse. The timestep wildcard (‘*’) is supported and the files are parsed in the sequence of timestep. parse_box (bool) – Whether parse box info for each step. Default to True. dtype – np.dtype for atoms data array.
as_dict()[source]

A JSON serializable dict representation of an object.

class LammpsLog(log_file='log.lammps')[source]

Bases: monty.json.MSONable

Parser for LAMMPS log file.

Parameters: log_file (string) – path to the log file
as_dict()[source]

A JSON serializable dict representation of an object.

classmethod from_dict(d)[source]
class LammpsRun(data_file, trajectory_file, log_file='log.lammps')[source]

Bases: monty.json.MSONable

Parse the lammps data file, trajectory(dump) file and the log file to extract useful info about the system.

Note: In order to parse trajectory or dump file, the first 2 fields must be
the id and the atom type. There can be arbitrary number of fields after that and they all will be treated as floats.
Parameters: data_file (str) – path to the data file trajectory_file (str) – path to the trajectory file or dump file log_file (str) – path to the log file
as_dict()[source]

A JSON serializable dict representation of an object.

box_lengths
classmethod from_dict(d)[source]
get_diffusion_analyzer(specie, temperature, time_step, step_skip, **kwargs)[source]
Parameters: specie (Element/Specie) – Specie to calculate diffusivity for as a String. E.g., “Li”. temperature (float) – Temperature of the diffusion run in Kelvin. time_step (int) – Time step between measurements. step_skip (int) – Sampling frequency of the displacements ( time_step is multiplied by this number to get the real time between measurements) the other parameters please see the (For) – documentation. (pymatgen.analysis.diffusion_analyzer.DiffusionAnalyzer) – DiffusionAnalyzer
get_displacements()[source]

Return the initial structure and displacements for each time step. Used to interface with the DiffusionAnalyzer.

Returns: Structure object, numpy array of displacements
get_structures_from_trajectory()[source]

Convert the coordinates in each time step to a structure(boxed molecule). Used to construct DiffusionAnalyzer object.

Returns: list of Structure objects
mol_trajectory

Compute the weighted average trajectory of each molecule at each timestep

Returns: 2D numpy array ((n_timesteps*mols_number) x 3)
mol_velocity

Compute the weighted average velcoity of each molecule at each timestep.

Returns: 2D numpy array ((n_timesteps*mols_number) x 3)
natoms
traj_timesteps

trajectory time steps in time units. e.g. for units = real, time units = fmsec

pbc_wrap(array, box_lengths)[source]

wrap the array for molecule coordinates around the periodic boundary.

Parameters: array (numpy.ndarray) – molecule coordinates, [[x1,y1,z1],[x2,y2,z2],..] box_lengths (list) – [x_length, y_length, z_length]