.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_qha_2d.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_qha_2d.py: QHA_2D method ============= This example shows how to use the GSR.nc and PHDOS.nc files computed with different volumes to compute thermodynamic properties within the quasi-harmonic approximation. .. GENERATED FROM PYTHON SOURCE LINES 9-37 .. code-block:: Python import os import numpy as np import abipy.data as abidata from abipy.dfpt.qha_2D import QHA_2D bo_strains_a = [995, 1000, 1005, 1010, 1015] bo_strains_c = [995, 1000, 1005, 1010, 1015] phdos_strains_a = [1000, 1005, 1010] phdos_strains_c = [1000, 1005, 1010] # Root points to the directory in the git submodule with the output results. root = os.path.join(abidata.dirpath, "data_v-ZSISA-QHA.git", "ZnO_ZSISA_approximation") #gsr_paths = [[f"scale_{s1}_{s3}/out_GSR.nc" for s3 in bo_strains_c] for s1 in bo_strains_a] gsr_paths = [[os.path.join(root, f"scale_{s1}_{s3}/out_GSR_DDB") for s3 in bo_strains_c] for s1 in bo_strains_a] phdos_paths = [[os.path.join(root, f"scale_{s1}_{s3}/out_PHDOS.nc") for s3 in phdos_strains_c] for s1 in phdos_strains_a] bo_strains_a = (np.array(bo_strains_a) - 1000)/ 100 bo_strains_c = (np.array(bo_strains_c) - 1000)/ 100 bo_strains_ac = [bo_strains_a, bo_strains_c] phdos_strains_a = (np.array(phdos_strains_a) - 1000)/ 100 phdos_strains_c = (np.array(phdos_strains_c) - 1000)/ 100 phdos_strains_ac = [phdos_strains_a, phdos_strains_c] qha = QHA_2D.from_files(gsr_paths, phdos_paths, bo_strains_ac, phdos_strains_ac, gsr_file="DDB") .. GENERATED FROM PYTHON SOURCE LINES 38-40 .. code-block:: Python qha.plot_energies() .. image-sg:: /gallery/images/sphx_glr_plot_qha_2d_001.png :alt: BO Energy Surface in 3D :srcset: /gallery/images/sphx_glr_plot_qha_2d_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 41-43 .. code-block:: Python qha.plot_free_energies(tstop=500, tstart=0, num=6) .. image-sg:: /gallery/images/sphx_glr_plot_qha_2d_002.png :alt: plot qha 2d :srcset: /gallery/images/sphx_glr_plot_qha_2d_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 44-46 .. code-block:: Python qha.plot_thermal_expansion(tstop=1000, tstart=0, num=101) .. image-sg:: /gallery/images/sphx_glr_plot_qha_2d_003.png :alt: plot qha 2d :srcset: /gallery/images/sphx_glr_plot_qha_2d_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Writing thermal expansion data to: thermal-expansion_data.txt .. GENERATED FROM PYTHON SOURCE LINES 47-48 .. code-block:: Python qha.plot_lattice(tstop=1000, tstart=0, num=101) .. image-sg:: /gallery/images/sphx_glr_plot_qha_2d_004.png :alt: Plots of a, c, and V (E$\infty$Vib2) :srcset: /gallery/images/sphx_glr_plot_qha_2d_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.236 seconds) .. _sphx_glr_download_gallery_plot_qha_2d.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_qha_2d.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_qha_2d.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_qha_2d.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_