{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Compute the vibrational polarizability tensor\n", "\n", "MyBigDFT comes with some classes implementing particular workflows of calculations. These workflows define a queue of jobs, that can easily be run sequentially, without having to worry about the `Job` context manager. They also generally define a particular post-processing procedure, run after all the BigDFT calculations in order to extract some meaningful imformation.\n", "\n", "The example provided here shows how to obtain the vibrational polarizability tensor of the CO molecule by using the [VibPolTensor](https://mmoriniere.gitlab.io/MyBigDFT/vibpoltensor.html#mybigdft.workflows.vibpoltensor.VibPolTensor) class. \n", "\n", "The vibrational polarizability tensor represents \"the second largest contribution to the static second-order polarizability tensor\" [[1]](https://pubs.acs.org/doi/abs/10.1021/ct050061t). It is \"usually due to field-induced atomic relaxations\" [[1]](https://pubs.acs.org/doi/abs/10.1021/ct050061t). \"Vibrational polarization is due to a distortion of the vibrational motion of the molecule by the field and it exists for all molecules having infrared-active transitions.\" [[2]](https://aip.scitation.org/doi/abs/10.1063/1.555658)\n", "\n", "Once the infrared spectrum of a sytem is known, the mean vibrational polarizability $\\overline{\\alpha_{vib}}$ can be computed:\n", "\n", "$\\overline{\\alpha_{vib}} = 1.338378076~10^{3} \\sum_{n=1}^{N_vib} \\frac{I_{n}}{{E_n}^2}$ (in $\\unicode[serif]{xc5}^3$),\n", "\n", "where $I_n$ is the infrared intensity of a normal mode (in km.mol$^{-1}$) and $E_n$ is the corresponding energy (in cm$^{-1}$)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Initialization\n", "\n", "You first need to import some useful classes to define a ground state calculation as well as the `VibPolTensor` class:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from mybigdft import Job, Posinp, Atom, InputParams\n", "from mybigdft.workflows import Phonons, InfraredSpectrum, VibPolTensor" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A `VibPolTensor` instance is based on an `Infrared` instance, which in turns is based on a `Phonons` instance. Another important parameter is `e_cut` (in cm$^{-1}$), which corresponds to an energy cut-off: if phonons have a lower energy than `e_cut`, they are not considered in the computation of the vibrational polarizability tensor. " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "CO_ref = \"\"\"2 angstroem \n", "free \n", "C -8.61468162115724335E-22 -5.85961390944064004E-22 -4.99273481690253648E-03 \n", "O 6.11054044310156593E-22 5.85961390944064004E-22 1.12999273481690232E+00\"\"\"\n", "pos = Posinp.from_string(CO_ref)\n", "inp = InputParams({\"dft\": {\"ixc\": 11, \"gnrm_cv\": 1.e-5, \"hgrids\": [0.35]*3, \"rmult\": [8, 10]}})\n", "gs = Job(posinp=pos, inputparams=inp, name='CO', run_dir='CO/phonons/')\n", "phonons = Phonons(gs)\n", "# The line above actually amounts to:\n", "# phonons = Phonons(gs, translation_amplitudes=[0.45/64]*3, order=2)\n", "infrared = InfraredSpectrum(phonons)\n", "vib_pt = VibPolTensor(infrared)\n", "# The line above actually amounts to:\n", "# vib_pt = VibPolTensor(infrared, e_cut=200)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can then run the workflow without having to care about the context manager to run each calculation:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0000/x+\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0000/x-\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0000/y+\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0000/y-\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0000/z+\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0000/z-\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0001/x+\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0001/x-\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0001/y+\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0001/y-\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0001/z+\n", "Logfile log-CO.yaml already exists!\n", "\n", "/Users/maximemoriniere/Documents/Python/MyBigDFT/doc/source/notebooks/CO/phonons/atom0001/z-\n", "Logfile log-CO.yaml already exists!\n", "\n" ] } ], "source": [ "vib_pt.run()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can access the mean vibrational polarizability via the `mean_polarizability` attribute. The value is given in atomic units but can easily be converted to $\\unicode[serif]{xc5}^3$." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.019682596858960125" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from mybigdft.globals import B_TO_ANG\n", "vib_pt.mean_polarizability*B_TO_ANG**3" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This value is consistent with the experimental one reported in [[2]](https://aip.scitation.org/doi/abs/10.1063/1.555658), that is 0.0178 $\\unicode[serif]{xc5}^3$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**References:**\n", "\n", "[[1] David M. Bishop and Lap M. Cheung, *Journal of Physical and Chemical Reference Data* **11**, 119 (1982)\n", "](https://aip.scitation.org/doi/abs/10.1063/1.555658)\n", "\n", "[[2] Mark R. Pederson et al., *J. Chem. Theory Comput.* **1**, 4, (2005), pp 590–596](https://pubs.acs.org/doi/abs/10.1021/ct050061t)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.0" } }, "nbformat": 4, "nbformat_minor": 2 }