restart_writer

A module for writing restart files.

Summary

Classes:

RestartFileWriter

A class for writing restart files.

Reference

class RestartFileWriter(
filename: str | None = None,
md_engine_format: MDEngineFormat | str = MDEngineFormat.PQ,
mode: FileWritingMode | str = 'w',
)[source]

Bases: BaseWriter

A class for writing restart files.

Inherits from the BaseWriter class. It writes restart files from the following molecular dynamics engines: - PQ - QMCFC

The restart file of these two md-engines are very similar. Both contain one line including the step information and one line including the box information. The following lines contain the atom information. The atom information is different for the two md-engines. The atom information of the PQ restart file contains the atom name, atom id, residue id, x position, y position, z position, x velocity, y velocity, z velocity, x force, y force and z force. The atom information of the QMCFC restart file contains the atom name, atom id, residue id, x position, y position, z position, x velocity, y velocity, z velocity, x force, y force, z force, x pos of previous step, y pos of previous step, z pos of previous step, x vel of previous step, y vel of previous step, z vel of previous step, x force of previous step, y force of previous step and z force of previous step. The old values are ignored.

For more information on how the restart file of PQ simulations is structured, see the corresponding documentation of the PQ code.

Parameters:
  • filename (str | None, optional) – The filename of the restart file, by default None (stdout)

  • md_engine_format (MDEngineFormat | str, optional) – The format of the restart file, by default MDEngineFormat.PQ

  • mode (FileWritingMode | str, optional) – The writing mode, by default ‘w’ - Possible values are ‘w’ (write), ‘a’ (append) and ‘o’ (overwrite).

write(
frame: AtomicSystem,
atom_counter: int | Np1DNumberArray | None = None,
) None[source]

Writes the frame to the file.

Parameters:
  • frame (AtomicSystem) – The frame to write.

  • atom_counter (int | Np1DNumberArray | None, optional) – The atom counter, by default None. If only a single integer is given, this number will be used as the atom counter for all atoms. If an array is given, this array has to have the same length as the number of atoms in the frame.

logger = <CustomLogger PQAnalysis.RestartFileWriter (INFO)>