eon.structure

Structure storage for the eOn Python server.

Canonical on-disk form is readcon.ConFrame (.con via the readcon package). In-memory working form is :class:Structure: contiguous numpy arrays for geometry algorithms (PBC, neighbor lists, displacements). This replaces the historical aselite-era mini-Atoms type without requiring ASE.

Atoms is an alias of :class:Structure for call-site compatibility.

Module Contents

Classes

Structure

Mutable atomic configuration (numpy-backed).

Functions

coerce_free

Normalize a free-flag array to shape (n, 3).

as_atom_free

Per-atom free flag: True if any Cartesian axis is free.

structure_order

Permutation taking file order to :class:Structure order.

structure_to_ase

Optional ASE export (requires ase + pyeonclient.ase_bridge).

ase_to_structure

Optional ASE import (requires ase + pyeonclient.ase_bridge).

Data

API

eon.structure.coerce_free(value, n: int) numpy.ndarray[source]

Normalize a free-flag array to shape (n, 3).

A length-n vector is the whole-atom form and is broadcast onto every Cartesian axis. 1.0 is free, 0.0 is fixed.

eon.structure.as_atom_free(free) numpy.ndarray[source]

Per-atom free flag: True if any Cartesian axis is free.

eon.structure.structure_order(atom_ids: numpy.ndarray) numpy.ndarray[source]

Permutation taking file order to :class:Structure order.

Structure orders its atoms by ascending atom_id; a .con file orders them by species block, because CON header lines 7 and 8 are a type count and per-type counts. Ascending ids therefore survive the grouping the writer applies and are what puts the atoms back where an index into

Attr:

Structure.r finds the same atom it found before the write.

Ids that repeat carry no permutation to invert (a writer that numbers each species from 1 produces those), so file order stands.

class eon.structure.Structure(n_atoms: int = 0)[source]

Mutable atomic configuration (numpy-backed).

Atoms sit in ascending :attr:atom_ids order, which is the order a from-scratch Structure builds them in and the order every index-coupled sidecar (mode.dat, masses.dat, direction.dat, the Hessian, Prefactor.movedAtoms) is written in. .con files store atoms grouped by species, so :meth:from_conframe undoes the grouping through the ids rather than taking file order as given.

Attributes

r : (N, 3) float Cartesian positions. free : (N, 3) float Per-axis free flags (1.0 free, 0.0 fixed). A length-N assignment broadcasts onto all three axes. CON column 4 is this mask. box : (3, 3) float Cell matrix with lattice vectors as rows (ASE/vesin convention). names : list[str] Chemical symbols, length N. mass : (N,) float Atomic masses. atom_ids : (N,) uint64 Per-atom identity, CON column 5. 1..N for a Structure built from scratch; whatever the file carried for one read off disk.

Initialization

property free: numpy.ndarray
copy() eon.structure.Structure[source]
ids_or_sequential() numpy.ndarray[source]

Atom ids, or 1..N when the id array is out of step with the geometry.

Callers that grow r / names / mass field by field leave the ids behind; a short or long id array carries no identity to preserve, so the sequential numbering stands in.

atom_is_free() numpy.ndarray[source]

True for atoms that have at least one free Cartesian axis.

free_r() numpy.ndarray[source]

Positions of atoms that have at least one free axis.

free_mask() numpy.ndarray[source]
fixed_mask() numpy.ndarray[source]
append(r, free, name, mass, atom_id: Optional[int] = None) None[source]

Add one atom at the end.

An atom_id of None takes one past the largest in use, keeping the ids distinct and ascending so the appended atom stays last across a save and load cycle.

classmethod from_conframe(frame: readcon.ConFrame) eon.structure.Structure[source]

Build a Structure from a readcon ConFrame (live API).

The frame holds atoms grouped by species; :func:structure_order puts them back in atom_id order.

to_conframe(prebox_header: Optional[Sequence[str]] = None, postbox_header: Optional[Sequence[str]] = None) readcon.ConFrame[source]

Convert to a readcon ConFrame for writing.

Atoms go out in Structure order carrying their own ids. The writer groups them by species; the ids are what :meth:from_conframe reads the grouping back out of.

eon.structure.Atoms

None

eon.structure.structure_to_ase(structure: eon.structure.Structure, *, pbc: bool = True)[source]

Optional ASE export (requires ase + pyeonclient.ase_bridge).

eon.structure.ase_to_structure(atoms)[source]

Optional ASE import (requires ase + pyeonclient.ase_bridge).