.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_structure.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_structure.py: Unit cell ========= This example shows how to display the unit cell with matplotlib. .. GENERATED FROM PYTHON SOURCE LINES 8-11 .. code-block:: default from abipy.abilab import abiopen import abipy.data as abidata .. GENERATED FROM PYTHON SOURCE LINES 12-13 Extract structure from the netcdf file: .. GENERATED FROM PYTHON SOURCE LINES 13-17 .. code-block:: default with abiopen(abidata.ref_file("sio2_kpath_GSR.nc")) as gsr: structure = gsr.structure .. GENERATED FROM PYTHON SOURCE LINES 18-19 To visualize the structure with matplotlib, use: .. GENERATED FROM PYTHON SOURCE LINES 19-21 .. code-block:: default structure.plot(color_scheme="Jmol") .. image:: /gallery/images/sphx_glr_plot_structure_001.png :alt: Si3 O6 :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 22-23 To wrap sites into first unit cell, use: .. GENERATED FROM PYTHON SOURCE LINES 23-26 .. code-block:: default # sphinx_gallery_thumbnail_number = 2 structure.plot(to_unit_cell=True) .. image:: /gallery/images/sphx_glr_plot_structure_002.png :alt: Si3 O6 :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none
.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.258 seconds) .. _sphx_glr_download_gallery_plot_structure.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_structure.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_structure.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_structure.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_