schrodinger.ui.qt.forcefield.forcefield module

Contains Force Field selector widgets

schrodinger.ui.qt.forcefield.forcefield.get_custom_opls_dir()

Returns current project opls path if present, else returns global preference custom opls path.

Returns

path to the OPLS directory. no validation occurs for returned directories.

Return type

str

schrodinger.ui.qt.forcefield.forcefield.get_opls_version_display_name(opls_version: pymmlibs.OPLSVersion) str
schrodinger.ui.qt.forcefield.forcefield.get_default_opls_version(customizable_only: bool = True) pymmlibs.OPLSVersion

Returns the default OPLS version to use. Note that The return value is actually an int. “Customizable” means that the OPLS version supports generating missing ff parameters using ffbuilder.

schrodinger.ui.qt.forcefield.forcefield.has_valid_custom_OPLS_preference()
Returns

whether the custom OPLS directory is a valid S-OPLS path

Return type

bool

class schrodinger.ui.qt.forcefield.forcefield.OPLSDirResult(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.IntEnum

Return object for validate_opls_dir function

ABORT = 0
VALID = 1
DEFAULT = 2
class schrodinger.ui.qt.forcefield.forcefield.OPLSValidator(parent: PyQt6.QtWidgets.QWidget)

Bases: object

Validates OPLS-related settings. Meant for use by GUIs that may need to block other code while performing validation.

INCOMPATIBLE_PARAMS_MSG = '<html><p>Your customizations\n        <a style="text-decoration:none;color:#3D3DF9;" href="opls_path">(path)</a>\n        are either unavailable or incompatible with the OPLS4 force\n        field currently in use in Schrödinger suite. New custom parameters are\n        needed to accurately model your structures.</p>\n        <p>You may run this job without customizations, but we recommend\n        that you cancel now and generate the new parameters. Use the Force\n        Field Builder, available from a Customize button on your panel or\n        from the Task Tool.</p>'
__init__(parent: PyQt6.QtWidgets.QWidget)
Variables

parent (QWidget) – The parent object from which to display messageboxes

property validating: bool

Return whether or not the validator is currently performing validation.

validateOPLSDir(opls_dir: Optional[str] = None, allow_default_dialog: bool = True) schrodinger.ui.qt.forcefield.forcefield.OPLSDirResult

Return validation results of OPLS_DIR. If invalid, attempt to update the OPLS_DIR. If invalid and can’t update OPLS_DIR, optionally prompt ValidateOplsDirMessageBox. See validate_opls_dir() for full documentation.

Parameters
  • opls_dir – Path to the custom OPLS directory. Use to avoid calling get_custom_opls_dir() twice in the event that the function is already called outside of this method. If not given or None the validation will be done for the user’s preferences custom OPLS directory.

  • allow_default_dialog – whether the user may be presented with the dialog allowing them to run with the default OPLS dir.

schrodinger.ui.qt.forcefield.forcefield.use_custom_opls_dir_preference()

If specified, sets the custom OPLSDIR Maestro preference into the env in a context managed scope.

class schrodinger.ui.qt.forcefield.forcefield.ValidateOplsDirMessageBox(opls_dir, parent=None, incompatible_params_msg='<html><p>Your customizations\n        <a style="text-decoration:none;color:#3D3DF9;" href="opls_path">(path)</a>\n        are either unavailable or incompatible with the OPLS4 force\n        field currently in use in Schrödinger suite. New custom parameters are\n        needed to accurately model your structures.</p>\n        <p>You may run this job without customizations, but we recommend\n        that you cancel now and generate the new parameters. Use the Force\n        Field Builder, available from a Customize button on your panel or\n        from the Task Tool.</p>')

Bases: schrodinger.ui.qt.messagebox.MessageBox

A message box allowing the user to cancel when the custom opls dir is not valid, or run with the default opls dir.

A check box exists to allow unset the Maestro preference for using the custom opls dir.

Variables
  • title (str) – dialog window title

  • text (str) – the message text

  • cancel_btn (QtWidgets.QPushButton) – the cancel button

  • run_defaults_btn (QtWidgets.QPushButton) – the ‘Run with Defaults’ button

  • incompatible_params_msg (str) – the message to display when incompatible parameters are found.

TITLE = 'Custom Parameters Incompatible'
CB_TEXT = 'Do not show this message again'
__init__(opls_dir, parent=None, incompatible_params_msg='<html><p>Your customizations\n        <a style="text-decoration:none;color:#3D3DF9;" href="opls_path">(path)</a>\n        are either unavailable or incompatible with the OPLS4 force\n        field currently in use in Schrödinger suite. New custom parameters are\n        needed to accurately model your structures.</p>\n        <p>You may run this job without customizations, but we recommend\n        that you cancel now and generate the new parameters. Use the Force\n        Field Builder, available from a Customize button on your panel or\n        from the Task Tool.</p>')
Parameters
  • parent (QtWidgets.QWidget) – the parent widget

  • title (str) – the dialog title

  • text (str) – the message

  • save_response_key (str or NoneType) –

    When set, message box will show a “Do not show again” checkbox. The value provided will be used to generate a preference key. See add_prefix_to_key for more information on how the preference key is generated.

    The preference is only stored if the checkbox is checked. If it is unchecked, instead of storing a False, no preference is stored at all. This allows subclasses to make the distinction between saving a False response and not saving the response at all.

  • add_prefix_to_key

    Whether to prepend some basic context to the response_key (module_name, class_name`*`) in order to unique-ify the key. If set to False, the value provided for save_response_key will be used as-is, and the user is responsible for ensuring the key does not clash with any other preference keys.

    * If a parent is set for the messagebox, then the class name of parent will be used for class_name, otherwise the class name of the message box will be used.

  • icon – the icon to show - see QMessageBox documentation for details

getResponse()

Override this method to specify the nature of the “response” to save. Here it is simply True, to indicate that the “Do not show this again” checkbox has been checked.

schrodinger.ui.qt.forcefield.forcefield.validate_opls_dir(opls_dir, parent=None, incompatible_params_msg='<html><p>Your customizations\n        <a style="text-decoration:none;color:#3D3DF9;" href="opls_path">(path)</a>\n        are either unavailable or incompatible with the OPLS4 force\n        field currently in use in Schrödinger suite. New custom parameters are\n        needed to accurately model your structures.</p>\n        <p>You may run this job without customizations, but we recommend\n        that you cancel now and generate the new parameters. Use the Force\n        Field Builder, available from a Customize button on your panel or\n        from the Task Tool.</p>', allow_default_dialog=True, with_gui=True)

Determine whether the automatically upgraded OPLS_DIR is valid.

Display a message box to inform the user whether an automatic upgrade was performed if with_gui is True.

If the OPLS dir remains invalid and allow_default_dialog is True a dialog allowing the user to use the default OPLS dir is presented if with_gui is True.

Parameters
  • opls_dir (str or None) – the opls directory path or None

  • parent (QtWidgets.QtWidget) – the QtWidget used to post dialogs

  • incompatible_params_msg (str) – the message to display when incompatible parameters are found. Default is for ValidateOplsDirMessageBox to use FFS_INCOMPATIBLE_PARAMS_MSG.

  • allow_default_dialog (bool) – whether the user may be presented with the ValidateOplsDirMessageBox allowing them to run with the default OPLS dir. This is ignored if with_gui is False.

  • with_gui (bool) – whether to show any GUI components while validating

Returns

the validation result

Return type

OPLSDirResult

schrodinger.ui.qt.forcefield.forcefield.get_project_preference_custom_opls_path()

Returns project specific opls directory.

Returns

path to custom OPLS parameters stored in the project-specific preferences

Return type

str

schrodinger.ui.qt.forcefield.forcefield.set_project_preference_custom_opls_path(project_opls_path)

Sets project specific opls custom paramteres path. :param project_opls_path: current project oplsdir path :type project_opls_path: str