本文整理汇总了C++中OBMol::SetAutomaticFormalCharge方法的典型用法代码示例。如果您正苦于以下问题:C++ OBMol::SetAutomaticFormalCharge方法的具体用法?C++ OBMol::SetAutomaticFormalCharge怎么用?C++ OBMol::SetAutomaticFormalCharge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBMol
的用法示例。
在下文中一共展示了OBMol::SetAutomaticFormalCharge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: redo
void HydrogensCommand::redo()
{
if (m_SelectedList.size() == 0) {
switch(m_action) {
case AddHydrogens:
m_molecule->addHydrogens();
break;
case AddHydrogensPH:
{
OBMol obmol = m_molecule->OBMol();
obmol.UnsetFlag(OB_PH_CORRECTED_MOL);
FOR_ATOMS_OF_MOL (a, obmol)
a->SetFormalCharge(0.0);
obmol.SetAutomaticFormalCharge(true);
obmol.AddHydrogens(false, true, m_pH);
m_molecule->setOBMol(&obmol);
break;
}
case RemoveHydrogens:
m_molecule->removeHydrogens();
break;
}
}
else { // user selected some atoms, only operate on those
foreach(unsigned long id, m_SelectedList.subList(Primitive::AtomType))
{
Atom *atom = m_molecule->atomById(id);
if(atom)
{
switch(m_action) {
case AddHydrogens:
m_molecule->addHydrogens(atom);
break;
case RemoveHydrogens:
m_molecule->removeHydrogens(atom);
break;
default:
break;
}
}
}
} // end adding to selected atoms
m_molecule->update();
}
示例2: phmodel_test
void phmodel_test()
{
OBMol mol;
OBConversion conv;
conv.SetInFormat("smi");
conv.SetOutFormat("smi");
unsigned int test = 0;
// amine acid COOH pKa = 4.0 (carboxylic acid entry in phmodel.txt)
// amino acid NH3+ pKa = 10.0 (amine entry in phmodel.txt)
//
// Aspartic acid (sidechain COOH pKa = 3.8)
//
conv.ReadString(&mol, "NC(CC(O)=O)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 1.0); // NH3+ COOH COOH
//conv.Write(&mol, &cout);
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 17, "Aspartic acid pH 1.0" );
conv.ReadString(&mol, "NC(CC(O)=O)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 3.9); // NH3+ COOH COO-
//conv.Write(&mol, &cout);
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 16, "Aspartic acid pH 3.9" );
conv.ReadString(&mol, "NC(CC(O)=O)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 7.4); // NH3+ COO- COO-
//conv.Write(&mol, &cout);
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 15, "Aspartic acid pH 7.4" );
conv.ReadString(&mol, "NC(CC(O)=O)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 13.0); // NH2 COO- COO-
//conv.Write(&mol, &cout);
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 14, "Aspartic acid pH 13.0" );
//
// Glutamic acid (sidechain COOH pKa = 4.3)
//
conv.ReadString(&mol, "NC(CCC(O)=O)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 1.0); // NH3+ COOH COOH
//conv.Write(&mol, &cout);
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 20, "Glutamic acid pH 1.0" );
conv.ReadString(&mol, "NC(CCC(O)=O)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 4.15); // NH3+ COOH COO-
//conv.Write(&mol, &cout);
// known bug
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 19, "Glutamic acid pH 4.15" );
conv.ReadString(&mol, "NC(CCC(O)=O)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 7.4); // NH3+ COO- COO-
//conv.Write(&mol, &cout);
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 18, "Glutamic acid pH 7.4" );
conv.ReadString(&mol, "NC(CCC(O)=O)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 13.0); // NH2 COO- COO-
//conv.Write(&mol, &cout);
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 17, "Glutamic acid pH 13.0" );
//
// Histidine (sidechain nH+ pKa = 6.08)
//
conv.ReadString(&mol, "NC(Cc1ncnc1)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 1.0); // NH3+ COOH nH+
//conv.Write(&mol, &cout);
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 22, "Histidine pH 1.0" );
conv.ReadString(&mol, "NC(Cc1ncnc1)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 5.0); // NH3+ COO- nH+
//conv.Write(&mol, &cout);
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 21, "Histidine pH 5.0" );
conv.ReadString(&mol, "NC(Cc1ncnc1)C(O)=O");
mol.SetAutomaticFormalCharge(true);
mol.AddHydrogens(false, true, 7.4); // NH3+ COO- n:
//conv.Write(&mol, &cout);
BOOST_CHECK_MESSAGE( mol.NumAtoms() == 20, "Histidine pH 7.4" );
conv.ReadString(&mol, "NC(Cc1ncnc1)C(O)=O");
//.........这里部分代码省略.........