本文整理汇总了C++中openbabel::OBMol::BeginAtoms方法的典型用法代码示例。如果您正苦于以下问题:C++ OBMol::BeginAtoms方法的具体用法?C++ OBMol::BeginAtoms怎么用?C++ OBMol::BeginAtoms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openbabel::OBMol
的用法示例。
在下文中一共展示了OBMol::BeginAtoms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
continue;
}
Log.level(20) << "Molecule <" << mol_name << "> is newly protonated because of missing hydrogens (non-hydrogen atoms keep their 3D coordinates)." << endl;
}
}
else
{
rebuild_mol = true;
Log.level(20) << "Molecule <" << mol_name << "> is rebuild because of either missing 3D coordinates, unusual charges or unusual bond lengths." << endl;
}
}
// Rebuild or re-protonate and minimze molecule using OpenBabel tools
// Note: Openbabel::OpGen3D::Do() is NOT used directly here, because it re-assigns hydrogens for a static ph of 7.4,
// i.e. the pH can not be specified. Furthermore, it does also not remove hydrogens before using OBBuilder, resulting in hydrogens sometimes having more than one bond!
obmol = MolecularSimilarity::createOBMol(*mol);
ob_error = false;
try
{
// Remove all hydrogens before using OBBuilder, otherwise hydrogens end up having more than one bond! (Sigh!)
obmol->DeleteHydrogens();
// Backup original atom coordinates
coord_backup.clear();
if (!rebuild_mol && keep3DcoordsProtonate)
{
for(OpenBabel::OBAtomIterator a_it=obmol->BeginAtoms(); a_it!=obmol->EndAtoms(); ++a_it)
{
coord_backup.insert(make_pair((*a_it)->GetIdx(), (*a_it)->GetVector()));
}
}
// Create 3D coordinates for individual fragments using template library
OpenBabel::OBBuilder builder;
builder.Build(*obmol);
obmol->SetDimension(3);
// Set up a constraints object for OpenBabel minimization
// It is used to set positional constraints on non-hydrogen atoms when only hydrogens should be minimized
OpenBabel::OBFFConstraints constraints;
// Reset original coordinates and set positional constraints on non-hydrogen atoms
if (!rebuild_mol && keep3DcoordsProtonate)
{
for(OpenBabel::OBAtomIterator a_it=obmol->BeginAtoms(); a_it!=obmol->EndAtoms(); ++a_it)
{
(*a_it)->SetVector(coord_backup[(*a_it)->GetIdx()]);
constraints.AddAtomConstraint((*a_it)->GetIdx());
}
}
// Now add hydrogens
obmol->AddHydrogens(false, true, pH);