schrodinger.application.matsci.chargegui module¶
Classes to aid in assigning charges to atoms in a GUI
Copyright Schrodinger, LLC. All rights reserved.
- class schrodinger.application.matsci.chargegui.ChargePropertySelector(label, layout=None, tip=None)¶
Bases:
schrodinger.ui.qt.propertyselector.PropertySelectorMenu
A widget that allows the user to pick from a list of properties from a combobox and shows the user the “User” version of the property name (Property Name rather than x_prog_Property_Name)
- __init__(label, layout=None, tip=None)¶
Create a Charge PropertySelector instance
- Parameters
label (str) – The label for the combobox
layout (QBoxLayout) – The layout to place the SLabeledComboBox into
tip (str) – The tooltip for the combobox
- setVisible(state)¶
Set the combobox and label visible or hidden
- Parameters
state (bool) – Whether to show (True) or hide (False) the widgets
- isVisible()¶
Check if the combobox is visible
- Return type
bool
- Returns
True if visible, False if not
- reset()¶
Reset the combobox
- updateProperties(structs, monomer_charge=True)¶
Fill the combobox with all allowed atom properties available in structs
- Parameters
structs (list or None) – If a list, each item is a
schrodinger.structure.Structure
object. Use None to remove all atom properties but the defaultmonomer_charge (bool) – If True, monomer charges shows up in the charge combo box.
- getSelectedProp()¶
Return the x_prog_property_name form of the selected property
- Return type
str or None
- Returns
The x_prog_property_name value of the selected property or None if no property is selected
- static getAllPotentialAtomChargeProperties(structs)¶
Accumulate a list of all numeric atomic properties in all structures, removing any on the NON_CHARGE_PROPS list
- Parameters
structs (list) – Each item is a
schrodinger.structure.Structure
object.- Return type
list
- Returns
A list of all numeric
(r_, i_)
atom properties found in structs. The list is sorted alphabetically.
- class schrodinger.application.matsci.chargegui.NeighborTreatment(quantum=False, label=None, basis_set='3-21G', layout_type='horizontal', **kwargs)¶
Bases:
schrodinger.ui.qt.swidgets.SFrame
An SFrame that contains a set of widgets that allows the user to pick whether neighboring atoms will be dealt with as atoms, existing charges or on-the-fly ESP charges
- __init__(quantum=False, label=None, basis_set='3-21G', layout_type='horizontal', **kwargs)¶
Create a NeighborTreatment instance
- Parameters
quantum (bool) – Whether the option to treat the neighbors as atoms is to be offered
label (str) – The leading label on the line
basis_set (str) – The basis set to use by default for quantum and ESP treatments
All other kwargs are passed to the SFrame __init__ method. In particular, pass in the layout keyword to place these widgets into a parent layout.
- methodChanged()¶
React to changing the treatment method
- reset()¶
Reset all the widgets
- updateProperties(structs)¶
Update the available charge properties based on structs
- Parameters
structs (list) – A list of structures to pull charge properties from
- validate()¶
Validate that the widgets are in a proper state
- Return type
True or (False, msg)
- Returns
True if everything is OK or (False, msg) if something is wrong. msg will describe the issue. The return value is consistent with af2 validation methods
- getMethod()¶
Get the current treatment method
- Return type
str
- Returns
The selected treatment method
- getBasis()¶
Get the currently selected basis set if the treatment method requires one
- Return type
str or None
- Returns
A current basis set or None if the current treatment does not use a basis set
- getQProp()¶
Get the currently selected charge property if applicable
- Return type
str or None
- Returns
The current charge property or None if the current treatment does not use a charge property (or none is available). The property will be in the x_prog_property_name format.
- getFlags(flag_names=None)¶
Get the command line flags generated by this set of widgets
- Parameters
flag_names (dict) – Used to modify flag names to custom values. Keys are default flag names (BASIS_FLAG, USE_Q_FLAG module constants) and values are the new flag string to use.
- Return type
list
- Returns
A list of command line flags and values that capture the current state of these widgets.
- class schrodinger.application.matsci.chargegui.ChargeDialog(master, user_accept_function=None, standard_buttons=None, nonstandard_buttons=None, help_topic='', title=None)¶
Bases:
schrodinger.ui.qt.swidgets.SDialog
A dialog that allows the user to choose custom charges for atoms
- layOut()¶
Lay out the dialog widgets
- setEnabledState(enabled)¶
The the enabled state for custom charge widgets.
- Parameters
enabled (bool) – Whether the custom charge widgets are enabled.
- reset()¶
Reset the dialog
- selectAtoms()¶
Open the select atoms panel to help the user build an ASL for custom-charged atoms
- testASL(asl=None)¶
Check to see if an ASL is valid for the structures obtained from the getStructures method on the master object.
- Parameters
asl (str) – The ASL to check
- Return type
bool
- Returns
Whether the ASL is valid and matches atoms or not
- updateProperties(structs)¶
Update the properties in the charge property combobox.
- Parameters
structs (list or None) – If a list, each item is a
schrodinger.structure.Structure
object. Use None to remove all atom properties but the default
- accept()¶
Allow the user to close the dialog only if the widgets are in a valid state
- closeEvent(event)¶
Allow the user to close the dialog via the window manager X button only if the widgets are in a valid state
- Parameters
event (
QtGui.QCloseEvent
) – The event object from the triggered event
- validateASL()¶
Check that the custom atom charge ASL is valid. Post a dialog if that ASL is not valid or matches no atoms.
- Return type
bool
- Returns
True if everything is OK, False if validation fails.
- getCustomChargeInfo()¶
Return the ASL for custom charge atoms and the custom charge property
- Return type
(str, str)
- Returns
The ASL specifying which atoms to charge and the name of the property that stores the custom charges
- allowAtomSelection(state)¶
Enable/disable the atom selection button
- Parameters
state (bool) – The enabled state of the button
- class schrodinger.application.matsci.chargegui.FFInfo(ffdialog, layout, cbox=None)¶
Bases:
schrodinger.ui.qt.swidgets.SFrame
A frame that contains information about the chosen forcefield and a button to change those options
- __init__(ffdialog, layout, cbox=None)¶
Create an FFInfo object
- Parameters
ffdialog (
schrodinger.ui.qt.swidgets.SDialog
) – The dialog to open when the options button is pressedlayout (
QtWidgets.QBoxLayout
) – The layout to place this frame intocbox (
QtWidgets.QCheckBox
) – A checkbox that will control whether this frame is enabled or not
- forceFieldChanged(name=None)¶
Update the label when the forcefield changes
- Parameters
name (str) – The name of the new forcefield
- showFFDialog()¶
Show the force field options dialog
- enableWithCBox()¶
Set this frame enabled/disabled when the controlling checkbox is checked/unchecked
- class schrodinger.application.matsci.chargegui.ForceFieldDialog(master, user_accept_function=None, standard_buttons=None, nonstandard_buttons=None, help_topic='', title=None)¶
Bases:
schrodinger.ui.qt.swidgets.SDialog
A dialog that contains forcefield options
- OK = True¶
- NOT_OK = False¶
- layOut()¶
Lay out the dialog widgets
- getForceFieldMenuItem()¶
- Returns
the text as the force field menu item.
- Return type
str
- showChargeDialog()¶
Show the dialog that allows custom charges
- reset()¶
Reset the dialog widgets
- customOPLSDir()¶
Return the custom OPLS directory if one was requested
- Return type
str or None
- Returns
The path to the custom directory, or None if no such directory was requested
- getFlags()¶
Get the command line flags based on the GUI settings
- Return type
list
- Returns
List of command line flags and arguments
- findInvalidFFStructures(structs)¶
Check a list of structures to see if any are invalid with the given forcefield
- Parameters
structs (list) – A list of structures to check
- Return type
str or bool
- Returns
If bool, whether any of the structures are invalid. If str, then invalid structures were found and the str is an error message. An error message is only returned if the previous state is was all valid. This avoids continually showing the failure dialog.
- getStructures()¶
Get a list of structures loaded into the parent panel
- Return type
list
- Returns
List of structures