Skip to content

Commit d7c97c5

Browse files
committed
Merge remote-tracking branch 'origin/main' into MGComponent
2 parents 4430cc7 + adb5238 commit d7c97c5

21 files changed

Lines changed: 111 additions & 73 deletions

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,28 @@ Following a discussion with a potential contributor, "new contributor" issues ar
1919

2020
[Documentation can be found at docs.crystaltoolkit.org](https://docs.crystaltoolkit.org)
2121

22+
## Example Apps
23+
24+
| Description | Link    |
25+
| :--------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
26+
| **`bandstructure.py`**<br> Demonstrates capabilities of the `BandstructureAndDosComponent` component | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/bandstructure.py) |
27+
| **`basic_hello_structure.py`**<br> Uses `StructureMoleculeComponent` to show a simple `pymatgen` structure | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/basic_hello_structure.py) |
28+
| **`basic_hello_structure_interactive.py`**<br> Adds a button to the `basic_hello_structure.py` to toggle between two structures interactively | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/basic_hello_structure_interactive.py) |
29+
| **`basic_hello_world.py`**<br> Bare-bones example showing how to render the text "Hello scientist!" in Dash app | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/basic_hello_world.py) |
30+
| **`diffraction.py`**<br> Demonstrates capabilities of the `XRayDiffractionComponent` component | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/diffraction.py) |
31+
| **`diffraction_dynamic.py`**<br> Adds a button to `diffraction.py` to load a new structure on the fly | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/diffraction_dynamic.py) |
32+
| **`diffraction_empty.py`**<br> Shows `XRayDiffractionComponent` can be mounted without a passing structure | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/diffraction_empty.py) |
33+
| **`kwarg_inputs.py`**<br> Shows off boolean input (aka toggle), matrix input and slider input components | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/kwarg_inputs.py) |
34+
| **`phase_diagram.py`**<br> Combines `MPRester.get_entries_in_chemsys()` and the `PhaseDiagram` component to plot the Li-O-Co convex hull | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/phase_diagram.py) |
35+
| **`pourbaix.py`**<br> Combines `MPRester.get_pourbaix_entries()` and the `PourbaixDiagramComponent` to plot the Fe-CO Pourbaix diagram | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/pourbaix.py) |
36+
| **`structure.py`**<br> Show cases multiple layout options for the `StructureMoleculeComponent` | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/structure.py) |
37+
| **`structure_magnetic.py`**<br> Plots a structure with magnetic moments | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/structure_magnetic.py) |
38+
| **`transformations.py`**<br> Combines `StructureMoleculeComponent` and `AllTransformationsComponent` to apply interactive structure transformations | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/transformations.py) |
39+
| **`transformations_minimal.py`**<br> Shows how to restrict the types of allowed transformations | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/transformations_minimal.py) |
40+
| **`write_structure_screenshot_to_file.py`**<br> Shows to save interactive structure views as image files | [![View on GitHub]](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/write_structure_screenshot_to_file.py) |
41+
42+
[View on GitHub]: https://img.shields.io/badge/View%20on-GitHub-darkblue?logo=github
43+
2244
## Team and Contribution Policy
2345

2446
The [Crystal Toolkit Development Team](https://github.com/materialsproject/crystaltoolkit/graphs/contributors) includes:

crystal_toolkit/apps/examples/bandstructure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
ctc.register_crystal_toolkit(app, layout=my_layout)
4040

4141

42-
# allow app to be run using "python structure.py"
42+
# run this app with "python path/to/this/file.py"
4343
# in production, deploy behind gunicorn or similar
4444
# see Dash documentation for more information
4545
if __name__ == "__main__":

crystal_toolkit/apps/examples/basic_hello_world.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# create your layout
1010
app.layout = html.Span(["Hello scientist!"])
1111

12-
# allow app to be run using "python app.py"
12+
# run this app with "python path/to/this/file.py"
1313
# in production, deploy behind gunicorn or similar
1414
# see Dash documentation for more information
1515
if __name__ == "__main__":

crystal_toolkit/apps/examples/diffraction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# as explained in "preamble" section in documentation
2828
ctc.register_crystal_toolkit(app=app, layout=my_layout)
2929

30-
# allow app to be run using "python structure.py"
30+
# run this app with "python path/to/this/file.py"
3131
# in production, deploy behind gunicorn or similar
3232
# see Dash documentation for more information
3333
if __name__ == "__main__":

crystal_toolkit/apps/examples/diffraction_dynamic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def load_structure(n_clicks: int) -> Structure:
2828
return structure
2929

3030

31-
# allow app to be run using "python structure.py"
31+
# run this app with "python path/to/this/file.py"
3232
# in production, deploy behind gunicorn or similar
3333
# see Dash documentation for more information
3434
if __name__ == "__main__":

crystal_toolkit/apps/examples/diffraction_empty.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import dash
22

3-
# create our crystal structure using pymatgen
4-
from pymatgen.core.lattice import Lattice
5-
from pymatgen.core.structure import Structure
6-
73
import crystal_toolkit.components as ctc
84
from crystal_toolkit.helpers.layouts import H1, Container
95
from crystal_toolkit.settings import SETTINGS
106

11-
app = dash.Dash(assets_folder=SETTINGS.ASSETS_PATH)
7+
# create our crystal structure using pymatgen
8+
129

13-
structure = Structure(Lattice.cubic(4.2), ["Na", "K"], [[0, 0, 0], [0.5, 0.5, 0.5]])
10+
app = dash.Dash(assets_folder=SETTINGS.ASSETS_PATH)
1411

1512
xrd_component = ctc.XRayDiffractionComponent()
1613

@@ -22,7 +19,7 @@
2219
# as explained in "preamble" section in documentation
2320
ctc.register_crystal_toolkit(app=app, layout=my_layout)
2421

25-
# allow app to be run using "python structure.py"
22+
# run this app with "python path/to/this/file.py"
2623
# in production, deploy behind gunicorn or similar
2724
# see Dash documentation for more information
2825
if __name__ == "__main__":

crystal_toolkit/apps/examples/kwarg_inputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def add_inputs(n_clicks):
8888
# tell Crystal Toolkit about the app and layout we want to display
8989
ctc.register_crystal_toolkit(app=app, layout=my_layout, cache=None)
9090

91-
# allow app to be run using "python app.py"
91+
# run this app with "python path/to/this/file.py"
9292
# in production, deploy behind gunicorn or similar
9393
# see Dash documentation for more information
9494
if __name__ == "__main__":

crystal_toolkit/apps/examples/phase_diagram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
app.layout = ctc.crystal_toolkit_layout(my_layout)
5959

6060

61-
# allow app to be run using "python structure.py"
61+
# run this app with "python path/to/this/file.py"
6262
# in production, deploy behind gunicorn or similar
6363
# see Dash documentation for more information
6464
if __name__ == "__main__":

crystal_toolkit/apps/examples/pourbaix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
ctc.register_crystal_toolkit(app=app, layout=my_layout)
3434

35-
# allow app to be run using "python pourbaix.py"
35+
# run this app with "python path/to/this/file.py"
3636
# in production, deploy behind gunicorn or similar
3737
# see Dash documentation for more information
3838
if __name__ == "__main__":

crystal_toolkit/apps/examples/structure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# tell crystal toolkit about your app and layout
3737
ctc.register_crystal_toolkit(app, layout=my_layout)
3838

39-
# allow app to be run using "python structure.py"
39+
# run this app with "python path/to/this/file.py"
4040
# in production, deploy behind gunicorn or similar
4141
# see Dash documentation for more information
4242
if __name__ == "__main__":

0 commit comments

Comments
 (0)