pymatgen.io.lammps.output module

class LammpsDump(timesteps, natoms, box_bounds, atoms_data)[source]

Bases: monty.json.MSONable

Parse lammps dump file.

classmethod from_file(dump_file)[source]
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]
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]
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) –
Returns:

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]