irradiapy.io.bzip2lammpswritermpi module

This module contains the BZIP2LAMMPSWriterMPI class.

class irradiapy.io.bzip2lammpswritermpi.BZIP2LAMMPSWriterMPI(file_path, mode='wb', encoding=<factory>, comm=<factory>, compresslevel=9, int_format=<factory>, float_format=<factory>, excluded_items=<factory>)[source]

Bases: MPIExceptionHandlerMixin

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

Note

Assumed orthogonal simulation box.

Note

All ranks compute their local subdomain of atoms, then rank 0 collects and writes the data.

Parameters:
  • file_path (Path) – Output .bz2 path.

  • mode (str) – File mode for the container file opened on rank 0 (default: ‘wb’).

  • encoding (str) – The file encoding.

  • comm (Comm) – The MPI communicator.

  • compresslevel (int) – Compression level for bzip2.

  • int_format (str) – The format for integers.

  • float_format (str) – The format for floats.

  • excluded_items (list[str]) – Atom fields to exclude from output.

close()[source]

Closes the file associated with this writer.

Return type:

None

comm: Comm
compresslevel: int = 9
encoding: str
excluded_items: list[str]
file_path: Path
float_format: str
int_format: str
mode: str = 'wb'
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