17#include <unordered_map>
29typedef std::vector<ConjElectrons *>
CEVect;
31typedef std::vector<std::uint8_t>
ConjFP;
32typedef std::unordered_map<std::size_t, ConjElectrons *>
CEMap;
78 struct ResonanceProgress {
79 size_t d_totalStructs;
80 size_t d_diverseStructs;
82 size_t d_maxStructs{0};
83 std::vector<ResonanceProgress> d_progress;
91 ALLOW_INCOMPLETE_OCTETS = (1 << 0),
94 ALLOW_CHARGE_SEPARATION = (1 << 1),
97 KEKULE_ALL = (1 << 2),
105 UNCONSTRAINED_CATIONS = (1 << 3),
111 UNCONSTRAINED_ANIONS = (1 << 4)
128 unsigned int maxStructs = 1000);
135 unsigned int flags()
const {
return d_flags; }
162 return d_callback.get();
200 typedef struct CEPerm {
202 std::vector<unsigned int> v;
204 unsigned int d_nConjGrp;
205 unsigned int d_length;
206 unsigned int d_flags;
207 unsigned int d_maxStructs;
209 unsigned int d_numThreads;
214 std::vector<int> d_bondConjGrpIdx;
215 std::vector<int> d_atomConjGrpIdx;
216 std::vector<size_t> d_enumIdx;
217 std::unique_ptr<ResonanceMolSupplierCallback> d_callback;
221 void mainLoop(
unsigned int ti,
unsigned int nt);
222 void assignConjGrpIdx();
225 void prepEnumIdxVect();
226 void idxToCEPerm(
size_t idx, std::vector<unsigned int> &c)
const;
227 void setResonanceMolSupplierLength();
228 void buildCEMap(
CEMap &ceMap,
unsigned int conjGrpIdx);
229 void storeCEMap(
const CEMap &ceMap,
unsigned int conjGrpIdx);
230 void assignBondsFormalChargesHelper(
ROMol &mol,
231 std::vector<unsigned int> &c)
const;
232 ROMol *assignBondsFormalCharges(std::vector<unsigned int> &c)
const;
233 static bool cePermCompare(
const CEPerm *a,
const CEPerm *b);
ResonanceMolSupplierCallback()
size_t getMaxStructures() const
size_t getNumDiverseStructures(unsigned int conjGrpIdx) const
virtual bool operator()()=0
virtual ~ResonanceMolSupplierCallback()
size_t getNumStructures(unsigned int conjGrpIdx) const
unsigned int getNumConjGrps() const
ResonanceMolSupplierCallback * getProgressCallback() const
ResonanceMolSupplier(ROMol &mol, unsigned int flags=0, unsigned int maxStructs=1000)
const ROMol & mol() const
void setProgressCallback(ResonanceMolSupplierCallback *callback)
ROMol * operator[](unsigned int idx)
int getAtomConjGrpIdx(unsigned int ai) const
void setNumThreads(int numThreads=1)
unsigned int flags() const
unsigned int getNumConjGrps() const
int getBondConjGrpIdx(unsigned int bi) const
void moveTo(unsigned int idx)
#define RDKIT_GRAPHMOL_EXPORT
bool rdvalue_is(const RDValue_cast_t)
std::vector< CEVect2 * > CEVect3
std::unordered_map< std::size_t, ConjElectrons * > CEMap
std::vector< std::uint8_t > ConjFP
std::vector< ConjElectrons * > CEVect
std::map< unsigned int, AtomElectrons * > ConjAtomMap
std::map< unsigned int, BondElectrons * > ConjBondMap