I’m new to C++ RDKit. How do I perform functions on elements of std::vector<boost::shared_ptr<RDKit::ROMol> > object? I’m struggle to unpack it (see highlighted sections below).
P.S. This is simply cut and pasted from the documentation with on addition: MolToSmiles() Thank you, Jarod std::string smi="[O:1]>>[N:1]"; RDKit::ChemicalReaction *rxn = RDKit::RxnSmartsToChemicalReaction(smi); rxn->initReactantMatchers(); RDKit::MOL_SPTR_VECT reacts; reacts.clear(); smi = "OCO"; RDKit::ROMol *mol = RDKit::SmilesToMol(smi); reacts.push_back(RDKit::ROMOL_SPTR(mol)); std::vector<RDKit::MOL_SPTR_VECT> prods; prods = rxn->runReactants(reacts); // here prods has two entries, because there are two Os in the // reactant. for( auto & mol: prods ) { std::cout << RDKit::MolToSmiles(mol) << std::endl; } reacts[0]->getAtomWithIdx(0)->setProp(RDKit::common_properties::_protected,1); prods = rxn->runReactants(reacts); // here prods only has one entry, the reaction at atom 0 // has been blocked by the _protected property test.cpp: In function ‘int main()’: test.cpp:37:36: error: no matching function for call to ‘MolToSmiles(std::vector<boost::shared_ptr<RDKit::ROMol> >&)’ 37 | std::cout << RDKit::MolToSmiles(mol) << std::endl; | ~~~~~~~~~~~~~~~~~~^~~~~ In file included from test.cpp:5: /opt/rdkit-Release_2022_09_2/Code/GraphMol/SmilesParse/SmilesWrite.h:96:38: note: candidate: ‘std::string RDKit::MolToSmiles(const ROMol&, const SmilesWri teParams&)’ 96 | RDKIT_SMILESPARSE_EXPORT std::string MolToSmiles( | ^~~~~~~~~~~ /opt/rdkit-Release_2022_09_2/Code/GraphMol/SmilesParse/SmilesWrite.h:96:38: note: candidate expects 2 arguments, 1 provided /opt/rdkit-Release_2022_09_2/Code/GraphMol/SmilesParse/SmilesWrite.h:116:20: note: candidate: ‘std::string RDKit::MolToSmiles(const ROMol&, bool, bool, in t, bool, bool, bool, bool)’ 116 | inline std::string MolToSmiles(const ROMol &mol, bool doIsomericSmiles = true, | ^~~~~~~~~~~ /opt/rdkit-Release_2022_09_2/Code/GraphMol/SmilesParse/SmilesWrite.h:116:45: note: no known conversion for argument 1 from ‘std::vector<boost::shared_pt r<RDKit::ROMol> >’ to ‘const RDKit::ROMol&’ 116 | inline std::string MolToSmiles(const ROMol &mol, bool doIsomericSmiles = true, Sent from my iPhone
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss