crystal_toolkit.components.transformations.core module

class crystal_toolkit.components.transformations.core.AllTransformationsComponent(transformations: list[str] | None = None, input_structure_component: MPComponent | None = None, *args, **kwargs)[source]

Bases: MPComponent

generate_callbacks(app, cache)[source]

Generate all callbacks associated with the layouts in this app. Assume that “suppress_callback_exceptions” is True, since it is not always guaranteed that all layouts will be displayed to the end user at all times, but it’s important the callbacks are defined on the server.

layout()[source]
Returns

A Dash layout for the full component. Basic implementation

provided, but should in general be overridden.

class crystal_toolkit.components.transformations.core.TransformationComponent(input_structure_component_id: str, *args, **kwargs)[source]

Bases: MPComponent

container_layout(state=None, structure=None) Div[source]
Returns

Layout defining transformation and its options.

property description
generate_callbacks(app, cache)[source]

Generate all callbacks associated with the layouts in this app. Assume that “suppress_callback_exceptions” is True, since it is not always guaranteed that all layouts will be displayed to the end user at all times, but it’s important the callbacks are defined on the server.

get_preview_layout(struct_in, struct_out)[source]

Override this method to give a layout that previews the transformation. Has beneficial side effect of priming the transformation cache when entire transformation pipeline is enabled.

Parameters
  • struct_in – input Structure

  • struct_out – transformed Structure

Returns

property is_one_to_many: bool

This should reflect the underlying transformation.

options_layouts(state=None, structure=None) list[dash.html.Div.Div][source]

Return a layout to change the transformation options (that is, that controls the args and kwargs that will be passed to pymatgen).

The “state” option is so that the controls can be populated appropriately using existing args and kwargs, e.g. when restoring the control panel from a previous state.

Parameters

state – existing state in format {“args”: [], “kwargs”: {}}

Returns

property title
property transformation