{ "cells": [ { "cell_type": "markdown", "id": "d7d1dc39", "metadata": {}, "source": [ "# 1.2.2 Preparing Qbox Input Files from the XYZ file with Displaced Coordinates\n", "\n", "In the last step, we stored normal-mode displaced coordinates into a file named enmfd_phonon.xyz. Just like example 1.2, here we have to convert xyz file into single/multiple qbox input file(s) using xyz2qb tool. \n", "\n", "While computing the phonon frequencies, we would also compute the EPCEs and ZPR. Therefore we need to compute band energies of a few valence and conduction bands. For that purpose we need to include virtual orbitals by specifying a non-zero nempty values. We would also require to save wavefunctions of HOMOs and LUMOs for each displaced coordinates, which can be done using qbox plot command.\n", "\n", "For CO2, HOMO is 2-fold degenerate and their orbital/band indices are 7 and 8, while LUMO is singly degenerate with band index 9. " ] }, { "cell_type": "code", "execution_count": 1, "id": "4165800b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[95mFile \u001b[94menmfd_phonon.xyz\u001b[95m has \u001b[94m3\u001b[95m number of atoms in each frame and a total \u001b[94m19\u001b[95m number of frames.\u001b[00m\n", "\u001b[95mNo of species: \u001b[94m2\u001b[00m\n", "\u001b[95mPresent species are: \u001b[94m\n", "O_species\n", "C_species\u001b[00m\n", "\u001b[95mThe file \u001b[94menmfd_phonon.xyz\u001b[95m is an i-PI output with\u001b[92m pos_unit: \u001b[94mangstrom\u001b[95m and \u001b[92mcell_unit: \u001b[94mangstrom\u001b[00m\n", "Enter start frame number: (Default = 1) \n", "Enter last frame number: (Default = 19) \n", "Enter step frame: (Default = 1) \n", "Enter qbox command for 1st iteration: (Default = ' randomize_wf, run -atomic_density 0 100 10')\n", "Hint: more than one commands should be separated by a comma.\n", "\n", "Enter qbox run command: (Default = ' run 0 60 10')\n", "Hint: more than one commands should be separated by a comma.\n", "\n", "Enter qbox plot command: (Default = ' None')\n", "Hints:\n", " (1) Example: plot options filename (without .cube extension) \n", " (2) More than one commands should be separated by a comma.\n", "plot -wf 7 wf7, plot -wf 8 wf8, plot -wf 9 wf9\n", "Enter qbox spectrum command: (Default = ' None')\n", "Hints:\n", " (1) Example: spectrum options filename (without .dat extension) \n", " \n", "Do you want to save sample for each configurations (y/n)? (Default = n) \n", "Enter filename of qbox input: (Default = qbox.i) enmfd-1.i\n", "Enter xc: (Default = PBE)B3LYP\n", "Enter wf_dyn: (Default = JD) \n", "Enter ecut (Ry): (Default = 50.0) \n", "Enter scf_tol (Ry): (Default = 1e-08) 1e-12\n", "Enter nempty: (Default = 100) 5\n", "Enter nspin (1/2): (Default = 1) \n", "Enter delta_spin: (Default = None) \n", "Enter net_charge: (Default = 0) \n", "Enter pseudopotential: (Default = ONCV_PBE-1.0) \n", "\u001b[91mWarning!\n", "Files: \u001b[94m\n", "O_ONCV_PBE-1.0.xml\n", "C_ONCV_PBE-1.0.xml\u001b[91m\n", "must be present in the following pseudo-potential directory.\n", "\u001b[00m../pseudos/\n" ] } ], "source": [ "%run ../../../utils/qbox_utils/xyz2qb.py enmfd_phonon.xyz" ] }, { "cell_type": "markdown", "id": "5bbcb3e1", "metadata": {}, "source": [ "This created a qbox input file with name enmfd-1.i. Just like example 1.2, here also multiple input file can be (must for a large system) created. For that purpose the bash wrapper many_xyz2qb.sh located at util/qbox_util folder can be used instead of running xyz2qb.py multiple times. Let us have a look at the qbox input file enmfd-1.i. Before that let us restart the kernel to finish the file writing. " ] }, { "cell_type": "code", "execution_count": 1, "id": "15557cb1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " set xc B3LYP \n", " set wf_dyn JD \n", " set ecut 50.00\n", " set scf_tol 1.00e-12\n", " species O_species ../pseudos/O_ONCV_PBE-1.0.xml\n", " species C_species ../pseudos/C_ONCV_PBE-1.0.xml\n", "# Frame 1/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " atom O1 O_species 0.000000 0.000000 2.186665\n", " atom O2 O_species 0.000000 0.000000 -2.186662\n", " atom C3 C_species 0.000000 0.000000 -0.000003\n", " set nempty 5\n", " randomize_wf\n", " run -atomic_density 0 100 10\n", "plot -wf 7 wf7_frame-1.cube\n", " plot -wf 8 wf8_frame-1.cube\n", " plot -wf 9 wf9_frame-1.cube\n", "# Frame 2/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to -0.000000 -0.000000 2.475340\n", " move O2 to -0.000000 -0.000000 -1.897987\n", " move C3 to -0.000000 -0.000000 0.288672\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-2.cube\n", " plot -wf 8 wf8_frame-2.cube\n", " plot -wf 9 wf9_frame-2.cube\n", "# Frame 3/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to 0.000000 0.000000 1.897990\n", " move O2 to 0.000000 0.000000 -2.475337\n", " move C3 to 0.000000 0.000000 -0.288678\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-3.cube\n", " plot -wf 8 wf8_frame-3.cube\n", " plot -wf 9 wf9_frame-3.cube\n", "# Frame 4/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to 0.000000 0.448620 2.186665\n", " move O2 to -0.000001 -0.172131 -2.186662\n", " move C3 to -0.000000 0.138244 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-4.cube\n", " plot -wf 8 wf8_frame-4.cube\n", " plot -wf 9 wf9_frame-4.cube\n", "# Frame 5/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to -0.000000 -0.448620 2.186665\n", " move O2 to 0.000001 0.172131 -2.186662\n", " move C3 to 0.000000 -0.138244 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-5.cube\n", " plot -wf 8 wf8_frame-5.cube\n", " plot -wf 9 wf9_frame-5.cube\n", "# Frame 6/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to 0.352008 -0.000001 2.186665\n", " move O2 to -0.355089 0.000000 -2.186662\n", " move C3 to -0.001542 -0.000000 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-6.cube\n", " plot -wf 8 wf8_frame-6.cube\n", " plot -wf 9 wf9_frame-6.cube\n", "# Frame 7/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to -0.352008 0.000001 2.186665\n", " move O2 to 0.355089 -0.000000 -2.186662\n", " move C3 to 0.001542 0.000000 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-7.cube\n", " plot -wf 8 wf8_frame-7.cube\n", " plot -wf 9 wf9_frame-7.cube\n", "# Frame 8/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to -0.290402 -0.000001 2.186665\n", " move O2 to -0.286941 0.000001 -2.186662\n", " move C3 to -0.288672 -0.000000 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-8.cube\n", " plot -wf 8 wf8_frame-8.cube\n", " plot -wf 9 wf9_frame-8.cube\n", "# Frame 9/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to 0.290402 0.000001 2.186665\n", " move O2 to 0.286941 -0.000001 -2.186662\n", " move C3 to 0.288672 0.000000 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-9.cube\n", " plot -wf 8 wf8_frame-9.cube\n", " plot -wf 9 wf9_frame-9.cube\n", "# Frame 10/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to -0.000000 -0.100021 2.186665\n", " move O2 to 0.000000 -0.416340 -2.186662\n", " move C3 to -0.000000 -0.258181 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-10.cube\n", " plot -wf 8 wf8_frame-10.cube\n", " plot -wf 9 wf9_frame-10.cube\n", "# Frame 11/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to 0.000000 0.100021 2.186665\n", " move O2 to -0.000000 0.416340 -2.186662\n", " move C3 to 0.000000 0.258181 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-11.cube\n", " plot -wf 8 wf8_frame-11.cube\n", " plot -wf 9 wf9_frame-11.cube\n", "# Frame 12/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to 0.031448 0.010314 2.186665\n", " move O2 to 0.031448 0.010314 -2.186662\n", " move C3 to -0.083784 -0.027478 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-12.cube\n", " plot -wf 8 wf8_frame-12.cube\n", " plot -wf 9 wf9_frame-12.cube\n", "# Frame 13/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to -0.031448 -0.010314 2.186665\n", " move O2 to -0.031448 -0.010314 -2.186662\n", " move C3 to 0.083784 0.027478 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-13.cube\n", " plot -wf 8 wf8_frame-13.cube\n", " plot -wf 9 wf9_frame-13.cube\n", "# Frame 14/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to 0.010314 -0.031448 2.186665\n", " move O2 to 0.010314 -0.031448 -2.186662\n", " move C3 to -0.027478 0.083784 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-14.cube\n", " plot -wf 8 wf8_frame-14.cube\n", " plot -wf 9 wf9_frame-14.cube\n", "# Frame 15/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to -0.010314 0.031448 2.186665\n", " move O2 to -0.010314 0.031448 -2.186662\n", " move C3 to 0.027478 -0.083784 -0.000003\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-15.cube\n", " plot -wf 8 wf8_frame-15.cube\n", " plot -wf 9 wf9_frame-15.cube\n", "# Frame 16/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to 0.000000 0.000000 2.216857\n", " move O2 to 0.000000 0.000000 -2.216853\n", " move C3 to -0.000000 -0.000000 -0.000004\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-16.cube\n", " plot -wf 8 wf8_frame-16.cube\n", " plot -wf 9 wf9_frame-16.cube\n", "# Frame 17/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to -0.000000 -0.000000 2.156473\n", " move O2 to -0.000000 -0.000000 -2.156471\n", " move C3 to 0.000000 0.000000 -0.000002\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-17.cube\n", " plot -wf 8 wf8_frame-17.cube\n", " plot -wf 9 wf9_frame-17.cube\n", "# Frame 18/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to -0.000000 0.000000 2.195700\n", " move O2 to -0.000000 0.000000 -2.177627\n", " move C3 to 0.000000 -0.000000 -0.024074\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " run 0 60 10\n", "plot -wf 7 wf7_frame-18.cube\n", " plot -wf 8 wf8_frame-18.cube\n", " plot -wf 9 wf9_frame-18.cube\n", "# Frame 19/19 from enmfd_phonon.xyz#\n", " set cell 20.000000 0.000000 0.000000 0.000000 20.000000 0.000000 0.000000 0.000000 20.000000\n", " move O1 to 0.000000 -0.000000 2.177630\n", " move O2 to 0.000000 -0.000000 -2.195697\n", " move C3 to -0.000000 0.000000 0.024068\n", " run 0 60 10\n", "plot -wf 7 wf7_frame-19.cube\n", " plot -wf 8 wf8_frame-19.cube\n", " plot -wf 9 wf9_frame-19.cube\n" ] } ], "source": [ "%%bash\n", "cat enmfd-1.i" ] }, { "cell_type": "markdown", "id": "7e2bfce1", "metadata": {}, "source": [ "The next step is to submit those jobs and wait until all calculations finished properly. Once the calculations are finished, the obox outputs must be post-processed to compute the dynamical matrix. This will be the topic of exercise 1.2.3." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.8.10" } }, "nbformat": 4, "nbformat_minor": 5 }