Source code for schrodinger.application.jaguar.gui.tabs.input_sub_tabs.basis_set

import schrodinger
from schrodinger.ui import picking

from ... import utils as gui_utils
from ...ui import input_sub_tabs as sub_tabs_ui
from ..sub_tab_widgets import basis_set_widgets
from . import base_sub_tab

maestro = schrodinger.get_maestro()


[docs]class BasisSetSubTab(base_sub_tab.BaseSubTab): """ An Input tab sub-tab for per-atom basis sets See parent class for documentation on the class variables """ NAME = "Per-Atom Basis" TABLE_MODEL_CLASS = basis_set_widgets.BasisSetModel PROXY_MODEL_CLASS = basis_set_widgets.BasisSetProxyModel UI_MODULE = sub_tabs_ui.basis_set_ui
[docs] def setup(self): self.picker = picking.PickAtomToggle(self.ui.pick_atom_cb, self.atomPicked)
[docs] def atomPicked(self, ws_atom_num): """ Respond to the user picking a workspace atom :param ws_atom_num: The atom number of the selected atom in the workspace structure :type ws_atom_num: int """ atom_name, atom_num, eid, title = gui_utils.get_atom_info(ws_atom_num) if self._proxy_model.isAcceptableEid(eid): self._table_model.addRow(eid, title, atom_name, atom_num) else: err = "This entry is not currently selected in the project table." self.warning(err)
[docs] def activate(self): # See parent class for documentation self.ui.pick_atom_cb.setChecked(True)
[docs] def deactivate(self): # See parent class for documentation self.ui.pick_atom_cb.setChecked(False)
[docs] def saveSettings(self, jag_input, eid): # See parent class for documentation rows = self._table_model.rowsForEid(eid) for cur_row in rows: # If we're doing an edit (instead of a start or a write), then we # haven't run validate() and some of the basis sets may be None. if cur_row.basis: jag_input.setAtomicBasis(cur_row.atom_num, str(cur_row.basis))
[docs] def loadSettings(self, jag_input, eid, title, struc): # See parent class for documentation self._table_model.clearDataForEid(eid) bases = jag_input.getAllAtomicBases() for atom_num, cur_basis in bases.items(): atom_name = struc.atom[atom_num].name self._table_model.addRow(eid, title, atom_name, atom_num, cur_basis)
[docs] def validate(self): # See parent class for documentation bad_data = self._proxy_model.checkBasisSets() if not bad_data: return None err = "Invalid per-atom basis sets selected:" for struc_name, atoms in bad_data.items(): joined_atoms = ", ".join(atoms) err += "\n\t%s: %s" % (struc_name, joined_atoms) return err
[docs] def perAtomBasisSetsPresent(self): """ Have any per-atom basis sets been set? :return: True if there are per-atom basis sets for any currently selected structures. False otherwise. :rtype: bool """ return bool(self._proxy_model.rowCount())