.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_phthermo.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_plot_phthermo.py: Thermodinamic properties ======================== This example shows how to compute and plot thermodinamic properties within the harmonic approximation using the phonon DOS produced by anaddb. .. GENERATED FROM PYTHON SOURCE LINES 9-21 .. code-block:: default from abipy.abilab import abiopen import abipy.data as abidata # Read the Phonon DOS from the netcd file produced by anaddb (prtdos 2) ncfile = abiopen(abidata.ref_file("trf2_5.out_PHDOS.nc")) phdos = ncfile.phdos # Print crystalline structure and zero-point energy. print(ncfile.structure) zpe = phdos.zero_point_energy print("Zero point energy:", zpe, zpe.to("J"), zpe.to("Ha")) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Full Formula (Al1 As1) Reduced Formula: AlAs abc : 3.970101 3.970101 3.970101 angles: 60.000000 60.000000 60.000000 Sites (2) # SP a b c --- ---- ---- ---- ---- 0 Al 0 0 0 1 As 0.25 0.25 0.25 Abinit Spacegroup: spgid: 0, num_spatial_symmetries: 24, has_timerev: True, symmorphic: False Zero point energy: 0.08400926480898568 eV 1.3459768111647533e-20 J 0.0030872835382053307 Ha .. GENERATED FROM PYTHON SOURCE LINES 22-25 Compute free energy from 2 to 300 K (20 points) By default, energies are is eV and thermodynamic quantities are given on a per-unit-cell basis. .. GENERATED FROM PYTHON SOURCE LINES 25-28 .. code-block:: default f = phdos.get_free_energy(tstart=2, tstop=300, num=20) #f.plot() .. GENERATED FROM PYTHON SOURCE LINES 29-31 Plot U, F, S, Cv as a function of T. Use J/mol units, results are divided by formula_units. .. GENERATED FROM PYTHON SOURCE LINES 31-33 .. code-block:: default phdos.plot_harmonic_thermo(units="Jmol", formula_units=1) .. image:: /gallery/images/sphx_glr_plot_phthermo_001.png :alt: internal_energy, free_energy, entropy, cv :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 34-35 Plotly version: .. GENERATED FROM PYTHON SOURCE LINES 35-37 .. code-block:: default phdos.plotly_harmonic_thermo(units="Jmol", formula_units=1) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 38-39 Remember to close the file: .. GENERATED FROM PYTHON SOURCE LINES 39-40 .. code-block:: default ncfile.close() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.353 seconds) .. _sphx_glr_download_gallery_plot_phthermo.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/abinit/abipy/gh-pages?filepath=notebooks/gallery/plot_phthermo.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_phthermo.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_phthermo.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_