Unit cellΒΆ

This example shows how to display the unit cell with matplotlib.

  • ../_images/sphx_glr_plot_structure_001.png
  • ../_images/sphx_glr_plot_structure_002.png

Out:

/Users/gmatteo/git_repos/pymatgen/pymatgen/util/plotting.py:550: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
  plt.show()
/Users/gmatteo/git_repos/pymatgen/pymatgen/util/plotting.py:550: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
  plt.show()

from abipy.abilab import abiopen
import abipy.data as abidata

# Extract structure from netcdf file.
with abiopen(abidata.ref_file("sio2_kpath_GSR.nc")) as gsr:
    structure = gsr.structure

# Visualize sites structure.
structure.plot(color_scheme="Jmol")

# Wrap sites into first unit cell.
# sphinx_gallery_thumbnail_number = 2
structure.plot(to_unit_cell=True)

Total running time of the script: ( 0 minutes 0.398 seconds)

Gallery generated by Sphinx-Gallery