本文整理汇总了C++中Chain::countResidues方法的典型用法代码示例。如果您正苦于以下问题:C++ Chain::countResidues方法的具体用法?C++ Chain::countResidues怎么用?C++ Chain::countResidues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chain
的用法示例。
在下文中一共展示了Chain::countResidues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: optimizeCapPosition
void PeptideCapProcessor::optimizeCapPosition(Chain& chain, bool start)
{
Vector3 translation;
Atom* axis = NULL;
Residue* cap = NULL;
std::vector<Atom*> a;
std::vector<Atom*> b;
Size nr = chain.countResidues();
// cap at the beginning of a peptide
if (start)
{
// put ACE-C to the center
for (AtomIterator it = chain.getResidue(1)->beginAtom(); +it; ++it)
{
if (it->getName() == "N")
{
translation = it->getPosition();
}
b.push_back(&*it);
}
cap = chain.getResidue(0);
for (AtomIterator it = cap->beginAtom(); +it; ++it)
{
a.push_back(&*it);
if (it->getName() == "C")
{
axis = &*it;
}
}
}
//cap at the end of a peptide
else
{
for (AtomIterator it = chain.getResidue(nr-2)->beginAtom(); +it; ++it)
{
if (it->getName() == "C")
{
translation = it->getPosition();
}
b.push_back(&*it);
}
cap = chain.getResidue(nr-1);
for (AtomIterator it = cap->beginAtom(); +it; ++it)
{
a.push_back(&*it);
if (it->getName() == "N")
{
axis = &*it;
}
}
}
//translate the anchor to origin
TranslationProcessor tlp;
tlp.setTranslation(translation*-1.0);
chain.apply(tlp);
//try all torsions
float largest_distance = 0.0;
float tmp_distance = 0.0;
float torsion = 0.0;
float step = 2.0;
TransformationProcessor tfp;
Matrix4x4 m;
m.setRotation( Angle(step, false), axis->getPosition());
tfp.setTransformation(m);
for (Position r = step; r <= 360; r+=step)
{
cap->apply(tfp);
tmp_distance = computeDistance(a,b);
if (largest_distance < tmp_distance)
{
largest_distance = tmp_distance;
torsion = r;
}
}
//apply best rotation angle
m.setRotation( Angle(torsion, false), axis->getPosition());
tfp.setTransformation(m);
cap->apply(tfp);
//now translate the protein back
tlp.setTranslation(translation);
chain.apply(tlp);
}
示例2: operator
//.........这里部分代码省略.........
//insert ACE-Cap into chain
chain.insertBefore(*ace_residue,*chain.getResidue(0));
//Add Bond between ACE-Cap and Helix
n_atom = chain.getResidue(1)->beginAtom();
while (+n_atom)
{
if (n_atom->getName() == "N")
{
Bond* new_bond = cAtom->createBond(*n_atom);
new_bond->setOrder(Bond::ORDER__SINGLE);
break;
}
++n_atom;
}
//back translation
tlp.setTranslation(nAtom);
chain.apply(tlp);
//remove old hydrogens
for (Position a = 0; a < to_remove.size(); ++a)
{
delete to_remove[a];
}
//torsional optimzation of ACE
optimizeCapPosition(chain, true);
}
//##################################################################
add_cap = (chain.getResidue(chain.countResidues()-1)->getName() != "NME");
if (add_cap)
{
//create NME-Cap
nme_residue = new Residue("NME");
nme_residue->setProperty(Residue::PROPERTY__AMINO_ACID);
nme_residue->apply(reconstruct);
nme_residue->apply(fragment_db.normalize_names);
nme_residue->apply(fragment_db.build_bonds);
Residue* last_residue = chain.getResidue(chain.countResidues()-1);
//####################################################
Atom* nAtom = NULL;
Atom* ch3Atom = NULL;
Atom* hAtom = NULL;
AtomIterator nme_atom = nme_residue->beginAtom();
while (+nme_atom)
{
if (nme_atom->getName() == "N")
nAtom = &*nme_atom;
else if (nme_atom->getName() == "CH3")
ch3Atom = &*nme_atom;
else if (nme_atom->getName() == "H")
hAtom = &*nme_atom;
++nme_atom;
}
Vector3 anchor(( (hAtom->getPosition()-nAtom->getPosition()).normalize()
+ (ch3Atom->getPosition()-nAtom->getPosition()).normalize()).normalize()*-1.335);