irradiapy.io.lammpswritermpi module

This module contains the LAMMPSWriterMPI class.

class irradiapy.io.lammpswritermpi.LAMMPSWriterMPI(file_path, mode='w', encoding=<factory>, newline=<factory>, comm=<factory>, int_format=<factory>, float_format=<factory>, excluded_items=<factory>)[source]

Bases: MPIExceptionHandlerMixin

A class to write data like a LAMMPS dump file in parallel using MPI.

Note

Assumes orthogonal simulation box.

Variables:
  • file_path (Path) – The path to the LAMMPS dump file.

  • mode (str, optional (default="w")) – The file open mode.

  • encoding (str, optional (default=irradiapy.config.ENCODING)) – The file encoding.

  • newline (str, optional (default=irradiapy.config.NEWLINE)) – The newline character for the file.

  • comm (MPI.Comm, optional (default=mpi4py.MPI.COMM_WORLD)) – The MPI communicator.

  • int_format (str, optional (default=irradiapy.config.INT_FORMAT)) – The format for integers.

  • float_format (str, optional (default=irradiapy.config.FLOAT_FORMAT)) – The format for floats.

  • excluded_items (list[str], optional (default=irradiapy.config.EXCLUDED_ITEMS)) – Atom fields to exclude from output.

close()[source]

Closes the file associated with this writer.

Return type:

None

comm: Comm
encoding: str
excluded_items: list[str]
file_path: Path
float_format: str
int_format: str
mode: str = 'w'
newline: str
write(data)[source]

Write the data to the file.

Parameters:

data (dict[str, Any]) – A dictionary containing the data to be written. The keys should include “timestep”, “boundary”, “xlo”, “xhi”, “ylo”, “yhi”, “zlo”, “zhi”, and “atoms”. Optional keys: “time”.

Return type:

None