schrodinger.application.matsci.kmcgui module

Run initial calculations to store mobility information for all the structures in a system.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.kmcgui.robust_log(value)

A sqrt function that is robust to missing (0.0) values

Parameters

value (float) – The value to take the log of

Return type

float

Returns

The log10 of value or 0 if value is 0

schrodinger.application.matsci.kmcgui.get_charged_prop_value(info, selector)

Get the full property name for a property that appends ‘h’ or ‘e’ at the end based on the charge the property is for and the state of a charge radiobutton group

Parameters
Return type

str

Returns

The full name of the property with the correct suffix

schrodinger.application.matsci.kmcgui.get_plottable_table_data(info, selector)

Get the data from the SQL database

Parameters
Return type

list

Returns

The values for prop in each row of table

class schrodinger.application.matsci.kmcgui.PlotInfo(combo, title, function, charged, prop, table_getter)

Bases: tuple

charged

Alias for field number 3

combo

Alias for field number 0

function

Alias for field number 2

prop

Alias for field number 4

table_getter

Alias for field number 5

title

Alias for field number 1

schrodinger.application.matsci.kmcgui.get_field_strength_string(components)

Get the string indicating field direction and strength, to be shown in the UI

Parameters

components (list) – Field value components

Return type

str

Returns

A string indicating field direction and strength

class schrodinger.application.matsci.kmcgui.PropertyCombo(text, items, values, layout, selector)

Bases: schrodinger.ui.qt.swidgets.SComboBox

A combobox used to select KMC properties

values_changed

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__(text, items, values, layout, selector)

Create a PropertyCombo instance

Parameters
  • text (str) – The label for the combobox. If no text is provided, there no label will be created and self.label will be None

  • items (list) – List of PlotInfo items to display in the combobox

  • values (dict) – Keys are property names (such as the .prop property from PropInfo objects (modified by the charge suffix), values are a list of values for that property. Initially, this dict can be empty and will be populated as properties are selected by the user. This prevents obtaining expensive properties unless needed, and allows multiple comboboxes to share the same property/value cache

  • layout (swidgets.SBoxLayout) – The layout to place this combobox into

  • selector (InputSelectorWithDatabase) – The database input selector

setEnabled(state)

Set all child widgets to enabled state of state

Parameters

state (bool) – True if widgets should be enabled, False if not

getValuesFromFile(info)

Get the values for info from the file

Parameters

info (PlotInfo) – The info object to get values for

loadAndProcessData(*_, quiet=False, info=None, prop=None)

Get the values for the current or passed info, loading them from a file if need be. The values_changed signal will be emitted unless quiet is specified. Args are signal arguments and are ignored.

Parameters
  • quiet (bool) – Whether to emit the values_changed signal

  • info (PlotInfo) – The info object to load values for. If not supplied, the current selection will be used.

  • prop (str) – The property to load values for. If not supplied, the current selection will be used.

reset()

Reset this combobox. Will emit the values_changed signal.

getCurrentInfoAndProp()

Get the current info object and property name from the combobox

Return type

(PlotInfo, str)

Returns

The current info object and name of the associated property

getCurrentInfoPropAndValues(quiet=True)

Get the current info object, property name and associated values from the combobox

Return type

(PlotInfo, str, list)

Returns

The current info object, property name and associated values. The values returned are the directly cached list, not a copy. So modifying the list will modify the values returned by future calls to this function.

getPropAndValues(info, quiet=True)

Get property name and associated values using the info object

Parameters
  • info (PlotInfo) – The info object to get values for

  • quiet (bool) – Whether to emit the values_changed signal

class schrodinger.application.matsci.kmcgui.DatabaseInfo(selector)

Bases: PyQt6.QtCore.QObject

Holds Schrodinger info from and about the SQL database

pathChanged

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__(selector)

Create a DatabaseInfo object

Parameters

selector (InputSelectorWithDatabase) – The input selector

setPath(path)

Set the path

Parameters

path (str or pathlib.Path) – The path to the database file

loadInfo()

Load info from the database

getPath()

Get the current path

Return type

pathlib.Path or None

Returns

The current path to the database file, or None if none has been specified

reset(force_emit=False)

Reset the data properties

Parameters

force_emit (bool) – Emit the pathChanged signal even if the path doesn’t actually change.

getPathLabelText()

Get the string version of the path to the database file

Return type

str

Returns

The path to the database file. NO_DB is returned if the path is not set.

class schrodinger.application.matsci.kmcgui.InputSelectorWithDatabase(parent, show_entry_cb=True, show_charge_combo=False, **options)

Bases: schrodinger.ui.qt.input_selector.InputSelector

Adds the ability to pick an SQL database instead of a structure file

DATABASE = 'Database'
database_changed

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.

data_changed

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.

USE_ENTRY_DB = ('included_entry', 'file')
__init__(parent, show_entry_cb=True, show_charge_combo=False, **options)

Create a InputSelectorWithDatabase object

Parameters
  • parent (af2.JobApp) – The panel this selector will be part of

  • show_entry_cb (bool) – Show the “Use database for this structure” checkbox

  • show_charge_combo (bool) – Show the charge combobox

useEntryDatabaseToggled()

React to the the use existing database checkbox toggling

showOrHideEntryDBFrame()

Set the visibility of the widgets that allow the user to request the database associated with the included entry

checkEntryDatabase()

Check the current included entry to see if there is an associated database

databaseComboChanged()

React to the value of the database combo changing

setCharges(charges)

Set the charges available for this database

Parameters

charges (list) – The charges that have results in the database

selectedCharge()

Get the currently selected charge

Return type

str

Returns

The currently selected charge

inputState(true_state=False)

Get the current input state of the selector

Parameters

true_state (bool) – If True, DATABASE will be returned if DATABASE is the selected input. If False, INCLUDED_ENTRY will be returned if DATABASE is the selected input. INCLUDED_ENTRY is returned in this case because that is where the input structure will actually come from.

Return type

str

Returns

The input source. See true_state param.

isDatabaseSource()

Check if DATABASE is the current input source

Return type

bool

Returns

Whether DATABASE is currently selected

validate()

Validate the state of the selector

Return type

str or None

Returns

None if there are no issues. A message describing the problem if there is an issue.

currentDBInfo(only_if_used=False)

Get the DatabaseInfo object for the current input selector settings

Parameters

only_if_used (bool) – If True, the included entry database info will only be returned if the user has elected to use it

Return type

DatabaseInfo or None

Returns

The info for the current settings, or None if the chosen input method does not allow for a database

getDatabasePath()

Get the path to the currently-used existing database

Return type

pathlib.Path or None

Returns

The path to the existing database to use or None if no database should be used

usingExistingDatabase()

Check if the user has specified an existing database be used

Return type

bool

Returns

Whether an existing database is used

existingDatabaseJobFilename()

Get the filename for the existing database in the job directory.

Note: !! This method is only valid during job launch - i.e. after the setup method has been called. Calling at other times may incorrectly yield None or a stale file name from the previous job launch.

Return type

str or None

Returns

The name of the database from the most recent job launch that used an existing database. None may be returned if no such job has been launched or the current job does not use an existing database.

reset()

Reset the widget

setup(jobname)
Prepares for job start. In addition to standard behavior, will copy the

chosen database to the job directory if DATABASE is the input source

Parameters

jobname (str) – The job name

Return type

bool

Returns

True if everything is OK, False if start should be aborted

validateDBAndStructure()

Check that everything looks OK with the chosen database and given structure

Return type

str or None

Returns

None if there are no issues. A message describing the problem if there is an issue.

browseFiles()

Allow the user to select an input file

In addition to parent class behavior, allows the selection of a SQL file

handleNewDatabaseSource()

Do the work required if the user picks a new database file as the source

findOrCreateDBEntry()

Find the structure that was used to generate the database and put it in the Workspace.

Raises a warning dialog if no structure can be found

class schrodinger.application.matsci.kmcgui.Tab(master, name)

Bases: schrodinger.ui.qt.swidgets.SFrame

Base class for advanced options tabs

__init__(master, name)

Create a Tab instance

Parameters
  • master (AdvancedOptionsDialog) – The dialog

  • name (str) – The name of this tab

setStructure(struct)

Set the structure for this tab

Parameters

struct (schrodinger.structure.Structure) – The structure for this tab

setDatabase(database)

Set the database for this tab

Parameters

database (str) – The path to the database

prepareForClose()

Prepare this tab for closing the dialog

reset()

Reset this tab

getFlags()

Get the command line flags for this tab

Return type

list

Returns

The command line flags generated by this tab’s options

validate()

Validate the settings on this tab

class schrodinger.application.matsci.kmcgui.MinMaxNeighborWidgets(master, text, parent_layout)

Bases: schrodinger.ui.qt.swidgets.SFrame

Widgets that give information about molecules with most or least neighbors

__init__(master, text, parent_layout)

Create a MinMaxNeighborWidgets instance

Parameters
  • master (Tab) – The Tab these widgets are owned by

  • text (str) – The text describing if this is for the min or max neighbor

  • parent_layout (QBoxLayout) – The layout to place these widgets into

highlightMolecule()

Highlight the min/max molecule and its neighbors

removeHighlights()

Remove any current highlights this instance has created

setValues(mol_number, neighbors)

Set the values for this instance

Parameters
  • mol_number (int) – The molecule number that is the central molecule

  • neighbors (list) – The molecule numbers for molecules that are neighbors of the central molecule

setEntryId(eid)

Set the entry ID

Parameters

eid (str) – The entry ID to use when highlighting

reset(entry_id=None)

Reset these widgets

Parameters

eid (str) – The entry ID to use when highlighting

class schrodinger.application.matsci.kmcgui.NeighborsTab(*args)

Bases: schrodinger.application.matsci.kmcgui.Tab

The Nearest Neighbors tab

HEAVY = 'Heavy atoms'
ALL = 'All atoms'
CUTOFF_COMBO_ITEMS = {'All atoms': 'all', 'Heavy atoms': 'heavy'}
AVERAGE = 'Average number of nearest neighbors: %s'
MAXIMUM = 'Maximum nearest neighbors: %s in molecule %s'
MINIMUM = 'Minimum nearest neighbors: %s in molecule %s'
TOTAL = 'Total number of pairs: %s'
MAX_CUTOFF = 99.0
__init__(*args)

Create a NeighborsTab instance

resetToDB()

Reset the settings to those from the existing database

removeHighlights()

Remove all Workspace highlights created by this tab

cutoffChanged()

React to the neighbor cutoff changing

setRecalcButtonState()

Set the Recalc button enabled/disabled based on whether the shown stats are for the current settings

setStructure(struct)

See parent class

recalculate()

Find all pairs based on the current settings and update the statistics

setDatabase(database)

See parent class

readFromDatabase()

Read all the pair information from the database and update stats

resetStats()

Reset the labels and widgets that present stats to the user

computeStats()

Compute the statistics for the current set of dimers

setMaxCutoff(struct)

Make sure the cutoff can’t be any larger than the sides of the PBC

Parameters

struct (schrodinger.structure.Structure or None) – The current structure if one exists.

reset(struct=None)

Reset this tab, using the given structure (if given)

Parameters

struct (schrodinger.structure.Structure) – The structure for this tab

prepareForClose()

Remove any Workspace highlights before closing

getPairInfo()

Get the current pair settings

Return type

float, str

Returns

The current pair settings, (cutoff distance, atom type)

getFlags()

Get the command line flags based on the current pair settings

Return type

list

Returns

The command line flags as a list of str

setEditable(state)

Set the editable state of the widgets in this tab

Parameters

state (bool) – Whether the widgets should be editable

Add the votca logo to the given layout

Parameters

layout (QLayout) – The layout to add the logo to

Return type

swidgets.SFrame

Returns

The frame containing the logo