Esempio n. 1
0
from pymatgen.analysis.phase_diagram import PhaseDiagram

# standard Crystal Toolkit import
import crystal_toolkit.components as ctc

# create Dash app as normal
app = dash.Dash()

# If callbacks created dynamically they cannot be statically checked at app startup.
# For this simple example this is not a problem, but if creating a complicated,
# nested layout this will need to be enabled -- consult Dash documentation
# for more information.
app.config["suppress_callback_exceptions"] = True

# tell Crystal Toolkit about the app
ctc.register_app(app)

# first, retrieve entries from Materials Project
with MPRester() as mpr:
    # li_entries = mpr.get_entries_in_chemsys(["Li"])
    # li_o_entries = mpr.get_entries_in_chemsys(["Li", "O"])
    li_co_o_entries = mpr.get_entries_in_chemsys(["Li", "O", "Co"])
    # li_co_o_fe_entries = mpr.get_entries_in_chemsys(["Li", "O", "Co", "Fe"])

# and then create the phase diagrams
# li_phase_diagram = PhaseDiagram(li_entries)
# li_o_phase_diagram = PhaseDiagram(li_o_entries)
li_co_o_phase_diagram = PhaseDiagram(li_co_o_entries)
# li_co_o_fe_phase_diagram = PhaseDiagram(li_co_o_fe_entries)

# and the corresponding Crystal Toolkit components
Esempio n. 2
0
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from dash.exceptions import PreventUpdate

import crystal_toolkit.components as ct
from pymatgen import Structure

from atomate_gui.app import app, collection
from atomate_gui.apps.info import InfoApp
from atomate_gui.apps.search import SearchApp

ct.register_app(app)
struct_component = ct.StructureMoleculeComponent()
struct_layout = html.Div(
    [
        struct_component.all_layouts["title"],
        struct_component.all_layouts["legend"],
        struct_component.all_layouts["options"],
        struct_component.all_layouts["screenshot"]
    ],
    id='visualizer-tools',
)

app.layout = html.Div([
    dcc.Location(id='url', refresh=False),
    ct.MPComponent.all_app_stores(),
    html.Div(
        id='header',
        children=html.H1('Materials Searcher.', ),
    ),
Esempio n. 3
0

################################################################################
# region SET UP LOGGING
################################################################################

logger = logging.getLogger(crystal_toolkit_app.title)

# endregion


################################################################################
# region INSTANTIATE CORE COMPONENTS
################################################################################

ctc.register_app(crystal_toolkit_app)
ctc.register_cache(cache)

# app not ready for production yet (e.g. pending papers, further testing, etc.)
if DEBUG_MODE:

    supercell = ctc.SupercellTransformationComponent()
    grain_boundary = ctc.GrainBoundaryTransformationComponent()
    oxi_state = ctc.AutoOxiStateDecorationTransformationComponent()
    slab = ctc.SlabTransformationComponent()
    substitution = ctc.SubstitutionTransformationComponent()

    transformation_component = ctc.AllTransformationsComponent(
        transformations=[supercell, slab, grain_boundary, oxi_state, substitution]
    )