{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# ADF parser API\n", "## Imports to get the resource files" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from vibrav.base import resource\n", "from vibrav.util.open_files import uncompress_file\n", "import os" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Uncompress the resource file to read." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "decomp = uncompress_file(resource('adf-ethane-ts-freq.t21.ascii.xz'))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Read the ASCII formatted ADF TAPE21 file" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from vibrav.adf import Tape21" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Read the atom and frequency tables." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "ed = Tape21(decomp)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Parse the frequency data frame\n", "\n", "The `r_mass` column is calculated on the fly when parsing the mass-weighted normal modes with the formula,\n", "$$ \\mu_i = \\left(\\sum_k^{3N}l_{CARTk,i}^2\\right)^{-1} = \\left(\\sum_k^{3N}\\left(\\frac{l_{MWC k,i}}{\\sqrt{m_k}}\\right)^2\\right)^{-1} = N_i^2$$\n", "\n", "The reason that we must use the ASCII formatted TAPE21 file from ADF rather than the output is that ADF prints the non-mass-weighted normalized cartesians with three decimals of precision. Looking at the equation shown above the $l_{CARTk,i}$ matrix elements are indeed non-mass-weighted cartesian normal modes. However, they are not normalized and the information of the reduced masses can still be extracted.\n", "\n", "To calculate the reduced masses the program will need the latest developers version of both the [exa](https://github.com/exa-analytics/exa) and [exatomic](https://github.com/exa-analytics/exatomic) packages." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | dx | \n", "dy | \n", "dz | \n", "frequency | \n", "freqdx | \n", "r_mass | \n", "symbol | \n", "label | \n", "ir_int | \n", "frame | \n", "
---|---|---|---|---|---|---|---|---|---|---|
frequency | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
0 | \n", "2.413489e-16 | \n", "-1.291217e-15 | \n", "-0.003898 | \n", "-239.036547 | \n", "0 | \n", "1.008159 | \n", "C | \n", "0 | \n", "0 | \n", "0 | \n", "
1 | \n", "-6.154398e-16 | \n", "2.740316e-16 | \n", "0.003898 | \n", "-239.036547 | \n", "0 | \n", "1.008159 | \n", "C | \n", "1 | \n", "0 | \n", "0 | \n", "
2 | \n", "-6.876806e-02 | \n", "4.021443e-01 | \n", "-0.014579 | \n", "-239.036547 | \n", "0 | \n", "1.008159 | \n", "H | \n", "2 | \n", "0 | \n", "0 | \n", "
3 | \n", "3.826512e-01 | \n", "-1.415172e-01 | \n", "-0.014579 | \n", "-239.036547 | \n", "0 | \n", "1.008159 | \n", "H | \n", "3 | \n", "0 | \n", "0 | \n", "
4 | \n", "-3.138831e-01 | \n", "-2.606270e-01 | \n", "-0.014579 | \n", "-239.036547 | \n", "0 | \n", "1.008159 | \n", "H | \n", "4 | \n", "0 | \n", "0 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
139 | \n", "-2.142217e-02 | \n", "1.661105e-04 | \n", "0.002568 | \n", "3044.853587 | \n", "17 | \n", "1.100672 | \n", "H | \n", "3 | \n", "0 | \n", "0 | \n", "
140 | \n", "2.947483e-01 | \n", "-3.633216e-01 | \n", "-0.180326 | \n", "3044.853587 | \n", "17 | \n", "1.100672 | \n", "H | \n", "4 | \n", "0 | \n", "0 | \n", "
141 | \n", "8.272322e-02 | \n", "-2.807390e-01 | \n", "0.112829 | \n", "3044.853587 | \n", "17 | \n", "1.100672 | \n", "H | \n", "5 | \n", "0 | \n", "0 | \n", "
142 | \n", "1.433751e-01 | \n", "1.971820e-01 | \n", "0.093630 | \n", "3044.853587 | \n", "17 | \n", "1.100672 | \n", "H | \n", "6 | \n", "0 | \n", "0 | \n", "
143 | \n", "5.269408e-01 | \n", "-9.430460e-02 | \n", "-0.206459 | \n", "3044.853587 | \n", "17 | \n", "1.100672 | \n", "H | \n", "7 | \n", "0 | \n", "0 | \n", "
144 rows × 10 columns
\n", "\n", " | symbol | \n", "set | \n", "label | \n", "x | \n", "y | \n", "z | \n", "Z | \n", "frame | \n", "
---|---|---|---|---|---|---|---|---|
atom | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
0 | \n", "C | \n", "0 | \n", "0 | \n", "0.000000 | \n", "0.000000 | \n", "1.450715 | \n", "6.0 | \n", "0 | \n", "
1 | \n", "C | \n", "1 | \n", "1 | \n", "0.000000 | \n", "0.000000 | \n", "-1.450715 | \n", "6.0 | \n", "0 | \n", "
2 | \n", "H | \n", "2 | \n", "2 | \n", "1.905940 | \n", "0.346368 | \n", "2.224450 | \n", "1.0 | \n", "0 | \n", "
3 | \n", "H | \n", "3 | \n", "3 | \n", "-0.653007 | \n", "-1.823777 | \n", "2.224450 | \n", "1.0 | \n", "0 | \n", "
4 | \n", "H | \n", "4 | \n", "4 | \n", "-1.252933 | \n", "1.477409 | \n", "2.224450 | \n", "1.0 | \n", "0 | \n", "
5 | \n", "H | \n", "5 | \n", "5 | \n", "-0.653007 | \n", "1.823777 | \n", "-2.224450 | \n", "1.0 | \n", "0 | \n", "
6 | \n", "H | \n", "6 | \n", "6 | \n", "-1.252933 | \n", "-1.477409 | \n", "-2.224450 | \n", "1.0 | \n", "0 | \n", "
7 | \n", "H | \n", "7 | \n", "7 | \n", "1.905940 | \n", "-0.346368 | \n", "-2.224450 | \n", "1.0 | \n", "0 | \n", "