{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Unit cell\n\nThis example shows how to display the unit cell with matplotlib.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from abipy.abilab import abiopen\nimport abipy.data as abidata" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Extract structure from the netcdf file:\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "with abiopen(abidata.ref_file(\"sio2_kpath_GSR.nc\")) as gsr:\n structure = gsr.structure" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To visualize the structure with matplotlib, use:\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "structure.plot(color_scheme=\"Jmol\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To wrap sites into first unit cell, use:\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# sphinx_gallery_thumbnail_number = 2\nstructure.plot(to_unit_cell=True)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.0" } }, "nbformat": 4, "nbformat_minor": 0 }