schrodinger.application.matsci.jagwidgets module

Contains widgets for MatSci jaguar-related panels.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.jagwidgets.BasisSetSelector(label, default_selection, layout=None, stretch=True)

Bases: schrodinger.ui.qt.swidgets.SelectorWithPopUp

A frame that allows the user to specify a basis from a pop up list

TOOL_BUTTON_CLASS

alias of schrodinger.application.jaguar.gui.basis_selector.BasisSelectorFilterListToolButton

selectionChanged()

Set the line edit to a newly selected basis set

setBasis(basis)

Set the basis for the widget

Parameters

basis (str) – The basis to set

Raises

ValueError – If basis is invalid

reset()

Reset the widget

setStructure(struct)

Set the structure to determine valid basis sets

Parameters

struct (structure.Structure) – The structure to set

validate()

Check if the basis set is valid

Return type

(False, msg) or True

Returns

False and error message if something is wrong, True if everything is OK

class schrodinger.application.matsci.jagwidgets.TheorySelector(label, default_selection, layout=None, stretch=True)

Bases: schrodinger.ui.qt.swidgets.SelectorWithPopUp

A frame that allows the user to specify a theory from a pop up list

TOOL_BUTTON_CLASS

alias of schrodinger.application.jaguar.gui.theory_selector.DftTheorySelectorFilterListToolButton

new_method_selected

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.

selectionChanged()

Set the line edit to the newly selected theory

setTheory(theory)

Set the theory for the widget

Parameters

theory (str) – The theory to set

Raises

ValueError – If the theory is not valid

reset()

Reset the widget

class schrodinger.application.matsci.jagwidgets.KeywordEdit(label_text='', keyword_dict=None, keyword_string='', **kwargs)

Bases: schrodinger.ui.qt.swidgets.SLabeledEdit

A labeled edit for displaying, editing and retrieving Jaguar keywords

__init__(label_text='', keyword_dict=None, keyword_string='', **kwargs)

Create a KeywordEdit instance.

Any unrecognized keyword arguments are passed to the SLabeledEdit class

Parameters
  • label_text (str) – The text of the label for the KeywordEdit. By default, there is no label.

  • keyword_dict (dict) – A dictionary of keyword/value pairs for the KeywordEdit to display. If both keyword_dict and keyword_string are supplied, the keyword_dict keywords appear first.

  • keyword_string (str) – The string to display in the KeywordEdit. If both keyword_dict and keyword_string are supplied, the keyword_dict keywords appear first.

getKeywordString()

Return the keyword string in the QLineEdit

Return type

str

Returns

The string in the QLineEdit. No validity checking is done.

getKeywordDict(keystring=None)

Return a dictionary whose keys are keywords and values are keyword values

Parameters

keystring (str) – If provided, the keywords are taken from this string rather than the QLineEdit. The default is to take the keywords from the QLineEdit

Return type

dict

Returns

Dictionary of keyword/value pairs

Raises

ValueError – if any tokens do not match the keyword=value format

setKeywords(keyword_dict=None, keyword_string='')

Set the text of the KeywordEdit

Parameters
  • keyword_dict (dict) – A dictionary of keyword/value pairs for the KeywordEdit to display. If both keyword_dict and keyword_string are supplied, the keyword_dict keywords appear first.

  • keyword_string (str) – The string to display in the KeywordEdit. If both keyword_dict and keyword_string are supplied, the keyword_dict keywords appear first.

validateKeywords(emptyok=False)

Validate the contents to ensure they are valid Jaguar keywords. The return value of this is compatible with appframework2 validation methods - i.e. an af2 validation method can just call: return self.keyword_le.validateKeywords()

Parameters

emptyok (bool) – Whether it is OK for the keyword input to be empty

Return type

True or (False, str)

Returns

True if no errors are found, otherwise a tuple containing False and an error message.

class schrodinger.application.matsci.jagwidgets.CompactSolventSelector(parent=None, layout=None, indent=False, keywords=None, **extra_args)

Bases: schrodinger.ui.qt.swidgets.SFrame

A single line of widgets that displays the currently chosen solvent and a button that will open a dialog allowing a new solvent model/solvent choice. Tracks the necessary Jaguar keywords to implement the user’s choice.

solventChanged

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__(parent=None, layout=None, indent=False, keywords=None, **extra_args)

Create a CompactSolventSelector object

Additional keyword arguments are passed on to the SolventDialog that is opened by this widget.

Parameters
  • layout (QBoxLayout) – The layout to place this widget into

  • indent (bool) – If true indent frame layout

  • keywords (dict) – Dictionary of solvent-related Jaguar key/value pairs to initialize/reset the widgets with

chooseSolvent()

Open a dialog that lets the user choose solvent parameters (model, solvent, solvent properties) and store the choices

solventKeywordsChanged(keywords, options={}, update=False)

Called when the user clicks accept on the SolventDialog

Parameters
  • keywords (dict) – A dictionary of Jaguar solvent model keywords

  • update (bool) – whether keywords should be updated or replaced

isSolventModelUsed()

Has a solvent model been chosen?

Return type

bool

Returns

True if yes, False if no

getSolventName()

Get the name of the chosen solvent

Return type

str

Returns

The user-facing name of the chosen solvent, or NO_SOLVENT if no model has been chosen

getKeystring()

Get a string containing all the keywords specified by the user’s choices

Return type

(str, str)

Returns

First item is a string containing keywords that define the user’s choices. An empty string is returned if no model has been selected. The second item is a string containing any keywords set for solvent=other.

reset()

Reset all the widgets to their original values

class schrodinger.application.matsci.jagwidgets.SolventDialog(parent, keywords=None, **extra_args)

Bases: PyQt6.QtWidgets.QDialog

A Dialog that allows the user to pick a solvent model, solvent and parameters.

Emits a keywordsChanged signal when the user clicks Accept and passes a dictionary of the Jaguar keywords that reflect the selected settings.

keywordsChanged

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__(parent, keywords=None, **extra_args)

Create a SolventDialog object

Additional keyword arguments are passed to the EmbeddedSolventWidget object

Parameters
  • parent (QWidget) – The parent widget for this dialog

  • keywords (dict) – A dictionary of jaguar key/value pairs that define the initial solvent settings for the dialog

help()

Show the Jaguar solvent help

accept()

Gather the options and emit a keyword dictionary with the keywords/values they define, then close the dialog.

class schrodinger.application.matsci.jagwidgets.EmbeddedSolventWidget(parent=None, layout=None, dielectric=True, reference=False, keywords=None, models=None, force_solvent=None)

Bases: schrodinger.application.jaguar.gui.tabs.solvation_tab.SolvationTab

A master widget that contains the widgets from the Jaguar Solvation tab and is convenient to use outside the Jaguar gui environment.

__init__(parent=None, layout=None, dielectric=True, reference=False, keywords=None, models=None, force_solvent=None)

Create a EmbeddedSolventWidget object

Parameters
  • parent (QWidget) – The parent widget for this widget

  • layout (QBoxLayout) – The layout to place this widget into

  • dielectric (bool) – If True, show the dielectric widgets, if False, do not

  • reference (bool) – If True, show the reference energy widgets, if False, do not

  • keywords (dict) – The Jaguar solvent-related key/value pairs that define the initial widget values

  • models (dict) – The allowed solvent models. keys are strings displayed to the user, values are Jaguar keywords. See parent class SOLVENT_MODELS constant for example. Use an OrderedDict to control the order of the solvent models in the model combobox

  • force_solvent (str) – If provided, set as solvent and disable the solvent selector

solventModelChanged()

React to a change in the solvent model

loadSettingsFromKeywords(keywords)

Set the widget states based on the given keyword dictionary

Parameters

keywords (dict) – Keys are jaguar keywords, values are keyword values

reset()

Reset the widgets to their initial values

class schrodinger.application.matsci.jagwidgets.NewPresetDialog(master, user_accept_function=None, standard_buttons=None, nonstandard_buttons=None, help_topic='', title=None)

Bases: schrodinger.ui.qt.swidgets.SDialog

Dialog for getting the name for a new preset

layOut()

Lay out the widgets for the dialog

accept()

Overwrite parent’s accept method to check if the name is valid

classmethod getName(master, keywords, existing_names)

Get a name from the user for the new preset

Parameters
  • master (QtWidget) – The parent widget

  • keywords (str) – The keywords in string format

  • existing_names (set) – Names for existing presets

Return type

str or None

Returns

The preset name, or None if the user cancels

class schrodinger.application.matsci.jagwidgets.PresetsDialog(master, *, keyword_setter, keyword_getter, keyword_validator=None, schrodinger_defaults_str='', title='Jaguar Option Sets', preferences_group='', **kwargs)

Bases: schrodinger.ui.qt.swidgets.SDialog

Dialog for saving and applying jaguar keyword presets and setting default preset

__init__(master, *, keyword_setter, keyword_getter, keyword_validator=None, schrodinger_defaults_str='', title='Jaguar Option Sets', preferences_group='', **kwargs)
Parameters
  • master (QDialog) – The parent dialog

  • keyword_setter (callable) – The function to call to set keywords. Should take keywords in string format as a single argument

  • keyword_getter (callable) – The function to call to get keywords. Should return keywords in string format

  • keyword_validator (callable) – The function to call to validate keywords. Should return a af2.validation.ValidationResult object

  • schrodinger_defaults_str (str) – Default keywords for the Schrodinger preset in string format

  • preferences_group (str) – The preference group to use for storing the presets. If not provided, a name will be created from the parent’s window title. NOTE: duplicate titles will break things when not specifying a preferences_group

  • title (str) – The title for the dialog

layOut()

Lay out the widgets for the dialog

setUpPreferences()

Set up the preferences for the presets

updatePreferences()

Update user preferences due to a change in Schrodinger defaults

getCustomPresetsNames()

Get a list of custom preset names

Return type

list

Returns

list of custom preset names

populateList()

Populate the list with presets

getSelectedPreset()

Get the selected preset in the list, removing “(default)” if it is the default preset

Return type

str or None

Returns

The name of the selected preset or None if there’s no selection

listSelectionChanged()

Update the widgets based on the selected preset in the list

newPreset()

Ask the user for a new preset name and save the current keywords as a new preset

setDefaultPreset(*, preset_name=None)

Set the default preset. If preset_name is provided, set the default to it. Otherwise use the selected preset.

Parameters

str – preset_name: The name of the preset, or None

applyPreset()

Apply the selected preset

deletePreset()

Delete the selected preset after confirming with the user

getDefaultPresetName()

Get the name of the current default preset

Return type

str

Returns

The name of the current default

getDefaultKeywords()

Get the keywords for the default preset

Return type

str

Returns

The keywords for the default preset

class schrodinger.application.matsci.jagwidgets.JaguarOptionsDialog(master, button_label='Jaguar Options...', title=None, help_topic=None, preference_group='', layout=None, show_optimization=True, optional_optimization=False, pass_optimization_keyword=True, show_geopt_iterations=True, show_spin_treatment=False, show_charge=True, show_multiplicity=True, show_hamiltonian=False, show_tddft=False, solvent_kwargs=None, keyword_validator=None, default_keywords='', tip=None)

Bases: schrodinger.ui.qt.swidgets.SDialog

OVERWRITE_QUESTION_KEY = 'JAGOPTS_OVERWRITE_KEYWORDS'
SPIN_AUTOMATIC = 'Automatic'
SPIN_UNRESTRICTED = 'Unrestricted'
SPIN_RESTRICTED = 'Restricted'
UHF_LABELS = {0: 'Restricted', 1: 'Unrestricted', 2: 'Automatic'}
DEFAULT_THEORY = 'B3LYP-D3'
DEFAULT_BASIS_SET = '6-31G**'
NON_ANALYTICAL_SCF_ACCURACIES = [3, 2, 1]
GEOPT_CONV_CRITERIA = {'Default': 2, 'Loose': 3, 'Tight': 5}
OPTIMIZATION_KEYWORDS = ['igeopt', 'maxitg', 'iaccg', 'nops_opt_switch']
ALL_SOLVENT_KEYWORDS = {'isolv', 'nogas', 'pbf_after_pcm', 'pcm_model', 'pcm_radii', 'solvent'}
EXCITED_STATE_KEYWORDS = ['itddft', 'itda', 'rsinglet', 'rtriplet', 'nroot']
panelLabelChanged

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__(master, button_label='Jaguar Options...', title=None, help_topic=None, preference_group='', layout=None, show_optimization=True, optional_optimization=False, pass_optimization_keyword=True, show_geopt_iterations=True, show_spin_treatment=False, show_charge=True, show_multiplicity=True, show_hamiltonian=False, show_tddft=False, solvent_kwargs=None, keyword_validator=None, default_keywords='', tip=None)

Create a JaguarOptionsDialog instance

Parameters
  • master (QWidget) – The parent widget

  • button_label (str) – The label for the button in the panel

  • title (str) – The dialog title. If not provided, a title will be created from the panel’s title

  • help_topic (str) – The help topic for this dialog. If not provided, an id will be created from the panel’s id

  • preferences_group (str) – The preference group to use for storing the presets. If not provided, a name will be created from this dialog’s title. NOTE: duplicate titles will break things when not specifying a preferences_group

  • layout (QLayout) – The layout to add the panel widgets to

  • show_optimization (bool) – Whether geometry optimization group should be shown

  • optional_optimization (bool) – Whether geometry optimization is optional

  • pass_optimization_keyword (bool) – Whether geometry optimization keyword (igeopt) should be returned when getting current keywords

  • show_geopt_iterations (bool) – Whether maximum iterations for geometry optimization should be shown

  • show_spin_treatment (bool) – Whether spin treatment rbg should be shown

  • show_charge (bool) – Whether charge spinbox should be shown

  • show_multiplicity (bool) – Whether multiplicity spinbox should be shown

  • solvent_kwargs (None or dict) – The kwargs to be passed to the solvent widget. If None, the widget won’t be created. An empty dict can be passed to create the solvent widget with default kwargs.

  • keyword_validator (callable) – Optional function to call to validate the keywords. Should raise KeyError if there are any issues with the keywords.

  • default_keywords (str or dict) – The default keywords for the dialog

  • tip (str) – The tooltip

layOut()

Lay out the widgets for the dialog

enforceBasis(method)

Ensure that methods that require a specific basis set use that basis set

Parameters

method (str) – The chosen method

updateWidgets(keyword_dict)

Update the widgets to match the current keywords

Parameters

keyword_dict (dict) – The keywords to update widgets with

Return type

bool

Returns

True if everything was OK, False if something went wrong

setUpDefaults()

Create a PresetsDialog instance for this dialog and set and validate default keywords

restrictJaguarTheoryOptions(text)

Restrict the level of theory option in jaguar dialog box by text. Text should be one of the predefined options. Acceptable text values are “Recommended”, “Long range corrected DFT”, “Hybrid DFT”, “Meta GGA DFT”, “GGA DFT”, “LDA DFT”

Parameters

text (str) – specifier to select level of theory.

setEditEnabled(state)

Set the enabled state of the edit button in the panel and the label after it

Parameters

state (bool) – Whether the widgets should be enabled

updatePanelLabel()

Update the label in the panel with the new options

showForEdit()

Show the dialog

showPresets()

Show the presets dialog for this dialog

setKeywords(keywords, save_as_current=True)

Set the keywords for the dialog. Widgets that are not modified by the passed keywords will be reset to default.

Parameters
  • keywords (str or dict) – The keywords to set

  • save_as_current (bool) – Whether the keywords should be saved so cancelling the dialog doesn’t undo the changes

getKeywordDict()

Get current keywords as a dict

Return type

dict

Returns

The current keywords as dict

getKeywordString()

Get current keywords as a string

Return type

str

Returns

The current keywords as a string

accept()

Update the keywords and close the dialog if the inputs are valid

reject()

Close the dialog and reset it back to when it was opened

reset(keywords=None, save_as_current=True)

Reset the dialog and update the widgets with any passed keywords

Parameters
  • keywords (dict or None) – The keywords to update widgets with

  • save_as_current (bool) – Whether the keywords should be saved so cancelling the dialog doesn’t undo the changes

validate()

Validate the dialog keywords

Return type

bool or (bool, str)

Returns

True if everything is OK, (False, msg) if the state is invalid and an error should be shown to the user in a warning dialog.

validateBasisSet(structs)

Validate that the passed structures are compatible with the current basis set

Parameters

structs (iterable) – The structures to validate

Return type

bool or (bool, str)

Returns

True if everything is OK, (False, msg) if the state is invalid and an error should be shown to the user.

static makeDict(keywords)

Create a keyword dictionary if the passed keywords are in string format

Parameters

keywords (str or dict) – Keyword dict or string

Return type

dict

Returns

Keyword dictionary

static makeString(keywords)

Create a keyword string if the passed keywords are in dictionary format

Parameters

keywords (str or dict) – Keyword dict or string

Return type

str

Returns

Keyword string

assertInKeywords(keywords)

Assert that the passed keywords are a subset of the dialog’s keywords

Used for unittests.

Parameters

keywords (str or dict) – Keyword dict or string