11#ifndef RD_SMILESWRITE_H_012020
12#define RD_SMILESWRITE_H_012020
26 bool doIsomericSmiles =
28 bool doKekule =
false;
32 bool canonical =
true;
33 bool allBondsExplicit =
false;
34 bool allHsExplicit =
false;
35 bool doRandom =
false;
37 int rootedAtAtom = -1;
39 bool includeDativeBonds =
42 bool ignoreAtomMapNumbers =
false;
46namespace SmilesWrite {
48#define CXSMILESFIELDS_ENUM_ITEMS \
49 CXSMILESFIELDS_ENUM_ITEM(CX_NONE, 0) \
50 CXSMILESFIELDS_ENUM_ITEM(CX_ATOM_LABELS, 1 << 0) \
51 CXSMILESFIELDS_ENUM_ITEM(CX_MOLFILE_VALUES, 1 << 1) \
52 CXSMILESFIELDS_ENUM_ITEM(CX_COORDS, 1 << 2) \
53 CXSMILESFIELDS_ENUM_ITEM(CX_RADICALS, 1 << 3) \
54 CXSMILESFIELDS_ENUM_ITEM(CX_ATOM_PROPS, 1 << 4) \
55 CXSMILESFIELDS_ENUM_ITEM(CX_LINKNODES, 1 << 5) \
56 CXSMILESFIELDS_ENUM_ITEM(CX_ENHANCEDSTEREO, 1 << 6) \
57 CXSMILESFIELDS_ENUM_ITEM(CX_SGROUPS, 1 << 7) \
58 CXSMILESFIELDS_ENUM_ITEM(CX_POLYMER, 1 << 8) \
59 CXSMILESFIELDS_ENUM_ITEM(CX_BOND_CFG, 1 << 9) \
60 CXSMILESFIELDS_ENUM_ITEM(CX_BOND_ATROPISOMER, 1 << 10) \
61 CXSMILESFIELDS_ENUM_ITEM(CX_COORDINATE_BONDS, 1 << 11) \
62 CXSMILESFIELDS_ENUM_ITEM(CX_ALL, 0x7fffffff) \
63 CXSMILESFIELDS_ENUM_ITEM(CX_ALL_BUT_COORDS, CX_ALL ^ CX_COORDS)
65#define CXSMILESFIELDS_ENUM_ITEM(k, v) k = (v),
67#undef CXSMILESFIELDS_ENUM_ITEM
68#define CXSMILESFIELDS_STD_MAP_ITEM(k) {#k, SmilesWrite::CXSmilesFields::k},
69#define CXSMILESFIELDS_ENUM_ITEM(k, v) CXSMILESFIELDS_STD_MAP_ITEM(k)
70#define CXSMILESFIELDS_ITEMS_MAP \
71 std::map<std::string, SmilesWrite::CXSmilesFields> { \
72 CXSMILESFIELDS_ENUM_ITEMS \
77 const ROMol &mol, std::uint32_t flags = CXSmilesFields::CX_ALL);
101 const Bond * =
nullptr,
102 bool allHsExplicit =
false,
107 ps.doKekule = doKekule;
108 ps.allHsExplicit = allHsExplicit;
132 bool doKekule =
false,
133 bool allBondsExplicit =
false) {
136 ps.allBondsExplicit = allBondsExplicit;
137 ps.doIsomericSmiles =
false;
174 bool doKekule =
false,
int rootedAtAtom = -1,
175 bool canonical =
true,
176 bool allBondsExplicit =
false,
177 bool allHsExplicit =
false,
178 bool doRandom =
false,
179 bool ignoreAtomMapNumbers =
false) {
182 ps.doKekule = doKekule;
183 ps.rootedAtAtom = rootedAtAtom;
184 ps.canonical = canonical;
185 ps.allBondsExplicit = allBondsExplicit;
186 ps.allHsExplicit = allHsExplicit;
187 ps.doRandom = doRandom;
188 ps.ignoreAtomMapNumbers = ignoreAtomMapNumbers;
206 const ROMol &mol,
unsigned int numSmiles,
unsigned int randomSeed = 0,
207 bool doIsomericSmiles =
true,
bool doKekule =
false,
208 bool allBondsExplicit =
false,
bool allHsExplicit =
false);
215 const std::vector<std::string> *atomSymbols =
nullptr,
216 const std::vector<std::string> *
bondSymbols =
nullptr);
246 const std::vector<std::string> *atomSymbols =
nullptr,
247 const std::vector<std::string> *
bondSymbols =
nullptr,
248 bool doIsomericSmiles =
true,
bool doKekule =
false,
int rootedAtAtom = -1,
249 bool canonical =
true,
bool allBondsExplicit =
false,
250 bool allHsExplicit =
false) {
253 ps.doKekule = doKekule;
254 ps.rootedAtAtom = rootedAtAtom;
255 ps.canonical = canonical;
256 ps.allBondsExplicit = allBondsExplicit;
257 ps.allHsExplicit = allHsExplicit;
262#define RESTOREBONDDIROPTION_ENUM_ITEMS \
263 RESTOREBONDDIROPTION_ENUM_ITEM(RestoreBondDirOptionTrue, \
265 RESTOREBONDDIROPTION_ENUM_ITEM(RestoreBondDirOptionClear, \
268#define RESTOREBONDDIROPTION_ENUM_ITEM(k, v) k = v,
270#undef RESTOREBONDDIROPTION_ENUM_ITEM
271#define RESTOREBONDDIROPTION_STD_MAP_ITEM(k) {#k, k},
272#define RESTOREBONDDIROPTION_ENUM_ITEM(k, v) \
273 RESTOREBONDDIROPTION_STD_MAP_ITEM(k)
274#define RESTOREBONDDIROPTION_ITEMS_MAP \
275 std::map<std::string, RestoreBondDirOption> { \
276 RESTOREBONDDIROPTION_ENUM_ITEMS \
282 std::uint32_t flags = SmilesWrite::CXSmilesFields::CX_ALL,
302 bool doKekule =
false,
int rootedAtAtom = -1,
303 bool canonical =
true,
304 bool allBondsExplicit =
false,
305 bool allHsExplicit =
false,
306 bool doRandom =
false) {
309 ps.doKekule = doKekule;
310 ps.rootedAtAtom = rootedAtAtom;
311 ps.canonical = canonical;
312 ps.allBondsExplicit = allBondsExplicit;
313 ps.allHsExplicit = allHsExplicit;
314 ps.doRandom = doRandom;
323 const std::vector<std::string> *atomSymbols =
nullptr,
324 const std::vector<std::string> *
bondSymbols =
nullptr);
352 const std::vector<std::string> *atomSymbols =
nullptr,
353 const std::vector<std::string> *
bondSymbols =
nullptr,
354 bool doIsomericSmiles =
true,
bool doKekule =
false,
int rootedAtAtom = -1,
355 bool canonical =
true,
bool allBondsExplicit =
false,
356 bool allHsExplicit =
false) {
359 ps.doKekule = doKekule;
360 ps.rootedAtAtom = rootedAtAtom;
361 ps.canonical = canonical;
362 ps.allBondsExplicit = allBondsExplicit;
363 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
@ RESTOREBONDDIROPTION_ENUM_ITEMS