class crystals.AtomicStructure(atoms: Optional[Iterable[Atom]] = None, substructures: Optional[Iterable[AtomicStructure]] = None, **kwargs)

Base class for atomic structures. These structures can be made out of Atom objects, or other AtomicStructures subclasses.

The AtomicStructures class provides an abstraction over structure with and without substructure. Subclasses can be iterated over as an iterable of atoms. Order of iteration is not guaranteed.

Hierarchical containership of AtomicStructures is implemented, as well as containership of Atom instances.

  • atoms (iterable, optional) – Atoms not attached to a substructure.

  • substructures (iterable, optional) – Atomic substructures. For example, different atom chains could form a secondary structure in a protein.

__init__(atoms: Optional[Iterable[Atom]] = None, substructures: Optional[Iterable[AtomicStructure]] = None, **kwargs)



Create a new structure made from the combination of two structures.

__array__(*args, **kwargs)

Returns an array in which each row represents an Atom instance.


An AtomicStructure is False if empty, and True otherwise


Check containership of Atom instances or AtomicStructure substructures recursively.

__delattr__(name, /)

Implement delattr(self, name).


Default dir() implementation.


Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.


Return hash(self).

__init__([atoms, substructures])


This method is called when a class is subclassed.


Yields Atom instances from the structure and substructures recursively.

__le__(value, /)

Return self<=value.


Number of Atom instances present in the structure and substructures

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.



Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.


Verbose string representation of this instance.

__setattr__(name, value, /)

Implement setattr(self, name, value).


Size of object in memory, in bytes.


Return str(self).


Abstract classes can override this to customize issubclass().

itersorted(*[, key, reverse])

Yields Atom in sorted order.


Builds a new AtomicStructure from atoms satisfying a predicate.


Return a transformed AtomicStructure based on symmetry operators.



Chemical composition of this structure as an ordered dictionary.


Empirical chemical formula for this structure based on the chemical symbols.