.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_ddb_convergence_alas.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_plot_ddb_convergence_alas.py: Phonon convergence of ε∞, BECS, phonons and quadrupoles ======================================================= This example shows how to use the DdbRobot to analyze the convergence of eps_inf, BECS, phonons and dynamical quadrupole with respect to the number of k-points. .. GENERATED FROM PYTHON SOURCE LINES 10-14 .. code-block:: Python import os import abipy.data as abidata .. GENERATED FROM PYTHON SOURCE LINES 15-18 Initialize the DdbRobot from a list of paths to DDB files Here we use DDB files shipped with the AbiPy package in data/refs/alas_eps_and_becs_vs_ngkpt Each DDB has been computed with a different k-mesh. .. GENERATED FROM PYTHON SOURCE LINES 18-25 .. code-block:: Python paths = ["AlAs_222k_DDB", "AlAs_444k_DDB","AlAs_666k_DDB", "AlAs_888k_DDB"] paths = [os.path.join(abidata.dirpath, "refs", "alas_eps_and_becs_vs_ngkpt", f) for f in paths] from abipy.dfpt.ddb import DdbRobot ddb_robot = DdbRobot.from_files(paths) .. GENERATED FROM PYTHON SOURCE LINES 26-29 Call anaddb to get ε∞ for all the DDB files. Results and metadata are stored in the epsinf_data.df dataframe. .. GENERATED FROM PYTHON SOURCE LINES 29-36 .. code-block:: Python epsinf_data = ddb_robot.anacompare_epsinf() print("ε∞ dataframe:\n", epsinf_data.df) epsinf_data.plot_conv("nkpt", abs_conv=0.1) .. image-sg:: /gallery/images/sphx_glr_plot_ddb_convergence_alas_001.png :alt: Convergence of $\epsilon^\infty$ with $\Delta$=0.1 :srcset: /gallery/images/sphx_glr_plot_ddb_convergence_alas_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none ε∞ dataframe: xx yy zz yz xz xy formula chneut nkpt 0 12.996449 12.996449 12.996449 0.0 0.0 0.0 Al1 As1 1 16 1 9.268431 9.268431 9.268431 0.0 0.0 0.0 Al1 As1 1 128 2 8.881665 8.881665 8.881665 0.0 0.0 0.0 Al1 As1 1 432 3 8.818122 8.818122 8.818122 0.0 0.0 0.0 Al1 As1 1 1024 .. GENERATED FROM PYTHON SOURCE LINES 37-39 Call anaddb to get BECs for all the DDB files. Results and metadata are stored in the becs_data.df dataframe. .. GENERATED FROM PYTHON SOURCE LINES 39-45 .. code-block:: Python becs_data = ddb_robot.anacompare_becs() print("BECS dataframe:\n", becs_data.df) becs_data.plot_conv("nkpt", abs_conv=0.1) .. image-sg:: /gallery/images/sphx_glr_plot_ddb_convergence_alas_002.png :alt: Convergence of BECs with $\Delta$=0.1 :srcset: /gallery/images/sphx_glr_plot_ddb_convergence_alas_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none BECS dataframe: element site_index frac_coords wyckoff ... zy formula chneut nkpt 0 Al 0 [0.0, 0.0, 0.0] 1a ... 0.0 Al1 As1 1 16 2 Al 0 [0.0, 0.0, 0.0] 1a ... 0.0 Al1 As1 1 128 6 Al 0 [0.0, 0.0, 0.0] 1a ... 0.0 Al1 As1 1 1024 4 Al 0 [0.0, 0.0, 0.0] 1a ... 0.0 Al1 As1 1 432 3 As 1 [0.25, 0.25, 0.25] 1d ... 0.0 Al1 As1 1 128 1 As 1 [0.25, 0.25, 0.25] 1d ... 0.0 Al1 As1 1 16 5 As 1 [0.25, 0.25, 0.25] 1d ... 0.0 Al1 As1 1 432 7 As 1 [0.25, 0.25, 0.25] 1d ... 0.0 Al1 As1 1 1024 [8 rows x 16 columns] .. GENERATED FROM PYTHON SOURCE LINES 46-48 Call anaddb to get phonons at a single q-point for all the DDB files. Results and metadata are stored in the ph_data.ph_df dataframe. .. GENERATED FROM PYTHON SOURCE LINES 48-54 .. code-block:: Python ph_data = ddb_robot.get_phdata_at_qpoint(qpoint=(0, 0, 0)) print(ph_data.ph_df) ph_data.plot_ph_conv("nkpt", abs_conv=0.1) # meV units. .. image-sg:: /gallery/images/sphx_glr_plot_ddb_convergence_alas_003.png :alt: Convergence of ph frequencies at q=(0, 0, 0) with $\Delta$=0.1 (meV) :srcset: /gallery/images/sphx_glr_plot_ddb_convergence_alas_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Calculation completed. Anaddb results available in: /tmp/tmptgzv9wkw Calculation completed. Anaddb results available in: /tmp/tmpfzai8cuv Calculation completed. Anaddb results available in: /tmp/tmped_gsnom Calculation completed. Anaddb results available in: /tmp/tmpt5rgqo1e mode0 ... spglib_lattice_type ../../data/refs/alas_eps_and_becs_vs_ngkpt/AlAs... 0.0 ... cubic ../../data/refs/alas_eps_and_becs_vs_ngkpt/AlAs... 0.0 ... cubic ../../data/refs/alas_eps_and_becs_vs_ngkpt/AlAs... 0.0 ... cubic ../../data/refs/alas_eps_and_becs_vs_ngkpt/AlAs... 0.0 ... cubic [4 rows x 27 columns] .. GENERATED FROM PYTHON SOURCE LINES 55-58 If the DDB contains dynamical quadrupoles, a similar dataframe with Q^* is automatically built and made available in ph_data.dyn_quad_df. A negative value of abs_conv is interpreted as relative convergence. .. GENERATED FROM PYTHON SOURCE LINES 58-61 .. code-block:: Python print(ph_data.dyn_quad_df) ph_data.plot_dyn_quad_conv("nkpt", abs_conv=-0.02) .. image-sg:: /gallery/images/sphx_glr_plot_ddb_convergence_alas_004.png :alt: Convergence of dynamical quadrupoles with $\Delta$=-0.02 :srcset: /gallery/images/sphx_glr_plot_ddb_convergence_alas_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none element site_index frac_coords wyckoff ... occopt ixc nband usepaw 0 Al 0 [0.0, 0.0, 0.0] 1a ... 1 1 4 0 1 As 1 [0.25, 0.25, 0.25] 1d ... 1 1 4 0 2 Al 0 [0.0, 0.0, 0.0] 1a ... 1 1 4 0 3 As 1 [0.25, 0.25, 0.25] 1d ... 1 1 4 0 4 Al 0 [0.0, 0.0, 0.0] 1a ... 1 1 4 0 5 As 1 [0.25, 0.25, 0.25] 1d ... 1 1 4 0 6 Al 0 [0.0, 0.0, 0.0] 1a ... 1 1 4 0 7 As 1 [0.25, 0.25, 0.25] 1d ... 1 1 4 0 [8 rows x 52 columns] .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 7.905 seconds) .. _sphx_glr_download_gallery_plot_ddb_convergence_alas.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ddb_convergence_alas.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ddb_convergence_alas.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_ddb_convergence_alas.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_