本文整理汇总了C++中OBAtom::ForceNoH方法的典型用法代码示例。如果您正苦于以下问题:C++ OBAtom::ForceNoH方法的具体用法?C++ OBAtom::ForceNoH怎么用?C++ OBAtom::ForceNoH使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OBAtom
的用法示例。
在下文中一共展示了OBAtom::ForceNoH方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadMolecule
bool ThermoFormat::ReadMolecule(OBBase* pOb, OBConversion* pConv)
{
OBMol* pmol = pOb->CastAndClear<OBMol>();
if(!pmol)
return false;
bool stopOnEnd = pConv->IsOption("e",OBConversion::INOPTIONS)!=NULL;
pmol->SetDimension(0);
OBNasaThermoData* pND = new OBNasaThermoData; //to store rate constant data
pND->SetOrigin(fileformatInput);
pmol->SetData(pND);
istream &ifs = *pConv->GetInStream();
double DefaultMidT = 1500;
char ln[BUFF_SIZE];
unsigned int i;
//find line with 1 in col 80
do
{
if(!ifs.getline(ln,BUFF_SIZE) || stopOnEnd && !strncasecmp(ln,"END",3))
return false;
}while(ln[79]!='1');
char phase, nam[25], dum[7], elname[3];
elname[2]=0;
int elnum;
double Coeff[14];
sscanf(ln,"%18s%6s",nam,dum);
pmol->SetTitle(nam);
char* p=ln+24;
if(ln[80]=='&')
{
//Reaction Design extension
p+=20;
string line;
if(!getline(ifs,line))return false;
vector<string> toks;
tokenize(toks,line," \t\n\r");
for(i=0;i<toks.size();i+=2)
{
OBAtom atom;
atom.SetAtomicNum(etab.GetAtomicNum(toks[i].c_str()));
elnum = atoi(toks[i+1].c_str());
atom.ForceNoH();
for(;elnum>0;--elnum)
pmol->AddAtom(atom);
}
}
else
{
for(i=0;i<4;i++,p+=5)
{
char snum[4]={0,0,0,0};//Was problem with F 10 0 reading as ten
sscanf(p,"%c%c%c%c%c",elname,elname+1,snum,snum+1,snum+2);
elnum=atoi(snum);
if(elname[0]!=' ' && elname[0]!='0')
{
if(elname[1]==' ')
elname[1]=0;
OBAtom atom;
atom.SetAtomicNum(etab.GetAtomicNum(elname));
atom.ForceNoH();
for(;elnum>0;--elnum)
pmol->AddAtom(atom);
}
}
}
double LoT, HiT, MidT=0;
/* int nc = */sscanf(p,"%c%10lf%10lf10%lf",&phase, &LoT, &HiT, &MidT);
pND->SetPhase(phase);
pND->SetLoT(LoT);
pND->SetHiT(HiT);
if(MidT>HiT || MidT<LoT)
MidT=DefaultMidT;
pND->SetMidT(MidT);
if (!ifs.getline(ln, BUFF_SIZE)) return false;
p=ln;
for(i=0;i<5;i++,p+=15)
sscanf(p,"%15lf",&Coeff[i]);
if (!ifs.getline(ln, BUFF_SIZE)) return false;
p=ln;
for(i=5;i<10;i++,p+=15)
sscanf(p,"%15lf",&Coeff[i]);
if (!ifs.getline(ln, BUFF_SIZE)) return false;
p=ln;
for(i=10;i<14;i++,p+=15)
sscanf(p,"%15lf",&Coeff[i]);
for(i=0;i<14;++i)
pND->SetCoeff(i, Coeff[i]);
pmol->AssignSpinMultiplicity();
return true;
}