本文整理汇总了C++中Frame::CalculateInertia方法的典型用法代码示例。如果您正苦于以下问题:C++ Frame::CalculateInertia方法的具体用法?C++ Frame::CalculateInertia怎么用?C++ Frame::CalculateInertia使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frame
的用法示例。
在下文中一共展示了Frame::CalculateInertia方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Principal
void Action_Vector::Principal(Frame const& currentFrame) {
Matrix_3x3 Inertia;
Vec3 Eval;
// Origin is center of atoms in mask_
Vec3 OXYZ = currentFrame.CalculateInertia( mask_, Inertia );
// NOTE: Diagonalize_Sort_Chirality places sorted eigenvectors in rows.
Inertia.Diagonalize_Sort_Chirality( Eval, 0 );
// Eval.Print("PRINCIPAL EIGENVALUES");
// Inertia.Print("PRINCIPAL EIGENVECTORS (Rows)");
if ( mode_ == PRINCIPAL_X )
Vec_->AddVxyz( Inertia.Row1(), OXYZ ); // First row = first eigenvector
else if ( mode_ == PRINCIPAL_Y )
Vec_->AddVxyz( Inertia.Row2(), OXYZ ); // Second row = second eigenvector
else // PRINCIPAL_Z
Vec_->AddVxyz( Inertia.Row3(), OXYZ ); // Third row = third eigenvector
}
示例2: Thermo
//.........这里部分代码省略.........
// electronic energy.
// for monatomics print and return.
if (avgcrd_.size() <= 3){
outfile.Printf("\n internal energy: %10.3f joule/mol %10.3f kcal/mol\n",
etran, etran * tokcal);
outfile.Printf( " entropy: %10.3f joule/k-mol %10.3f cal/k-mol\n",
stran, stran * tocal);
outfile.Printf( " heat capacity cv: %10.3f joule/k-mol %10.3f cal/k-mol\n",
ctran, ctran * tocal);
return 0;
}
Frame AVG;
AVG.SetupFrameXM( avgcrd_, mass_ );
// Allocate workspace memory
// vtemp vibrational temperatures, in kelvin.
// evibn contribution to e from the vibration n.
// cvibn contribution to cv from the vibration n.
// svibn contribution to s from the vibration n.
double* WorkSpace = new double[ 4 * nmodes_ ];
double* vtemp = WorkSpace;
double* evibn = WorkSpace + nmodes_;
double* cvibn = WorkSpace + nmodes_*2;
double* svibn = WorkSpace + nmodes_*3;
// compute contributions due to rotation.
// Compute the principal moments of inertia, get the rotational
// symmetry number, see if the molecule is linear, and compute
// the rotational temperatures. Note the imbedded conversion
// of the moments to SI units.
Matrix_3x3 Inertia;
AVG.CalculateInertia( AtomMask(0, AVG.Natom()), Inertia );
// NOTE: Diagonalize_Sort sorts evals/evecs in descending order, but
// thermo() expects ascending.
// pmom principal moments of inertia, in amu-bohr**2 and in ascending order.
Vec3 pmom;
Inertia.Diagonalize_Sort( pmom );
rtemp = pmom[0];
pmom[0] = pmom[2];
pmom[2] = rtemp;
outfile.Printf("\n principal moments of inertia (nuclei only) in amu-A**2:\n");
outfile.Printf( " %12.2f%12.2f%12.2f\n", pmom[0], pmom[1], pmom[2]);
bool linear = false;
// Symmetry number: only for linear molecules. for others symmetry number is unity
double sn = 1.0;
if (AVG.Natom() <= 2) {
linear = true;
if (AVG.Mass(0) == AVG.Mass(1)) sn = 2.0;
}
outfile.Printf("\n rotational symmetry number %3.0f\n", sn);
double con = planck / (boltz*8.0*pipi);
con = (con / tokg) * (planck / (tomet*tomet));
if (linear) {
rtemp = con / pmom[2];
if (rtemp < 0.2) {
outfile.Printf("\n Warning-- assumption of classical behavior for rotation\n");
outfile.Printf( " may cause significant error\n");
}
outfile.Printf("\n rotational temperature (kelvin) %12.5f\n", rtemp);
} else {
rtemp1 = con / pmom[0];
rtemp2 = con / pmom[1];