{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Generating the displaced structures from a Gaussian frequencies calculation\n", "\n", "Requirements:\n", "\n", " - A vibrational frequencies calculation on a well optimized structure\n", "\n", "The vibrational frequencies should have the highest precision possible as the displacements made are small to remain in the harmonic approximztion. In gaussian this can be done from the normal output with the `Freq=(HPModes)` or with the formatted checkpoint file. The frequencies must be saved to the checkpoint file which is not a default with `Freq=(SaveNormalModes)`." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from vibrav.util.io import uncompress_file\n", "from vibrav.base import resource\n", "import os" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This next step is only to decompress the resource output file. In most user cases this can be skipped as the output files are not compressed binaries." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "decomp = uncompress_file(resource('g16-nitromalonamide-freq.out.xz'))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Use the quantum code parser of choice and get the atom, frequency and extended frequency data frames. In this case we are using the gaussian parser from the *Exatomic* package." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from exa import logging\n", "logging.disable()\n", "from exatomic import gaussian" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Parsing frequency normal modes from HPModes output\n", "Parsing frequency normal modes from HPModes output\n" ] } ], "source": [ "ed = gaussian.Output(decomp)\n", "ed.parse_atom()\n", "ed.parse_frequency()\n", "ed.parse_frequency_ext()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Remove the uncompressed file for some clean up." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "os.remove(decomp)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Generating the displaced structures" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "from vibrav.util.gen_displaced import Displace" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "inputs = Displace(cls=ed)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `disp` class attribute holds the coordinates of all the displaced coordinates that are generated. The frequency indeces are as follows:\n", " - 0 is reserved for the equilibrium structure\n", " - From 1 up to and including the number of normal modes (39 in this example) are the ones displaced in the positive direction.\n", " - From the number of normal modes plus 1 (40 in this example) up to and including twice the number of normal modes (78 in this example) are the negative displacements.\n", " \n", "It should be mentioned that the positive and negative displacements are completely arbitrary. Meaning, that we only multiply the normal modes by +1 or -1 for the positive and negative displacements, respectively." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | x | \n", "y | \n", "z | \n", "freqdx | \n", "Z | \n", "symbol | \n", "frequency | \n", "frame | \n", "
---|---|---|---|---|---|---|---|---|
atom | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
0 | \n", "0.213964 | \n", "-4.244614 | \n", "0.0 | \n", "0 | \n", "1 | \n", "H | \n", "0.0000 | \n", "0 | \n", "
1 | \n", "-5.885437 | \n", "-2.178947 | \n", "0.0 | \n", "0 | \n", "1 | \n", "H | \n", "0.0000 | \n", "0 | \n", "
2 | \n", "-4.921215 | \n", "1.041846 | \n", "0.0 | \n", "0 | \n", "1 | \n", "H | \n", "0.0000 | \n", "0 | \n", "
3 | \n", "6.295407 | \n", "-0.573277 | \n", "0.0 | \n", "0 | \n", "1 | \n", "H | \n", "0.0000 | \n", "0 | \n", "
4 | \n", "4.506458 | \n", "2.260056 | \n", "0.0 | \n", "0 | \n", "1 | \n", "H | \n", "0.0000 | \n", "0 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
1180 | \n", "-1.771898 | \n", "-4.006233 | \n", "0.0 | \n", "78 | \n", "8 | \n", "O | \n", "3696.3886 | \n", "78 | \n", "
1181 | \n", "-0.358161 | \n", "2.748341 | \n", "0.0 | \n", "78 | \n", "7 | \n", "N | \n", "3696.3886 | \n", "78 | \n", "
1182 | \n", "1.505387 | \n", "4.175983 | \n", "0.0 | \n", "78 | \n", "8 | \n", "O | \n", "3696.3886 | \n", "78 | \n", "
1183 | \n", "-2.542736 | \n", "3.630069 | \n", "0.0 | \n", "78 | \n", "8 | \n", "O | \n", "3696.3886 | \n", "78 | \n", "
1184 | \n", "-4.537880 | \n", "-0.833527 | \n", "0.0 | \n", "78 | \n", "7 | \n", "N | \n", "3696.3886 | \n", "78 | \n", "
1185 rows × 8 columns
\n", "