adsorpy.gui module

GUI module of adsorpy.

class adsorpy.gui.RunSimulationInput[source]

Bases: TypedDict

Typed dictionary corresponding to the input of the run_simulation function.

rsa_config: RsaConfig | None
molecules_list: list[Polygon] | ndarray[tuple[int], dtype[Polygon]] | None
rotation_symmetries: int | list[int] | ndarray[tuple[int], dtype[int64]] | None
reflection_symmetries: bool | list[bool] | ndarray[tuple[int], dtype[bool]] | None
rotation_counts: int | list[int] | ndarray[tuple[int], dtype[int64]] | None
lattice_type: str
site_count: int | None
lattice_a: float | None
boundary_condition: str | None
simulation_type: str
dosing_distribution: list[float] | ndarray[tuple[int], dtype[float64]] | None
include_rejected_flux: bool
calculate_gap_size: bool
prlongoutput_flag: bool
plot_output_flag: bool
seed: int | Generator | None
timestep_limit: int
site_x_coords: ndarray[tuple[int], dtype[float64]] | None
site_y_coords: ndarray[tuple[int], dtype[float64]] | None
bounding_x_coord: float | None
bounding_y_coord: float | None
sticking_probability: float | list[float] | ndarray[tuple[int], dtype[float64]]
class adsorpy.gui.BatchSimulationInput[source]

Bases: RunSimulationInput

Typed dictionary with repeats argument.

repeats: int
class adsorpy.gui.FilePickerWidget(parent=None, placeholder='Select a file...')[source]

Bases: QWidget

Widget to help pick a file.

Initialise the file-picker widget.

Parameters:
  • parent (QWidget | None) – Parent widget.

  • placeholder (str) – Placeholder text to display in the selector box.

__init__(parent=None, placeholder='Select a file...')[source]

Initialise the file-picker widget.

Parameters:
  • parent (QWidget | None) – Parent widget.

  • placeholder (str) – Placeholder text to display in the selector box.

Return type:

None

_settings

Load the settings between sessions.

line_edit

Line edit to show the path and hold the actual value.

browse_button

Button to browse files.

setText(value)[source]

Set the file path text.

Parameters:

value (str) – The new file path text string.

Return type:

None

_fetch_setting(name, default, return_type=None)[source]

Fetch settings by checking if they exist followed by their value.

Parameters:
  • name (str) – The name of the setting to fetch.

  • default (TypeVar(T_inv, bool, int, str, float)) – The default value to return if the setting does not exist.

  • return_type (type[TypeVar(T_inv, bool, int, str, float)] | None) – The default return type if the setting exists. If not given, type(default) is used.

Return type:

TypeVar(T_inv, bool, int, str, float)

Returns:

The setting value if it exists, or else the default.

open_file_dialog()[source]

Dialogue to display when selecting a file.

Return type:

None

text()[source]

Get the text of the box being edited.

Return type:

str

Returns:

Text of the box being edited.

staticMetaObject = PySide6.QtCore.QMetaObject("FilePickerWidget" inherits "QWidget": Methods:   #33 type=Slot, signature=setText(QString), parameters=QString )
adsorpy.gui.set_content(widget, content)[source]

Set content of widget by matched content type.

Parameters:
Raises:

ValueError – If the content does not match the widget.

Return type:

None

adsorpy.gui.extract_param_docs(func)[source]

Extract parameters and their types from the docstring of a function.

This function is written for reStructuredText (rst) style docstrings.

Parameters:

func (Callable[[ParamSpec(P, bound= None)], TypeVar(R)]) – The function from which the docstring is extracted.

Return type:

dict[str, str]

Returns:

The dictionary of parameters and their types (as strings).

Raises:

ValueError – If the function has no docstring.

adsorpy.gui.from_geojson_str_to_polygon(geojson_str)[source]

Convert from GeoJSON string to Polygon and validate geometry.

Parameters:

geojson_str (str) – GeoJSON string to convert to Polygon.

Return type:

Polygon

Returns:

Shapely Polygon.

Raises:
  • TypeError – If the string does not generate a Polygon.

  • ValueError – If the generated Polygon is invalid.

  • GEOSException – If the string cannot be parsed as a geojson.

adsorpy.gui.validate_polygon(pol)[source]

Convert the GeoJSON dict data into a real Shapely Polygon or pass the data if it is already a Polygon.

Parameters:

pol (Polygon | str | dict[str, str | list[list[list[float]]]]) – Polygon or GeoJSON format.

Return type:

Polygon

Returns:

Polygon.

Raises:

TypeError – if the type cannot be converted to Polygon.

class adsorpy.gui.SimplePolygonDict[source]

Bases: TypedDict

Concise representation of a GeoJSON Polygon dictionary.

type: Literal['Polygon']
coordinates: list[list[list[float]]]
class adsorpy.gui.PydanticPolygon(shell=None, holes=None)[source]

Bases: Polygon

A Pydantic-native wrapper type for a Shapely Polygon.

Create a new Polygon geometry.

class adsorpy.gui.ParamWidgets[source]

Bases: TypedDict

Typed dictionary for the parameter widgets.

Variables:
  • radius – Radius of the molecule.

  • distance – Distance between the halves.

  • x_offset – Offset in x-direction.

  • y_offset – Offset in y-direction.

  • quad_segs – How many segments in a quarter circle.

  • scale – Scale of the molecule.

  • verts – Vertex count of the molecule.

  • roundedness – Roundness of the molecule.

  • file_name – File name of the molecule.

  • ignore_atoms – Ignore atoms in the molecule.

  • roll – Roll of the molecule.

  • pitch – Pitch of the molecule.

  • yaw – Yaw of the molecule.

  • z_trim – Z trim of the molecule.

  • reference_lattice_spacing – Reference lattice spacing of the molecule.

radius: QDoubleSpinBox
distance: QDoubleSpinBox
x_offset: QDoubleSpinBox
y_offset: QDoubleSpinBox
quad_segs: QSpinBox
scale: QDoubleSpinBox
verts: QSpinBox
roundedness: QDoubleSpinBox
file_name: FilePickerWidget
ignore_atoms: QLineEdit
roll: QDoubleSpinBox
pitch: QDoubleSpinBox
yaw: QDoubleSpinBox
z_trim: QDoubleSpinBox
reference_lattice_spacing: QDoubleSpinBox
class adsorpy.gui.SymmetryWidgets[source]

Bases: TypedDict

Typed dictionary for the molecule symmetry widgets.

Variables:
  • rot_sym – Rotation symmetry.

  • refl_sym – Reflection symmetry.

  • rot_cnt – Rotation count.

rot_sym: QSpinBox
refl_sym: QCheckBox
rot_cnt: QSpinBox
adsorpy.gui.is_valid_param(name)[source]

Check if a parameter name is valid.

Parameters:

name (str) – Name of the parameter.

Return type:

TypeGuard[Literal['radius', 'distance', 'x_offset', 'y_offset', 'quad_segs', 'scale', 'verts', 'roundedness', 'file_name', 'ignore_atoms', 'roll', 'pitch', 'yaw', 'z_trim', 'reference_lattice_spacing']]

Returns:

Boolean denoting validity.

class adsorpy.gui.MoleculeParameters[source]

Bases: TypedDict

Molecule parameters dataclass.

Variables:
  • index – Index of the molecule parameters configuration.

  • label – Label of the molecule parameters configuration, guaranteed to be unique.

  • function_name – Function name of the molecule.

  • refl_sym – Reflection symmetry.

  • rot_sym – Rotation symmetry.

  • rot_cnt – Rotation count (before accounting for reflection/rotation symmetry).

  • polygon – 2D polygon representation of the molecule.

  • settings – Function input of the molecule. Defaults to an empty dictionary.

index: Annotated[int, Ge(ge=0)]
label: str
function_name: str
refl_sym: bool
rot_sym: Annotated[int, Ge(ge=0)]
rot_cnt: Annotated[int, Gt(gt=0)]
polygon: PydanticPolygon
settings: dict[str, float | int | str]
class adsorpy.gui.SurfaceParameters[source]

Bases: TypedDict

Surface parameters dataclass.

Variables:
  • lattice_type – Surface lattice type.

  • site_count – Site count of the surface.

  • lattice_a – Lattice spacing of the surface.

  • seed – RNG seed.

lattice_type: Literal['hexagonal', 'triangular', 'honeycomb', 'square']
site_count: Annotated[int, Gt(gt=0)]
lattice_a: Annotated[float, Gt(gt=0)] | None
seed: int | None
class adsorpy.gui.MiscParameters[source]

Bases: TypedDict

Miscellaneous parameters dataclass.

Variables:
  • seed – RNG seed.

  • timestep_limit – Maximum allowed step count of the simulation.

seed: Annotated[int, Ge(ge=0)] | None
timestep_limit: Annotated[int, Ge(ge=0)] | None
class adsorpy.gui.ZoomableSvgWidget(parent=None)[source]

Bases: QSvgWidget

SVG widget with zoom capabilities and an absolute floating save button.

Initialise the ZoomableSvgWidget.

Parameters:

parent (QSvgWidget | None) – Parent QSvgWidget.

graphics_changed
__init__(parent=None)[source]

Initialise the ZoomableSvgWidget.

Parameters:

parent (QSvgWidget | None) – Parent QSvgWidget.

Return type:

None

current_svg_path: str | None
_current_svg_bytes: bytes | None
resizeEvent(event)[source]

Handle dynamic window resizes by pinning the button to the bottom right corner.

Parameters:

event (QResizeEvent) – Resize event object.

Return type:

None

load(contents)[source]

Override native load to accept raw bytes, strings, or paths while caching data.

Parameters:

contents (bytes | str | Path | QByteArray | memoryview[int] | bytearray) – Raw SVG byte content, string path, or Pathlib instance.

Return type:

None

load_svg(file_path)[source]

Public convenience method that accepts Pathlib or strings.

Parameters:

file_path (Path | str) – Path to the file to load.

Return type:

None

export_graphics()[source]

Handle exporting the SVG payload with native file handling and proper scaling.

Return type:

None

wheelEvent(event)[source]

Override scroll wheel events to support Zoom and Horizontal Pan.

Parameters:

event (QWheelEvent) – QWheelEvent for when scrolling occurs.

Return type:

None

staticMetaObject = PySide6.QtCore.QMetaObject("ZoomableSvgWidget" inherits "QSvgWidget": Methods:   #35 type=Signal, signature=graphics_changed(bool), parameters=bool )
class adsorpy.gui.AutoStateMeta(name, bases, attrs)[source]

Bases: ObjectType, Generic[P_mol, T_qobj]

Metaclass for AppState to automatically communicate between tabs.

This metaclass scans the fields class variable and dynamically generates a private storage field (_field), a public property (field), and a Qt notification signal (fieldChanged) for each entry.

Variables:

fields – A dictionary mapping state field names to their expected types.

Parameters:
Return type:

AutoStateMeta[P_mol, T_qobj]

Create an AutoState class instance.

Parameters:
  • name (str) – The name of the class.

  • bases (tuple[type, ...]) – The base classes.

  • attrs (dict[str, object]) – The class attributes.

Returns:

The AutoState class instance.

Return type:

AutoStateMeta[P_mol, T_qobj]

fields: ClassVar[dict[str, type]] = {'coverages': 'tuple[DistArray, ...] | None', 'fraction_of_covered_area': 'tuple[DistArray, ...] | None', 'gap_size_distribution': 'DistArray | None', 'misc_params': 'MiscParameters | None', 'molecule_param_list': 'list[MoleculeParameters] | None', 'seed_input': 'QLineEdit', 'step_limit': 'QSpinBox', 'surface_params': 'SurfaceParameters | None'}
class adsorpy.gui.AppState(*args, **kwargs)[source]

Bases: QObject

AppState class to communicate between tabs.

This class maintains synchronised states across the user interface. Changes to any property automatically emit a corresponding <property>Changed signal.

Variables:
  • seed_input – The Qt input widget holding the seed value.

  • step_limit – The maximum allowable processing steps.

  • misc_params – Miscellaneous parameters.

  • molecule_param_list – Settings of the molecule(s).

  • surface_params – Settings of the surface.

  • coverages – Coverage of simulation results.

  • fraction_of_covered_area – Fraction of covered area of simulation results.

  • gap_size_distribution – Gap size distribution of simulation results.

Parameters:
  • args (P_mol.args)

  • kwargs (P_mol.kwargs)

Return type:

T_qobj

property seed_input: object

Get the value.

Parameters:

private_name (str) – private name.

Returns:

the getattr() object.

property step_limit: object

Get the value.

Parameters:

private_name (str) – private name.

Returns:

the getattr() object.

property misc_params: object

Get the value.

Parameters:

private_name (str) – private name.

Returns:

the getattr() object.

property molecule_param_list: object

Get the value.

Parameters:

private_name (str) – private name.

Returns:

the getattr() object.

property surface_params: object

Get the value.

Parameters:

private_name (str) – private name.

Returns:

the getattr() object.

property coverages: object

Get the value.

Parameters:

private_name (str) – private name.

Returns:

the getattr() object.

property fraction_of_covered_area: object

Get the value.

Parameters:

private_name (str) – private name.

Returns:

the getattr() object.

property gap_size_distribution: object

Get the value.

Parameters:

private_name (str) – private name.

Returns:

the getattr() object.

coveragesChanged
fraction_of_covered_areaChanged
gap_size_distributionChanged
misc_paramsChanged
molecule_param_listChanged
seed_inputChanged
staticMetaObject = PySide6.QtCore.QMetaObject("AppState" inherits "QObject": Methods:   #4 type=Signal, signature=seed_inputChanged(PyObject), parameters=PyObject   #5 type=Signal, signature=step_limitChanged(PyObject), parameters=PyObject   #6 type=Signal, signature=misc_paramsChanged(PyObject), parameters=PyObject   #7 type=Signal, signature=molecule_param_listChanged(PyObject), parameters=PyObject   #8 type=Signal, signature=surface_paramsChanged(PyObject), parameters=PyObject   #9 type=Signal, signature=coveragesChanged(PyObject), parameters=PyObject   #10 type=Signal, signature=fraction_of_covered_areaChanged(PyObject), parameters=PyObject   #11 type=Signal, signature=gap_size_distributionChanged(PyObject), parameters=PyObject )
step_limitChanged
surface_paramsChanged
class adsorpy.gui.AdsorpyGUI[source]

Bases: QMainWindow

Main window application shell for the AdsorPy simulation engine framework.

Coordinates the primary window frame, top level configuration menu bars, and hooks up the shared global data state across tab layout frames.

Variables:

window_resized – Signal of (width, height) emitted when the main application window dimensions are modified.

Initialise frame parameters, global context caches, and child windows.

This is the main window of the AdsorPy simulation application.

window_resized: Signal
__init__()[source]

Initialise frame parameters, global context caches, and child windows.

This is the main window of the AdsorPy simulation application.

Return type:

None

state

Shared application runtime cache synchronised across all view frames.

_settings

Persistent platform configuration handle cached between user runtime sessions.

_init_menu_bar()[source]

Construct the top level application drop-down menu navigation bars.

Return type:

None

_init_tabs()[source]

Assemble the central tab frame layout and register sub-dashboards.

Return type:

None

_save_settings_json()[source]

Save settings to JSON file.

Return type:

None

_load_settings_json()[source]

Load, validate, and version-check simulation settings profiles.

Return type:

None

_fetch_setting(name, default, return_type=None)[source]

Fetch settings by checking if they exist followed by their value.

Parameters:
  • name (str) – The name of the setting to fetch.

  • default (TypeVar(T_inv, bool, int, str, float)) – The default value to return if the setting does not exist.

  • return_type (type[TypeVar(T_inv, bool, int, str, float)] | None) – The default return type if the setting exists. If not given, type(default) is used.

Return type:

TypeVar(T_inv, bool, int, str, float)

Returns:

The setting value if it exists, or else the default.

resizeEvent(event)[source]

Trigger automatically whenever the window size changes.

Parameters:

event (QResizeEvent) – QResizeEvent, an event changing the window size.

Return type:

None

staticMetaObject = PySide6.QtCore.QMetaObject("AdsorpyGUI" inherits "QMainWindow": Methods:   #39 type=Signal, signature=window_resized(int,int), parameters=int, int )
class adsorpy.gui.GeneralSettings(state)[source]

Bases: QWidget

General simulation configuration dashboard tab view.

Provides inputs for setting the execution step boundaries, absolute pseudo-random number generator seeds, and renders real-time structural vector tracking maps.

Initialise validation engines and build structural control modules.

Parameters:

state (AppState) – AppState object for communication between tab widgets.

__init__(state)[source]

Initialise validation engines and build structural control modules.

Parameters:

state (AppState) – AppState object for communication between tab widgets.

Return type:

None

_settings

Persistent platform configuration handle cached between user runtime sessions.

state

App state object for communication between tab widgets.

bg_signals

Signals for the simulation background tasks.

input_metadata: BatchSimulationInput

Dict of input values, to be stored as metadata.

_fetch_setting(name, default, return_type=None)[source]

Fetch settings by checking if they exist followed by their value.

Parameters:
  • name (str) – The name of the setting to fetch.

  • default (TypeVar(T_inv, bool, int, str, float)) – The default value to return if the setting does not exist.

  • return_type (type[TypeVar(T_inv, bool, int, str, float)] | None) – The default return type if the setting exists. If not given, type(default) is used.

Return type:

TypeVar(T_inv, bool, int, str, float)

Returns:

The setting value if it exists, or else the default.

_init_validators()[source]

Instantiate validation models for text constraint processing.

Return type:

None

_init_controls()[source]

Assemble environment settings selectors and connect state triggers.

Return type:

QVBoxLayout

Returns:

A populated vertical layout holding runtime widgets.

_change_bulk_run_value(run_count)[source]

Change the bulk run button tooltip.

Parameters:

run_count (int) – The number of times to repeat the simulation.

Return type:

None

_init_feedback_textboxes()[source]

Provide text to show the user whether data has been loaded.

Return type:

QGridLayout

_on_surface_changed(params)[source]

Fire instantly when surface_params changes in another tab.

Return type:

None

Parameters:

params (SurfaceParameters | None)

_on_molecules_changed(mol_list)[source]

Fire instantly when molecule_param_list changes in another tab.

Return type:

None

Parameters:

mol_list (list[MoleculeParameters] | None)

_init_svg_view()[source]

Construct the graphics frame and isolate structural canvas layouts.

Return type:

QSvgWidget

Returns:

An isolated vector viewport container canvas.

_assemble_layout(left, center)[source]

Unify sub-panels inside the scalable horizontal splitter framework.

Parameters:
  • left (QWidget) – QWidget to place sub-panels inside.

  • center (QScrollArea) – QScrollArea to place sub-panels inside.

Return type:

None

static get_run_sim_default(name)[source]

Get the default value of a function.

Parameters:

name (str) – Name of the parameter.

Return type:

str | int | float | None

Returns:

Default value of the parameter.

Raises:
  • ValueError – If the parameter has no default value.

  • KeyError – If the parameter does not exist.

_prepare_simulation_inputs()[source]

Validate UI components and format into a unified dictionary for the simulation engine.

Return type:

BatchSimulationInput

Returns:

Dict as input for run_simulation if successful, None if validation fails.

run_simulation()[source]

Run exactly one instance of the simulation engine.

Return type:

None

run_batch_simulation()[source]

Run N parallel instances using Dask with safe child-spawned seeds.

Return type:

None

_on_simulation_complete(simulation_outputs)[source]

Run lightweight plotting pipeline back on the UI thread.

Return type:

None

Returns:

Simulation outputs.

Parameters:

simulation_outputs (tuple[list[int], ndarray[tuple[int], dtype[float64]], int | Generator, tuple[ndarray[tuple[int], dtype[int64]], ...], ndarray[tuple[int], dtype[int64]], Simulator])

_on_batch_simulation_complete(batch_outputs)[source]

Process multiple parallel output tuples sent back from the dask pool cluster.

Parameters:

batch_outputs (list[tuple[ndarray[tuple[int], dtype[double]], ndarray[tuple[int], dtype[double]], ndarray[tuple[int], dtype[double]]]]) – list of output values.

Return type:

None

_on_simulation_error(exception)[source]

Fallback callback handling background core crashes safely.

Parameters:

exception (Exception) – Exception raised during simulation.

Return type:

None

export_results()[source]

Export the simulation results to JSON, HDF5, Pickle, or zipped CSVs.

Return type:

None

error(msg)[source]

Handle the errors.

Parameters:

msg (str) – Error message to display in a new window.

Return type:

None

staticMetaObject = PySide6.QtCore.QMetaObject("GeneralSettings" inherits "QWidget": )
class adsorpy.gui.MoleculeGeneration(state)[source]

Bases: QWidget

Molecule layout configuration dashboard tab view.

Handles dynamic generation of geometric molecule polygon shapes via reflective library lookups, updates parameters on the fly, and lists them inside a tracking layout.

Initialise settings storage engines and compile separate view columns.

Parameters:

state (AppState) – AppState instance for communication between tabs.

__init__(state)[source]

Initialise settings storage engines and compile separate view columns.

Parameters:

state (AppState) – AppState instance for communication between tabs.

Return type:

None

param_widgets: ParamWidgets

“Parameter widgets derived from molecule function signatures.

opt_checkboxes: dict[str, QCheckBox]

“Optional checkbox widgets derived from molecule function signatures.

_settings

Persistent platform configuration handle cached between user runtime sessions.

state

Shared application state cache container.

_init_data_storage()[source]

Initialise internal state tracking arrays and counting iterations.

Return type:

None

_build_left_panel()[source]

Construct the left parameters control dashboard and link active list triggers.

The left panel is populated by the parameters of a molecule selected from adsorpy.mol_lib. The molecules are kept in a dropdown menu based on a filtered list of the molecule functions. Parameters are taken from type hints. Type hints determine whether a box is a spinbox, textbox, optional, etc.

Return type:

QWidget

Returns:

A populated structural container pane acting as the configuration panel.

_update_func_dropdown(name)[source]

Update when func dropdown changes.

Parameters:

name (str) – The name of the dropdown option.

Return type:

None

static _discover_molecule_generators()[source]

Isolate reflection logic filtering usable library structural definitions.

Return type:

dict[str, Callable[[ParamSpec(P_mol, bound= None)], Polygon]]

Returns:

A sorted lookup dict mapping valid function names to execution references.

_build_center_panel()[source]

Construct the viewport frame area housing the centered vector graphics.

Return type:

QScrollArea

Returns:

A scroll area wrapper managing the interactive central viewport.

_build_right_panel()[source]

Construct the right tracking grid columns managing existing records.

Return type:

QWidget

Returns:

A secondary control panel listing items added to the current system context.

_assemble_layout(left, center, right)[source]

Unify sub-panels inside the scalable horizontal splitter framework.

Parameters:
  • left (QWidget) – Parameter selection pane widget.

  • center (QScrollArea) – Scroll pane holding vector outputs.

  • right (QWidget) – Management column listing generated arrays.

Return type:

None

_fetch_setting(name, default, return_type=None)[source]

Fetch settings by checking if they exist followed by their value.

Parameters:
  • name (str) – The name of the setting to fetch.

  • default (TypeVar(T_inv, bool, int, str, float)) – The default value to return if the setting does not exist.

  • return_type (type[TypeVar(T_inv, bool, int, str, float)] | None) – The default return type if the setting exists. If not given, type(default) is used.

Return type:

TypeVar(T_inv, bool, int, str, float)

Returns:

The setting value if it exists, or else the default.

_delete_previous_layout()[source]

Recursively delete the layout of the previous molecule parameters.

Return type:

None

build_param_inputs(func_name)[source]

Inspect a generator function signature to build a parameter layout frame.

Clears existing child controls, parses required types from function type annotations, configures dynamic tooltip data, and maps live text update signalling pipelines.

Parameters:

func_name (str) – Target library function name registry string.

Return type:

None

static _create_param_widget(annotation, default)[source]

Create param widget using factory strategy translating library type hints to matching user input views.

Parameters:
  • annotation (str) – The raw string signature representation of the type hint.

  • default (str | float | Parameter) – The underlying fallback data default value assigned to the flag.

Return type:

QSpinBox | QDoubleSpinBox | QLineEdit | FilePickerWidget

Returns:

A customised interactive input container widget subclass.

Raises:

TypeError – If an unmapped or exotic data structure type is processed.

sync_list_order(old_index, new_index)[source]

Take the row transformation from list A and applies it programmatically to list B.

The ReorderableListWidget allows for items to be drag/dropped. This function links the reordering.

Parameters:
  • old_index (int) – The original index of the item changing position.

  • new_index (int) – The new index to which the item is moved.

Return type:

None

_build_symmetry_controls()[source]

Assemble the geometric shape matrix transformation property grid layouts.

Return type:

None

_build_action_buttons()[source]

Map active interactive preview checkboxes and form processing buttons.

Return type:

None

_update_symmetry_tooltip(is_checked)[source]

Update the tooltip of the rotation symmetry label and spinbox.

Parameters:

is_checked (bool) – True if there is reflection symmetry, False otherwise.

Return type:

None

launch_first_time_loader()[source]

Launch the first time loader from molecule_lib.

If no file path has been provided, prompt the user to add one before running the first time loader.

Return type:

None

get_param_values()[source]

Extract current user inputs from widgets back into a data dictionary.

Return type:

dict[str, float | int | str]

Returns:

Dictionary containing the key-value pairs of the parameters.

error(msg)[source]

Handle the errors.

Please open a ticket if this happens when it should not.

Parameters:

msg (str) – Error message.

Return type:

None

plot_molecule()[source]

Plot the molecule.

Return type:

None

add_molecule()[source]

Add a molecule to the list of molecules to use.

Return type:

None

delete_molecule()[source]

Delete the current selected molecule.

Return type:

None

show_molecule_settings()[source]

Show the settings of this molecule.

Return type:

None

staticMetaObject = PySide6.QtCore.QMetaObject("MoleculeGeneration" inherits "QWidget": )
class adsorpy.gui.SurfaceGeneration(state)[source]

Bases: QWidget

Surface generation dashboard tab view.

Provides control inputs for generating geometric lattice surfaces and displays the resulting surface within an interactive, centered viewer.

Initialise user widgets and assemble geometric layout wrappers.

Parameters:

state (AppState) – AppState object to share information between tabs.

__init__(state)[source]

Initialise user widgets and assemble geometric layout wrappers.

Parameters:

state (AppState) – AppState object to share information between tabs.

Return type:

None

state

Shared application state cache container.

surface_count: int

Default surface site count.

real_surface_count: int

Default computed surface site count.

stored_params: SurfaceParameters | None

Parameters of the surface, to be communicated between tabs.

main_splitter

Main splitter of the window.

_init_validators()[source]

Instantiate validation models for text constraint processing.

Return type:

None

_build_left_panel()[source]

Construct the left controls container pane layout.

Return type:

QWidget

Returns:

A populated structural layout container.

staticMetaObject = PySide6.QtCore.QMetaObject("SurfaceGeneration" inherits "QWidget": )
_init_svg_view()[source]

Construct the graphics frame and isolate structural canvas centering.

Return type:

QScrollArea

Returns:

A scroll container managing the viewport window frame.

_get_real_surface_site_count()[source]

Get the real surface site count.

Return type:

None

generate_surface()[source]

Generate an example surface.

Return type:

None

error(msg)[source]

Handle the errors.

Parameters:

msg (str) – Error message to display in a new window.

Return type:

None

class adsorpy.gui.BackgroundTaskSignals[source]

Bases: QObject

Signals for the generic background worker.

Variables:
  • finished – Emits the raw output data package.

  • progress – Emits the current simulation progress as a percentage integer.

  • progress – Emits the integer percentage (0 to 100).

staticMetaObject = PySide6.QtCore.QMetaObject("BackgroundTaskSignals" inherits "QObject": Methods:   #4 type=Signal, signature=finished(PyObject), parameters=PyObject   #5 type=Signal, signature=error(PyObject), parameters=PyObject   #6 type=Signal, signature=progress(int), parameters=int )
finished
error
progress
class adsorpy.gui.BackgroundTask(func, *args, **kwargs)[source]

Bases: QRunnable, Generic[P, R]

Executes a single blocking function call in the background thread pool.

Initialise the BackgroundTask.

Parameters:
__init__(func, *args, **kwargs)[source]

Initialise the BackgroundTask.

Parameters:
Return type:

None

func: Callable[[P], R]
run()[source]

Run the background task.

Return type:

None

class adsorpy.gui.ReorderableListWidget(parent=None)[source]

Bases: QListWidget

Reorderable list widget.

Variables:

itemsMoved – Custom signal that emits (old_row_idx, new_row_idx).

Parameters:

parent (QListWidget | None)

Initialise the ReorderableListWidget.

Parameters:

parent (QListWidget | None) – Parent widget.

staticMetaObject = PySide6.QtCore.QMetaObject("ReorderableListWidget" inherits "QListWidget": Methods:   #83 type=Signal, signature=itemsMoved(int,int), parameters=int, int )
itemsMoved
__init__(parent=None)[source]

Initialise the ReorderableListWidget.

Parameters:

parent (QListWidget | None) – Parent widget.

Return type:

None

dropEvent(event)[source]

Overridden drop event method.

Define a new drop event that emits the old and the new position.

Parameters:

event (QDropEvent) – Event object.

Return type:

None

adsorpy.gui._make_horizontal_line()[source]

Create a horizontal line widget using a QFrame object.

Return type:

QFrame

Returns:

A horizontal line widget.

adsorpy.gui.main()[source]

Launch the adsorpy GUI.

Return type:

int

Returns:

Return code.