# Background This page details what molecular geometry standardization is and its value, as well as the mathematics of MolOrient, and existing algorithms/software similar to MolOrient. ## Molecular Geometry Standardization Molecular geometry standardization is the act of enforcing a set of rules on a molecular geometry to ensure that every translated or rotated copy of a molecule is mapped to the same canonical position and orientation. In most settings, this is done by way of the principal axes of inertia. Reproducibility is a motivation for standardization. Certain methods, such as grid-based DFT, are not rotationally invariant, meaning that changing a molecule's orientation can affect its results{cite:p}`gill1993`. A molecule's orientation also affects how electronic structure packages treat symmetry: irreducible representation labels depend on the choice of axes, and because point groups are detected with finite tolerances, a nearly symmetric structure may be assigned different point groups. Thus, a well-defined and deterministic orientation is crucial. ## Mathematics MolOrient utilizes Standard Nuclear Orientation by Gill et al. Contrary to most orientation conventions, this utilizes nuclear positive charge instead of mass for translations and the inertia tensor. The inertia tensor, which is a 3x3 symmetric real matrix, is diagonalized with a from-scratch eigensolver. The eigenvalues are calculated by Viéte's Trigonometric Method for the cubic characteristic polynomial. The eigenvectors (principal axes) are calculated via cross products of the tensor's columns{cite:p}`kopp2008`. Every operation has a precision guard of at least 2 decimal places past the user's specified significant figures. ### Precision and symmetry tolerance `--precision` also sets how close two moments of inertia (or two coordinates) must be to count as equal. In SNO the tolerance is relative, about 10^-(p-2) (capped at 10^-(p/2+8)), so a nearly symmetric molecule can be treated as symmetric at low precision and as asymmetric at high precision, and be oriented differently. Input rounded to 7 decimals stops looking symmetric above about p = 6. For an asymmetric top, the sign of each axis is chosen once, on the unrounded geometry, with the same tolerance; the result is then rounded. NWChem orientation (`--nwchem`) follows NWChem and uses absolute thresholds that do not depend on `--precision`. Molecules whose moments differ by more than NWChem's 1e-4 bohr²·amu threshold, however nearly degenerate (large near-symmetric molecules, or small ones given coarsely rounded coordinates), are oriented as asymmetric tops, so their in-plane axes follow input noise exactly as in NWChem. ## Existing Software Electronic structure packages will have their own geometry standardization, such as NWChem{cite:p}`nwchem` and GAMESS{cite:p}`gamess`. These are necessary to exploit symmetry in calculations. Both of these packages use a mass-weighted inertia tensor as opposed to Gill et al.'s nuclear charge-weighted inertia tensor. The electronic structure package Q-Chem{cite:p}`qchem` uses Gill et al.'s Standard Nuclear Orientation for its orientation, however it does not use fixed-precision for its calculations, so it is susceptible to floating-point noise. In addition to precision, MolOrient is lightweight compared to these packages; it only has three dependencies rather than being embedded in a full electronic structure package. While NWChem and GAMESS utilize Gill et al.'s orientation convention, the infrastructure of MolOrient, such as the eigensolver, classes, and trig series functions are not dependent on one specific convention. For example, the implementation of NWChem's orientation convention is only one file, nwchem_orientation.py, and a small addition to cli.py was made to switch between MolOrient's convention and NWChem's. MolSym{cite:p}`molsym` is a similar package to MolOrient, with molecular symmetrization being one of its main functionalities. In this, the coordinate frame is constructed using symmetry, contrary to MolOrient, which uses principal axes to construct the frame, using symmetry only for spherical tops. A C1 molecule in MolSym will receive no rotation, but in MolOrient, the molecule will still receive an rotation based on its principal axes. MolSym uses double precision, while MolOrient uses Decimals. Orientation is secondary in MolSym; it is mainly used for point group detection and SALCs. Another similar package is RDKit{cite:p}`rdkit`, which has a function named CanonicalizeConformer. One main difference is that CanonicalizeConformer uses a covariance matrix as opposed to the inertia tensor. The weights are determined by heavy atoms, each with a unit weight and hydrogens excluded by default, while MolOrient uses nuclear positive charge and includes hydrogens. CanonicalizeConformer lacks a rigorous tie-breaking system for highly symmetric molecules and near-degenerate eigenvalues, meaning the input orientation influences the final orientation. Because MolOrient is a package focused entirely on Decimals, it was necessary to create from-scratch functions. A high-precision math package, such as mpmath{cite:p}`mpmath`, would not have sufficed. mpmath uses its own object, mpf, to represent floating-point numbers. A constant conversion of Decimal to mpf back to Decimal would have inevitably resulted in precision loss due to binary rounding. mpmath also performs its calculations in binary, while Decimal uses base-10 arithmetic. ## References ```{bibliography} ```