本文整理汇总了C++中Conformer::setId方法的典型用法代码示例。如果您正苦于以下问题:C++ Conformer::setId方法的具体用法?C++ Conformer::setId怎么用?C++ Conformer::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conformer
的用法示例。
在下文中一共展示了Conformer::setId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testIssue219
void testIssue219(){
BOOST_LOG(rdErrorLog) << "-------------------------------------" << std::endl;
BOOST_LOG(rdErrorLog) << "Testing Issue219: Pickle Failure with Conformations." << std::endl;
std::string smi="CC";
ROMol *m1 = SmilesToMol(smi);
TEST_ASSERT(m1);
std::string pickle;
ROMol *m2;
MolPickler::pickleMol(*m1,pickle);
m2 = new ROMol();
MolPickler::molFromPickle(pickle,*m2);
TEST_ASSERT(m1->getNumAtoms()==m2->getNumAtoms());
Conformer *conf = new Conformer(2);
conf->setId(23);
m1->addConformer(conf);
MolPickler::pickleMol(*m1,pickle);
delete m2;
m2 = new ROMol();
MolPickler::molFromPickle(pickle,*m2);
TEST_ASSERT(m1->getNumAtoms()==m2->getNumAtoms());
TEST_ASSERT(m2->getConformer().getId()==23);
BOOST_LOG(rdErrorLog) << "\tdone" << std::endl;
}
示例2: FileParseException
ROMol *TDTMolSupplier::parseMol(std::string inLine) {
PRECONDITION(dp_inStream, "no stream");
Utils::LocaleSwitcher ls;
std::size_t startP = inLine.find("<");
std::size_t endP = inLine.find_last_of(">");
std::string smiles = inLine.substr(startP + 1, endP - startP - 1);
ROMol *res = SmilesToMol(smiles, 0, df_sanitize);
if (res && res->getNumAtoms() > 0) {
// -----------
// Process the properties:
d_line++;
std::getline(*dp_inStream, inLine);
while (!dp_inStream->eof() && inLine.find("|") != 0) {
endP = inLine.find("<");
std::string propName = inLine.substr(0, endP);
boost::trim_if(propName, boost::is_any_of(" \t"));
startP = endP + 1;
if (propName == common_properties::TWOD && d_confId2D >= 0) {
std::string rest = inLine.substr(startP, inLine.size() - startP);
std::vector<double> coords;
TDTParseUtils::ParseNumberList(rest, coords, dp_inStream);
Conformer *conf = new Conformer(res->getNumAtoms());
conf->setId(d_confId2D);
conf->set3D(false);
for (unsigned int atIdx = 0; atIdx < res->getNumAtoms(); atIdx++) {
if (2 * atIdx + 1 < coords.size()) {
conf->setAtomPos(
atIdx,
RDGeom::Point3D(coords[2 * atIdx], coords[2 * atIdx + 1], 0.0));
} else {
// we're going to let this slide... but maybe we should do something
// else?
}
}
res->addConformer(conf, false);
} else if (propName == "3D" && d_confId3D >= 0) {
std::string rest = inLine.substr(startP, inLine.size() - startP);
std::vector<double> coords;
TDTParseUtils::ParseNumberList(rest, coords, dp_inStream);
Conformer *conf = new Conformer(res->getNumAtoms());
conf->setId(d_confId3D);
conf->set3D(true);
for (unsigned int atIdx = 0; atIdx < res->getNumAtoms(); atIdx++) {
if (3 * atIdx + 2 < coords.size()) {
conf->setAtomPos(
atIdx, RDGeom::Point3D(coords[3 * atIdx], coords[3 * atIdx + 1],
coords[3 * atIdx + 2]));
} else {
// we're going to let this slide... but maybe we should do something
// else?
}
}
res->addConformer(conf, false);
} else {
endP = inLine.find_last_of(">");
if (endP == std::string::npos) {
std::ostringstream errout;
errout << "no end tag found for property" << propName;
throw FileParseException(errout.str());
} else {
std::string propVal = inLine.substr(startP, endP - startP);
res->setProp(propName, propVal);
if (propName == d_nameProp)
res->setProp(common_properties::_Name, propVal);
}
}
std::getline(*dp_inStream, inLine);
}
}
return res;
}