.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_potentials.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_potentials.py: Potentials ========== This example shows how to plot the potentials stored in netcdf files. Use the input variables `prtpot`, `prtvha`, `prtvhxc`, `prtvxc` with `iomode 3` to produce these files at the end of the SCF-GS run. .. GENERATED FROM PYTHON SOURCE LINES 10-46 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /gallery/images/sphx_glr_plot_potentials_001.png :alt: $V_{hartree}(r)$ :srcset: /gallery/images/sphx_glr_plot_potentials_001.png :class: sphx-glr-multi-img * .. image-sg:: /gallery/images/sphx_glr_plot_potentials_002.png :alt: $V_{xc}(r)$ :srcset: /gallery/images/sphx_glr_plot_potentials_002.png :class: sphx-glr-multi-img * .. image-sg:: /gallery/images/sphx_glr_plot_potentials_003.png :alt: $V_{hxc}(r)$ :srcset: /gallery/images/sphx_glr_plot_potentials_003.png :class: sphx-glr-multi-img * .. image-sg:: /gallery/images/sphx_glr_plot_potentials_004.png :alt: $V_{loc}(r)$ :srcset: /gallery/images/sphx_glr_plot_potentials_004.png :class: sphx-glr-multi-img .. code-block:: Python from abipy.abilab import abiopen import abipy.data as abidata # VKS = Hartree + XC potential + sum of local part of pseudos. with abiopen(abidata.ref_file("ni_666k_POT.nc")) as ncfile: vks = ncfile.vks #vks.plot_line(point1=[0, 0, 0], point2=[0, 4, 0], num=400, title="$V_{ks}(r)$") # Hartree potential. with abiopen(abidata.ref_file("ni_666k_VHA.nc")) as ncfile: vh = ncfile.vh vh.plot_line(point1=[0, 0, 0], point2=[0, 4, 0], num=400, title="$V_{hartree}(r)$") # XC potential. with abiopen(abidata.ref_file("ni_666k_VXC.nc")) as ncfile: vxc = ncfile.vxc vxc.plot_line(point1=[0, 0, 0], point2=[0, 4, 0], num=400, title="$V_{xc}(r)$") # Hartree + XC potential. with abiopen(abidata.ref_file("ni_666k_VHXC.nc")) as ncfile: vhxc = ncfile.vhxc vhxc.plot_line(point1=[0, 0, 0], point2=[0, 4, 0], num=400, title="$V_{hxc}(r)$") vloc = vks - vhxc vloc.plot_line(point1=[0, 0, 0], point2=[0, 4, 0], num=400, title="$V_{loc}(r)$") foo = vhxc - vh - vxc #foo.plot_line(point1=[0, 0, 0], point2=[0, 4, 0], num=400, title="$V_{hxc - h - xc}(r)$") # To plot the wavefunction along the lines connect the firt atom in the structure # and all the neighbors within a sphere of radius 3 Angstrom: #vxc.plot_line_neighbors(site_index=0, radius=3) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.289 seconds) .. _sphx_glr_download_gallery_plot_potentials.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_potentials.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_potentials.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_potentials.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_