11#ifndef RD_SMILESWRITE_H_012020
12#define RD_SMILESWRITE_H_012020
20#include <boost/shared_ptr.hpp>
30 bool doIsomericSmiles =
32 bool doKekule =
false;
36 bool canonical =
true;
37 bool cleanStereo =
true;
38 bool allBondsExplicit =
false;
39 bool allHsExplicit =
false;
40 bool doRandom =
false;
43 int rootedAtAtom = -1;
47 bool includeDativeBonds =
50 bool ignoreAtomMapNumbers =
false;
54namespace SmilesWrite {
56#define CXSMILESFIELDS_ENUM_ITEMS \
57 CXSMILESFIELDS_ENUM_ITEM(CX_NONE, 0) \
58 CXSMILESFIELDS_ENUM_ITEM(CX_ATOM_LABELS, 1 << 0) \
59 CXSMILESFIELDS_ENUM_ITEM(CX_MOLFILE_VALUES, 1 << 1) \
60 CXSMILESFIELDS_ENUM_ITEM(CX_COORDS, 1 << 2) \
61 CXSMILESFIELDS_ENUM_ITEM(CX_RADICALS, 1 << 3) \
62 CXSMILESFIELDS_ENUM_ITEM(CX_ATOM_PROPS, 1 << 4) \
63 CXSMILESFIELDS_ENUM_ITEM(CX_LINKNODES, 1 << 5) \
64 CXSMILESFIELDS_ENUM_ITEM(CX_ENHANCEDSTEREO, 1 << 6) \
65 CXSMILESFIELDS_ENUM_ITEM(CX_SGROUPS, 1 << 7) \
66 CXSMILESFIELDS_ENUM_ITEM(CX_POLYMER, 1 << 8) \
67 CXSMILESFIELDS_ENUM_ITEM(CX_BOND_CFG, 1 << 9) \
68 CXSMILESFIELDS_ENUM_ITEM(CX_BOND_ATROPISOMER, 1 << 10) \
69 CXSMILESFIELDS_ENUM_ITEM(CX_COORDINATE_BONDS, 1 << 11) \
70 CXSMILESFIELDS_ENUM_ITEM(CX_ALL, 0x7fffffff) \
71 CXSMILESFIELDS_ENUM_ITEM(CX_ALL_BUT_COORDS, CX_ALL ^ CX_COORDS)
73#define CXSMILESFIELDS_ENUM_ITEM(k, v) k = (v),
75#undef CXSMILESFIELDS_ENUM_ITEM
76#define CXSMILESFIELDS_STD_MAP_ITEM(k) {#k, SmilesWrite::CXSmilesFields::k},
77#define CXSMILESFIELDS_ENUM_ITEM(k, v) CXSMILESFIELDS_STD_MAP_ITEM(k)
78#define CXSMILESFIELDS_ITEMS_MAP \
79 std::map<std::string, SmilesWrite::CXSmilesFields> { \
80 CXSMILESFIELDS_ENUM_ITEMS \
85 const ROMol &mol, std::uint32_t flags = CXSmilesFields::CX_ALL);
89 const std::vector<ROMol *> &mols, std::uint32_t flags);
113 const Bond * =
nullptr,
114 bool allHsExplicit =
false,
119 ps.doKekule = doKekule;
120 ps.allHsExplicit = allHsExplicit;
144 bool doKekule =
false,
145 bool allBondsExplicit =
false) {
148 ps.allBondsExplicit = allBondsExplicit;
149 ps.doIsomericSmiles =
false;
186 bool doKekule =
false,
int rootedAtAtom = -1,
187 bool canonical =
true,
188 bool allBondsExplicit =
false,
189 bool allHsExplicit =
false,
190 bool doRandom =
false,
191 bool ignoreAtomMapNumbers =
false) {
194 ps.doKekule = doKekule;
195 ps.rootedAtAtom = rootedAtAtom;
196 ps.canonical = canonical;
197 ps.allBondsExplicit = allBondsExplicit;
198 ps.allHsExplicit = allHsExplicit;
199 ps.doRandom = doRandom;
200 ps.ignoreAtomMapNumbers = ignoreAtomMapNumbers;
218 const ROMol &mol,
unsigned int numSmiles,
unsigned int randomSeed = 0,
219 bool doIsomericSmiles =
true,
bool doKekule =
false,
220 bool allBondsExplicit =
false,
bool allHsExplicit =
false);
227 const std::vector<std::string> *atomSymbols =
nullptr,
228 const std::vector<std::string> *
bondSymbols =
nullptr);
258 const std::vector<std::string> *atomSymbols =
nullptr,
259 const std::vector<std::string> *
bondSymbols =
nullptr,
260 bool doIsomericSmiles =
true,
bool doKekule =
false,
int rootedAtAtom = -1,
261 bool canonical =
true,
bool allBondsExplicit =
false,
262 bool allHsExplicit =
false) {
265 ps.doKekule = doKekule;
266 ps.rootedAtAtom = rootedAtAtom;
267 ps.canonical = canonical;
268 ps.allBondsExplicit = allBondsExplicit;
269 ps.allHsExplicit = allHsExplicit;
274#define RESTOREBONDDIROPTION_ENUM_ITEMS \
275 RESTOREBONDDIROPTION_ENUM_ITEM(RestoreBondDirOptionTrue, \
277 RESTOREBONDDIROPTION_ENUM_ITEM(RestoreBondDirOptionClear, \
280#define RESTOREBONDDIROPTION_ENUM_ITEM(k, v) k = v,
282#undef RESTOREBONDDIROPTION_ENUM_ITEM
283#define RESTOREBONDDIROPTION_STD_MAP_ITEM(k) {#k, k},
284#define RESTOREBONDDIROPTION_ENUM_ITEM(k, v) \
285 RESTOREBONDDIROPTION_STD_MAP_ITEM(k)
286#define RESTOREBONDDIROPTION_ITEMS_MAP \
287 std::map<std::string, RestoreBondDirOption> { \
288 RESTOREBONDDIROPTION_ENUM_ITEMS \
294 std::uint32_t flags = SmilesWrite::CXSmilesFields::CX_ALL,
314 bool doKekule =
false,
int rootedAtAtom = -1,
315 bool canonical =
true,
316 bool allBondsExplicit =
false,
317 bool allHsExplicit =
false,
318 bool doRandom =
false) {
321 ps.doKekule = doKekule;
322 ps.rootedAtAtom = rootedAtAtom;
323 ps.canonical = canonical;
324 ps.allBondsExplicit = allBondsExplicit;
325 ps.allHsExplicit = allHsExplicit;
326 ps.doRandom = doRandom;
335 const std::vector<std::string> *atomSymbols =
nullptr,
336 const std::vector<std::string> *
bondSymbols =
nullptr);
364 const std::vector<std::string> *atomSymbols =
nullptr,
365 const std::vector<std::string> *
bondSymbols =
nullptr,
366 bool doIsomericSmiles =
true,
bool doKekule =
false,
int rootedAtAtom = -1,
367 bool canonical =
true,
bool allBondsExplicit =
false,
368 bool allHsExplicit =
false) {
371 ps.doKekule = doKekule;
372 ps.rootedAtAtom = rootedAtAtom;
373 ps.canonical = canonical;
374 ps.allBondsExplicit = allBondsExplicit;
375 ps.allHsExplicit = allHsExplicit;
The class for representing atoms.
class for representing a bond
#define RDKIT_SMILESPARSE_EXPORT
RDKIT_SMILESPARSE_EXPORT std::string MolToSmiles(const ROMol &mol, const SmilesWriteParams ¶ms, bool doingCXSmiles)
RDKIT_SMILESPARSE_EXPORT std::string GetAtomSmiles(const Atom *atom, const SmilesWriteParams &ps)
returns the SMILES for an atom
RDKIT_SMILESPARSE_EXPORT bool inOrganicSubset(int atomicNumber)
returns true if the atom number is in the SMILES organic subset
@ CXSMILESFIELDS_ENUM_ITEMS
RDKIT_SMILESPARSE_EXPORT std::string GetBondSmiles(const Bond *bond, const SmilesWriteParams &ps, int atomToLeftIdx=-1)
returns the SMILES for a bond
RDKIT_SMILESPARSE_EXPORT std::string getCXExtensions(const ROMol &mol, std::uint32_t flags=CXSmilesFields::CX_ALL)
returns the cxsmiles data for a molecule
RDKIT_SMILESPARSE_EXPORT std::vector< std::string > MolToRandomSmilesVect(const ROMol &mol, unsigned int numSmiles, unsigned int randomSeed=0, bool doIsomericSmiles=true, bool doKekule=false, bool allBondsExplicit=false, bool allHsExplicit=false)
returns a vector of random SMILES for a molecule (may contain duplicates)
void updateSmilesWriteParamsFromJSON(SmilesWriteParams ¶ms, const std::string &details_json)
bool rdvalue_is(const RDValue_cast_t)
RDKIT_SMILESPARSE_EXPORT std::string MolFragmentToSmiles(const ROMol &mol, const SmilesWriteParams ¶ms, const std::vector< int > &atomsToUse, const std::vector< int > *bondsToUse=nullptr, const std::vector< std::string > *atomSymbols=nullptr, const std::vector< std::string > *bondSymbols=nullptr)
returns canonical SMILES for part of a molecule
RDKIT_SMILESPARSE_EXPORT std::string MolToSmiles(const ROMol &mol, const SmilesWriteParams ¶ms)
returns canonical SMILES for a molecule
RDKIT_SMILESPARSE_EXPORT std::string MolToCXSmiles(const ROMol &mol, const SmilesWriteParams &ps, std::uint32_t flags=SmilesWrite::CXSmilesFields::CX_ALL, RestoreBondDirOption restoreBondDirs=RestoreBondDirOptionClear)
returns canonical CXSMILES for a molecule
void updateCXSmilesFieldsFromJSON(SmilesWrite::CXSmilesFields &cxSmilesFields, RestoreBondDirOption &restoreBondDirs, const std::string &details_json)
RDKIT_SMILESPARSE_EXPORT std::string MolFragmentToCXSmiles(const ROMol &mol, const SmilesWriteParams ¶ms, const std::vector< int > &atomsToUse, const std::vector< int > *bondsToUse=nullptr, const std::vector< std::string > *atomSymbols=nullptr, const std::vector< std::string > *bondSymbols=nullptr)
returns canonical CXSMILES for part of a molecule
std::vector< boost::shared_ptr< ROMol > > MOL_SPTR_VECT
@ RESTOREBONDDIROPTION_ENUM_ITEMS