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
Atom
objects, or otherAtomicStructures
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 ofAtom
instances.- 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
Atom
instance.__bool__
()An
AtomicStructure
is False if empty, and True otherwise__contains__
(item)Check containership of
Atom
instances orAtomicStructure
substructures 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
Atom
instances from the structure and substructures recursively.__le__
(value, /)Return self<=value.
__len__
()Number of
Atom
instances 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
Atom
in 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_composition
Chemical composition of this structure as an ordered dictionary.
chemical_formula
Empirical chemical formula for this structure based on the chemical symbols.