本文整理汇总了C++中OBBond::IsAromatic方法的典型用法代码示例。如果您正苦于以下问题:C++ OBBond::IsAromatic方法的具体用法?C++ OBBond::IsAromatic怎么用?C++ OBBond::IsAromatic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBBond
的用法示例。
在下文中一共展示了OBBond::IsAromatic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void fingerprint2::getFragments(vector<int> levels, vector<int> curfrag,
int level, OBAtom* patom, OBBond* pbond)
{
//Recursive routine to analyse schemical structure and populate fragset and ringset
//Hydrogens,charges(except dative bonds), spinMultiplicity ignored
const int Max_Fragment_Size = 7;
int bo=0;
if(pbond)
{
bo = pbond->IsAromatic() ? 5 : pbond->GetBO();
// OBAtom* pprevat = pbond->GetNbrAtom(patom);
// if(patom->GetFormalCharge() && (patom->GetFormalCharge() == -pprevat->GetFormalCharge()))
// ++bo; //coordinate (dative) bond eg C[N+]([O-])=O is seen as CN(=O)=O
}
curfrag.push_back(bo);
curfrag.push_back(patom->GetAtomicNum());
levels[patom->GetIdx()-1] = level;
vector<OBEdgeBase*>::iterator itr;
OBBond *pnewbond;
// PrintFpt(curfrag,(int)patom);
for (pnewbond = patom->BeginBond(itr);pnewbond;pnewbond = patom->NextBond(itr))
{
if(pnewbond==pbond) continue; //don't retrace steps
OBAtom* pnxtat = pnewbond->GetNbrAtom(patom);
if(pnxtat->GetAtomicNum() == OBElements::Hydrogen) continue;
int atlevel = levels[pnxtat->GetIdx()-1];
if(atlevel) //ring
{
if(atlevel==1)
{
//If complete ring (last bond is back to starting atom) add bond at front
//and save in ringset
curfrag[0] = pnewbond->IsAromatic() ? 5 : pnewbond->GetBO();
ringset.insert(curfrag);
curfrag[0] = 0;
}
}
else //no ring
{
if(level<Max_Fragment_Size)
{
// TRACE("level=%d size=%d %p frag[0]=%p\n",level, curfrag.size(),&curfrag, &(curfrag[0]));
//Do the next atom; levels, curfrag are passed by value and hence copied
getFragments(levels, curfrag, level+1, pnxtat, pnewbond);
}
}
}
//do not save C,N,O single atom fragments
if(curfrag[0]==0 &&
(level>1 || patom->GetAtomicNum()>8 || patom->GetAtomicNum()<6))
{
fragset.insert(curfrag); //curfrag ignored if an identical fragment already present
// PrintFpt(curfrag,level);
}
}
示例2: if
//.........这里部分代码省略.........
OBPairData *dp = (OBPairData*)mol.GetData("PartialCharges");
if (dp != NULL) {
// Tripos spec says:
// NO_CHARGES, DEL_RE, GASTEIGER, GAST_HUCK, HUCKEL, PULLMAN,
// GAUSS80_CHARGES, AMPAC_CHARGES, MULLIKEN_CHARGES, DICT_ CHARGES,
// MMFF94_CHARGES, USER_CHARGES
if (dp->GetValue() == "Mulliken")
ofs << "MULLIKEN_CHARGES" << endl;
else // should pick from the Tripos types
ofs << "GASTEIGER" << endl;
}
else { // No idea what these charges are... all our code sets "PartialCharges"
ofs << "GASTEIGER" << endl;
}
ofs << "Energy = " << mol.GetEnergy() << endl;
if (mol.HasData(OBGenericDataType::CommentData))
{
OBCommentData *cd = (OBCommentData*)mol.GetData(OBGenericDataType::CommentData);
ofs << cd->GetData();
}
ofs << endl;
ofs << "@<TRIPOS>ATOM" << endl;
OBAtom *atom;
OBResidue *res;
vector<OBAtom*>::iterator i;
vector<int> labelcount;
labelcount.resize( etab.GetNumberOfElements() );
ttab.SetFromType("INT");
ttab.SetToType("SYB");
for (atom = mol.BeginAtom(i);atom;atom = mol.NextAtom(i))
{
//
// Use sequentially numbered atom names if no residues
//
snprintf(label,BUFF_SIZE, "%s%d",
etab.GetSymbol(atom->GetAtomicNum()),
++labelcount[atom->GetAtomicNum()]);
strcpy(rlabel,"<1>");
strcpy(rnum,"1");
str = atom->GetType();
ttab.Translate(str1,str);
//
// Use original atom names if there are residues
//
if (!ligandsOnly && (res = atom->GetResidue()) )
{
// use original atom names defined by residue
snprintf(label,BUFF_SIZE,"%s",(char*)res->GetAtomID(atom).c_str());
// make sure that residue name includes its number
snprintf(rlabel,BUFF_SIZE,"%s%d",res->GetName().c_str(), res->GetNum());
snprintf(rnum,BUFF_SIZE,"%d",res->GetNum());
}
snprintf(buffer,BUFF_SIZE,"%7d%1s%-6s%12.4f%10.4f%10.4f%1s%-5s%4s%1s %-8s%10.4f",
atom->GetIdx(),"",label,
atom->GetX(),atom->GetY(),atom->GetZ(),
"",str1.c_str(),
rnum,"",rlabel,
atom->GetPartialCharge());
ofs << buffer << endl;
}
ofs << "@<TRIPOS>BOND" << endl;
OBBond *bond;
vector<OBBond*>::iterator j;
OBSmartsPattern pat;
string s1, s2;
for (bond = mol.BeginBond(j);bond;bond = mol.NextBond(j))
{
s1 = bond->GetBeginAtom()->GetType();
s2 = bond->GetEndAtom()->GetType();
if (bond->IsAromatic() || s1 == "O.co2" || s2 == "O.co2")
strcpy(label,"ar");
else if (bond->IsAmide())
strcpy(label,"am");
else
snprintf(label,BUFF_SIZE,"%d",bond->GetBO());
snprintf(buffer, BUFF_SIZE,"%6d%6d%6d%3s%2s",
bond->GetIdx()+1,bond->GetBeginAtomIdx(),bond->GetEndAtomIdx(),
"",label);
ofs << buffer << endl;
}
// NO trailing blank line (PR#1868929).
// ofs << endl;
return(true);
}
示例3: WriteMolecule
bool HINFormat::WriteMolecule(OBBase* pOb, OBConversion* pConv)
{
OBMol* pmol = dynamic_cast<OBMol*>(pOb);
if(pmol==NULL)
return false;
//Define some references so we can use the old parameter names
ostream &ofs = *pConv->GetOutStream();
OBMol &mol = *pmol;
unsigned int i, file_num = 1;
string str,str1;
char buffer[BUFF_SIZE];
OBAtom *atom;
OBBond *bond;
vector<OBBond*>::iterator j;
char bond_char;
// make sure to escape titles in double quotes
// PR#1501694
ofs << "mol " << file_num << " \"" << mol.GetTitle() << "\"\n";
for(i = 1;i <= mol.NumAtoms(); i++)
{
atom = mol.GetAtom(i);
snprintf(buffer, BUFF_SIZE, "atom %d - %-3s ** - %8.5f %8.5f %8.5f %8.5f %d ",
i,
etab.GetSymbol(atom->GetAtomicNum()),
atom->GetPartialCharge(),
atom->GetX(),
atom->GetY(),
atom->GetZ(),
atom->GetValence());
ofs << buffer;
for (bond = atom->BeginBond(j); bond; bond = atom->NextBond(j))
{
switch(bond->GetBO())
{
case 1 :
bond_char = 's';
break;
case 2 :
bond_char = 'd';
break;
case 3 :
bond_char = 't';
break;
case 5 :
bond_char = 'a';
break;
default:
bond_char = 's';
break;
}
if (bond->IsAromatic())
bond_char = 'a';
snprintf(buffer,BUFF_SIZE, "%d %c ", (bond->GetNbrAtom(atom))->GetIdx(), bond_char);
ofs << buffer;
}
ofs << endl;
}
ofs << "endmol " << file_num << endl;
return(true);
}