Example #1
0
 def __init__(self, app, system, freq=30):
     self.system = system
     self.on_update_gui = Signal()
     self.frq = freq
     self.app = app
     self.on_run_started = Signal()
     self.on_run_finished = Signal()
Example #2
0
    def __init__(self, database, graph=None, params={}, parent=None):
        super(DGraphWidget, self).__init__(parent=parent)

        self.database = database
        self.graph = graph

        self.ui = dgraph_browser.Ui_Form()
        self.ui.setupUi(self)
        self.canvas = self.ui.widget.canvas
        #        self.ui.wgt_mpl_toolbar = NavigationToolbar()
        #        self.toolbar = self.

        self.input_params = params.copy()
        self.params = {}
        self.set_defaults()

        self.minimum_selected = Signal()
        # self.minimum_selected(minim)

        #        self.rebuild_disconnectivity_graph()
        self.colour_tree = []
        self.tree_selected = None

        # populate the dropdown list with the color names
        self._colors = sorted(col.cnames.keys())
        self.ui.comboBox_colour.addItems(self._colors)
        [self.ui.comboBox_colour.addItem(s) for s in self._colors]
        self.ui.comboBox_colour.activated[str].connect(self._color_tree)
    def __init__(self,
                 system,
                 database,
                 min1,
                 min2,
                 outstream=None,
                 return_smoothed_path=True,
                 daemon=True):
        QtCore.QObject.__init__(self)
        self.system = system
        self.database = database
        self.min1, self.min2 = min1, min2
        self.return_smoothed_path = return_smoothed_path
        self.daemon = daemon

        self.outstream = outstream

        self.on_finished = Signal()

        self.decprocess = None

        self.newminima = set()
        self.newtransition_states = set()
        self.success = False
        self.killed_early = False
        self.is_running = False
Example #4
0
 def __init__(self, parent=None, nplots=3):
     #QtGui.QWidget
     MPLWidget.__init__(self, parent=parent)
     #self.canvas = MPLWidget(self)
     self.nplots = nplots
     self.on_neb_pick = Signal()
     self.mpl_connect('pick_event', self.on_pick)
Example #5
0
    def __init__(self, parent=None):
        super(NEBWidget, self).__init__(parent=parent)
                
        self.ui = ui.nebbrowser.Ui_Form()
        self.ui.setupUi(self)
        self.plw = self.ui.widget
        
#        self.plw.axes.set_ylabel("NEB image energy")
#        pl.xlabel("distance along the path")
        
#        self.system = system
#        self.min1 = min1
#        self.min2 = min2
        
#        self.minimum_selected = Signal()
        # self.minimum_selected(minim)
    
        #the function which tells the eventloop to continue processing events
        #if this is not set, the plots will stall and not show until the end of the NEB run.
        #ideally it is the function app.processEvents where app is returned by
        #app = QApplication(sys.argv)
        self.process_events = Signal()
        
        self.on_neb_pick = Signal()
        self.on_neb_pick.connect(self.on_pick)
Example #6
0
    def __init__(self, database=None, parent=None, app=None, minima=None):
        MPLWidget.__init__(self, parent=parent)
        #        self.widget = GraphDisplayWidget(parent=parent)
        self.database = database
        self.minima = minima
        self.app = app

        self.on_minima_picked = Signal()
Example #7
0
    def __init__(self,
                 db=":memory:",
                 accuracy=1e-3,
                 connect_string='sqlite:///%s',
                 compareMinima=None,
                 createdb=True):
        global _schema_version
        if not createdb:
            if not os.path.isfile(db):
                raise IOError("database does not exist")

        self.engine = create_engine(connect_string % (db), echo=verbose)
        if createdb:
            conn = self.engine.connect()
            if not self.engine.has_table("tbl_minima"):
                conn.execute("PRAGMA user_version = %d;" % _schema_version)
            Base.metadata.create_all(self.engine)
            result = conn.execute("PRAGMA user_version;")
            schema = result.fetchone()[0]
            result.close()
            conn.close()
            if _schema_version != schema:
                raise IOError(
                    "database schema outdated, current (newest) version: "
                    "%d (%d). Please use migrate_db.py in pygmin/scripts to update database"
                    % (schema, _schema_version))

        Session = sessionmaker(bind=self.engine)
        self.session = Session()
        self.accuracy = accuracy
        self.on_minimum_added = Signal()
        self.on_minimum_removed = Signal()
        self.on_ts_added = Signal()
        self.on_ts_removed = Signal()

        self.compareMinima = compareMinima
        self.lock = threading.Lock()
        self.connection = self.engine.connect()

        self._initialize_queries()
Example #8
0
    def __init__(self, *args, **kwargs):
        super(Show3DWithSlider, self).__init__(*args, **kwargs)
        self.setMinimumSize(200, 200)

        self.ui = Ui_show3d_with_slider()
        self.ui.setupUi(self)

        self.label = self.ui.label
        self.label.hide()

        self.ui.btn_animate.hide()
        self.ui.btn_animate.setCheckable(True)

        self.oglwgt = self.ui.oglwgt

        self.slider = self.ui.slider

        self.on_frame_updated = Signal()

        self.animate = False
        self._animate_dir = 1
Example #9
0
class NEBWidget(QWidget):
    def __init__(self, parent=None):
        super(NEBWidget, self).__init__(parent=parent)
                
        self.ui = ui.nebbrowser.Ui_Form()
        self.ui.setupUi(self)
        self.plw = self.ui.widget
        
#        self.plw.axes.set_ylabel("NEB image energy")
#        pl.xlabel("distance along the path")
        
#        self.system = system
#        self.min1 = min1
#        self.min2 = min2
        
#        self.minimum_selected = Signal()
        # self.minimum_selected(minim)
    
        #the function which tells the eventloop to continue processing events
        #if this is not set, the plots will stall and not show until the end of the NEB run.
        #ideally it is the function app.processEvents where app is returned by
        #app = QApplication(sys.argv)
        self.process_events = Signal()
        
        self.on_neb_pick = Signal()
        self.on_neb_pick.connect(self.on_pick)
    
    def highlight2(self, x, y):
        """draw a circle around x, y"""
#        if hasattr(self, "highlight_circle"):
        try:
            self.highlight_circle.remove()
        except: pass
        self.highlight_circle=Circle((x, y),radius=0.5, fill=False)
        self.plw.axes.add_patch(self.highlight_circle)
        
    
    def highlight1(self, x, y):
        ylim = self.plw.axes.get_ylim()
#        if hasattr(self, "highlight_line"):
        try:
            self.highlight_line.remove()
        except: pass
        self.highlight_line = Line2D([x,x],list(ylim), ls='--', c='k')
#        self.highlight_line.set_data([x,x],list(ylim))
                                                        
        self.plw.axes.add_line(self.highlight_line)
#        self.plw.axes.plot([x,x], list(ylim), 'k')
    
    def highlight(self, index, style=1):
        """draw a vertical line to highlight a particular point in the neb curve"""
        if index < 0:
            #I would like to delete the line here, but I don't know how to do it easily
            return
        from matplotlib.lines import Line2D
        S, energies, tmp = self.neb_callback.data[-1]
        x = S[index]
        y = energies[index]
        if style == 2:
            self.highlight2(x, y)
        else:
            self.highlight1(x, y)
        
        self.plw.draw()
        self.process_events()
        
    
    def on_pick(self, index=None, *args, **kwargs):
        self.highlight(index)

    def attach_to_NEB(self, neb):
        neb_callback = NEBCallback(self.plw, self.plw.axes)
        self.neb_callback = neb_callback
        neb_callback.process_events.connect(self.process_events)
        neb_callback.on_coords_select.connect(self.on_neb_pick)      
        neb.update_event.connect(neb_callback)