本文整理汇总了C++中Conformer::set3D方法的典型用法代码示例。如果您正苦于以下问题:C++ Conformer::set3D方法的具体用法?C++ Conformer::set3D怎么用?C++ Conformer::set3D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conformer
的用法示例。
在下文中一共展示了Conformer::set3D方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateOneProductSet
MOL_SPTR_VECT generateOneProductSet(const ChemicalReaction& rxn,
const MOL_SPTR_VECT& reactants,
const std::vector<MatchVectType> &reactantsMatch)
{
PRECONDITION(reactants.size() == reactantsMatch.size(),"vector size mismatch");
// if any of the reactants have a conformer, we'll go ahead and
// generate conformers for the products:
bool doConfs=false;
BOOST_FOREACH(ROMOL_SPTR reactant,reactants) {
if(reactant->getNumConformers()) {
doConfs=true;
break;
}
}
MOL_SPTR_VECT res;
res.resize(rxn.getNumProductTemplates());
unsigned int prodId=0;
for(MOL_SPTR_VECT::const_iterator pTemplIt = rxn.beginProductTemplates();
pTemplIt != rxn.endProductTemplates(); ++pTemplIt) {
// copy product template and its properties to a new product RWMol
RWMOL_SPTR product = initProduct(*pTemplIt);
Conformer *conf = 0;
if(doConfs) {
conf = new Conformer();
conf->set3D(false);
}
unsigned int reactantId = 0;
for(MOL_SPTR_VECT::const_iterator iter = rxn.beginReactantTemplates();
iter != rxn.endReactantTemplates(); ++iter, reactantId++) {
addReactantAtomsAndBonds(rxn, product, reactants.at(reactantId),
reactantsMatch.at(reactantId),
*iter, conf);
}
if(doConfs) {
product->addConformer(conf,true);
}
res[prodId] = product;
++prodId;
}
return res;
}
示例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;
}