29 #ifndef CDPL_CHEM_TAUTOMERGENERATOR_HPP
30 #define CDPL_CHEM_TAUTOMERGENERATOR_HPP
35 #include <unordered_set>
252 void initHashCalculator();
260 bool addNewTautomer(
const MoleculePtr& mol_ptr);
261 bool outputTautomer(
const MoleculePtr& mol_ptr);
263 std::uint64_t calcConTabHashCode(
const MolecularGraph& molgraph,
bool arom_bonds);
269 typedef std::array<std::size_t, 3> BondDescriptor;
270 typedef std::vector<MoleculePtr> MoleculeList;
271 typedef std::vector<TautomerizationRule::SharedPointer> TautRuleList;
272 typedef std::vector<BondDescriptor> BondDescrArray;
273 typedef std::vector<std::size_t> SizeTArray;
274 typedef std::unordered_set<std::uint64_t> HashCodeSet;
275 typedef std::array<std::size_t, 6> StereoCenter;
276 typedef std::vector<StereoCenter> StereoCenterList;
283 bool remResDuplicates;
287 TautRuleList tautRules;
288 MoleculeList currGeneration;
289 MoleculeList nextGeneration;
290 StereoCenterList atomStereoCenters;
291 StereoCenterList bondStereoCenters;
292 HashCodeSet intermTautHashCodes;
293 HashCodeSet outputTautHashCodes;
297 BondDescrArray tautomerBonds;
Definition of class CDPL::Chem::AromaticSubstructure.
Definition of class CDPL::Chem::BasicMolecule.
Definition of class CDPL::Chem::CIPConfigurationLabeler.
Definition of the preprocessor macro CDPL_CHEM_API.
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of class CDPL::Chem::HashCodeCalculator.
Definition of class CDPL::Util::ObjectPool.
Definition of class CDPL::Chem::TautomerizationRule.
Implements the perception of aromatic atoms and bonds in a molecular graph.
Definition: AromaticSubstructure.hpp:52
Assigns Cahn-Ingold-Prelog (CIP) configuration labels to stereogenic atoms and bonds of a molecular g...
Definition: CIPConfigurationLabeler.hpp:60
Computes a 64-bit hash code that identifies a molecular graph up to a configurable set of atom and bo...
Definition: HashCodeCalculator.hpp:67
Abstract base class for representations of a chemical structure as a graph of bonded atoms.
Definition: MolecularGraph.hpp:57
Enumerates the tautomers of a molecular graph by iteratively applying a configurable set of Chem::Tau...
Definition: TautomerGenerator.hpp:66
std::shared_ptr< TautomerGenerator > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated TautomerGenerator instances.
Definition: TautomerGenerator.hpp:84
bool coordinates3DCleared() const
Tells whether 3D atom coordinates are cleared from the generated tautomers.
bool resonanceDuplicatesRemoved() const
Tells whether resonance-only duplicates are filtered out.
void setCallbackFunction(const CallbackFunction &func)
Sets the callback invoked for every accepted output tautomer.
TautomerGenerator()
Constructs the TautomerGenerator instance.
bool isotopesRegarded() const
Tells whether atom isotope information is regarded by the tautomer duplicate detection algorithm.
std::size_t getNumTautomerizationRules() const
Returns the number of registered tautomerization rules.
virtual ~TautomerGenerator()
Virtual destructor.
Definition: TautomerGenerator.hpp:105
bool stereochemistryRegarded() const
Tells whether atom/bond stereochemistry is regarded by the tautomer duplicate detection algorithm.
void clearCoordinates3D(bool clear)
Specifies whether 3D atom coordinates shall be cleared from the generated tautomers.
void regardStereochemistry(bool regard)
Specifies whether atom/bond stereochemistry shall be regarded by the tautomer duplicate detection alg...
TautomerGenerator(const TautomerGenerator &gen)
Constructs a copy of the TautomerGenerator instance gen.
std::function< bool(MolecularGraph &)> CallbackFunction
Type of the callback invoked for every generated tautomer (returning false aborts the enumeration).
Definition: TautomerGenerator.hpp:87
const TautomerizationRule::SharedPointer & getTautomerizationRule(std::size_t idx) const
Returns the registered tautomerization rule at index idx.
void generate(const MolecularGraph &molgraph)
Enumerates the tautomers of molgraph and reports each accepted one to the registered callback.
void removeResonanceDuplicates(bool remove)
Specifies whether tautomers that differ only by resonance (no atom-connectivity change) shall be filt...
void removeTautomerizationRule(std::size_t idx)
Removes the registered tautomerization rule at index idx.
Mode
Constants specifying the output tautomer filtering strategy.
Definition: TautomerGenerator.hpp:73
@ TOPOLOGICALLY_UNIQUE
Report a generated tautomer only if its molecular graph is not topologically equivalent to an already...
Definition: TautomerGenerator.hpp:76
@ GEOMETRICALLY_UNIQUE
Report a generated tautomer only if its ordinary H-deplete molecular graph connection table is differ...
Definition: TautomerGenerator.hpp:78
bool coordinates2DCleared() const
Tells whether 2D atom coordinates are cleared from the generated tautomers.
void setMode(Mode mode)
Sets the tautomer duplicate filtering mode.
Mode getMode() const
Returns the currently configured tautomer duplicate filtering mode.
void addTautomerizationRule(const TautomerizationRule::SharedPointer &rule)
Registers a new tautomerization rule.
void clearCoordinates2D(bool clear)
Specifies whether 2D atom coordinates shall be cleared from the generated tautomers.
void setCustomSetupFunction(const CustomSetupFunction &func)
Sets the optional setup function invoked on the generated tautomers.
void regardIsotopes(bool regard)
Specifies whether atom isotope information shall be regarded by the tautomer duplicate detection algo...
const CallbackFunction & getCallbackFunction() const
Returns the currently configured callback.
std::function< void(MolecularGraph &)> CustomSetupFunction
Type of the optional setup function invoked on the input molecular graph before enumeration starts.
Definition: TautomerGenerator.hpp:89
TautomerGenerator & operator=(const TautomerGenerator &gen)
Replaces the state of this generator by a copy of the state of gen.
std::shared_ptr< TautomerizationRule > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated TautomerizationRule instances.
Definition: TautomerizationRule.hpp:54
std::shared_ptr< ObjectType > SharedObjectPointer
A smart pointer to a borrowed object that returns the object to the pool on destruction.
Definition: ObjectPool.hpp:71
CDPL_CHEM_API void setAromaticityFlags(MolecularGraph &molgraph, bool overwrite)
Perceives aromaticity and sets the corresponding atom/bond aromaticity flags on molgraph.
The namespace of the Chemical Data Processing Library.