本文整理汇总了C++中openbabel::OBMol::ConnectTheDots方法的典型用法代码示例。如果您正苦于以下问题:C++ OBMol::ConnectTheDots方法的具体用法?C++ OBMol::ConnectTheDots怎么用?C++ OBMol::ConnectTheDots使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openbabel::OBMol
的用法示例。
在下文中一共展示了OBMol::ConnectTheDots方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convert
List Factory::convert(Data::Geometry& geometry)
{
List list;
Atoms* atoms(new Atoms());
Bonds* bonds(new Bonds());
list.append(atoms);
list.append(bonds);
unsigned nAtoms(geometry.nAtoms());
OpenBabel::OBMol obMol;
obMol.BeginModify();
AtomMap atomMap;
for (unsigned i = 0; i < nAtoms; ++i) {
unsigned Z(geometry.atomicNumber(i));
qglviewer::Vec position(geometry.position(i));
Atom* atom(new Atom(geometry.atomicNumber(i)));
atom->setPosition(geometry.position(i));
atoms->appendLayer(atom);
OpenBabel::OBAtom* obAtom(obMol.NewAtom());
obAtom->SetAtomicNum(Z);
obAtom->SetVector(position.x, position.y, position.z);
atomMap.insert(obAtom, atom);
}
obMol.SetTotalCharge(geometry.charge());
obMol.SetTotalSpinMultiplicity(geometry.multiplicity());
obMol.EndModify();
obMol.ConnectTheDots();
obMol.PerceiveBondOrders();
for (OpenBabel::OBMolBondIter obBond(&obMol); obBond; ++obBond) {
Atom* begin(atomMap.value(obBond->GetBeginAtom()));
Atom* end(atomMap.value(obBond->GetEndAtom()));
Bond* bond(new Bond(begin, end));
bond->setOrder(obBond->GetBondOrder());
bonds->appendLayer(bond);
}
return list;
}