本文整理汇总了C++中openbabel::OBMol::EndModify方法的典型用法代码示例。如果您正苦于以下问题:C++ OBMol::EndModify方法的具体用法?C++ OBMol::EndModify怎么用?C++ OBMol::EndModify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openbabel::OBMol
的用法示例。
在下文中一共展示了OBMol::EndModify方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeGasteigerCharges
void Geometry::computeGasteigerCharges()
{
// This is returning zero charges for some reason
return;
qDebug() << "Geometry::computeGasteigerCharges() not working correctly";
OpenBabel::OBAtom* obAtom(0);
OpenBabel::OBMol obMol;
obMol.BeginModify();
obMol.UnsetPartialChargesPerceived();
for (int i = 0; i < m_atoms.size(); ++i) {
obAtom = obMol.NewAtom();
obAtom->SetAtomicNum(m_atoms[i]->atomicNumber());
obAtom->SetVector(m_coordinates[i].x, m_coordinates[i].y, m_coordinates[i].z);
}
obMol.SetTotalCharge(m_charge);
obMol.SetTotalSpinMultiplicity(m_multiplicity);
obMol.EndModify();
OpenBabel::OBMolAtomIter iter(&obMol);
for (int i = 0; i < m_atoms.size(); ++i, ++iter) {
int index(iter->GetIdx());
qDebug() << "Setting Gasteiger Charge for" << index << "to" << iter->GetPartialCharge();
GasteigerCharge& charge(m_atoms[i]->getProperty<GasteigerCharge>());
charge.setValue(iter->GetPartialCharge());
}
}
示例2: 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;
}