Skip to content

Commit 5537ae6

Browse files
committed
added example app
1 parent 06fe687 commit 5537ae6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#%%
2+
from __future__ import annotations
3+
4+
import dash
5+
from dash import html
6+
from pymatgen.core import Lattice, Structure
7+
8+
import crystal_toolkit
9+
import crystal_toolkit.components as ctc
10+
from crystal_toolkit.settings import SETTINGS
11+
from dash_mp_components import CrystalToolkitScene
12+
from pymatgen.io.vasp import Chgcar
13+
14+
15+
app = dash.Dash(assets_folder=SETTINGS.ASSETS_PATH)
16+
17+
chgcar = Chgcar.from_file("../../../tests/test_files/chgcar.vasp")
18+
scene = chgcar.get_scene(isolvl=0.0001)
19+
20+
layout = html.Div(
21+
[CrystalToolkitScene(data=scene.to_json())],
22+
style={"width": "100px", "height": "100px"},
23+
)
24+
#%%
25+
# as explained in "preamble" section in documentation
26+
ctc.register_crystal_toolkit(app=app, layout=layout)
27+
28+
if __name__ == "__main__":
29+
app.run(debug=True, port=8050)

0 commit comments

Comments
 (0)