.. _tutorial_ir: Infrared spectra ========================= This tutorial shows how to calculate infrared spectra with MLatom using a commonly used way: calculate frequencies and infrared (IR) intensities of static molecules. Please check out how to :ref:`calculate vibrational spectra from molecular dynamics trajectories `. Theory ------- In the harmonic approximation, the frequencies of a stationary point can be calculated by diagonalizing its Hessian matrix (second derivatives of energy with respect to coordinates). The corresponding IR intensities need dipole derivatives (first derivatives of dipole moment with respect to coordinates): :math:`I_{n} = \sum \limits _{t=1} ^{3} (\frac {\partial p_{t}} {\partial Q_{n}}) ^{2}` , where :math:`t` corresponds to each Cartesian dimension, :math:`p` is the dipole moment of the molecule, :math:`Q_{n}` is the :math:`n` th normal coordinate. Usually we get dipole derivatives with respect to each atomic coordinate, so the above equation can be rewritten as: :math:`I_{n} = \sum \limits _{t=1} ^{3} (\sum \limits _{x} \frac {\partial p_{t}} {\partial q_{x}} \frac {\partial q_{x}} {\partial Q_{n}}) ^{2}` , where :math:`q_{x}` is the component of atomic coordinates. Example -------- We present a simple example of calculating harmonic frequencies and IR intensities of ethanol, whose geometry is provided here :download:`ethanol_init.xyz `. We need to optimize its geometry first and then calculate its frequencies as frequency calculations are only reasonable for stationary points (e.g., local minima and transition states). .. warning:: Example below is just to show that you can use DFT methods for calculating IR spectra with the open-source MLatom. We recommend to use :ref:`UAIQM ` methods for the IR calculations which are available in the special versions of MLatom which also support calculations with the GFN2-xTB method. .. include:: a-mlatom-xacs_notice.rst Example with input file +++++++++++++++++++++++++ First we need to optimize the geometry of ethanol. Below is the input file for this task. You can refer to :ref:`geometry optimization tutorial ` for more details. .. code-block:: geomopt B3LYP/6-31G* xyzfile=ethanol_init.xyz optxyz=ethanol_opt.xyz After getting the geometry of the optimized ethanol (``ethanol_opt.xyz``) we can calculate its frequencies and IR intenities. For IR intenisties, the keyword ``ir`` is needed. You can refer to :ref:`frequencies tutorial ` for information of other keywords. .. code-block:: ir B3LYP/6-31G* xyzfile=ethanol_opt.xyz You should be able to find in the MLatom output the vibrational analysis and IR intensities. .. code-block:: ============================================================================== Vibration analysis for molecule 1 ============================================================================== Multiplicity: 1 This is a nonlinear molecule Mode Frequencies Reduced masses Force Constants IR intensities (cm^-1) (AMU) (mDyne/A) (km/mol) 1 248.4747 1.1524 0.0419 32.3833 2 301.0663 1.0696 0.0571 99.1615 3 417.5299 2.6381 0.2710 11.2144 4 830.0330 1.0800 0.4384 0.0152 5 912.5116 2.2005 1.0796 9.7442 6 1042.3161 2.1512 1.3770 56.5354 7 1125.4816 2.2612 1.6876 23.7752 8 1193.9827 1.4953 1.2559 4.7774 9 1290.5694 1.2508 1.2275 87.6053 10 1310.5341 1.1222 1.1356 0.0903 11 1427.9291 1.2321 1.4802 0.4122 12 1480.9785 1.4590 1.8854 16.5845 13 1513.8300 1.0411 1.4058 4.4003 14 1532.0798 1.0458 1.4464 3.0858 15 1561.1233 1.0910 1.5666 2.6189 16 2980.0716 1.0552 5.5213 73.9417 17 3003.5497 1.1085 5.8921 78.0445 18 3058.1727 1.0352 5.7041 15.7969 19 3129.0297 1.1026 6.3606 31.5280 20 3133.5337 1.1038 6.3856 34.2645 21 3746.8800 1.0665 8.8215 10.4090 On XACS platform, we provide our own implementation of calculating IR intensities. IR intensities are available when using PySCF for HF and DFT, which are based on the `pyscf.prop module `__. .. include:: tutorial_vibrview.inc Linear scaling of frequencies ------------------------------ It is a common practice to scale the frequencies linearly to make the calculated IR spectra match better with the experiments. We provide a keyword ``scaling`` to deal with it. When the user specifies its value, MLatom will output both unscaled and scaled frequencies. For AIQM1 and AIQM2 methods, the ``scaling`` is activated by default and their frequencies will be scaled by 0.957 and 0.962, respectively. Now we will show an example of calculating the IR spectrum of ethanol with AIQM2. First, we need to optimize its geometry, which is provided here: :download:`ethanol_init.xyz `. The input file should look like: .. code-block:: geomopt AIQM2 xyzfile=ethanol_init.xyz optprog=ase optxyz=ethanol_opt.xyz Then we can calculate the frequencies and IR intensities: .. code-block:: ir AIQM2 xyzfile=ethanol_opt.xyz As scaling factor is applied by default for AIQM2, the above input file is equivalent to: .. code-block:: ir AIQM2 xyzfile=ethanol_opt.xyz scaling=0.962 You will find the following things in your output file: .. code-block:: ============================================================================== Vibration analysis for molecule 1 ============================================================================== Multiplicity: 1 This is a nonlinear molecule Mode Frequencies Reduced masses Force Constants IR intensities (cm^-1) (AMU) (mDyne/A) (km/mol) 1 233.0042 1.1460 0.0367 24.3148 2 284.2353 1.0716 0.0510 136.0188 3 420.9724 2.6476 0.2765 12.7217 4 825.6527 1.0829 0.4350 2.5855 5 913.6812 2.2319 1.0978 6.3449 6 1055.6910 2.1786 1.4305 39.9877 7 1115.0663 2.2802 1.6704 37.0315 8 1187.5787 1.5239 1.2663 13.1134 9 1280.7458 1.2320 1.1907 103.6870 10 1313.8324 1.1081 1.1270 0.9832 11 1409.4878 1.2342 1.4447 2.0347 12 1453.2597 1.4434 1.7961 18.2637 13 1493.2140 1.0392 1.3652 1.7485 14 1512.6421 1.0510 1.4169 4.6961 15 1531.5126 1.0895 1.5056 1.8487 16 3009.1176 1.0544 5.6250 69.1294 17 3044.8103 1.0348 5.6522 14.5552 18 3047.3488 1.1081 6.0628 74.9335 19 3121.0591 1.1002 6.3146 38.3573 20 3130.4621 1.1021 6.3636 33.9217 21 3847.8329 1.0663 9.3014 6.0155 Scale frequencies linearly Scaling factor: 0.962 Mode Frequencies Reduced masses Force Constants IR intensities (cm^-1) (AMU) (mDyne/A) (km/mol) 1 224.1500 1.1460 0.0367 24.3148 2 273.4344 1.0716 0.0510 136.0188 3 404.9755 2.6476 0.2765 12.7217 4 794.2779 1.0829 0.4350 2.5855 5 878.9613 2.2319 1.0978 6.3449 6 1015.5748 2.1786 1.4305 39.9877 7 1072.6938 2.2802 1.6704 37.0315 8 1142.4507 1.5239 1.2663 13.1134 9 1232.0775 1.2320 1.1907 103.6870 10 1263.9068 1.1081 1.1270 0.9832 11 1355.9273 1.2342 1.4447 2.0347 12 1398.0358 1.4434 1.7961 18.2637 13 1436.4719 1.0392 1.3652 1.7485 14 1455.1617 1.0510 1.4169 4.6961 15 1473.3151 1.0895 1.5056 1.8487 16 2894.7711 1.0544 5.6250 69.1294 17 2929.1075 1.0348 5.6522 14.5552 18 2931.5496 1.1081 6.0628 74.9335 19 3002.4588 1.1002 6.3146 38.3573 20 3011.5045 1.1021 6.3636 33.9217 21 3701.6153 1.0663 9.3014 6.0155 You will see two blocks of vibration analysis. Unscaled frequencies come first, then the scaled frequencies. On `the XACS cloud computing `__, MLatom will also dump the ``scaled_freq_gaussian{mol_index}.log`` file that saves the scaled frequencies in Gaussian-style output format. Any questions or suggestions? ----------------------------- If you have further questions, criticism, and suggestions, we would be happy to receive them in English or Chinese via `email `_, `Slack `_ (preferred), or WeChat (please send an email to request to add you to the XACS user support group).