|
| | MoleculeMutator (Molecule &mol) |
| | Construct a new MoleculeMutator object.
|
| | MoleculeMutator ()=delete |
| | MoleculeMutator (const MoleculeMutator &)=delete |
| MoleculeMutator & | operator= (const MoleculeMutator &)=delete |
| | MoleculeMutator (MoleculeMutator &&) noexcept=default |
| MoleculeMutator & | operator= (MoleculeMutator &&) noexcept=default |
| | ~MoleculeMutator () noexcept |
| int | add_atom (const AtomData &atom) |
| | Add an atom to the molecule.
|
| int | add_atom (AtomData &&atom) noexcept |
| | Add an atom to the molecule.
|
| int | add_atom (const Molecule::Atom &atom) |
| | Add an atom to the molecule.
|
| void | mark_atom_erase (int atom_idx) |
| | Mark an atom to be erased.
|
| void | mark_atom_erase (Molecule::Atom atom) |
| | Mark an atom to be erased.
|
| void | clear_atoms () noexcept |
| | Clear all atoms and bonds of the molecule.
|
| std::pair< int, bool > | register_bond (int src, int dst, const BondData &bond) |
| | Register a bond to be added to the molecule.
|
| std::pair< int, bool > | register_bond (int src, int dst, BondData &&bond) noexcept |
| | Register a bond to be added to the molecule.
|
| std::pair< int, bool > | register_bond (int src, int dst, Molecule::Bond bond) |
| | Register a bond to be added to the molecule.
|
| void | mark_bond_erase (int bid) |
| | Mark a bond to be erased.
|
| void | mark_bond_erase (int src, int dst) |
| | Mark a bond to be erased.
|
| void | mark_bond_erase (Molecule::Atom src, Molecule::Atom dst) |
| | Mark a bond to be erased.
|
| void | clear_bonds () noexcept |
| | Clear all bonds of the molecule.
|
| void | clear () noexcept |
| | Clear the molecule.
|
| void | finalize () noexcept |
| | Finalize the mutation.
|
| Molecule & | mol () noexcept |
| const Molecule & | mol () const noexcept |
A class to mutate a molecule.
Atom addition is directly applied to the molecule, but bond addition and atom/bond erasure are delayed until the finalize() method is called. This is because bulk bond addition is more efficient than individual bond addition, and atom erasure might change the atom indices of the remaining atoms, resulting in unexpected behavior if the mutation is not applied in the correct order. The finalize() method applies the mutations in the following order:
- Add registered bonds.
- Erase marked bonds.
- Erase marked atoms.
If finalize() method is not explicitly called, the destructor will automatically call it.
Conformers of molecules will resize to the new number of atoms also at the finalize() call. Currently, there is no way to specify the new positions of the added atoms. Assign the new positions manually after the mutation if necessary.
- Note
- Having multiple instances of this class for the same molecule might result in an inconsistent state.