write_api

A module containing API functions for writing different objects to a file.

Summary

Functions:

write

API write wrapper function for writing different objects to a file.

write_box

Writes the given trajectory to the file in a selected box file format.

Reference

write(
object_to_write: Any,
filename: str | None = None,
mode: FileWritingMode | str = FileWritingMode.WRITE,
) None[source]

API write wrapper function for writing different objects to a file.

It can call the following specialized write functions (depending on the object_to_write):

write_trajectory: Writes a trajectory to a file.
  • Trajectory

  • AtomicSystem

Parameters:
  • object_to_write (Any) – The object to write to a file.

  • filename (str | None, optional) – The name of the file to write to. If None, the output is printed to stdout.

  • mode (FileWritingMode | str, optional) – The writing mode. If a string is given, it is converted to a FileWritingMode enum.

write_box(
traj: Trajectory,
filename: str | None = None,
output_format: str | None = None,
) None[source]

Writes the given trajectory to the file in a selected box file format.

Parameters:
  • traj (Trajectory) – The trajectory to write.

  • filename (str, optional) – The name of the file to write to. If None, the output is printed to stdout.

  • output_format (str, optional) – The format of the file. If None, the format is inferred as a data file format. (see BoxWriter.formats for available formats)