Beispiel #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()
Beispiel #2
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)
Beispiel #3
0
    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
Beispiel #4
0
    def __init__(self, database, graph=None, params=None, parent=None):
        if params is None: params = dict()
        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._selected_minimum = None

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

        self._tree_cid = None
        self._minima_cid = None

        self._minima_labels = dict()
Beispiel #5
0
    def __init__(self, plw, axes, neb=None, frq=30, nplots=3):
        self.count = 0
        self.nplots = nplots
        self.data = deque()
        self.frq = frq
        self.process_events = Signal()
        self.plw = plw
        self.axes = axes
        self.neb = neb
        
        self.on_coords_select = Signal()

        self.points_list = []
        def on_pick_tmp(event):
            self.on_pick(event)
            return
        self.plw.mpl_connect('pick_event', on_pick_tmp)
Beispiel #6
0
    def __init__(self, app, systemtype, parent=None):
        QtGui.QWidget.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.systemtype = systemtype
        self.transition = None
        self.app = app
        self.double_ended_connect_runs = []
        self.pick_count = 0

        self.minima_selection = MySelection()
        self.on_minimum_1_selected = Signal()
        self.on_minimum_2_selected = Signal()

        # set up the list manager
        self.list_manager = ListViewManager(self)

        # define the system
        self.NewSystem()

        # finish setting up the list manager (this must be done after NewSystem() is called)
        self.list_manager.finish_setup()

        # try to load the pymol viewer.
        try:
            self.usepymol = self.system.params.gui.use_pymol
        except (KeyError, AttributeError):
            self.usepymol = config.getboolean("gui", "use_pymol")
        if self.usepymol:
            try:
                from .pymol_viewer import PymolViewer
                self.pymolviewer = PymolViewer(self.system.load_coords_pymol)
            except (ImportError or NotImplementedError):
                self.usepymol = False

        if not self.usepymol:
            # note: glutInit() must be called exactly once.  pymol calls it
            # during pymol.finish_launching(), so if we call it again it will
            # give an error. On the other hand, if we're not using pymol we
            # must call it.
            from OpenGL.GLUT import glutInit
            glutInit()

        self.bhmanager = None
Beispiel #7
0
    def __init__(self,
                 potential,
                 coords1,
                 coords2,
                 k=100.,
                 max_images=50,
                 image_density=10.,
                 iter_density=10.,
                 verbose=0,
                 factor=1.05,
                 NEBquenchParams=None,
                 adjustk_freq=0,
                 adjustk_tol=0.1,
                 adjustk_factor=1.05,
                 dneb=True,
                 reinterpolate_tol=0.1,
                 reinterpolate=0,
                 adaptive_nimages=False,
                 adaptive_niter=False,
                 interpolator=interpolate_linear,
                 distance=distance_cart,
                 **kwargs):

        self.potential = potential
        self.interpolator = interpolator

        self.verbose = verbose
        self.distance = distance
        self.factor = factor
        self.max_images = max_images
        self.min_images = 3
        self.image_density = image_density
        self.iter_density = iter_density
        self.update_event = Signal()
        self.coords1 = coords1
        self.coords2 = coords2
        self.reinterpolate = reinterpolate
        self.reinterpolate_tol = reinterpolate_tol
        self._nebclass = NEB
        self._kwargs = kwargs.copy()
        self.k = k
        self.adaptive_images = adaptive_nimages
        self.adaptive_niter = adaptive_niter

        self._kwargs["adjustk_freq"] = adjustk_freq
        self._kwargs["adjustk_tol"] = adjustk_tol
        self._kwargs["adjustk_factor"] = adjustk_factor

        self._kwargs["dneb"] = dneb

        if NEBquenchParams is None:
            NEBquenchParams = {'tol': 1e-2, 'maxErise': 100.0}

        self.quenchParams = NEBquenchParams

        self.prepared = False
Beispiel #8
0
    def __init__(self,
                 db=":memory:",
                 accuracy=1e-3,
                 connect_string='sqlite:///%s',
                 compareMinima=None,
                 createdb=True):
        self.accuracy = accuracy
        self.compareMinima = compareMinima

        if not os.path.isfile(db) or db == ":memory:":
            newfile = True
            if not createdb:
                raise IOError(
                    "createdb is False, but database does not exist (%s)" % db)
        else:
            newfile = False

        # set up the engine which will manage the backend connection to the database
        self.engine = create_engine(connect_string % db, echo=verbose)

        if not newfile and not self._is_pele_database():
            raise IOError("existing file (%s) is not a pele database." % db)

        # set up the tables and check the schema version
        if newfile:
            self._set_schema_version()
        self._check_schema_version()
        self._update_schema()
        #         self._check_schema_version_and_create_tables(newfile)

        # set up the session which will manage the frontend connection to the database
        Session = sessionmaker(bind=self.engine)
        self.session = Session()

        # these functions will be called when a minimum or transition state is
        # added or removed
        self.on_minimum_added = Signal()
        self.on_minimum_removed = Signal()
        self.on_ts_added = Signal()
        self.on_ts_removed = Signal()

        self.lock = threading.Lock()
        self.connection = self.engine.connect()
Beispiel #9
0
    def __init__(self, system, database, on_number_alive_changed=None):
        self.system = system
        self.database = database
        self.workers = []
        self._old_nalive = -1

        self.on_number_alive_changed = Signal()
        if on_number_alive_changed is not None:
            self.on_number_alive_changed.connect(on_number_alive_changed)

        self.refresh_timer = QtCore.QTimer()
        self.refresh_timer.timeout.connect(self._check_number)
Beispiel #10
0
    def __init__(self, system, database, nsteps=None, on_finish=None):
        QtCore.QObject.__init__(self)
        self.system = system
        self.database = database
        self.daemon = True
        self.nsteps = nsteps

        #child_conn = self
        self.bhprocess = None

        self.on_finish = Signal()
        if on_finish is not None:
            self.on_finish.connect(on_finish)
Beispiel #11
0
    def __init__(self, database=None, parent=None, app=None, minima=None):
        QWidget.__init__(self, parent=parent)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.database = database
        self.minima = minima
        self.app = app

        self.canvas = self.ui.canvas.canvas

        self.axes = self.canvas.axes
        self.fig = self.canvas.fig

        self.on_minima_picked = Signal()

        self.from_minima = set()
        self.positions = dict()
        self.boundary_nodes = set()

        self._selected_minimum = None
        self._mpl_cid = None

        self._minima_color_value = None
Beispiel #12
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
Beispiel #13
0
 def __init__(self, parent=None, nplots=3):
     MPLWidget.__init__(self, parent=parent)
     self.nplots = nplots
     self.on_neb_pick = Signal()
     self.mpl_connect('pick_event', self.on_pick)
Beispiel #14
0
 def __init__(self, value):
     self.__value = value
     self.changed = Signal()
Beispiel #15
0
 def __init__(self, *args, **kwargs):
     super(GetThermodynamicInfoParallelQT, self).__init__(*args, **kwargs)
     self.on_finish = Signal()