本文整理汇总了C++中Topology::ParmCoordInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Topology::ParmCoordInfo方法的具体用法?C++ Topology::ParmCoordInfo怎么用?C++ Topology::ParmCoordInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topology
的用法示例。
在下文中一共展示了Topology::ParmCoordInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RandomizeAngles
// Exec_PermuteDihedrals::RandomizeAngles()
void Exec_PermuteDihedrals::RandomizeAngles(Frame& currentFrame, Topology const& topIn) {
Matrix_3x3 rotationMatrix;
# ifdef DEBUG_PERMUTEDIHEDRALS
// DEBUG
int debugframenum=0;
Trajout_Single DebugTraj;
DebugTraj.PrepareTrajWrite("debugtraj.nc",ArgList(),(Topology*)&topIn,
topIn.ParmCoordInfo(), topIn.Nframes(),
TrajectoryFile::AMBERNETCDF);
DebugTraj.WriteSingle(debugframenum++,currentFrame);
# endif
int next_resnum;
int bestLoop = 0;
int number_of_rotations = 0;
// Set max number of rotations to try.
int max_rotations = (int)BB_dihedrals_.size();
max_rotations *= max_factor_;
// Loop over all dihedrals
std::vector<PermuteDihedralsType>::const_iterator next_dih = BB_dihedrals_.begin();
next_dih++;
for (std::vector<PermuteDihedralsType>::const_iterator dih = BB_dihedrals_.begin();
dih != BB_dihedrals_.end();
++dih, ++next_dih)
{
++number_of_rotations;
// Get the residue atom of the next dihedral. Residues up to and
// including this residue will be checked for bad clashes
if (next_dih != BB_dihedrals_.end())
next_resnum = next_dih->resnum;
else
next_resnum = dih->resnum - 1;
// Set axis of rotation
Vec3 axisOfRotation = currentFrame.SetAxisOfRotation(dih->atom1, dih->atom2);
// Generate random value to rotate by in radians
// Guaranteed to rotate by at least 1 degree.
// NOTE: could potentially rotate 360 - prevent?
// FIXME: Just use 2PI and rn_gen, get everything in radians
double theta_in_degrees = ((int)(RN_.rn_gen()*100000) % 360) + 1;
double theta_in_radians = theta_in_degrees * Constants::DEGRAD;
// Calculate rotation matrix for random theta
rotationMatrix.CalcRotationMatrix(axisOfRotation, theta_in_radians);
int loop_count = 0;
double clash = 0;
double bestClash = 0;
if (debug_>0) mprintf("DEBUG: Rotating dihedral %zu res %8i:\n", dih - BB_dihedrals_.begin(),
dih->resnum+1);
bool rotate_dihedral = true;
while (rotate_dihedral) {
if (debug_>0) {
mprintf("\t%8i %12s %12s, +%.2lf degrees (%i).\n",dih->resnum+1,
topIn.AtomMaskName(dih->atom1).c_str(),
topIn.AtomMaskName(dih->atom2).c_str(),
theta_in_degrees,loop_count);
}
// Rotate around axis
currentFrame.Rotate(rotationMatrix, dih->Rmask);
# ifdef DEBUG_PERMUTEDIHEDRALS
// DEBUG
DebugTraj.WriteSingle(debugframenum++,currentFrame);
# endif
// If we dont care about sterics exit here
if (!check_for_clashes_) break;
// Check resulting structure for issues
int checkresidue;
if (!checkAllResidues_)
checkresidue = CheckResidue(currentFrame, topIn, *dih, next_resnum, clash);
else
checkresidue = CheckResidue(currentFrame, topIn, *dih, topIn.Nres(), clash);
if (checkresidue==0)
rotate_dihedral = false;
else if (checkresidue==-1) {
if (dih - BB_dihedrals_.begin() < 2) {
mprinterr("Error: Cannot backtrack; initial structure already has clashes.\n");
number_of_rotations = max_rotations + 1;
} else {
dih--; // 0
dih--; // -1
next_dih = dih;
next_dih++;
if (debug_>0)
mprintf("\tCannot resolve clash with further rotations, trying previous again.\n");
}
break;
}
if (clash > bestClash) {bestClash = clash; bestLoop = loop_count;}
//n_problems = CheckResidues( currentFrame, second_atom );
//if (n_problems > -1) {
// mprintf("%i\tCheckResidues: %i problems.\n",frameNum,n_problems);
// rotate_dihedral = false;
//} else if (loop_count==0) {
if (loop_count==0 && rotate_dihedral) {
if (debug_>0)
mprintf("\tTrying dihedral increments of +%i\n",increment_);
// Instead of a new random dihedral, try increments
theta_in_degrees = (double)increment_;
theta_in_radians = theta_in_degrees * Constants::DEGRAD;
// Calculate rotation matrix for new theta
rotationMatrix.CalcRotationMatrix(axisOfRotation, theta_in_radians);
//.........这里部分代码省略.........