opan.utils.inertia¶
Utilities for calculation of inertia tensor, principal axes/moments, and rotational constants.
These functions are housed separately from the opan.vpt2
VPT2 module
since they may have broader applicability to other envisioned capabilites of
Open Anharmonic.
Functions
-
opan.utils.inertia.
ctr_geom
(geom, masses)¶ Returns geometry shifted to center of mass.
Helper function to automate / encapsulate translation of a geometry to its center of mass.
Parameters: Returns: ctr_geom – length-3N
np.float_
– Atomic coordinates after shift to center of massRaises: ValueError
– If shapes of geom & masses are inconsistent
-
opan.utils.inertia.
ctr_mass
(geom, masses)¶ Calculate the center of mass of the indicated geometry.
Take a geometry and atom masses and compute the location of the center of mass.
Parameters: Returns: ctr – length-3
np.float_
– Vector location of center of massRaises: ValueError
– If geom & masses shapes are inconsistent
-
opan.utils.inertia.
inertia_tensor
(geom, masses)¶ Generate the 3x3 moment-of-inertia tensor.
Compute the 3x3 moment-of-inertia tensor for the provided geometry and atomic masses. Always recenters the geometry to the center of mass as the first step.
Reference for inertia tensor: [Kro92], Eq. (2.26)
Todo
Replace cite eventually with link to exposition in user guide.
Parameters: Returns: tensor – 3 x 3
np.float_
– Moment of inertia tensor for the systemRaises: ValueError
– If shapes of geom & masses are inconsistent
-
opan.utils.inertia.
principals
(geom, masses[, on_tol])¶ Principal axes and moments of inertia for the indicated geometry.
Calculated by
scipy.linalg.eigh()
, since the moment of inertia tensor is symmetric (real-Hermitian) by construction. More convenient to compute both the axes and moments at the same time since the eigenvectors must be processed to ensure repeatable results.The principal axes (inertia tensor eigenvectors) are processed in a fashion to ensure repeatable, identical generation, including orientation AND directionality.
Todo
Add ref to exposition in webdocs once written up.
Parameters: - geom – length-3N
np.float_
– Coordinates of the atoms - masses – length-N OR length-3N
np.float_
– Atomic masses of the atoms. Length-3N option is to allow calculation of a per-coordinate perturbed value. - on_tol –
np.float_
, optional – Tolerance for deviation from unity/zero for principal axis dot products within which axes are considered orthonormal. Default isopan.const.DEF.ORTHONORM_TOL
.
Returns: - moments – length-3
np.float_
– Principal inertial moments, sorted in increasing order \(\left(0 \leq I_A \leq I_B \leq I_C\right)\) - axes – 3 x 3
np.float_
– Principal axes, as column vectors, sorted with the principal moments and processed for repeatability. The axis corresponding tomoments[i]
is retrieved asaxes[:,i]
- top –
EnumTopType
– Detected molecular top type
- geom – length-3N
-
opan.utils.inertia.
rot_consts
(geom, masses[, units[, on_tol]])¶ Rotational constants for a given molecular system.
Calculates the rotational constants for the provided system with numerical value given in the units provided in units. The orthnormality tolerance on_tol is required in order to be passed through to the
principals()
function.If the system is linear or a single atom, the effectively-zero principal moments of inertia will be assigned values of
opan.const.PRM.ZERO_MOMENT_TOL
before transformation into the appropriate rotational constant units.The moments of inertia are always sorted in increasing order as \(0 \leq I_A \leq I_B \leq I_C\); the rotational constants calculated from these will thus always be in decreasing order as \(B_A \geq B_B \geq B_C\), retaining the ordering and association with the three principal
axes[:,i]
generated byprincipals()
.Parameters: - geom – length-3N
np.float_
– Coordinates of the atoms - masses – length-N OR length-3N
np.float_
– Atomic masses of the atoms. Length-3N option is to allow calculation of a per-coordinate perturbed value. - units –
EnumUnitsRotConst
, optional – Enum value indicating the desired units of the output rotational constants. Default isINV_INERTIA
\(\left(1\over \mathrm{uB^2}\right)\) - on_tol –
np.float_
, optional – Tolerance for deviation from unity/zero for principal axis dot products, within which axes are considered orthonormal. Default isopan.const.DEF.ORTHONORM_TOL
Returns: rc – length-3
np.float_
– Vector of rotational constants in the indicated units- geom – length-3N