Skip to content

Commit

Permalink
added example app
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmshn committed Jan 19, 2025
1 parent 06fe687 commit 5537ae6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions crystal_toolkit/apps/examples/chgcar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#%%
from __future__ import annotations

import dash
from dash import html
from pymatgen.core import Lattice, Structure

import crystal_toolkit
import crystal_toolkit.components as ctc
from crystal_toolkit.settings import SETTINGS
from dash_mp_components import CrystalToolkitScene
from pymatgen.io.vasp import Chgcar


app = dash.Dash(assets_folder=SETTINGS.ASSETS_PATH)

chgcar = Chgcar.from_file("../../../tests/test_files/chgcar.vasp")
scene = chgcar.get_scene(isolvl=0.0001)

layout = html.Div(
[CrystalToolkitScene(data=scene.to_json())],
style={"width": "100px", "height": "100px"},
)
#%%
# as explained in "preamble" section in documentation
ctc.register_crystal_toolkit(app=app, layout=layout)

if __name__ == "__main__":
app.run(debug=True, port=8050)

0 comments on commit 5537ae6

Please sign in to comment.