aiidalab_chemshell.common package

Submodules

aiidalab_chemshell.common.chemshell module

Module containing common settings for configuring ChemShell.

class aiidalab_chemshell.common.chemshell.BasisSetOptions(*values)

Bases: Enum

Pre-defined basis set levels for simplified ChemShell inputs.

BALANCED = 1
FAST = 0
QUALITY = 2
property label: str

Convert enum value to a string representation for ChemShell input.

class aiidalab_chemshell.common.chemshell.WorkflowOptions(*values)

Bases: Enum

Enum defining the available ChemShell based AiiDA workflows.

ATOMIC_ENERGIES = 2
GEOMETRY = 0
NEB = 3
SINGLE_POINT = 1
property label: str

Convert enum value into a more human readable string.

property tab_label: str

Create a tab title for the given enum option.

aiidalab_chemshell.common.citation module

Footer with a “Citation” disclosure for the app’s footer.

Clicking the “Citation” word reveals a formatted box listing the citations for this app, the aiida-chemshell plugin, and ChemShell itself, each with a bolded title and its DOI rendered as a clickable link.

aiidalab_chemshell.common.citation.ALC_URL = 'https://adalovelacecentre.ac.uk/'

The Ada Lovelace Centre’s website, linked from the footer’s copyright line.

aiidalab_chemshell.common.citation.CITATION_BOX_CLASS = 'chemshell-citation-box'

CSS class applied to the revealed citation box.

aiidalab_chemshell.common.citation.CITATION_ENTRIES = [{'doi': '10.5281/zenodo.19188755', 'text': 'Speake, B. T. "AiiDAlab ChemShell App". Zenodo.', 'title': 'AiiDAlab ChemShell App'}, {'doi': '10.5281/zenodo.17055004', 'text': 'Speake, B. T. "AiiDA ChemShell Plugin". Zenodo.', 'title': 'AiiDA ChemShell plugin'}, {'doi': '10.1021/acs.jctc.8b01036', 'text': 'Lu, Y.; Farrow, M. R.; Fayon, P.; Logsdail, A. J.; Sokol, A. A.; Catlow, C. R. A.; Sherwood, P.; Keal, T. W. "Open-Source, Python-Based Redevelopment of the ChemShell Multiscale QM/MM Environment". J. Chem. Theory Comput. 2019, 15, 1317-1328.', 'title': 'ChemShell'}, {'doi': '10.1021/jp9028968', 'text': 'Kästner, J.; Carr, J. M.; Keal, T. W.; Thiel, W.; Wander, A.; Sherwood, P. "DL-FIND: An Open-Source Geometry Optimizer for Atomistic Simulations". J. Phys. Chem. A 2009, 113, 11856-11865.', 'title': 'ChemShell — DL-FIND geometry optimiser (if used)'}, {'doi': '10.1039/D3CP00648D', 'text': 'Lu, Y.; Sen, K.; Yong, C.; Gunn, D. S. D.; Purton, J. A.; Guan, J.; Desmoutier, A.; Nasir, J. A.; Zhang, X.; Zhu, L.; Hou, Q.; Jackson-Masters, J.; Watts, S.; Hanson, R.; Thomas, H. N.; Jayawardena, O.; Logsdail, A. J.; Woodley, S. M.; Senn, H. M.; Sherwood, P.; Catlow, C. R. A.; Sokol, A. A.; Keal, T. W. "Multiscale QM/MM modelling of catalytic systems with ChemShell". Phys. Chem. Chem. Phys. 2023, 25, 21816-21835.', 'title': 'ChemShell — v21.0+ features (recommended)'}]

a bolded title, the citation text, and a DOI (rendered as a clickable https://doi.org/... link).

Type:

One entry per citable work

aiidalab_chemshell.common.citation.CITATION_HEADER = 'If you have used this project in your work, please cite the following components;'

Header shown at the top of the citation box.

aiidalab_chemshell.common.citation.CITATION_HEADER_CLASS = 'chemshell-citation-header'

CSS class applied to the citation box’s header line.

aiidalab_chemshell.common.citation.CITATION_HTML = '<p class="chemshell-citation-header">If you have used this project in your work, please cite the following components;</p>\n    <p>\n        <strong>AiiDAlab ChemShell App</strong><br>\n        Speake, B. T. "AiiDAlab ChemShell App". Zenodo.<br>\n        <a href="https://doi.org/10.5281/zenodo.19188755" target="_blank" rel="noopener noreferrer">https://doi.org/10.5281/zenodo.19188755</a>\n    </p>\n    \n    <p>\n        <strong>AiiDA ChemShell plugin</strong><br>\n        Speake, B. T. "AiiDA ChemShell Plugin". Zenodo.<br>\n        <a href="https://doi.org/10.5281/zenodo.17055004" target="_blank" rel="noopener noreferrer">https://doi.org/10.5281/zenodo.17055004</a>\n    </p>\n    \n    <p>\n        <strong>ChemShell</strong><br>\n        Lu, Y.; Farrow, M. R.; Fayon, P.; Logsdail, A. J.; Sokol, A. A.; Catlow, C. R. A.; Sherwood, P.; Keal, T. W. "Open-Source, Python-Based Redevelopment of the ChemShell Multiscale QM/MM Environment". J. Chem. Theory Comput. 2019, 15, 1317-1328.<br>\n        <a href="https://doi.org/10.1021/acs.jctc.8b01036" target="_blank" rel="noopener noreferrer">https://doi.org/10.1021/acs.jctc.8b01036</a>\n    </p>\n    \n    <p>\n        <strong>ChemShell — DL-FIND geometry optimiser (if used)</strong><br>\n        Kästner, J.; Carr, J. M.; Keal, T. W.; Thiel, W.; Wander, A.; Sherwood, P. "DL-FIND: An Open-Source Geometry Optimizer for Atomistic Simulations". J. Phys. Chem. A 2009, 113, 11856-11865.<br>\n        <a href="https://doi.org/10.1021/jp9028968" target="_blank" rel="noopener noreferrer">https://doi.org/10.1021/jp9028968</a>\n    </p>\n    \n    <p>\n        <strong>ChemShell — v21.0+ features (recommended)</strong><br>\n        Lu, Y.; Sen, K.; Yong, C.; Gunn, D. S. D.; Purton, J. A.; Guan, J.; Desmoutier, A.; Nasir, J. A.; Zhang, X.; Zhu, L.; Hou, Q.; Jackson-Masters, J.; Watts, S.; Hanson, R.; Thomas, H. N.; Jayawardena, O.; Logsdail, A. J.; Woodley, S. M.; Senn, H. M.; Sherwood, P.; Catlow, C. R. A.; Sokol, A. A.; Keal, T. W. "Multiscale QM/MM modelling of catalytic systems with ChemShell". Phys. Chem. Chem. Phys. 2023, 25, 21816-21835.<br>\n        <a href="https://doi.org/10.1039/D3CP00648D" target="_blank" rel="noopener noreferrer">https://doi.org/10.1039/D3CP00648D</a>\n    </p>\n    '

a header followed by a bolded title, citation text and a clickable DOI link for each entry in CITATION_ENTRIES.

Type:

The full citation box content

aiidalab_chemshell.common.citation.CITATION_TOGGLE_CLASS = 'chemshell-citation-toggle'

CSS class applied to the “Citation” disclosure toggle.

aiidalab_chemshell.common.citation.FOOTER_CLASS = 'chemshell-footer'

CSS class applied to the footer container.

Return the app footer: a copyright line plus a “Citation” disclosure.

Clicking “Citation” reveals a box containing CITATION_HTML: one entry per citable work, each with a bolded title and a clickable DOI link.

Returns:

The footer widget, carrying FOOTER_CLASS.

Return type:

ipywidgets.VBox

aiidalab_chemshell.common.force_field_selector module

Widget for selecting a force field file from various sources.

class aiidalab_chemshell.common.force_field_selector.ForceFieldSelectionWidget(*args: t.Any, **kwargs: t.Any)

Bases: VBox, HasTraits

Widget for selecting a force field file from various sources.

disable(val: bool = True) → None

Disable the widget and all of its children.

Parameters:

val (bool) – Whether to disable (True) or re-enable (False) the widget’s inputs.

force_field

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

aiidalab_chemshell.common.navigation module

Module handling navigation controls within the app.

class aiidalab_chemshell.common.navigation.QuickAccessButtons(*args: t.Any, **kwargs: t.Any)

Bases: HBox

Quick access buttons present in the apps header and start banner.

aiidalab_chemshell.common.node_viewers module

Defines a custom AiiDA node visualiser.

class aiidalab_chemshell.common.node_viewers.CustomAiidaNodeViewWidget(*args: t.Any, **kwargs: t.Any)

Bases: VBox

Custom viewer based on a specific AiiDA node type.

An extension of the aiida_widgets_base.viewers.AiidaNodeViewWidget enabling more customisability when registering viewers with nodes returned from ChemShell jobs. The main outline is taken from the base aiidalab_widgets_base viewer with an extended viewer() method which allows handling of node types which the base viewer has no registered visualisation widgets.

node

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class aiidalab_chemshell.common.node_viewers.VibrationalModesViewWidget(*args: t.Any, **kwargs: t.Any)

Bases: VBox

Custom widget to display vibrational modes produced from ChemShell.

aiidalab_chemshell.common.process_tree module

Extend aiidalab-widgets-base’s process node tree to also show inputs.

aiidalab_widgets_base.ProcessNodesTreeWidget builds a tree of nodes linked to a process via its outputs (CREATE/RETURN links) and its called sub-processes (CALL_CALC/CALL_WORK links), but never shows the nodes that were fed into the process (INPUT_CALC/INPUT_WORK links, e.g. the input structure or QM parameters). This module adds an “inputs” branch alongside the existing “outputs” branch by subclassing a handful of non-public aiidalab_widgets_base.nodes/process classes.

This is intentionally scoped to aiidalab-chemshell for now. Once it has been tested and user-verified it is intended to be lifted into alc-aiidalab-widgets (as a reusable, exported widget) so other ALC-maintained AiiDAlab apps can use it too.

Warning

This relies on subclassing several non-public, undocumented internal classes of aiidalab-widgets-base (NodesTreeWidget, AiidaProcessNodeTreeNode, AiidaOutputsTreeNode and the per-node-type process tree-node classes). Behaviour has been verified against aiidalab-widgets-base 2.5.1 and 3.0.1 (the latter matching this project’s pinned dependency range); re-verify against the installed version after any upgrade of that pin.

class aiidalab_chemshell.common.process_tree.AiidaInputsTreeNode(*args: t.Any, **kwargs: t.Any)

Bases: AiidaOutputsTreeNode

Tree node representing the “inputs” folder of a process node.

Subclasses AiidaOutputsTreeNode (rather than introducing a wholly new base class) so that the upstream isinstance(node, AiidaOutputsTreeNode) checks in NodesTreeWidget._observe_tree_selected_nodes and NodesTreeWidget.find_node - which resolve such nodes via their parent_pk rather than a pk of their own - also apply correctly to this “inputs” folder without requiring any further overrides.

icon

A trait for unicode strings.

class aiidalab_chemshell.common.process_tree.CalcFunctionTreeNodeWithInputs(*args: t.Any, **kwargs: t.Any)

Bases: _TreeNodeWithInputsMixin, CalcFunctionTreeNode

CalcFunctionTreeNode variant that also exposes process inputs.

class aiidalab_chemshell.common.process_tree.CalcJobTreeNodeWithInputs(*args: t.Any, **kwargs: t.Any)

Bases: _TreeNodeWithInputsMixin, CalcJobTreeNode

CalcJobTreeNode variant that also exposes process inputs.

class aiidalab_chemshell.common.process_tree.NodesTreeWidgetWithInputs(*args: t.Any, **kwargs: t.Any)

Bases: NodesTreeWidget

NodesTreeWidget variant that also shows nodes linked via input links.

Overrides NODE_TYPE so every process/sub-process tree node gains an inputs_node folder (mirroring the existing outputs_node), and extends _find_children to walk it via a new _find_inputs classmethod, which mirrors the upstream _find_outputs implementation but reads process_node.inputs instead of process_node.outputs.

Notes

A process/sub-process node whose type is not one of WorkChainNode, CalcFunctionNode or CalcJobNode falls back to the upstream UnknownTypeTreeNode and will not get an “inputs” branch.

NODE_TYPE = {<class 'aiida.orm.nodes.process.calculation.calcfunction.CalcFunctionNode'>: <class 'aiidalab_chemshell.common.process_tree.CalcFunctionTreeNodeWithInputs'>, <class 'aiida.orm.nodes.process.calculation.calcjob.CalcJobNode'>: <class 'aiidalab_chemshell.common.process_tree.CalcJobTreeNodeWithInputs'>, <class 'aiida.orm.nodes.process.workflow.workchain.WorkChainNode'>: <class 'aiidalab_chemshell.common.process_tree.WorkChainProcessTreeNodeWithInputs'>}
find_node(pk, namespaces=None, is_input=False)

Find a node by its pk, namespaces, and inputs/outputs disambiguator.

The upstream implementation identifies a folder node solely by (parent_pk, namespaces), which is not unique here: since AiidaInputsTreeNode subclasses AiidaOutputsTreeNode, the “inputs” and “outputs” folders of the same process (and of any shared nested namespace name) have an identical (parent_pk, namespaces) key. Without this override, looking up either folder always resolves to whichever one _find_children yields first (the “inputs” folder), so clicking “outputs” would incorrectly expand “inputs”.

Parameters:
  • pk (int) – Primary key of the node, or of its parent process if looking up an “inputs”/”outputs” folder.

  • namespaces (tuple[str, ...], optional) – Namespace path, for a nested “inputs”/”outputs” folder lookup.

  • is_input (bool) – Whether the folder being looked up is an “inputs” folder (as opposed to an “outputs” folder). Ignored for non-folder nodes.

Returns:

The matching tree node.

Return type:

ipytree.Node

Raises:

KeyError – If no matching node is found.

class aiidalab_chemshell.common.process_tree.ProcessNodesTreeWidget(*args: t.Any, **kwargs: t.Any)

Bases: ProcessNodesTreeWidget

Drop-in replacement for aiidalab_widgets_base.ProcessNodesTreeWidget.

Exposes the same value/selected_nodes traits as the upstream widget, but the underlying tree also shows an “inputs” branch (nodes linked via INPUT_CALC/INPUT_WORK links) alongside the existing “outputs” and “called” branches, for every process and sub-process in the tree.

class aiidalab_chemshell.common.process_tree.WorkChainProcessTreeNodeWithInputs(*args: t.Any, **kwargs: t.Any)

Bases: _TreeNodeWithInputsMixin, WorkChainProcessTreeNode

WorkChainProcessTreeNode variant that also exposes process inputs.

aiidalab_chemshell.common.structure_uploader module

Widget for selecting an input structure from various sources.

class aiidalab_chemshell.common.structure_uploader.StructureSelectionWidget(*args: t.Any, **kwargs: t.Any)

Bases: VBox, HasTraits

Widget for selecting an input structre from various sources.

disable(val: bool = True) → None

Disable the widget and all children.

structure_data

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

structure_file

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

trajectory_data

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

aiidalab_chemshell.common.theme module

Central visual theme for the AiiDAlab ChemShell application.

This module provides a single stylesheet, injected once at the application root, that gives the app a consistent modern look. It is built on CSS custom properties (design tokens) so the whole app can be retuned from one place, and so that dark mode is a matter of overriding a handful of variables.

Usage

Add APP_ROOT_CLASS to the top-level application container and include the widget returned by chemshell_theme() once among its children:

view = ipw.VBox(children=[chemshell_theme(), header, body, footer])
view.add_class(APP_ROOT_CLASS)

All rules are scoped under .{APP_ROOT_CLASS} so the theme does not leak into other AiiDAlab apps sharing the same page. The design tokens live on :root (they are inert until referenced by a scoped rule).

aiidalab_chemshell.common.theme.APPBAR_CLASS = 'chemshell-appbar'

CSS class applied to the header “app bar” (logo, subtitle and quick-access buttons). See chemshell_appbar().

aiidalab_chemshell.common.theme.APP_ROOT_CLASS = 'chemshell-app'

CSS class applied to the top-level application container. All theme rules are scoped under this class.

aiidalab_chemshell.common.theme.chemshell_appbar(children)

Return a header “app bar” VBox wrapping the given children.

The returned box carries APPBAR_CLASS and is styled as a muted surface band. Intended to hold the logo, subtitle and quick-access buttons at the top of a page.

Parameters:

children (list of ipywidgets.Widget) – Widgets to place inside the app bar (e.g. logo, subtitle, nav buttons).

Returns:

The styled app-bar container.

Return type:

ipywidgets.VBox

aiidalab_chemshell.common.theme.chemshell_theme()

Return an HTML widget carrying the application theme stylesheet.

Include the returned widget once among the children of the top-level application container, and apply APP_ROOT_CLASS to that container. The <style> block is global to the page, so a single instance suffices.

Returns:

A hidden widget holding the stylesheet.

Return type:

ipywidgets.HTML

aiidalab_chemshell.common.utils module

Small common widgets used accross the application.

aiidalab_chemshell.common.utils.CHEMSHELL_BUTTON_CLASS = 'chemshell-sleek-btn'

CSS class applied to buttons that should use the sleek/modern styling.

aiidalab_chemshell.common.utils.add_button_style_class(*buttons)

Apply the sleek styling class to one or more buttons.

Note that the accompanying stylesheet from sleek_button_style() must also be present in the rendered layout for the styling to take effect.

Parameters:

*buttons (ipywidgets.Button) – Buttons to receive the CHEMSHELL_BUTTON_CLASS CSS class.

aiidalab_chemshell.common.utils.chemshell_button_style()

Return an HTML widget carrying the sleek button stylesheet.

Include the returned widget once in a layout that contains buttons styled via sleek_buttons(). The <style> block is global to the page, so a single instance is enough even if it appears multiple times.

Returns:

A zero-height widget holding the stylesheet.

Return type:

ipywidgets.HTML

Module contents

Package for general common components.