Generic Functional Group

class GenericFunctionalGroup(atoms, bonders, deleters, placers=None)[source]

Bases: stk.molecular.functional_groups.functional_groups.functional_group.FunctionalGroup

A functional group which defines general atomic classes.

Bonders are atoms which should have bonds added by a Reaction. Deleters are atoms which should be removed by a Reaction.

This interface allows the same reactions to be carried out across different functional groups, without knowing which specific elements it holds.

Methods

clone()

Return a clone.

get_atom_ids()

Yield the ids of all atoms in the functional group.

get_atoms()

Yield all the atoms in the functional group.

get_bonder_ids()

Yield the ids of bonder atoms.

get_bonders()

Yield bonder atoms in the functional group.

get_core_atom_ids()

Yield the ids of core atoms held by the functional group.

get_deleter_ids()

Yield the ids of deleter atoms.

get_deleters()

Yield the deleter atoms in the functional group.

get_num_bonders()

Get the number of bonder atoms.

get_placer_ids()

Yield the ids of placer atoms.

with_atoms(atom_map)

Return a clone holding different atoms.

with_ids(id_map)

Return a clone holding different atom ids.

__init__(atoms, bonders, deleters, placers=None)[source]

Initialize a GenericFunctionalGroup.

Parameters
  • atoms (tuple of Atom) – The atoms in the functional group.

  • bonders (tuple of Atom) – The bonder atoms in the functional group.

  • deleters (tuple of Atom) – The deleter atoms in the functional group.

  • placers (tuple of Atom, optional) – The placer atoms of the functional group. If None, the bonders will be used.

clone()[source]

Return a clone.

Returns

A clone. Has the same type as the original functional group.

Return type

FunctionalGroup

get_atom_ids()

Yield the ids of all atoms in the functional group.

Yields

int – The id of an Atom.

get_atoms()

Yield all the atoms in the functional group.

Yields

Atom – An atom in the functional group.

get_bonder_ids()[source]

Yield the ids of bonder atoms.

Yields

int – The id of a bonder Atom.

get_bonders()[source]

Yield bonder atoms in the functional group.

These are atoms which have bonds added during ConstructedMolecule construction.

Yields

Atom – A bonder atom.

get_core_atom_ids()

Yield the ids of core atoms held by the functional group.

Yields

int – The id of an Atom.

get_deleter_ids()[source]

Yield the ids of deleter atoms.

Yields

int – The id of a deleter Atom.

get_deleters()[source]

Yield the deleter atoms in the functional group.

These are atoms which are removed during ConstructedMolecule construction.

Yields

Atom – A deleter atom.

get_num_bonders()[source]

Get the number of bonder atoms.

Returns

The number of bonder atoms.

Return type

int

get_placer_ids()

Yield the ids of placer atoms.

Placer atoms are those, which should be used to calculate the position of the functional group.

Yields

int – The id of an Atom.

with_atoms(atom_map)[source]

Return a clone holding different atoms.

Parameters

atom_map (dict) – Maps the id of an atom in the functional group to the new atom the clone should hold. If the id of an atom in the functional group is not found in atom_map, the atom will not be replaced in the clone.

Returns

The clone. Has the same type as the original functional group.

Return type

FunctionalGroup

with_ids(id_map)

Return a clone holding different atom ids.

Parameters

id_map (dict[int, int]) – Maps the id of an atom in the functional group to the new id the clone should hold. If the id of an atom in the functional group is not found in id_map, the atom will not be replaced in the clone.

Return type

FunctionalGroup

Returns

The clone.