本文整理汇总了C++中Topology::Setup_NoResInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Topology::Setup_NoResInfo方法的具体用法?C++ Topology::Setup_NoResInfo怎么用?C++ Topology::Setup_NoResInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topology
的用法示例。
在下文中一共展示了Topology::Setup_NoResInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadParm
/** Read file as a Tinker file. */
int Parm_Tinker::ReadParm(FileName const& fname, Topology &parmOut) {
TinkerFile infile;
infile.SetTinkerName( fname );
if (infile.OpenTinker()) return 1;
mprintf("\tReading Tinker file %s as topology file.\n",infile.Filename().base());
// Allocate memory for coordinates.
double* Coords = new double[ infile.TinkerNatom() * 3 ];
std::vector<int> Bonds;
std::vector<Atom> Atoms = infile.ReadTinkerAtoms(Coords, Bonds);
if (Atoms.empty()) return 1;
// Use up to first 3 chars of title as residue name.
std::string resname;
for (std::string::const_iterator c = infile.TinkerTitle().begin();
c != infile.TinkerTitle().end(); ++c)
resname += *c;
if (resname.size() > 3) resname.resize(3);
Residue tinker_res( resname, 0, ' ', ' ' );
// Put atoms into topology
const double* XYZ = Coords;
for (std::vector<Atom>::const_iterator atom = Atoms.begin();
atom != Atoms.end();
++atom, XYZ += 3)
parmOut.AddTopAtom( *atom, tinker_res, XYZ );
delete[] Coords;
// Add bond information
for (std::vector<int>::const_iterator bond = Bonds.begin();
bond != Bonds.end(); bond += 2)
parmOut.AddBond( *bond, *(bond+1) );
// Try to set up residue info based on bonds.
if (parmOut.Setup_NoResInfo()) return 1;
// Set topology box info.
parmOut.SetParmBox( infile.TinkerBox() );
parmOut.SetParmName( infile.TinkerTitle(), infile.Filename() );
mprintf("\tTinker file contains %i atoms, %i residues,\n", parmOut.Natom(),parmOut.Nres());
//mprintf(" %i bonds to H, %i other bonds.\n", parmOut.NbondsWithH,parmOut.NbondsWithoutH);
infile.CloseFile();
return 0;
}