mdadash.backend.kernel.core

Kernel core where MDAnalysis code runs

Functions

init_n_universes(data)

Initialize n universes in UniverseManager

Classes

CommHandler()

Comm Handler

UniverseManager(_wm, _comm_handler)

Universe Manager

WidgetsComm(_wm, _comm_handler)

Widgets Communication

class mdadash.backend.kernel.core.CommHandler[source]

Bases: object

Comm Handler

This class is responsible for handling all the communication to and from this kernel. This is the class that interfaces with the KernelManager on the server side.

register_handler(msg_type: str, handler_func: callable) None[source]

Register a handler function for a message type

Parameters:
  • msg_type (str) – A message type to identify the handler

  • handler_func (callable) – The handler function to invoke when a message with this message type is received

send(msg: dict) None[source]

Send a message (response) back on the comm

Parameters:

msg (dict) – A generic message dictionary

class mdadash.backend.kernel.core.UniverseManager(_wm: WidgetManager, _comm_handler: CommHandler)[source]

Bases: object

Universe Manager

This class is responsible for managing all MDAnalysis universes. It has handlers to interact with the MD simulation. These handlers are invoked by comm messages sent from the server.

This also provides an iterable and indexable access to the individual universes.

connect_to_simulations(universe_configs: list[dict]) None[source]

Connect to MD simulations

Parameters:

universe_configs (list[dict]) – A list of configurations for universe(s) creation. Each dict has universe related config like topology, trajectory, imdclient params, user-defined kwargs etc

disconnect_from_simulations(_data: dict) None[source]

Disconnect from MD simulations

init_n_universes(n: int) None[source]

Initialize array for n universes

Parameters:

n (int) – Number of universes to initialize

pause_simulations(_data: dict) None[source]

Pause MD simulations

resume_simulations(_data: dict) None[source]

Resume MD simulations

class mdadash.backend.kernel.core.WidgetsComm(_wm: WidgetManager, _comm_handler: CommHandler)[source]

Bases: object

Widgets Communication

This class is responsible for handling communications related to widgets. It uses WidgetManager instance and communicates via CommHandler back to the server from this kernel.

add_instance(data: dict) dict[source]

Add widget instance based on registered widget name

get_available_widgets(_data: dict)[source]

Send list of available widgets - name and description

remove_instance(data: dict) dict[source]

Remove widget instance based on uuid

mdadash.backend.kernel.core.init_n_universes(data: dict) None[source]

Initialize n universes in UniverseManager