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¶
Mutable atomic configuration (numpy-backed). |
Functions¶
Normalize a free-flag array to shape |
|
Per-atom free flag: True if any Cartesian axis is free. |
|
Permutation taking file order to :class: |
|
Optional ASE export (requires ase + pyeonclient.ase_bridge). |
|
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-
nvector is the whole-atom form and is broadcast onto every Cartesian axis.1.0is free,0.0is 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:
Structureorder.Structureorders its atoms by ascendingatom_id; a.confile 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.rfinds 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_idsorder, which is the order a from-scratchStructurebuilds them in and the order every index-coupled sidecar (mode.dat,masses.dat,direction.dat, the Hessian,Prefactor.movedAtoms) is written in..confiles store atoms grouped by species, so :meth:from_conframeundoes 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..Nfor a Structure built from scratch; whatever the file carried for one read off disk.Initialization
- property free: numpy.ndarray¶
- ids_or_sequential() numpy.ndarray[source]¶
Atom ids, or
1..Nwhen the id array is out of step with the geometry.Callers that grow
r/names/massfield by field leave the ids behind; a short or long id array carries no identity to preserve, so the sequential numbering stands in.
- 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_orderputs them back inatom_idorder.
- 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_conframereads 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).