schrodinger.ui.qt.forcefield.metals_forcefield module

class schrodinger.ui.qt.forcefield.metals_forcefield.SettingsButtonState

Bases: Enum

SELECTED = 'selected'
WARNING = 'warning'
class schrodinger.ui.qt.forcefield.metals_forcefield.MetalsForcefieldPopUp(parent, *args, **kwargs)

Bases: InitMixin, PopUp

A pop-up widget for configuring and analyzing the Metals force field compatibility of given structures.

Usage Example:

pop_up = MetalsForcefieldPopUp(parent)
pop_up.registerInputGetter(get_input_system_callback)
pop_up.onInputChanged()

# After analysis
is_selected = pop_up.shouldUseMetalsForcefield()
if is_selected:
    prepared_file_path = pop_up.getAnalyzedOutput()
ui_module = <module 'schrodinger.ui.qt.forcefield.metals_forcefield_gui_dir.metals_forcefield_ui' from '/scr/buildbot/builds/build/internal/lib/python3.11/site-packages/schrodinger/ui/qt/forcefield/metals_forcefield_gui_dir/metals_forcefield_ui.py'>
__init__(parent, *args, **kwargs)
Parameters:

parent – Parent widget

initSetUp()

Creates widget from ui and stores it ui_widget.

Suggested subclass use: create and initialize subwidgets, and connect signals.

initSetDefaults()

Set widget to its default state. If the widget uses a model/mapper, it’s preferable to reset the widget state by resetting the model.

registerInputGetter(callback)

Register a callback to get the input system when analysis is run.

Note: The callback should return either a file path to the input system, a Structure object, or an iterable of Structure objects or a FEPMap object.

Parameters:

callback – A callable that returns the input system.

setAlwaysEnableMetalsCheckbox(enable: bool)

Set whether to enable the use of metals force field checkbox

Parameters:

enable – If True, allows the checkbox to remain always enabled else follows default enabling/disabling logic

shouldUseMetalsForcefield() bool

Return whether the Metals force field option is currently selected by the user.

getAnalyzedOutput() str

Get the file path to the prepared metal complex file.

Raises:

RuntimeError – If the analysis has not been run yet.

Returns:

The file path to the prepared metal complex file.

onInputChanged()

Reset the pop-up when input structures change.

Note: This has to be called by the parent widget when input structures change.

setup()

Subclass-specific initialization. Subclasses can re-implement this function with custom set up code.

enableMetalsForceFieldOption(enable: bool)

Enable or disable the Metals force field checkbox.

When _always_enable_metals_cb is True, the checkbox remains enabled as long as structures are present, regardless of the enable parameter.

Parameters:

enable – True to enable the checkbox, False to disable it.

class schrodinger.ui.qt.forcefield.metals_forcefield.MetalsForcefieldSettingsButton(parent, always_enable_metals_cb=False, *args, **kwargs)

Bases: InitMixin, FlatButtonWithPopUp

A button to open the Metals Force Field configuration pop-up.

Usage Example:

button = MetalsForcefieldSettingsButton(parent)
button.registerInputGetter(get_input_system_callback)
button.onInputChanged()

# After analysis
is_selected = button.shouldUseMetalsForcefield()
if is_selected:
    prepared_file_path = button.getAnalyzedOutput()
PRESSED_ICON_PATH = ':icons/settings-ON-light.png'
STYLESHEET_PROPERTY = 'state'
__init__(parent, always_enable_metals_cb=False, *args, **kwargs)
Parameters:
  • parent – Parent widget

  • always_enable_metals_cb – If True, keep the checkbox enabled when structures are present, regardless of analysis status

initSetUp()

Creates widget from ui and stores it ui_widget.

Suggested subclass use: create and initialize subwidgets, and connect signals.

initSetDefaults()

Set widget to its default state. If the widget uses a model/mapper, it’s preferable to reset the widget state by resetting the model.

registerInputGetter(callback)

Register a callback to get the input system when analysis is run.

Note: The callback should return either a file path to the input system, a Structure object, or an iterable of Structure objects or a FEPMap object.

Parameters:

callback – A callable that returns the input system.

onInputChanged()

Set the button to warning state if input changes and the Metals force field was previously selected. Also notify the pop-up of the input change.

Note: This has to be called by the parent widget when input changes.

shouldUseMetalsForcefield() bool

Return whether the Metals force field option is currently selected (checked) by the user in the pop-up.

getAnalyzedOutput() str

Get the file path to the prepared metal complex file

Raises:

RuntimeError – If the analysis has not been run yet.

Returns:

The file path to the prepared metal complex file.

updateStyleSheet()

Override to update the stylesheet based on the button state.

class schrodinger.ui.qt.forcefield.metals_forcefield.MetalsForcefieldMixin(*args, **kwargs)

Bases: object

A mixin class to add metals forcefield settings button functionality to a forcefield selector widget.

Note: Subclasses must implement the getOPLSVersion method

to return the selected OPLS version

Usage Example:

# Approach 1: Set via constructor parameter (preferred)
class MyForcefieldSelector(MetalsForcefieldMixin, ForcefieldSelector):
    def __init__(self, parent=None, supports_metals_forcefield=False):
        super().__init__(parent)

    def getOPLSVersion(self):
        return self._opls_version

# Approach 2: Set after initialization (if constructor parameter cannot be used)
class MyForcefieldSelector(MetalsForcefieldMixin, ForcefieldSelector):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setSupportsMetalsForcefield(supports_metals_forcefield=True)

    def getOPLSVersion(self):
        return self._opls_version
__init__(*args, **kwargs)
Parameters:
  • supports_metals_forcefield (bool, optional) – Whether to enable metals forcefield button functionality. Defaults to False.

  • always_enable_metals_cb (bool, optional) – If True, keep the metals forcefield checkbox enabled when structures are present, regardless of analysis status. Defaults to False.

setSupportsMetalsForcefield(supports_metals_forcefield: bool = False)

Set whether to support the metals settings button in the UI

Parameters:

supports_metals_forcefield – True to support metals settings button, False otherwise

resetMetalsForcefieldSettings()

Reset the metals forcefield settings button to default state.

registerInputGetter(callback)

Register a callback to get the input system for the metals forcefield configuration.

Note: The callback should return either a file path to the input system, a Structure object, or an iterable of Structure objects or a FEPMap object.

Parameters:

callback – A callable that returns the input system.

onInputChanged()

Notify the metals forcefield settings button of input changes.

Note: This has to be called by the parent widget when input changes.

shouldUseMetalsForcefield() bool

Return whether the metals forcefield option is currently selected.

Returns:

True if metals forcefield should be used, False otherwise

getMetalsForcefieldAnalyzedOutput() str

Get the file path to the prepared metal complex file from analysis.

Returns:

The file path to the prepared metal complex file

Raises:

RuntimeError – If metals settings button is not enabled or analysis not run

getOPLSVersion() OPLSVersion

Get the selected OPLS version.

Returns:

The selected OPLS version.

Raises:

NotImplementedError – This method must be implemented by subclasses.