本文整理汇总了C++中Topology::SetExtraAtomInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Topology::SetExtraAtomInfo方法的具体用法?C++ Topology::SetExtraAtomInfo怎么用?C++ Topology::SetExtraAtomInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topology
的用法示例。
在下文中一共展示了Topology::SetExtraAtomInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadParm
// Parm_CIF::ReadParm()
int Parm_CIF::ReadParm(FileName const& fname, Topology &TopIn) {
CIFfile infile;
CIFfile::DataBlock::data_it line;
if (infile.Read( fname, debug_ )) return 1;
CIFfile::DataBlock const& block = infile.GetDataBlock("_atom_site");
if (block.empty()) {
mprinterr("Error: CIF data block '_atom_site' not found.\n");
return 1;
}
// Does this CIF contain multiple models?
int Nmodels = 0;
int model_col = block.ColumnIndex("pdbx_PDB_model_num");
if (model_col != -1) {
line = block.end();
--line;
Nmodels = convertToInteger( (*line)[model_col] );
if (Nmodels > 1)
mprintf("Warning: CIF '%s' contains %i models. Using first model for topology.\n",
fname.full(), Nmodels);
}
// Get essential columns
int COL[NENTRY];
for (int i = 0; i < (int)NENTRY; i++) {
COL[i] = block.ColumnIndex(Entries[i]);
if (COL[i] == -1) {
mprinterr("Error: In CIF file '%s' could not find entry '%s' in block '%s'\n",
fname.full(), Entries[i], block.Header().c_str());
return 1;
}
if (debug_>0) mprintf("DEBUG: '%s' column = %i\n", Entries[i], COL[i]);
}
// Get optional columns
int occ_col = block.ColumnIndex("occupancy");
int bfac_col = block.ColumnIndex("B_iso_or_equiv");
int icode_col = block.ColumnIndex("pdbx_PDB_ins_code");
int altloc_col = block.ColumnIndex("label_alt_id");
std::vector<AtomExtra> extra;
// Loop over all atom sites
int current_res = 0;
double XYZ[3];
double occupancy = 1.0;
double bfactor = 0.0;
char altloc = ' ';
char icode;
icode = ' ';
Frame Coords;
for (line = block.begin(); line != block.end(); ++line) {
// If more than 1 model check if we are done.
if (Nmodels > 1) {
if ( convertToInteger( (*line)[model_col] ) > 1 )
break;
}
if (occ_col != -1) occupancy = convertToDouble( (*line)[ occ_col ] );
if (bfac_col != -1) bfactor = convertToDouble( (*line)[ bfac_col ] );
if (altloc_col != -1) altloc = (*line)[ altloc_col ][0];
// '.' altloc means blank?
if (altloc == '.') altloc = ' ';
extra.push_back( AtomExtra(occupancy, bfactor, altloc) );
if (icode_col != -1) {
icode = (*line)[ icode_col ][0];
// '?' icode means blank
if (icode == '?') icode = ' ';
}
XYZ[0] = convertToDouble( (*line)[ COL[X] ] );
XYZ[1] = convertToDouble( (*line)[ COL[Y] ] );
XYZ[2] = convertToDouble( (*line)[ COL[Z] ] );
NameType currentResName( (*line)[ COL[RNAME] ] );
// It seems that in some CIF files, there doesnt have to be a residue
// number. Check if residue name has changed.
if ( (*line)[ COL[RNUM] ][0] == '.' ) {
Topology::res_iterator lastResidue = TopIn.ResEnd();
--lastResidue;
if ( currentResName != (*lastResidue).Name() )
current_res = TopIn.Nres() + 1;
} else
current_res = convertToInteger( (*line)[ COL[RNUM] ] );
TopIn.AddTopAtom( Atom((*line)[ COL[ANAME] ], " "),
Residue(currentResName, current_res, icode,
(*line)[ COL[CHAINID] ][0]) );
Coords.AddXYZ( XYZ );
}
if (TopIn.SetExtraAtomInfo( 0, extra )) return 1;
// Search for bonds // FIXME nobondsearch?
BondSearch( TopIn, Coords, Offset_, debug_ );
// Get title.
CIFfile::DataBlock const& entryblock = infile.GetDataBlock("_entry");
std::string ciftitle;
if (!entryblock.empty())
ciftitle = entryblock.Data("id");
TopIn.SetParmName( ciftitle, infile.CIFname() );
// Get unit cell parameters if present.
CIFfile::DataBlock const& cellblock = infile.GetDataBlock("_cell");
if (!cellblock.empty()) {
double cif_box[6];
cif_box[0] = convertToDouble( cellblock.Data("length_a") );
cif_box[1] = convertToDouble( cellblock.Data("length_b") );
cif_box[2] = convertToDouble( cellblock.Data("length_c") );
//.........这里部分代码省略.........