void MolDraw2DSVG::addMoleculeMetadata(const ROMol &mol, int confId) const { PRECONDITION(d_os, "no output stream"); d_os << "<metadata>" << std::endl; d_os << "<rdkit:mol" << " xmlns:rdkit = \"http://www.rdkit.org/xml\"" << " version=\"" << RDKIT_SVG_VERSION << "\"" << ">" << std::endl; for (const auto atom : mol.atoms()) { d_os << "<rdkit:atom idx=\"" << atom->getIdx() + 1 << "\""; bool doKekule = false, allHsExplicit = true, isomericSmiles = true; d_os << " atom-smiles=\"" << SmilesWrite::GetAtomSmiles(atom, doKekule, nullptr, allHsExplicit, isomericSmiles) << "\""; auto tag = boost::str(boost::format("_atomdrawpos_%d") % confId); const Conformer &conf = mol.getConformer(confId); RDGeom::Point3D pos = conf.getAtomPos(atom->getIdx()); Point2D dpos(pos.x, pos.y); if (atom->hasProp(tag)) dpos = atom->getProp<Point2D>(tag); else dpos = getDrawCoords(dpos); d_os << " drawing-x=\"" << dpos.x << "\"" << " drawing-y=\"" << dpos.y << "\""; d_os << " x=\"" << pos.x << "\"" << " y=\"" << pos.y << "\"" << " z=\"" << pos.z << "\""; d_os << " />" << std::endl; } for (const auto bond : mol.bonds()) { d_os << "<rdkit:bond idx=\"" << bond->getIdx() + 1 << "\""; d_os << " begin-atom-idx=\"" << bond->getBeginAtomIdx() + 1 << "\""; d_os << " end-atom-idx=\"" << bond->getEndAtomIdx() + 1 << "\""; bool doKekule = false, allBondsExplicit = true; d_os << " bond-smiles=\"" << SmilesWrite::GetBondSmiles(bond, -1, doKekule, allBondsExplicit) << "\""; d_os << " />" << std::endl; } d_os << "</rdkit:mol></metadata>" << std::endl; }