Package schrodinger :: Package application :: Package jaguar :: Package gui :: Module utils
[hide private]
[frames] | no frames]

Module utils

Utility functions and classes for the Jaguar GUIs

Classes [hide private]
  Solvent
Solvent(name, keyvalue, dielectric, radius, weight, density)
  JaguarSettingError
An exception indicating that there was an error with the user-specified Jaguar settings
  JaguarSettingWarning
A warning indicating that a user-specified Jaguar settings could not be loaded into the GUI
  EnhancedComboBox
A combo box for use in the Jaguar GUI with several Pythonic enhancements
  PropertiesTableWidget
A QTableWidget for the Properties table on the Properties tab
  WorkspaceInclusionCheckBox
A checkbox that is skinned to look like the Project Table workspace inclusion checkbox.
  ProjTableLikeView
A table view that mimics the selecting and editing behaviors of the Project Table
  SpinTreatment
An enumeration of the possible spin treatment settings.
Functions [hide private]
 
count_num_strucs(input_selector)
Count the number of structures currently specified in the input selector widget.
 
find_key_for_value(mydict, value)
This function finds key corresponding to a given value in a dictionary.
float
validate_le_float_input(widget, msg=None)
This function checks whether a given line edit widget has a valid input.
 
catch_jag_errors(func)
A decorator that will display any JaguarSettingErrors in an error dialog.
bool
warn_about_mmjag_unknowns(jag_input, parent=None)
If the JaguarInput object contains any unknown keywords, warn the user about the unknowns and ask them if they want to continue.
int
calculate_num_protons(struc)
Calculate the number of protons in the specified structure
tuple
get_atom_info(ws_atom_num)
Get information about the specified workspace atom
tuple
atom_name_sort_key(atom_name)
Convert a Jaguar atom name into a key for use in sorting by number
str
generate_job_name(struc_name, task_name, theory, basis)
Generate an appropriate job name for a job with the specified settings.
Variables [hide private]
  maestro = schrodinger.get_maestro()
  THEORY_DFT = 'DFT'
  THEORY_HF = 'HF'
  THEORY_LMP2 = 'LMP2'
  MOLECULAR_CHARGE_PROP = 'i_m_Molecular_charge'
  SPIN_MULT_PROP = 'i_m_Spin_multiplicity'
  ERROR_BACKGROUND_BRUSH = gui_utils.ERROR_BACKGROUND_BRUSH
  JAGUAR_IN_MAE_FILETYPES = (('Jaguar Structure Input', '*.in *....
  ALL_SOLVENTS = [Solvent(name='Water', keyvalue='water', dielec...
  atom_name_regex = re.compile(r'^([^\W\d]+)(\d+)$')
A regular expression that matches Jaguar atom names.
  __package__ = 'schrodinger.application.jaguar.gui'
Function Details [hide private]

count_num_strucs(input_selector)

 

Count the number of structures currently specified in the input selector widget. Since Jaguar can't accept more than three structures, this function will return 4 for all values >= 4.

Parameters:
  • input_selector (schrodinger.ui.qt.input_selector.InputSelector) - The input selector widget

find_key_for_value(mydict, value)

 

This function finds key corresponding to a given value in a dictionary. We assume here that values in a given dictionary are unique.

Parameters:
  • mydict (dict) - dictionary
  • value - value in dictionary. It can be any hashable type.
Returns:
key, which can be any type.

validate_le_float_input(widget, msg=None)

 

This function checks whether a given line edit widget has a valid input. If it does it will return a float value. Otherwise an exception will be raised. This function should only be used for line edits used to enter float numbers.

Parameters:
  • widget (QLineEdit) - line edit widget
  • msg (str) - text of exception error message
Returns: float
valid float number

catch_jag_errors(func)

 

A decorator that will display any JaguarSettingErrors in an error dialog.

Returns:
If the decorated function raised a JaguarSettingError, False will be returned. Otherwise, the return value of the decorated function will be returned.
Decorators:
  • @decorator.decorator

warn_about_mmjag_unknowns(jag_input, parent=None)

 

If the JaguarInput object contains any unknown keywords, warn the user about the unknowns and ask them if they want to continue.

Parameters:
Returns: bool
True if we should continue (either there were no unknown keywords, or there were but the user wants to continue). False if we should cancel.

calculate_num_protons(struc)

 

Calculate the number of protons in the specified structure

Parameters:
Returns: int
The number of protons

get_atom_info(ws_atom_num)

 

Get information about the specified workspace atom

Parameters:
  • ws_atom_num (int) - The workspace atom number
Returns: tuple
A tuple of
  • The atom name (after Jaguar atom naming has been applied)
  • The atom number relative to the entry (rather than relative to the workspace structure)
  • The entry id
  • The entry title

atom_name_sort_key(atom_name)

 

Convert a Jaguar atom name into a key for use in sorting by number

Parameters:
  • atom_name (str) - The atom name
Returns: tuple
A tuple of (atom number, element)

generate_job_name(struc_name, task_name, theory, basis)

 

Generate an appropriate job name for a job with the specified settings. Any settings that are specified as None will be omitted from the job name. If a directory or file with the specified name exists in the current directory, an integer will be appended to the job name.

Parameters:
  • struc_name (str or NoneType) - The structure title
  • task_name (str or NoneType) - The task name (i.e. a shortened version of the panel name
  • theory (str or NoneType) - The theory method. Should be "HF", "LMP2", or the DFT functional.
  • basis (str or NoneType) - The basis name
Returns: str
The job name

Note: If generating multiple job names, the input for each job must be saved before the next job name is generated. Otherwise, this function will not be able to append the appropriate integer.


Variables Details [hide private]

JAGUAR_IN_MAE_FILETYPES

Value:
(('Jaguar Structure Input', '*.in *.mae *.maegz *.mae.gz'),
 ('Jaguar Input', '*.in'),
 ('Maestro', '*.mae *.maegz *.mae.gz'))

ALL_SOLVENTS

Value:
[Solvent(name='Water', keyvalue='water', dielectric=80.37, radius=1.4,\
 weight=18.02, density=0.99823),
 Solvent(name='Acetonitrile', keyvalue='acetonitrile', dielectric=37.5\
, radius=2.19, weight=41.05, density=0.777),
 Solvent(name='Benzene', keyvalue='benzene', dielectric=2.284, radius=\
2.6, weight=78.12, density=0.87865),
 Solvent(name='Carbon tetrachloride', keyvalue='carbon_tet', dielectri\
c=2.238, radius=2.67, weight=153.82, density=1.594),
...

atom_name_regex

A regular expression that matches Jaguar atom names. Group 1 of the match is the element and group 2 is the number.

Value:
re.compile(r'^([^\W\d]+)(\d+)$')