示例#1
0
文件: run.py 项目: pele-python/pele
    def _doubleEndedConnect(self, reconnect=False, min1min2=None):
        """
        launch a double ended connect run to connect the two selected minima.

        If the minima are not connected, or reconnect is True, launch a connect browser
        in  a separate window.  Else just show the path in the OGL viewer
        """
        # determine which minima to connect
        if min1min2 is None:
            min1, min2 = self.get_selected_minima()
        else:
            min1, min2 = min1min2
        database = self.system.database
        if not reconnect:
            # check if the minima are already connected
            double_ended_connect = self.system.get_double_ended_connect(min1, min2, database, 
                                                   fresh_connect=False, verbosity=0)
            if double_ended_connect.graph.areConnected(min1, min2):
                print("minima are already connected.  loading smoothed path in viewer")
                mints, S, energies = double_ended_connect.returnPath()
                clist = [m.coords for m in mints]
                smoothpath = self.system.smooth_path(clist)
                
                coords = np.array(smoothpath)
                self.nebcoords = coords
                self.nebenergies = np.array(energies)
                print("setting path in oglPath")
                self.ui.oglPath.setCoordsPath(coords)
#                self.ui.oglPath.setCoords(coords[0,:], 1)
#                self.ui.oglPath.setCoords(None, 2)
#                self.ui.sliderFrame.setRange(0, coords.shape[0]-1)
                
                if self.usepymol:
                    self.pymolviewer.update_coords(self.nebcoords, index=1, delete_all=True)
                
                return

                
        # make the connect viewer
        
        
        decviewer = ConnectViewer(self.system, self.system.database, min1, min2, parent=self, app=self.app)
        
        print("starting double ended")
        decviewer.show()
        decviewer.start()
        
        # store pointers
        self.double_ended_connect_runs.append(decviewer)
示例#2
0
    def __init__(self, system, database, parent=None, app=None):
        ConnectViewer.__init__(self, system, database, app=app, parent=parent)
        self.setWindowTitle("Connect all")

        self.wgt_dgraph = DGraphWidget(database=self.database, parent=self)
        self.connect_manager = ConnectManager(database)
        self.view_dgraph = self.new_view("Disconnectivity Graph",
                                         self.wgt_dgraph,
                                         QtCore.Qt.TopDockWidgetArea)
        self.view_dgraph.hide()
        self.ui.actionD_Graph.setVisible(True)
        self.ui.actionD_Graph.setChecked(False)

        self.textEdit_summary = QtGui.QTextEdit(parent=self)
        self.textEdit_summary.setReadOnly(True)
        self.view_summary = self.new_view("Summary",
                                          self.textEdit_summary,
                                          pos=QtCore.Qt.TopDockWidgetArea)
        self.connect_summary = _ConnectAllSummary()
        self.ui.actionSummary.setVisible(True)
        self.view_summary.hide()
        self.ui.actionSummary.setChecked(False)

        self.ui.action3D.setChecked(False)
        self.view_3D.hide()

        self.ui.actionEnergy.setChecked(False)
        self.view_energies.hide()

        self.ui.actionPause.setVisible(True)

        self.is_running = False

        self.failed_pairs = set()

        # add combo box to toolbar
        self.combobox = Qt.QComboBox()
        self.ui.toolBar.addWidget(self.combobox)
        self.combobox.addItems(
            ["connect strategy:", "random", "global min", "untrap", "combine"])
        self.combobox.setToolTip(
            "the strategy used to select which minima to connect")
示例#3
0
    def __init__(self, system, database, parent=None, app=None):
        ConnectViewer.__init__(self, system, database, app=app, parent=parent)
        self.setWindowTitle("Connect all")

        self.wgt_dgraph = DGraphWidget(database=self.database, parent=self)
        self.connect_manager = ConnectManager(database)
        self.view_dgraph = self.new_view("Disconnectivity Graph", self.wgt_dgraph, QtCore.Qt.TopDockWidgetArea)
        self.view_dgraph.hide()
        self.ui.actionD_Graph.setVisible(True)
        self.ui.actionD_Graph.setChecked(False)

        self.textEdit_summary = QtGui.QTextEdit(parent=self)
        self.textEdit_summary.setReadOnly(True)
        self.view_summary = self.new_view("Summary", self.textEdit_summary, pos=QtCore.Qt.TopDockWidgetArea)
        self.connect_summary = _ConnectAllSummary()
        self.ui.actionSummary.setVisible(True)
        self.view_summary.hide()
        self.ui.actionSummary.setChecked(False)
        

        self.ui.action3D.setChecked(False)
        self.view_3D.hide()
        
        self.ui.actionEnergy.setChecked(False)
        self.view_energies.hide()
        
        self.ui.actionPause.setVisible(True)
        
        self.is_running = False
        
        self.failed_pairs = set()
        
        # add combo box to toolbar
        self.combobox = Qt.QComboBox()
        self.ui.toolBar.addWidget(self.combobox)
        self.combobox.addItems(["connect strategy:",
                                "random",
                                "global min",
                                "untrap",
                                "combine"])
        self.combobox.setToolTip("the strategy used to select which minima to connect")
示例#4
0
    def _doubleEndedConnect(self, reconnect=False, min1min2=None):
        """
        launch a double ended connect run to connect the two selected minima.

        If the minima are not connected, or reconnect is True, launch a connect browser
        in  a separate window.  Else just show the path in the OGL viewer
        """
        # determine which minima to connect
        if min1min2 is None:
            min1, min2 = self.get_selected_minima()
        else:
            min1, min2 = min1min2
        database = self.system.database
        if not reconnect:
            # check if the minima are already connected
            double_ended_connect = self.system.get_double_ended_connect(
                min1, min2, database, fresh_connect=False, verbosity=0)
            if double_ended_connect.graph.areConnected(min1, min2):
                print(
                    "minima are already connected.  loading smoothed path in viewer"
                )
                mints, S, energies = double_ended_connect.returnPath()
                clist = [m.coords for m in mints]
                smoothpath = self.system.smooth_path(clist)

                coords = np.array(smoothpath)
                self.nebcoords = coords
                self.nebenergies = np.array(energies)
                print("setting path in oglPath")
                self.ui.oglPath.setCoordsPath(coords)
                #                self.ui.oglPath.setCoords(coords[0,:], 1)
                #                self.ui.oglPath.setCoords(None, 2)
                #                self.ui.sliderFrame.setRange(0, coords.shape[0]-1)

                if self.usepymol:
                    self.pymolviewer.update_coords(self.nebcoords,
                                                   index=1,
                                                   delete_all=True)

                return

        # make the connect viewer

        decviewer = ConnectViewer(self.system,
                                  self.system.database,
                                  min1,
                                  min2,
                                  parent=self,
                                  app=self.app)

        print("starting double ended")
        decviewer.show()
        decviewer.start()

        # store pointers
        self.double_ended_connect_runs.append(decviewer)