Skip to main content

CIF Format

Read Crystallographic Information File (CIF) _atom_site loop rows as flat dictionaries.

Overview​

PropertyValue
Format idcif
ClassCIFIterable
Extensions.cif
ReadYes
WriteNo
Extranone (stdlib)
Maturityexperimental

Record shape​

Column names are stripped of the _atom_site. prefix:

{"type_symbol": "O", "label_atom_id": "O1", "Cartn_x": 0.0, "Cartn_y": 0.0, "Cartn_z": 0.0}

Only loop_ blocks whose columns all start with _atom_site. are yielded. . / ? become None; numeric fields are coerced when possible.

Usage​

from iterable import open_iterable

with open_iterable("structure.cif") as source:
for atom in source:
print(atom["type_symbol"], atom["Cartn_x"], atom["Cartn_y"], atom["Cartn_z"])

Error Handling​

  • Missing dependency: optional libraries raise ImportError with an install hint (pip install 'iterabledata[<extra>]' when an extra exists).
  • Read-only: opening with mode="w" raises WriteNotSupportedError or ValueError.
  • 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.