Source code for stk.molecular.functional_groups.functional_groups.secondary_amino

Secondary Amino


from .generic_functional_group import GenericFunctionalGroup

[docs]class SecondaryAmino(GenericFunctionalGroup): """ Represents a secondary amino functional group. The structure of the functional group is given by the pseudo-SMILES ``[atom1][nitrogen]([hydrogen])[atom2]``. """
[docs] def __init__( self, nitrogen, hydrogen, atom1, atom2, bonders, deleters, placers=None, ): """ Initialize a :class:`.SecondaryAmine` instance. Parameters ---------- nitrogen : :class:`.N` The ``[nitrogen]`` atom hydrogen : :class:`.H` The ``[hydrogen]`` atom. atom1 : :class:`.Atom` The ``[atom]`` atom. atom2 : :class:`.Atom` The ``[atom]`` atom. bonders : :class:`tuple` of :class:`.Atom` The bonder atoms. deleters : :class:`tuple` of :class:`.Atom` The deleter atoms. placers : :class:`tuple` of :class:`.Atom`, optional The placer atoms. If ``None`` the `bonders` will be used. """ self._nitrogen = nitrogen self._hydrogen = hydrogen self._atom1 = atom1 self._atom2 = atom2 super().__init__( atoms=(nitrogen, hydrogen, atom1, atom2), bonders=bonders, deleters=deleters, placers=bonders if placers is None else placers, )
[docs] def get_nitrogen(self): """ Get the ``[nitrogen]`` atom. Returns ------- :class:`.N` The ``[nitrogen]`` atom. """ return self._nitrogen
[docs] def get_hydrogen(self): """ Get the ``[hydrogen]`` atom. Returns ------- :class:`.H` The ``[hydrogen]`` atom. """ return self._hydrogen
[docs] def get_atom1(self): """ Get the ``[atom1]`` atom. Returns ------- :class:`.Atom` The ``[atom1]`` atom. """ return self._atom1
[docs] def get_atom2(self): """ Get the ``[atom2]`` atom. Returns ------- :class:`.Atom` The ``[atom2]`` atom. """ return self._atom2
[docs] def clone(self): clone = super().clone() clone._nitrogen = self._nitrogen clone._hydrogen = self._hydrogen clone._atom1 = self._atom1 clone._atom2 = self._atom2 return clone
[docs] def with_atoms(self, atom_map): clone = super().with_atoms(atom_map) clone._nitrogen = atom_map.get( self._nitrogen.get_id(), self._nitrogen, ) clone._hydrogen = atom_map.get( self._hydrogen.get_id(), self._hydrogen, ) clone._atom1 = atom_map.get( self._atom1.get_id(), self._atom1, ) clone._atom2 = atom_map.get( self._atom2.get_id(), self._atom2, ) return clone
def __repr__(self): return ( f"{self.__class__.__name__}(" f"{self._nitrogen}, {self._hydrogen}, {self._atom1}, " f"{self._atom2}, " f"bonders={self._bonders}, deleters={self._deleters})" )