schrodinger.application.matsci.mswidgets module

Contains widgets that are useful in MatSci panels.

Copyright Schrodinger, LLC. All rights reserved.

Add a Desmond D. E. Shaw logo on the left and a MatSci logo on the right

Parameters:layout (QBoxLayout) – The layout to add the logos to
schrodinger.application.matsci.mswidgets.sub_formula(formula)

Add <sub></sub> tags around numbers. Can be used to prettify unit cell formula.

Parameters:formula (str) – Formula to add tags around numbers
Return type:str
Returns:Formula with tags added
schrodinger.application.matsci.mswidgets.center_widget_in_table_cell(table, row, column, widget)

Centers the widget in the cell and adds a non-selectable widget item so the cell background can’t be selected

Parameters:
  • table (QTableWidget) – The table that contains the cell & widget
  • row (int) – The row of the cell
  • column (int) – The column of the cell
  • widget (QWidget) – The widget that will be placed into the cell and centered
class schrodinger.application.matsci.mswidgets.MdAtomSelector(master, title, status_label=True)

Bases: schrodinger.ui.qt.atomselector.AtomSelector

Overide the AtomSelector class in atomselector. Modify the reset button to clear asl text only, and add a status label if needed.

clearAslText()

Currently, the reset button is used to clear asl string

pickMolecule()

Set the pick_menu with pick molecule option.

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

Bases: PyQt5.QtWidgets.QFrame

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.

chooseSolvent()

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

solventKeywordsChanged(keywords, options={})

Called when the user clicks accept on the SolventDialog

Parameters:keywords (dict) – A dictionary of Jaguar solvent model keywords
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
Returns:A string containg keywords that define the user’s choices. An empty string is returned if no model has been selected
reset()

Reset all the widgets to their original values

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

Bases: PyQt5.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
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.mswidgets.EmbeddedSolventWidget(parent=None, solvents=None, layout=None, dielectric=True, reference=False, keywords=None, models=None, other_solvent_options={})

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.

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.mswidgets.WheelEventFilterer

Bases: PyQt5.QtCore.QObject

An event filter that turns off wheel events for the affected widget

eventFilter(unused, event)

Filter out mouse wheel events

Parameters:
  • unused (unused) – unused
  • event (QEvent) – The event object for the current event
Return type:

bool

Returns:

True if the event should be ignored (a Mouse Wheel event) or False if it should be passed to the widget

schrodinger.application.matsci.mswidgets.turn_off_unwanted_wheel_events(widget, combobox=True, spinbox=True, others=None)

Turns off the mouse wheel event for any of the specified widget types that are a child of widget

Note: The mouse wheel will still scroll an open pop-up options list for a combobox if the list opens too large for the screen. Only mouse wheel events when the combobox is closed are ignored.

Parameters:
  • widget (QtWidgets.QWidget) – The widget to search for child widgets
  • combobox (bool) – True if comboboxes should be affected
  • spinbox (bool) – True if spinboxes (int and double) should be affected
  • others (list) – A list of other widget classes that should be affected
class schrodinger.application.matsci.mswidgets.StageFrame(master, layout=None, copy_stage=None, stage_type=None, icons=None)

Bases: schrodinger.ui.qt.swidgets.SFrame

The base frame for a stage in a MultiStageArea

Contains a Toolbutton for a title and some Window-manager-like control buttons in the upper right corner

icons = {}
layOut(copy_stage=None)

Lay out any custom widgets

Parameters:copy_stage (StageFrame) – The StageFrame this StageFrame should be a copy of. The default is None, which will create a new default stage.
initialize(copy_stage=None)

Perform any custom initialization before the widget is finalized

Parameters:copy_stage (StageFrame) – The StageFrame this StageFrame should be a copy of. The default is None, which will create a new default stage.
createControlButtons()

Create upper-right corner control buttons as requested by the user

createIconsIfNecessary()

Factory to create button icons if they have not been created

toggleVisibility(checked=None, show=None)

Show or hide the stage

Parameters:
  • checked (bool) – Not used, but swallows the PyQt clicked signal argument so that show doesn’t get overwritten
  • show (bool) – If True
updateLabel()

Set the label of the title button that toggles the stage open and closed

moveUp()

Move the stage up towards the top of the panel 1 stage

moveDown()

Move the stage down towards the bottom of the panel 1 stage

delete()

Delete this stage

copy()

Create a copy of this stage

reset()

Resets the parameters to their default values.

class schrodinger.application.matsci.mswidgets.MultiStageArea(layout=None, append_button=True, append_stretch=True, stage_class=<class 'schrodinger.application.matsci.mswidgets.StageFrame'>)

Bases: PyQt5.QtWidgets.QScrollArea

A scrollable frame meant to hold multiple stages. See the MatSci Desmond Multistage Simulation Workflow as one example.

addStage(copy_stage=None, stage_type=None, **kwargs)

Add a new stage

Parameters:
  • copy_stage (StageFrame) – The stage to copy. The default is None, which will create a new default stage.
  • stage_type – What type of stage to add. Must be dealt with in the StageFrame subclass
Return type:

StageFrame

Returns:

The newly created stage

Note:

All other keyword arguments are passed to the stage class

getStageIndex(stage)

Return which stage number this is

Parameters:stage (StageFrame) – Returns the index for this stage in the stage list
Return type:int
Returns:The stage number (starting at 0)
moveStageUp(stage)

Shift the given stage up one stage

Parameters:stage (StageFrame) – The stage to move up
moveStageDown(stage)

Shift the given stage down one stage

Parameters:stage (StageFrame) – The stage to move down
moveStage(current, new)

Move the a stage

Parameters:
  • current (int) – The current position of the stage
  • new (int) – The desired new position of the stage
copyStage(stage)

Create a copy of stage and add it directly below stage

Parameters:stage (StageFrame) – The stage to copy
deleteStage(stage, update=True)

Delete a stage

Parameters:
  • stage (StageFrame) – The stage to be deleted
  • update (bool) – True if stage labels should be updated, False if not (use False if all stages are being deleted)
updateStageLabels(start_at=0)

Update stage labels - usually due to a change in stage numbering

Parameters:start_at (int) – All stages from this stage to the end of the stage list will be updated
reset()

Reset the stage area

expandAll()

Expand all stages

collapseAll()

Collapse all stages

class schrodinger.application.matsci.mswidgets.StageControlButton(icon, layout, command)

Bases: PyQt5.QtWidgets.QToolButton

The QToolButtons on the right of each StageFrame

class schrodinger.application.matsci.mswidgets.Divider(layout)

Bases: PyQt5.QtWidgets.QFrame

A raised divider line

class schrodinger.application.matsci.mswidgets.SaveDesmondFilesWidget(layout=None, **kwargs)

Bases: schrodinger.ui.qt.swidgets.SCheckBoxWithSubWidget

Standardized checkbox with combo to provide options for saving intermediate Desmond job files.

getCommandLineArgs()

Return the command line flags to be used based on the widget state. Note that this expects driver classes to the jobutils.SAVE_FLAG with the allowed options found in l{jobutils.SAVE_FLAG_OPTS}.

Returns:List of command line args to use
Return type:list
class schrodinger.application.matsci.mswidgets.RandomSeedWidget(layout=None, minimum=0, maximum=2147483647, default=1234, **kwargs)

Bases: schrodinger.ui.qt.swidgets.SCheckBoxWithSubWidget

Standardized checkbox with spinbox to provide option to specify random seed.

getSeed()

Return the value specified in the spinbox.

Returns:seed for random number generator
Return type:int
getCommandLineFlag()

Return a list containing the proper random seed flag and argument specified by the state of this widget. Meant to be added onto a command list, e.g.

cmd = [EXEC, infile_path] cmd += rs_widget.getCommandLineFlag()
Returns:if disabled, an empty list. Otherwise, a list containing the random seed flag followed by the string representation of the seed specified in this widget’s spinbox.
Return type:empty list, or list of two str
class schrodinger.application.matsci.mswidgets.DefineASLDialog(master, help_topic='', show_markers=False, struct=None)

Bases: schrodinger.ui.qt.swidgets.SDialog

Manage defining an ASL.

layOut()

Lay out the widgets.

getAsl()

Return the ASL.

Return type:str
Returns:the ASL
getIndices()

If a structure was provided at instantiation then return the atom indices of the provided structure that match the specified ASL.

Return type:list
Returns:matching atom indices or None if no structure was provided
isValid()

Return True if valid, (False, msg) otherwise.

Return type:bool, pair tuple
Returns:True if valid, (False, msg) otherwise
accept()

Callback for the Accept (OK) button.

reject()

Callback for the Reject (Cancel) button.

reset()

Reset it.

class schrodinger.application.matsci.mswidgets.SliderchartVLClass(significant_figure=5, **kwargs)

Bases: schrodinger.application.bioluminate.sliderchart.SliderPlot

Overide the SliderPlot class in sliderchart to provide vertical slide bars and significant figure round.

round(value)
Parameters:value (float) – change the significant figures of this value.
Return type:float
Returns:value with proper significant figures
setVsliderPosition(slider_id, value)

Set the position of vertical sliders.

Parameters:
  • slider_id (int) – 0 means the left slider; 1 means the right one
  • value (float) – The new x value to attempt to place the slider at
Return type:

float

Returns:

final slider position, corrected by x range and the other slider

updateSlider(slider_idx, fit_edit=None, value=None, draw=True)

Change the slider to the user typed position, read this new position, and set the widget to this new position. At least one of value and fit_edit must be provided, and only read fit_edit when value is not provided.

Parameters:
  • fit_edit (The text of this widget defines one fitting boundary, and the text may be changed according to the newly adjusted boundary.) – swidgets.EditWithFocusOutEvent or None
  • slider_idx (0 --> left vertical slider; 1 --> right vertical slider;) – int (0 or 1)
  • value (set slider to value position, if not None) – float
  • draw (force the canvas to draw) – bool
Return type:

float

Returns:

left or right slider position

class schrodinger.application.matsci.mswidgets.StructureLoader(label, master, maestro, parent_layout)

Bases: schrodinger.ui.qt.swidgets.SFrame

A set of widgets that allow the user to load a structure.

structure_changed
WORKSPACE = 'Included entry'
FILE = 'From file'
BUTTON_TEXT = {'From file': 'Browse...', 'Included entry': 'Import'}
NOT_LOADED = 'Not loaded'
NOT_LOADED_TIP = 'Structure is not yet loaded'
DIALOG_ID = 'STRUCTURE_LOADER_IR'
typeChanged()

React to a change in the type of scaffold

reset()

Reset the widgets

updateLabel()

Update the status label.

loadStructure()

Load a structure from the selected source.

importFromWorkspace()

Import a structure from the workspace.

Return type:bool or None
Returns:True if a structure was loaded successfully, None if not
importFromFile()

Import a structure from a file, including opening the dialog to allow the user to select the file.

Return type:bool or None
Returns:True if the structure was loaded successfully, None if not
class schrodinger.application.matsci.mswidgets.DesmondMDWidgets(time_changed_command=None, timestep_changed_command=None, show_temp=True, temp_changed_command=None, show_press=True, show_save=True, show_enegrp=False, ensembles=None, defaults=None, time_use_ps=False, **kwargs)

Bases: schrodinger.ui.qt.swidgets.SFrame

Frame that holds core MD related fields, to be reused in the panels that submit desmond jobs.

LE_WIDTH = 80
TRJ_NFRM_LABEL = 'yields %d frames'
ENEGRP_NFRM_LABEL = 'yields %d records'
DEFAULTS = {'-md_enegrp_int': 4.8, '-md_press': 1.01325, '-md_temp': 300.0, '-md_time': 1.0, '-md_timestep': 2.0, '-md_trj_int': 4.8}
updateTrjFrames()

Update approximate number of trajectory frames and trajectory interval (if needed).

updateEneGrpFrames()

Update approximate number of if energy group recordings and interval (if needed).

onTimeChanged()

Called when simulation time changes.

onTimestepChanged()

Called when time step changes.

onTrjIntervalChanged()

Called when trajectory interval changes.

onEneGrpIntervalChanged()

Called when energy group interval changes.

getCommandLineFlags()

Return a list containing the proper command-line flags and their values, e.g.

cmd = [EXEC, infile_path] cmd += rs_widget.getCommandLineFlag()
Return type:list
Returns:command-line flags and their values
reset()

Reset widgets.