schrodinger.ui.qt.forcefield.forcefield_selector module

class schrodinger.ui.qt.forcefield.forcefield_selector.OPLSForcefieldSelector(*args, **kwargs)

Bases: MapperMixin, BaseWidget

Selector for OPLS forcefields. Selector shows OPLS_2005, OPLS4, and OPLS5 versions by default

Selector is synced with Maestro OPLS version, whether to use custom OPLS and opls dir preferences. When opls dir in preferences is changed, the selector is updated to use the new opls dir.

The OPLSForcefieldSelector does not directly handle oplsdir changes made in the UI. Instead, the FFSettingsButton interacts directly with Maestro to update the oplsdir in preferences. These changes are then propagated back here via the oplsdirChanged signal.

Usage:: >>> selector = OPLSForcefieldSelector() >>> selector.setAllowedOPLSVersions([OPLS_2005, OPLS5]) # use non-default versions >>> is_valid, msg = selector.validate() >>> assert is_valid, msg >>> selector.model <Concrete OPLSForcefield {‘version’: ‘OPLS4’, ‘opls_dir’: ‘/path/to/opls’}>

model_class

alias of OPLSForcefield

ui_module = <module 'schrodinger.ui.qt.forcefield.opls_forcefield_selector_ui' from '/scr/buildbot/builds/build/internal/lib/python3.11/site-packages/schrodinger/ui/qt/forcefield/opls_forcefield_selector_ui.py'>
initSetUp()

Creates widget from ui and stores it ui_widget.

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

initSetDefaults()

@overrides: widgetmixins.InitMixin

defineMappings()

Override this in the subclass to define mappings. Should return a list of tuples [(<target>, <param>)]. Targets can be:

  1. a basic widget, like QLineEdit or QComboBox

  2. a custom object that inherits MapperMixin or TargetMixin

  3. a TargetSpec instance

  4. a slot

For common widgets, standard signals and getter/setter methods will be used, as defined in mappers._get_default_access_names().

For more fine-grained custom control, instantiate a TargetSpec object, which allows custom setters, getters, and signals to be specified.

Supplying a slot as the first element of the tuple is equivalent to providing TargetSpec(slot=my_slot).

Note that all target slots are triggered on setModel() as well as in response to the specified signal.

The param is an abstract param reference, e.g. MyModel.my_param.

Example:

def defineMappings(self):
    combo = self.style_combo
    return [(self.name_le, MyModel.name),
            (TargetSpec(combo,
                    getter=combo.currentText,
                    setter=combo.setCurrentText), MyModel.style),
            (self.coord_widget, MyModel.coord),
            (self._onASLTextChanged, MyModel.asl_text)]
initFinalize()

Suggested subclass use: perform any remaining initialization.

setAllowedOPLSVersions(versions: Iterable[OPLSVersion])

Set allowed OPLS versions with a license check. If the version is not supported, exclude it.

validate() tuple[bool, str]

Validate the OPLS version and OPLS dir.

See _validateOPLSDir for details on OPLS dir validation.

Returns:

Tuple containing whether OPLS settings are valid, and a non-empty string if the OPLS settings are invalid.

syncMaestroPreferences() None

Synchronize this widget’s state with the current Maestro global defaults

Default = 'default'
FooterContrast = 'footer_contrast'
Panel = 'panel'
schrodinger.ui.qt.forcefield.forcefield_selector.main()