crystal_toolkit.components.structure module

class crystal_toolkit.components.structure.StructureMoleculeComponent(struct_or_mol: None | Structure | StructureGraph | Molecule | MoleculeGraph = None, id: str = None, className: str = 'box', scene_additions: Scene | None = None, bonding_strategy: str = 'CrystalNN', bonding_strategy_kwargs: dict | None = None, color_scheme: str = 'VESTA', color_scale: str | None = None, radius_strategy: str = 'uniform', unit_cell_choice: str = 'input', draw_image_atoms: bool = True, bonded_sites_outside_unit_cell: bool = False, hide_incomplete_bonds: bool = True, show_compass: bool = True, scene_settings: dict | None = None, group_by_site_property: str | None = None, show_legend: bool = True, show_settings: bool = True, show_controls: bool = True, show_expand_button: bool = True, show_image_button: bool = True, show_export_button: bool = True, show_position_button: bool = True, **kwargs)[source]

Bases: MPComponent

A component to display pymatgen Structure, Molecule, StructureGraph and MoleculeGraph objects.

available_bonding_strategies = {'BrunnerNN_real': <class 'pymatgen.analysis.local_env.BrunnerNN_real'>, 'BrunnerNN_reciprocal': <class 'pymatgen.analysis.local_env.BrunnerNN_reciprocal'>, 'BrunnerNN_relative': <class 'pymatgen.analysis.local_env.BrunnerNN_relative'>, 'CovalentBondNN': <class 'pymatgen.analysis.local_env.CovalentBondNN'>, 'Critic2NN': <class 'pymatgen.analysis.local_env.Critic2NN'>, 'CrystalNN': <class 'pymatgen.analysis.local_env.CrystalNN'>, 'CutOffDictNN': <class 'pymatgen.analysis.local_env.CutOffDictNN'>, 'EconNN': <class 'pymatgen.analysis.local_env.EconNN'>, 'JmolNN': <class 'pymatgen.analysis.local_env.JmolNN'>, 'MinimumDistanceNN': <class 'pymatgen.analysis.local_env.MinimumDistanceNN'>, 'MinimumOKeeffeNN': <class 'pymatgen.analysis.local_env.MinimumOKeeffeNN'>, 'MinimumVIRENN': <class 'pymatgen.analysis.local_env.MinimumVIRENN'>, 'OpenBabelNN': <class 'pymatgen.analysis.local_env.OpenBabelNN'>, 'VoronoiNN': <class 'pymatgen.analysis.local_env.VoronoiNN'>}
default_scene_settings = {'extractAxis': True, 'renderer': 'webgl', 'secondaryObjectView': False}
default_title = 'Crystal Toolkit'
download_options = {'Structure': {'CIF': {'fmt': 'cif'}, 'CIF (Symmetrized)': {'fmt': 'cif', 'symprec': 0.1}, 'JSON': {'fmt': 'json'}, 'POSCAR': {'fmt': 'poscar'}, 'Prismatic': {'fmt': 'prismatic'}, 'VASP Input Set (MPRelaxSet)': {}}}
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.

static get_scene_and_legend(graph: StructureGraph | MoleculeGraph | None, color_scheme='VESTA', color_scale=None, radius_strategy='uniform', draw_image_atoms=True, bonded_sites_outside_unit_cell=False, hide_incomplete_bonds=True, explicitly_calculate_polyhedra_hull=False, scene_additions=None, show_compass=True, group_by_site_property=None) tuple[Scene, dict[str, str]][source]
layout(size: str = '500px') Div[source]
Parameters

size – a CSS dimension specifying width/height of Div

Returns

A html.Div containing the 3D structure or molecule

title_layout()[source]
Returns

A layout including the composition of the structure/molecule as a title.