crystals.AtomicStructure
- class crystals.AtomicStructure(atoms: Iterable[Atom] | None = None, substructures: Iterable[AtomicStructure] | None = None, **kwargs)
Base class for atomic structures. These structures can be made out of
Atomobjects, or otherAtomicStructuressubclasses.The
AtomicStructuresclass 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
AtomicStructuresis implemented, as well as containership ofAtominstances.- Parameters:
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: Iterable[Atom] | None = None, substructures: Iterable[AtomicStructure] | None = None, **kwargs)
Methods
__add__(other)Create a new structure made from the combination of two structures.
__array__(*args, **kwargs)Returns an array in which each row represents an
Atominstance.__bool__()An
AtomicStructureis False if empty, and True otherwise__contains__(item)Check containership of
Atominstances orAtomicStructuresubstructures recursively.__delattr__(name, /)Implement delattr(self, name).
__dir__()Default dir() implementation.
__eq__(other)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.
__hash__()Return hash(self).
__init__([atoms, substructures])__init_subclass__This method is called when a class is subclassed.
__iter__()Yields
Atominstances from the structure and substructures recursively.__le__(value, /)Return self<=value.
__len__()Number of
Atominstances present in the structure and substructures__lt__(value, /)Return self<value.
__ne__(value, /)Return self!=value.
__new__(**kwargs)__reduce__()Helper for pickle.
__reduce_ex__(protocol, /)Helper for pickle.
__repr__()Verbose string representation of this instance.
__setattr__(name, value, /)Implement setattr(self, name, value).
__sizeof__()Size of object in memory, in bytes.
__str__()Return str(self).
__subclasshook__Abstract classes can override this to customize issubclass().
itersorted(*[, key, reverse])Yields
Atomin sorted order.satisfying(predicate)Builds a new AtomicStructure from atoms satisfying a predicate.
transform(*operators)Return a transformed AtomicStructure based on symmetry operators.
Attributes
__annotations__chemical_compositionChemical composition of this structure as an ordered dictionary.
chemical_formulaEmpirical chemical formula for this structure based on the chemical symbols.