Skip to main content

XYZ Format

Read and write whitespace-delimited XYZ coordinate tables (molecular or point clouds).

Overview​

PropertyValue
Format idxyz
ClassXYZIterable
Extensions.xyz
Text formatYes
Flat rowsYes
ReadYes
WriteYes
Extranone (stdlib)

Record shape​

Each data row yields:

{"element": "O", "x": 0.0, "y": 0.0, "z": 0.0}

Optional trailing fields become extra_0, extra_1, …. An optional atom-count header and comment line are skipped on read and written on write.

Usage​

from iterable import open_iterable

with open_iterable("molecule.xyz") as source:
for row in source:
print(row["element"], row["x"], row["y"], row["z"])

Error Handling​

  • Missing dependency: optional libraries raise ImportError with an install hint (pip install 'iterabledata[<extra>]' when an extra exists).
  • Write mode: read-only formats raise WriteNotSupportedError or ValueError when opened with mode="w".
  • Bad or unsupported input: may raise ValueError, OSError, or library-specific errors.
  • See Troubleshooting for decoding, detection, and engine issues.

See also​

Parameters​

ParameterTypeDefaultRequiredDescription
encodingstr'utf-8'NoPassed via iterableargs.