Source code for stk.molecular.functional_groups.functional_groups.single_atom

Single Atom


from .generic_functional_group import GenericFunctionalGroup

[docs]class SingleAtom(GenericFunctionalGroup): """ Represents an abstract single atom functional group. The structure of the functional group is given by the pseudo-SMILES ``[atom]``. """
[docs] def __init__(self, atom): """ Initialize a :class:`.SingleAtom` instance. Parameters ---------- atom : :class:`.Atom` Any :class:`.Atom` will work. """ self._atom = atom atoms = (atom, ) super().__init__(atoms, atoms, ())
[docs] def get_atom(self): """ Get the atom that defines the functional group. Returns ------- :class:`.Atom` The atom. """ return self._atom
[docs] def with_atoms(self, atom_map): clone = super().with_atoms(atom_map) clone._atom = atom_map.get( self._atom.get_id(), self._atom, ) return clone
[docs] def clone(self): clone = super().clone() clone._atom = self._atom return clone
def __repr__(self): return ( f'{self.__class__.__name__}({self._atom})' )