Skip to content

Geo Io Engine Utility

Read and write geometry structures through ASE-backed helpers.

This module provides thin, engine-agnostic wrappers around ase.io.read and ase.io.write. It focuses on simple path handling and output-directory creation while leaving format parsing/serialization to ASE.

Usage context

  • Common I/O layer: Shared by generators and structure-transformer utilities.
  • Format interoperability: Supports any structure format recognized by ASE.
  • File safety: Ensures parent directories exist before writing outputs.

Function: read_structure

Read a structure file using ASE.

Parameters:

Name Type Description Default
path str | Path

Input structure file path.

required
format Optional[str]

Explicit ASE format override. None lets ASE infer the format.

None
index int | str

Structure index selection forwarded to ase.io.read.

0

Returns:

Type Description
Atoms

Parsed ASE Atoms object.

Examples:

atoms = read_structure("slab.xyz")

Function: write_structure

Write an ASE structure file in any ASE-supported format.

Parameters:

Name Type Description Default
atoms Atoms

Structure object to serialize.

required
path str | Path

Output file path.

required
format Optional[str]

Explicit ASE format override. None lets ASE infer from filename.

None
comment Optional[str]

Optional comment string forwarded to ASE writers that support it.

None

Returns:

Type Description
Path

Normalized output path written to disk.

Examples:

out = write_structure(atoms, "outputs/model.xyz", comment="generated")