Skip to content

Instantly share code, notes, and snippets.

@lan496
Created December 26, 2024 08:26
Show Gist options
  • Select an option

  • Save lan496/3ef3310f40f11e811f71c84e6055be89 to your computer and use it in GitHub Desktop.

Select an option

Save lan496/3ef3310f40f11e811f71c84e6055be89 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from pymatgen.core.lattice import Lattice\n",
"from pymatgen.core.structure import Structure\n",
"\n",
"# create our crystal structure using pymatgen\n",
"structure = Structure(Lattice.cubic(4.2), [\"Na\", \"K\"], [[0, 0, 0], [0.5, 0.5, 0.5]])"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"650\"\n",
" src=\"http://127.0.0.1:8884/\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x1522e4f50>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from crystal_toolkit.renderables.structuregraph import StructureGraph\n",
"from pymatgen.analysis.local_env import CrystalNN\n",
"\n",
"graph = StructureGraph.from_local_env_strategy(structure * (2, 2, 2), CrystalNN())\n",
"graph"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "sandbox",
"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.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment