schrodinger.application.matsci.deswidgets module

Contains widgets that are useful in MatSci desmond panels.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.deswidgets.get_row_from_proj_table(struct)

Given an input structure, return the row from the project table

Parameters

st (schrodinger.structure.Structure) – structure to get associated row of from project table

Return type

schrodinger.project.project.ProjectRow

Returns

the row from project table

schrodinger.application.matsci.deswidgets.get_cms_path_from_proj_table(struct, traj=False)

Get cms path and optionally trajectory path for the passed structure in maestro from project table

Parameters
  • struct (schrodinger.structure.Structure) – Structure to get associated cms

  • traj (bool) – If True, get traj for the passed structure. Default is False.

Return type

tuple(str or None, str or None)

Returns

Path to the associated cms file and trajectory for the structure. None if there is no associated cms.

schrodinger.application.matsci.deswidgets.check_cms_trj_properties_are_found(cms_file, trj_dir, source_path)

Check if the CMS and trj properties were found and raise ValueError if not

Parameters
  • str (trj_dir) – Path to source cms and trj folder

  • str – Path to the associated CMS file

  • str – Path to the associated trajectory

Return str,str

Path to the cms file trajectory frames if both are found.

Raises

ValueError – Raises error if the cms file or trajectory is not found

schrodinger.application.matsci.deswidgets.get_cms_and_trj_path(struct, source_path=None)

Get trajectory and cms path for the passed structure in maestro

Parameters
  • schrodinger.structure.Structure (struct) – Structure to get associated cms and trajectory of

  • str (source_path) – Path to source cms and trj folder in case they do not exist in the working folder. Structure source path will be used in case it is not passed.

Return str,str

Path to the cms file trajectory frames if both are found.

Raises

ValueError – In case the cms file or trajectory is not found

class schrodinger.application.matsci.deswidgets.FrameSpinBox(layout, commands=None)

Bases: schrodinger.ui.qt.swidgets.SSpinBox

A spin box to change and set the frames for the trajectory

__init__(layout, commands=None)

Create a FrameSpinBox instance

Parameters
  • layout (QLayout) – If supplied, the FrameSpinBox created will be added to this layout

  • commands (list) – The list of callbacks for the valueChanged signal.

class schrodinger.application.matsci.deswidgets.TrajRangeSelectorDialog(master)

Bases: schrodinger.ui.qt.swidgets.SDialog

Trajectory range selector dialog with fixed labels, a spinbox for step, and no overlapping of sliders

DIALOG_SIZE = (490, 160)
__init__(master)

Create a TrajRangeSelectorDialog instance

layOut()

Layout the widgets in the Dialog

updateRangeLabel()

Function to change label when spinbox values are changed or slider is moved

slidersMoved()

Sets values in spinboxes and label when the sliders are moved

reset()

Reset the widgets

getStep()

Get the trajectory step

Return int

The step

getFrames()

Get the frame numbers based on the range and step

Return list

list of frames numbers

accept()

Save the step value in addition to what parent does

reject()

Restore step value in addition to what parent does

setTrajLimits(min_f, max_f, step_size, last_f_time)

Set the limits for trajectory range

Parameters
  • min_f (float) – minimum value of the trajectory frames

  • max_f (float) – maximum value of the trajectory frames

  • step_size (float) – step size of the frames

  • last_f_time (float) – last frame time

setTempRangeToSlider(traj_range)

Set temporary trajectory range values to the range selection widgets

Parameters

traj_range (SimpleNamespace) – set of values for the minimum and maximum number of frames and the step size.

setTempTrajRange()

Read values from widgets and store the temporary range value in traj_range property

changeLimitsEnd()

Change limits of end time spin box to reflect the left slider position

changeLimitsStart()

Change limits of start time spin box to reflect the right slider position

getRangeLabel()

This function returns text string showing trajectory range in ns.

Returns

range string

Return type

str

class schrodinger.application.matsci.deswidgets.TrajRangeSelectorFrame(layout)

Bases: schrodinger.ui.qt.swidgets.SFrame

Frame that adds trajectory selection button and label. It is connected to a dialog to select the trajectory range

__init__(layout)
Parameters

layout (QLayout) – layout to add the button to

updateTrajectoryRangeLabel()

Update the trajectory range label with new range from traj dialog and correct the text

showTrajRangeSelectorDialog()

Show traj dialog

updateTrj(trj_path)

Load new trajectory range

Parameters

trj_path (str) – path to the trajectory.

Return bool

True if trajectory range was loaded, else False

getFlags()

Get flags for current selected trajectory range

getRange()

Get current range of frames selected

Return type

tuple(int)

Returns

lower limit and upper limit of the selected range of frames

setRange(start_val=None, end_val=None)

Set the frame range (in number and not time) for trajectory selection

Parameters
  • start_val (int) – lower limit for frame in trajectory selection

  • end_val (int) – upper limit for frame in trajectory selection

setEnabled(state)

Enable or disable the button and label for showing the traj dialog

Parameters

state (bool) – True to enable the button, and False to disable

reset()

Reset the frame

getInputs()

Get the minimum, maximum and step value of trajectory frames

Returns

min,max and step value of trajectory frames

Return type

dict

schrodinger.application.matsci.deswidgets.copy_cms_and_trj(cms_file, trj_path, jobname)

Copy cms and trj to the job directory

Parameters
  • cms_file (str) – The path to the input cms file

  • trj_path (str) – The path to the input trj dir

  • jobname (str) – The job name

class schrodinger.application.matsci.deswidgets.TrajAnalysisGuiMixin

Bases: schrodinger.application.matsci.appbase.BaseAnalysisGui

Class for extension of af2 to add widgets to gui for desmond trajectory analysis.

addLoadTrajButton(layout, setup_method=None, allow_gcmc=True)

Load button to load structure from workspace and associated trajectory

Parameters
  • layout (QLayout) – layout to add the button and range selector to

  • setup_method (callable) – The method to call to setup the panel

  • allow_gcmc (bool) – Whether gcmc cms’s should be allowed

resetPanel()

Reset the panel variables and widgets set by this mixin

Raises

NotImplementedError – Will raise error if load button is not added

toggleStateMain(state)

Enable and disable trajectory traj button and label

Parameters

state (bool) – True to enable the button, and False to disable

getTrajFlags()

Get the command line flags for cms file, trajectory path, and trajectory range.

Return list

A list of command line flags and values

validateCMS()

Check if valid structure has been loaded.

Return type

bool or (bool, str)

Returns

The bool is True if file is loaded. False with message pop up if file is not loaded.

class schrodinger.application.matsci.deswidgets.TrajectoryTimeSlider(layout=None, command=None, parent=None)

Bases: object

Mixin class to add the time slider and play/pause buttons and related methods.

INTERVAL = 100
ICON_SIZE = 24
__init__(layout=None, command=None, parent=None)

Add time slider and play button to the layout

Parameters
  • layout (QLayout) – Layout to place the time slider into

  • command (python callable) – The callback for the valueChanged signal.

  • parent (QWidget) – The widget that owns this table widget

  • time_stamps (list) – Trajectory time range data to set the timer interval

addTimerButton(layout=None)

Add Timer button to the timer

Parameters

layout (QWidgets.QHBoxLayout) – Layout to add the play/pause button

initVariables()

Initialize variables

toggleTimer()

Response to the timer button

repeatingMethod()

Repeating method for timer. Resets the timer to start position.

setTimeSlider(time_stamps)

Set the time range, maximum and minimum value for the time slider.

Parameters

time_stamps (list) – Trajectory time range data to set the timer interval

floatValue()

Get the current float value. The float value differs from the slider value in that the slider value is an integer, while the float value is a float calculated by multiplying float_step by the integer value.

Return type

float

Returns

The current widget float value

setFloatValue(float_value)

Set the current float value of the slider. The value gets rounded to the nearest acceptable slider value.

Parameters

float_value (float) – The value to set

reset()

Reset the time slider

class schrodinger.application.matsci.deswidgets.SubstrateRestraintGroupBox(panel, parent_layout, *, title=None, cms_check=True, checkable=False, **kwargs)

Bases: schrodinger.application.matsci.mswidgets.MSAtomSelector

Group box used to define which atoms in a panel’s MD system are substrates, at which point Desmond force restraints can be added to those substrate atoms.

__init__(panel, parent_layout, *, title=None, cms_check=True, checkable=False, **kwargs)

Initialize a group box tailored for defining and restraining substrate atoms.

Parameters
  • panel (MultiDesmondJobApp) – The Maestro panel that this widget should be associated with

  • parent_layout (QBoxLayout) – The layout to place this SGroupBox into

  • title (str) – Title of the group box

  • cms_check (bool) – Whether the input structure should be cms only

  • checkable (bool) – Whether the groupbox is checkable, False by default.

getForceConstant()

Gets the currently-assigned force constant

Return type

float

Returns

the force constant currently entered into the widget, in units of kcal/mol/Ang^2

setForceConstant(force_constant)

Sets the force constant to a given value

Parameters

force_constant (float) – the force constant you want to set in the widget, in units of kcal/mol/Ang^2

getCommandLineFlags()

Returns the command line flags associated with this widget.

Return type

list(str)

Returns

Command-line flags and their values. If no ASL is set, then returns an empty list.

getASL()
checkASL()

Check if asl contains sets, entry.id or entry.name

Parameters

asl (str) – asl in the line edit

error(msg)

Raises an error in the parent panel

validateASL()

Check that the ASL is valid.

Return type

bool or bool, msg

Returns

True if everything is OK, (True, msg) if the user should be asked if “msg” is OK to continue.

reset()

Reset the widget

class schrodinger.application.matsci.deswidgets.AdvancedMDOptions(master, button_label='Advanced MD Options...', title='Advanced MD Options', help_topic='MATERIALS_SCIENCE_ADVANCED_MD_OPTIONS', layout=None)

Bases: schrodinger.ui.qt.swidgets.SDialog

Advanced Simulation options. This class will create the advanced dialog in DesmondMDWidget

__init__(master, button_label='Advanced MD Options...', title='Advanced MD Options', help_topic='MATERIALS_SCIENCE_ADVANCED_MD_OPTIONS', layout=None)

Creat an SDialog object

Parameters
  • master (QWidget) – The parent of this dialog

  • user_accept_function (callable) – A function to call from a custom accept method implemented in a subclass

  • standard_buttons (list) – List of standard buttons to add - each item must be a QDialogButtonBox.StandardButton constant (i.e. QDialogButtonBox.Ok). The default if no standard buttons or non-standard buttons are provided is Ok and Cancel.

  • nonstandard_buttons (list of (QPushButton, QDialogButtonBox.ButtonRole) tuples) – Each item of the list is a tuple containing an existing button and a ButtonRole such as AcceptRole. The default if no standard buttons or non-standard buttons are provided is Ok and Cancel buttons.

  • help_topic (str) – The help topic for this panel. If the help topic is provided a help button will automatically be added to the panel.

  • title (str) – The dialog window title

layOut()

Lay out the widgets for the dialog

showForEdit()

Show the dialog

udpateToolTip()

Update advance setting button tooltip

accept()

Overwrite accept method.

reset()

Overwrite reset method

class schrodinger.application.matsci.deswidgets.DesmondMDWEdit(*args, **kwargs)

Bases: schrodinger.ui.qt.swidgets.EditWithFocusOutEvent

The standard edit used by DesmondMDWidgets

LE_WIDTH = 80
BOTTOM_DATOR = 1e-10
__init__(*args, **kwargs)

Create a DesmondMDWEdit instance

See parent class for additional documentation

getValidator()

Get the validator for this edit

Return type

swidgets.SNonNegativeRealValidator

Returns

The validator to use

class schrodinger.application.matsci.deswidgets.DesmondMDWidgets(input_selector=None, time_changed_command=None, timestep_changed_command=None, show_temp=True, temp_changed_command=None, show_press=True, show_save=True, show_enegrp=False, show_ptensor=False, show_eneseq=False, show_seed=True, show_trj_interval=True, show_advanced_options=False, show_coulomb=False, enegrp_changed_command=None, ensembles=None, isotropy=None, defaults=None, thermo_methods=None, baro_methods=None, time_use_ps=False, combined_trj=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.

TRJ_NFRM_LABEL = 'yields ~%d frames'
ENEGRP_NFRM_LABEL = 'yields %d records'
PTENSOR_NFRM_LABEL = 'yields %d records'
ENESEQ_NFRM_LABEL = 'yields %d records'
DEFAULTS = {'-coulomb_cutoff': 9.0, '-md_baro_relax_time': 2.0, '-md_enegrp_int': 4.8, '-md_eneseq_int': 1.2, '-md_press': 1.01325, '-md_ptensor_int': 4.8, '-md_temp': 300.0, '-md_thermo_relax_time': 1.0, '-md_time': 1.0, '-md_timestep': 2.0, '-md_trj_int': 4.8}
class NUM_FRMS_TYPE(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.Enum

enegrp = 1
eneseq = 2
ptensor = 3
trj = 4
__init__(input_selector=None, time_changed_command=None, timestep_changed_command=None, show_temp=True, temp_changed_command=None, show_press=True, show_save=True, show_enegrp=False, show_ptensor=False, show_eneseq=False, show_seed=True, show_trj_interval=True, show_advanced_options=False, show_coulomb=False, enegrp_changed_command=None, ensembles=None, isotropy=None, defaults=None, thermo_methods=None, baro_methods=None, time_use_ps=False, combined_trj=False, **kwargs)

Initialize object and place widgets on the layout. See swidgets.SFrame for more documentation.

Parameters
  • input_selector (schrodinger.ui.qt.InputSelector) – Input selector object

  • time_changed_command (Method or None) – Called on focus out event of MD time field

  • timestep_changed_command (Method or None) – Called on focus out event of MD time step field

  • show_temp (bool) – Show or not MD temperature field

  • temp_changed_command (Method or None) – Called on focus out event of MD temp step field

  • show_press (bool) – Show or not MD pressure field

  • show_save (bool) – Show or not Save MD related data widget

  • show_enegrp (bool) – Show or not energy group recording interval widget

  • show_ptensor (bool) – Whether to show pressure tensor recording interval

  • show_eneseq (bool) – Show or not energy recording interval widget

  • show_seed (bool) – Show or not random seed widget

  • show_trj_interval (bool) – Show or not the widgets for saving trajectory intervals

  • show_advanced_options (bool) – Show advanced option dialog

  • show_coulomb (bool) – Show coulomb combobox to select Coulomb method

  • enegrp_changed_command (Method or None) – Called on focus out event of enegrp interval field

  • ensembles (None or list) – Show choice of desmond ensembles

  • isotropy (None or dict) – Show choice of desmond barostat isotropy policies. Keys are user-facing text for each isotropy policy, values are the value from schrodinger.application.desmond.constants.IsotropyPolicy.

  • defaults (dict or None) – Dict with the default values of MD fields

  • thermo_methods (dict or None) – Provide a dict with cms model type as keys and list of enabled thermostat for these methods as values. See msconst.VALID_THERMO_METHODS for example.

  • baro_methods (dict or None) – Provide a dict with cms model type as keys and list of enabled barostat for these methods as values. See msconst.VALID_BARO_METHODS for example.

  • time_use_ps (bool) – If True, use ps for the time field, otherwise ns (which is default in Desmond GUI)

layOut()

Add MD widgets to layout

updateBarrierLabel(struct=None)

Update the barrier label using the potential barrier on the structure

Parameters

struct (schrodinger.structure.Structure) – The structure to check for a potential barrier

addAdvancedWidgets(layout)

Advanced MD Widgets

updateEnsembleParameters()

Update timestep, thermostat method, thermostat relaxation time, barostat method and barostat relaxation time upon structure changed.

classmethod getTimeStepFromModel(model_type, model=None)

Return type of model and default timestep for the model. Three possible types of model are AA, DPD and COARSE_GRAIN (see msconst).

Parameters
  • model (cms.Cms) – input selector model

  • model_type (str) – type of the desmond system model type

Returns

return timestep corresponding to the different desmond model.

Return type

float

setThermoRelaxationMethod(model_type)

Set thermostat option based on model type

Parameters

model_type (str) – type of the cms model

setBaroRelaxationMethod(model_type)

Set barostat option based on model type

Parameters

model_type (str) – type of the cms model

getAdvancedSettingString()

Update advance setting label

Return type

str

Returns

Advanced setting in the string format joined by “/”.

updateAllNumFrames()

Update all known frames.

updateNumFrames(num_frms_type)

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

Parameters

num_frms_type (NUM_FRMS_TYPE) – Type of the recordings to update

getTimestepPS()

Returns the simulation timestep in picoseconds.

Return type

float

Returns

Time in picoseconds

getTimePS()

Returns the simulation time in picoseconds.

Return type

float

Returns

Time in picoseconds

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.

onPtensorIntervalChanged()

Called when energy group interval changes.

onEneSeqIntervalChanged()

Called when energy interval changes.

onEnsembleChanged()

Called when ensemble 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

setFromCommandLineFlags(flags)

Set the state of these widgets from command line flag values

Parameters

flags (dict) – Keys are command line flags, values are flag values. For flags that take no value, the value is ignored - the presence of the key indicates the flag is present.

getSimulationParam()

Get parameters compatible with kwargs of MSJStringer method. The method can be used in as desconfig.MSJStringer(**(self.getSimulationParam()).

Return type

dict, dict

Returns

First dictionary contains the msj parameters acceptable by MSJStringer class. Second dictionary contains other parameters related to MD. These parameters are not directly used by MSJStringer.

reset()

Reset widgets.

resetAdvancedWidgets()

Reset advanced widgets