aiida_lammps.parsers.parse_raw.trajectory#

Set of functions to parse the LAMMPS dump output.

Module Contents#

Functions#

_iter_step_lines(file_obj)

Parse the lines containing the time step information

parse_step(→ collections.namedtuple)

Parse a given trajectory step

iter_trajectories(file_obj)

Parse a LAMMPS Trajectory file, yielding data for each time step.

create_structure(, original_structure)

Generate a structure from the atomic positions at a given step.

Attributes#

TrajectoryBlock

aiida_lammps.parsers.parse_raw.trajectory.TrajectoryBlock[source]#
aiida_lammps.parsers.parse_raw.trajectory._iter_step_lines(file_obj)[source]#

Parse the lines containing the time step information

Parameters:

file_obj ([type]) – file object that is being parsed

Yield:

initial line to start the parsing, content of the time step line

Return type:

int, str

aiida_lammps.parsers.parse_raw.trajectory.parse_step(lines, initial_line=0) collections.namedtuple[source]#

Parse a given trajectory step

Parameters:
  • lines (str) – subset fo the file content to be parsed.

  • initial_line (int, optional) – place where the parsing starts, defaults to 0

Raises:
  • IOError – if no timestep is found

  • IOError – if no number of atoms is found

  • IOError – if the box bounds are not found

  • IOError – if the header for the atomic positions is not found

Returns:

[description]

Return type:

namedtuple

aiida_lammps.parsers.parse_raw.trajectory.iter_trajectories(file_obj)[source]#

Parse a LAMMPS Trajectory file, yielding data for each time step.

aiida_lammps.parsers.parse_raw.trajectory.create_structure(trajectory_block: collections.namedtuple, symbol_field: str = 'element', position_fields: tuple = ('x', 'y', 'z'), original_structure: aiida.orm.StructureData = None) aiida.orm.StructureData[source]#

Generate a structure from the atomic positions at a given step.

Parameters:
  • trajectory_block (namedtuple) – block with the trajectory information

  • symbol_field (str, optional) – field name where the element symbols are found, defaults to ‘element’

  • position_fields (tuple, optional) – name of the files where the positions are found, defaults to (‘x’, ‘y’, ‘z’)

  • original_structure (orm.StructureData, optional) – original structure of the calculation, defaults to None

Raises:
  • ValueError – if the symbols of the structure and of the trajectory info differ

  • NotImplementedError – If the boundary conditions are not periodic or free

Returns:

structure of the current time step

Return type:

orm.StructureData