本文整理汇总了C++中atom::is_neighbor方法的典型用法代码示例。如果您正苦于以下问题:C++ atom::is_neighbor方法的具体用法?C++ atom::is_neighbor怎么用?C++ atom::is_neighbor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atom
的用法示例。
在下文中一共展示了atom::is_neighbor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: a
receptor::receptor(istream& is, const box& b) : partitions(b.num_partitions)
{
// Initialize necessary variables for constructing a receptor.
atoms.reserve(5000); // A receptor typically consists of <= 5,000 atoms.
// Initialize helper variables for parsing.
string residue = "XXXX"; // Current residue sequence, used to track residue change, initialized to a dummy value.
vector<size_t> residues;
residues.reserve(1000); // A receptor typically consists of <= 1,000 residues, including metal ions and water molecules if any.
size_t num_lines = 0; // Used to track line number for reporting parsing errors, if any.
string line;
line.reserve(79); // According to PDBQT specification, the last item AutoDock atom type locates at 1-based [78, 79].
// Parse ATOM/HETATM.
while (getline(is, line))
{
++num_lines;
if (starts_with(line, "ATOM") || starts_with(line, "HETATM"))
{
// Parse and validate AutoDock4 atom type.
const string ad_type_string = line.substr(77, isspace(line[78]) ? 1 : 2);
const size_t ad = parse_ad_type_string(ad_type_string);
if (ad == AD_TYPE_SIZE) continue;
// Skip non-polar hydrogens.
if (ad == AD_TYPE_H) continue;
// Parse the Cartesian coordinate.
string name = line.substr(12, 4);
boost::algorithm::trim(name);
const atom a(line.substr(21, 1) + ':' + line.substr(17, 3) + right_cast<string>(line, 23, 26) + ':' + name, vec3(right_cast<fl>(line, 31, 38), right_cast<fl>(line, 39, 46), right_cast<fl>(line, 47, 54)), ad);
// For a polar hydrogen, the bonded hetero atom must be a hydrogen bond donor.
if (ad == AD_TYPE_HD)
{
const size_t residue_start = residues.back();
for (size_t i = atoms.size(); i > residue_start;)
{
atom& b = atoms[--i];
if (!b.is_hetero()) continue; // Only a hetero atom can be a hydrogen bond donor.
if (a.is_neighbor(b))
{
b.donorize();
break;
}
}
}
else // It is a heavy atom.
{
// Parse the residue sequence located at 1-based [23, 26].
if ((line[25] != residue[3]) || (line[24] != residue[2]) || (line[23] != residue[1]) || (line[22] != residue[0])) // This line is the start of a new residue.
{
residue[3] = line[25];
residue[2] = line[24];
residue[1] = line[23];
residue[0] = line[22];
residues.push_back(atoms.size());
}
atoms.push_back(a);
}
}
else if (starts_with(line, "TER"))
{
residue = "XXXX";
}
}
// Dehydrophobicize carbons if necessary.
const size_t num_residues = residues.size();
residues.push_back(atoms.size());
for (size_t r = 0; r < num_residues; ++r)
{
const size_t begin = residues[r];
const size_t end = residues[r + 1];
for (size_t i = begin; i < end; ++i)
{
const atom& a = atoms[i];
if (!a.is_hetero()) continue; // a is a hetero atom.
for (size_t j = begin; j < end; ++j)
{
atom& b = atoms[j];
if (b.is_hetero()) continue; // b is a carbon atom.
// If carbon atom b is bonded to hetero atom a, b is no longer a hydrophobic atom.
if (a.is_neighbor(b))
{
b.dehydrophobicize();
}
}
}
}
// Find all the heavy receptor atoms that are within 8A of the box.
vector<size_t> receptor_atoms_within_cutoff;
receptor_atoms_within_cutoff.reserve(atoms.size());
const size_t num_rec_atoms = atoms.size();
for (size_t i = 0; i < num_rec_atoms; ++i)
{
const atom& a = atoms[i];
//.........这里部分代码省略.........