schrodinger.ui.qt.forcefield.ffselector module¶
- class schrodinger.ui.qt.forcefield.ffselector.ForceFieldSelector(layout=None, show_when_no_choice=False, parent=None, stretch=True, allow_opls5=False, add_customize_force_field=True)¶
Bases:
PyQt6.QtWidgets.QFrame
- __init__(layout=None, show_when_no_choice=False, parent=None, stretch=True, allow_opls5=False, add_customize_force_field=True)¶
Initialize the force field selector widget
- Parameters
layout (
PyQt5.QtWidgets.QLayout
) – The layout to add this widget toshow_when_no_choice (bool) – Whether to show the ffs even if the user has no choice of force fields
parent (
PyQt5.QtWidgets.QWidget
) – The Qt parentstretch (bool) – If layout is supplied, the default behavior is to add a stretch to the layout after this Frame is added to it. Setting stretch to False prevents the stretch from being added to the layout. It has no effect if layout is not provided.
allow_opls5 (bool) – whether or not to show the OPLS5 option in the menu
add_customize_force_field (bool) – Whether or not to add the customize force field widgets.
- property has_valid_opls_dir¶
Checks whether Maestro preferences point to a valid S-OPLS directory.
- Returns
whether the OPLS dir is valid
- Return type
bool
- setF16Only()¶
Reset force field menu and include only F16 force field in the menu. If OPLS license is not available exception is raised. This method is intended to be used only with panels that require OPLS license to run.
- getSelectionForceField(index: Optional[int] = None) str ¶
Return the string representation of the selected force field. If index is passed, the force field name at that index is returned. Because Maestro panels using this selector set options based on the common OPLS names, extracted names are regularized to be compatible.
- Parameters
index – combo box index
- Returns
the name corresponding to the selected force field
- setSelectionForceField(force_field_int)¶
Set the force_field_menu’s current text to the name matching the force field int. Will raise a key error if the int does not correspond to a possible selection and a value error if the int does not correspond to an available selection.
:param force_field_int the integer corresponding to the force field :type force_field int :return: None
- getSelectionForceFieldInt()¶
Return the integer representation of the current force field. For names without mappable integers (i.e. those loaded by the MaestroForceFieldSelector) -1 is returned.
- Return type
int
- getCustomOPLSDIR()¶
Return OPLSDIR suitable for passing to jobcontrol through -OPLSDIR or None if usage of a custom directory is not selected.
- Return type
str
- Returns
string of OPLS dir or None custom forcefield not selected
- sanitizeCustomOPLSDir(allow_default_dialog=True)¶
Sanitize the custom OPLS directory if a custom OPLS dir is used.
If a custom OPLS directory is used that is not acceptable a dialog will be presented to allow the user to abort, or use the default parameters, see also
validate_opls_dir
.Note: A side-effect of this method call is that the custom force field checkbox may be unchecked. This means that
self.getCustomOPLSDir()
has to be called (again) if this method returns True in order to determine what the actual opls directory is that should be used.- Parameters
allow_default_dialog (bool) – whether the user may be presented with the dialog allowing them to run with the default OPLS dir.
- Returns
False if the custom OPLS dir choice is not acceptable. True in all other cases
- Return type
bool
- update()¶
Synchronize the maestro preferences with the selector.
- hide()¶
Hide all the children of the QFrame object and then hide the QFrame itself.
- class schrodinger.ui.qt.forcefield.ffselector.ForceFieldSelectorUi(parent=None)¶
Bases:
schrodinger.ui.qt.forcefield.ffselector.ForceFieldSelector
A forcefield selector that accepts the standard QFrame initialization arguments so it can be used directly in Qt Designer by promoting a QFrame.
- __init__(parent=None)¶
Initialize the force field selector widget
- Parameters
layout (
PyQt5.QtWidgets.QLayout
) – The layout to add this widget toshow_when_no_choice (bool) – Whether to show the ffs even if the user has no choice of force fields
parent (
PyQt5.QtWidgets.QWidget
) – The Qt parentstretch (bool) – If layout is supplied, the default behavior is to add a stretch to the layout after this Frame is added to it. Setting stretch to False prevents the stretch from being added to the layout. It has no effect if layout is not provided.
allow_opls5 (bool) – whether or not to show the OPLS5 option in the menu
add_customize_force_field (bool) – Whether or not to add the customize force field widgets.
- class schrodinger.ui.qt.forcefield.ffselector.MacrocycleForceFieldSelector(layout=None, show_when_no_choice=False, parent=None, stretch=True, allow_opls5=False, add_customize_force_field=True)¶
Bases:
schrodinger.ui.qt.forcefield.ffselector.ForceFieldSelector
A forcefield widget that contains an entry for MMFFs
- class schrodinger.ui.qt.forcefield.ffselector.ffComboBox(text, side='left', stretch=True, after_label='', layout=None, tip='', **kwargs)¶
Bases:
schrodinger.ui.qt.swidgets.SLabeledComboBox
- showEvent(event)¶
Override show event to update the default value in case the user has updated maestro preferences.
- class schrodinger.ui.qt.forcefield.ffselector.MaestroForceFieldSelector(panel, mmod_ffoptions=None, *args, **kwargs)¶
Bases:
schrodinger.ui.qt.forcefield.ffselector.ForceFieldSelector
This class is intened to use only for Maestro cpp panels that uses force field selectors to set force field names
Signals emitted by this class.
- Variables
forcefieldOptionChanged – Signal emitted when the force field selection is changed. Emitted with: - the current selection of force field - the cpp panel name in which the selector is embedded
useCustomforceFieldToggled – Signal emitted when ‘Use custom force field’ toggle state is changed. Emitted with: - the cpp panel name in which the selector is embedded - the current toggle state
- forcefieldOptionChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- useCustomForceFieldToggled¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- __init__(panel, mmod_ffoptions=None, *args, **kwargs)¶
Initialize the Maestro force field selector widget
- Parameters
panel (str) – is the cpp panel name (used with showpanel command in Maestro)
mmod_ffoptions (list or None) – the list of forcefield names supported by macromodel cpp panel
- setForceField(name: str)¶
Set the force_field_menu’s current text to the name matching the force field name. Because Maestro panels using this selector set with values based on the common OPLS names, they must be translated to available display names.
- Parameters
name – the name corresponding to the force field
- getForceFieldOptions() List[str] ¶
Obtain names for all available force field choices in the selector. Because Maestro panels using this selector set options based on the common OPLS names, extracted names are regularized to be compatible.
- Returns
all available combo box options
- class schrodinger.ui.qt.forcefield.ffselector.MaestroPreferenceForceFieldSelector(panel, mmod_ffoptions, *args, **kwargs)¶
Bases:
schrodinger.ui.qt.forcefield.ffselector.MaestroForceFieldSelector
A specialized force field selector widget for the preference panel in Maestro.Additional force field items are added at the end of the list.
In contrast to the default behavior where additional items are added at the start, for the preference panel, they are added at the end.
- __init__(panel, mmod_ffoptions, *args, **kwargs)¶
Initialize the Maestro preference force field selector widget.
- Parameters
panel – The panel in which the selector is contained.
mmod_ffoptions – Additional force field options.
- schrodinger.ui.qt.forcefield.ffselector.get_maestro_forcefield_selector(panel, default_opls, mmod_ffoptions, show_when_no_choice=False, add_customize_force_field=True)¶
This function is called from Maestro. Creates an instance of the ‘MaestroPreferenceForceFieldSelector’ widget in case of ‘prefer’ panel and ‘MaestroForceFieldSelector’ widget for all other panels and passes on the QWidget to Maestro via MaestroHub::setForceFieldSelectorWidget SIGNAL. Also hooks up the SIGNAL emitted from MaestroForceFieldSelector class to MaestroHub::emitffselectorOptionChanged Slot
See ForceFieldSelector for arguments documentation.
- Parameters
panel (str) – C++ panel name in which force field selector is embedded
default_opls – default force field option to select
mmod_ffoptions (list or None) – list of forcefield options supported by given mmod panel