本文整理汇总了C++中AtomIterator::addInteraction方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomIterator::addInteraction方法的具体用法?C++ AtomIterator::addInteraction怎么用?C++ AtomIterator::addInteraction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomIterator
的用法示例。
在下文中一共展示了AtomIterator::addInteraction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateScore
double Polarity::updateScore()
{
score_ = 0.0;
//float val = 0.0;
//float distance;
//float R1;
//float R2;
const HashGrid3<Atom*>* hashgrid = scoring_function_->getHashGrid();
int radius = 1;
Size no_neighbor_cells = (Size)pow((double)(radius*2+1), 3); // radius of 1 cell == > 3 cells on each axis
double total_sum = 0;
AtomPairVector::const_iterator it;
for (AtomIterator it = scoring_function_->getLigand()->beginAtom(); +it; it++)
{
int no_positive_contacts = 0;
int no_negative_contacts = 0;
bool ligandatom_is_lipophilic = isLipophilic_(&*it);
if (!ligandatom_is_lipophilic)
{
continue;
}
const HashGridBox3<Atom*>* box = hashgrid->getBox(it->getPosition());
// ligand atom lies outside of grid
if (!box) continue;
Position pos_x, pos_y, pos_z;
hashgrid->getIndices(*box, pos_x, pos_y, pos_z);
// indices in HashGrid, where the search for interacting target atoms should begin ( != position of ligand atom)
int i = ((int)pos_x)-radius; if (i < 0){i = 0; }
int j0 = ((int)pos_y)-radius; if (j0 < 0){j0 = 0; }
int k0 = ((int)pos_z)-radius; if (k0 < 0){k0 = 0; }
int x_size = (int)hashgrid->getSizeX();
int y_size = (int)hashgrid->getSizeY();
int z_size = (int)hashgrid->getSizeZ();
for (; i <= pos_x+radius && i < x_size; i++)
{
for (int j = j0; j <= pos_y+radius && j < y_size; j++)
{
for (int k = k0; k <= pos_z+radius && k < z_size; k++)
{
const HashGridBox3<Atom*>* box = hashgrid->getBox(i, j, k);
if (!box->isEmpty())
{
double cell_score = 0;
for (HashGridBox3 < Atom* > ::ConstDataIterator d_it = box->beginData(); d_it != box->endData(); d_it++)
{
if (isBackboneAtom_(*d_it)) continue;
bool rec_polar = isPolar_(*d_it);
bool rec_lipophilic = 0;
if (!rec_polar) rec_lipophilic = isLipophilic_(*d_it);
if (!rec_polar && ! rec_lipophilic) continue;
double distance = ((*d_it)->getPosition()-it->getPosition()).getLength();
if (distance > (*d_it)->getElement().getVanDerWaalsRadius()+it->getElement().getVanDerWaalsRadius()+1.5) continue;
double val;
if (distance > 1) val = 1/distance;
else val = 1;
// lipophilic--lipophilic interaction; else polar rec. -- lipophilic ligand atom
if (rec_lipophilic)
{
val *= -1;
}
cell_score += val;
total_sum += val;
if (scoring_function_->storeInteractionsEnabled())
{
val = scaleScore(val);
it->addInteraction(*d_it, "pol", val);
(*d_it)->addInteraction(&*it, "pol", val);
}
}
if (cell_score < -0.1) no_positive_contacts++;
else if (cell_score > 0.1) no_negative_contacts++;
}
// if there is no neighboring receptor atom, there will be water ...
// else if(i!=pos_x||j!=pos_y||k!=pos_z)
// {
// if(ligandatom_is_lipophilic)
// {
// no_negative_contacts++;
// double scaled_atom_score = 1.0/no_neighbor_cells;
// scaleScore(scaled_atom_score);
// total_sum += scaled_atom_score;
// it->addInteraction("pol",scaled_atom_score);
// }
// }
//.........这里部分代码省略.........