Ejemplo n.º 1
0
    def callback_add_shape(self):
        layer = get_epi().layers[self.layer_index]
        s = get_epi().new_shape_file(layer)
        layer.shapes.append(s)
        new_filename = s.file_name + ".inp"
        get_epi().save()

        my_tab = tab_class(new_filename)
        self.notebook.addTab(my_tab, s.name)
        my_tab.changed.connect(self.callback_edit)
        global_object_run("gl_force_redraw")
Ejemplo n.º 2
0
	def layer_delete(self):
		epi=get_epi()
		obj=self.gl_objects_get_first_selected()
		if obj!=None:
			s=epi.find_shape_by_id(obj.id[0])
			if s!=None:
				response=yes_no_dlg(self,"Do you really want to delete the object: "+s.name)
				if response == True:
					epi=get_epi()
					epi.remove_by_id(s.id)
					epi.save()
					self.force_redraw() 
Ejemplo n.º 3
0
    def mouseReleaseEvent(self, QMouseEvent):
        if QMouseEvent.x() < 160:
            if self.value == "none":
                epi = get_epi()
                self.value = epi.add_new_dos_to_shape(self.shape_file)

            else:
                epi = get_epi()
                self.value = epi.del_dos_shape(self.shape_file)
                self.value = "none"

            self.repaint()
            self.changed.emit()
Ejemplo n.º 4
0
    def change_dir_and_refresh_interface(self, new_dir):
        used_files_add(os.path.join(new_dir, "sim.gpvdm"))
        self.scan_human_labels.clear()
        inp_callbacks_clear()
        get_watch().reset()
        self.splash.inc_value()

        self.scan_human_labels.populate_from_known_tokens()
        self.splash.inc_value()

        self.splash.inc_value()

        set_sim_path(new_dir)
        self.splash.inc_value()

        calculate_paths()
        self.splash.inc_value()

        epi = get_epi()
        epi.load(get_sim_path())
        self.splash.inc_value()

        self.splash.inc_value()

        if get_mesh().load(epi) == False:
            error_dlg(
                self,
                _("There was a problem loading the electrical mesh, I suspect you are trying to open a file generated in a very old version of gpvdm."
                  ))
            return

        self.statusBar().showMessage(get_sim_path())
        self.splash.inc_value()

        self.notebook.load()

        self.update_interface()
        self.enable_disable_buttons()

        self.splash.inc_value()

        if self.notebook.terminal != None:
            self.my_server.set_terminal(self.notebook.terminal)

        if self.notebook.update_display_function != None:
            self.my_server.set_display_function(
                self.notebook.update_display_function)

        self.scan_human_labels.add_item("sim.inp", "#simmode", "sim mode")
        self.scan_human_labels.add_item("light.inp", "#Psun",
                                        "light intensity")
        #scan_populate_from_file("light.inp")

        self.ribbon.update()
        self.splash.inc_value()

        if self.notebook.is_loaded() == True:
            self.l.run()
            self.notebook.tab_main.three_d.update()
        get_watch().rebase()
Ejemplo n.º 5
0
	def layer_add(self):
		obj=self.gl_objects_get_first_selected()
		if obj!=None:
			epi=get_epi()
			s=epi.find_shape_by_id(obj.id[0])
			if type(s)==epi_layer or type(s)==shape:
				layer_index=epi.find_layer_by_id(obj.id[0])
				new_filename=epi.new_electrical_file("shape")+".inp"
				orig_filename=os.path.join(get_default_material_path(),"shape.inp")
				inp_copy_file(os.path.join(get_sim_path(),new_filename),os.path.join(get_sim_path(),orig_filename))

				mesh=get_mesh()
				my_shape=shape()
				my_shape.load(new_filename)
				my_shape.dy=epi.layers[layer_index].dy
				my_shape.dx=mesh.get_xlen()
				my_shape.dz=mesh.get_zlen()
				my_shape.shape_electrical=epi.gen_new_electrical_file("electrical")
				my_shape.shape_nx=1
				my_shape.shape_ny=1
				my_shape.shape_nz=1
				my_shape.name="New shape"
				my_shape.save()

				epi.layers[layer_index].shapes.append(my_shape)
				epi.save()
				self.force_redraw()
Ejemplo n.º 6
0
 def gl_objects_save_selected(self):
     epi = get_epi()
     for obj in self.objects:
         if obj.selected == True:
             s = epi.find_shape_by_id(obj.id[0])
             if type(s) == shape:
                 s.save()
Ejemplo n.º 7
0
    def __init__(self):
        QWidgetSavePos.__init__(self, "cost")
        self.setFixedSize(900, 600)
        self.setWindowIcon(icon_get("jv"))

        self.setWindowTitle(_("Cost and energy payback calculator"))

        self.main_vbox = QVBoxLayout()

        toolbar = QToolBar()
        toolbar.setIconSize(QSize(48, 48))

        self.play = QAction(icon_get("media-playback-start"),
                            _("Re-calcualte"), self)
        self.play.triggered.connect(self.update)
        toolbar.addAction(self.play)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        toolbar.addWidget(spacer)

        self.help = QAction(icon_get("help"), _("Help"), self)
        self.help.triggered.connect(self.callback_help)
        toolbar.addAction(self.help)

        self.main_vbox.addWidget(toolbar)

        self.tab = gpvdm_tab()

        self.main_vbox.addWidget(self.tab)

        self.setLayout(self.main_vbox)
        self.epi = get_epi()

        self.update()
Ejemplo n.º 8
0
    def update(self):
        self.notebook.clear()
        fulle_sim = True
        sim_type = newton_solver_get_type()
        if sim_type == "newton_simple":
            fulle_sim = False
        epi = get_epi()
        for l in epi.layers:
            if fulle_sim == True:
                if l.dos_file.startswith("dos") == True:

                    name = "DoS of " + l.name
                    print(l.dos_file)
                    widget = tab_class(l.dos_file + ".inp")
                    self.notebook.addTab(widget, name)

                    for s in l.shapes:
                        if s.shape_dos != "none":
                            name = "DoS of " + s.name
                            widget = tab_class(s.shape_dos + ".inp")
                            self.notebook.addTab(widget, name)
                            #tab.append(s.shape_dos+".inp")
            else:
                name = "Electrical " + l.name

                widget = tab_class(l.shape_electrical + ".inp")

                self.notebook.addTab(widget, name)
Ejemplo n.º 9
0
    def __init__(self, verbose=True):
        self.save_dir = os.getcwd()
        self.server = base_server()
        if verbose == True:
            self.server.pipe_to_null = False
        else:
            self.server.pipe_to_null = True

        #self.server.base_server_init(get_sim_path())
        if server_get() != False:
            self.server = server_get()
            self.server.clear_cache()

        self.epi = get_epi()
        if self.epi.loaded == False:
            self.epi.load(os.getcwd())

        self.scan = api_scan(self.server)
        #image ops
        self.Image = Image
        self.ImageFilter = ImageFilter
        self.ImageOps = ImageOps
        self.path = ""
        self.callback = None
        self.get_scan_human_labels = get_scan_human_labels()
        self.get_scan_human_labels.clear()
        self.get_scan_human_labels.populate_from_known_tokens()
        self.get_scan_human_labels.populate_from_files()
Ejemplo n.º 10
0
	def create_model(self):
		self.tab.blockSignals(True)
		self.tab.clear()
		self.tab.setColumnCount(11)
		#if enable_betafeatures()==False:
		#	self.tab.setColumnHidden(4, True)
		#	self.tab.setColumnHidden(5, True)

		self.tab.setSelectionBehavior(QAbstractItemView.SelectRows)
		self.tab.setHorizontalHeaderLabels([_("Layer name"), _("Thicknes"), _("Optical material"), _("Layer type"), _("DoS\nfile"), _("PL\nfile"), _("LUMO\nfile"), _("H**O\nfile"), _("Solve optical\nproblem"), _("Solve thermal\nproblem"), _("ID")])
		self.tab.setColumnWidth(2, 250)
		self.tab.setColumnWidth(4, 80)
		self.tab.setColumnWidth(5, 80)
		self.tab.setColumnWidth(6, 80)
		self.tab.setColumnWidth(7, 80)
		self.tab.setColumnWidth(10, 10)

		self.tab.horizontalHeader().setFixedHeight(40)
		self.tab.setRowCount(epitaxy_get_layers())

		epi=get_epi()
		i=0
		for l in epi.layers:
			self.add_row(i,l)
			i=i+1

		self.tab.blockSignals(False)
Ejemplo n.º 11
0
 def on_move_up(self):
     layer = self.tab.move_up()
     epi = get_epi()
     epi.move_up(layer)
     self.save_model()
     self.emit_change()
     self.emit_structure_changed()
	def create_model(self):
		self.tab.blockSignals(True)
		self.tab.clear()
		self.tab.setColumnCount(2)

		self.tab.setSelectionBehavior(QAbstractItemView.SelectRows)
		self.tab.setHorizontalHeaderLabels([_("Layer name"), _("Generation rate (m^{-3}s^{-1})")])
		self.tab.setColumnWidth(1, 250)
		self.tab.setRowCount(epitaxy_get_layers())

		data=inp()
		data.load(os.path.join(get_sim_path(),"light_gnp.inp"))
		data.to_sections(start="#layer_Gnp")
		epi=get_epi()
		i=0
		for l in epi.layers:
			if i<len(data.sections):
				Gnp=float(data.sections[i].layer_Gnp)
				l.Gnp=data.sections[i].layer_Gnp
			else:
				Gnp=0
			self.add_row(i,l.name,Gnp)
			i=i+1

		self.tab.blockSignals(False)
Ejemplo n.º 13
0
    def __init__(self):
        QWidgetSavePos.__init__(self, "contacts")
        self.epi = get_epi()

        self.setMinimumSize(1000, 400)

        self.setWindowIcon(icon_get("contact"))

        self.setWindowTitle(_("Edit contacts") + " (www.gpvdm.com)")

        self.main_vbox = QVBoxLayout()

        self.toolbar = QToolBar()
        self.toolbar.setIconSize(QSize(48, 48))

        #add = QAction(icon_get("list-add"),  _("Add contact"), self)

        #toolbar.addAction(add)

        #remove = QAction(icon_get("list-remove"),  _("Remove contacts"), self)

        #toolbar.addAction(remove)

        self.main_vbox.addWidget(self.toolbar)

        self.tab = gpvdm_tab(toolbar=self.toolbar)
        self.tab.resizeColumnsToContents()

        self.tab.tb_add.triggered.connect(self.on_add_clicked)
        self.tab.user_remove_rows.connect(self.on_remove_clicked)
        self.tab.tb_down.triggered.connect(self.on_move_down)
        self.tab.tb_up.triggered.connect(self.on_move_up)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.toolbar.addWidget(spacer)

        #self.charge_density = QAction(icon_get("preferences-system"), _("Charge density"), self)
        #self.charge_density.triggered.connect(self.callback_contacts_boundary)
        #toolbar.addAction(self.charge_density)

        self.help = QAction(icon_get("help"), _("Help"), self)
        self.help.setStatusTip(_("Close"))
        self.help.triggered.connect(self.callback_help)
        self.toolbar.addAction(self.help)

        self.tab.verticalHeader().setVisible(False)

        self.tab.clear()
        self.tab.setColumnCount(13)
        self.tab.setSelectionBehavior(QAbstractItemView.SelectRows)

        self.load()

        self.tab.cellChanged.connect(self.tab_changed)

        self.main_vbox.addWidget(self.tab)

        self.setLayout(self.main_vbox)
Ejemplo n.º 14
0
    def callback_material_select(self):
        epi = get_epi()
        for i in range(0, self.tab.rowCount()):
            epi.layers[i].optical_material = self.tab.cellWidget(i, 2).text()
            epi.layers[i].cal_rgb()

        self.emit_structure_changed()
        self.save_model()
Ejemplo n.º 15
0
	def callback_model_select(self):
		epi=get_epi()
		for i in range(0,self.tab.rowCount()):
			epi.layers[i].solve_optical_problem=str2bool(self.tab.get_value(i, 8))
			epi.layers[i].solve_thermal_problem=str2bool(self.tab.get_value(i, 9))
			#print(epi.layers[i].solve_optical_probelm,epi.layers[i].solve_thermal_probelm)
		#self.emit_structure_changed()

		self.save_model()
Ejemplo n.º 16
0
	def on_add_item_clicked(self):
		row=self.tab.insert_row()
		epi=get_epi()
		a=epi.add_new_layer(pos=row)
		self.add_row(row,a)
		epi.update_layer_type(row,self.tab.get_value(row,3).lower())
		epi.save()
		#self.emit_change()
		return
	def cell_changed(self, y,x):
		epi=get_epi()

		if x==1:
			epi.layers[y].Gnp=float(self.tab.get_value(y,x))
#			try:
				
#			except:
#				error_dlg(self,_("You have entered a non numeric value."))
		self.save_model()
Ejemplo n.º 18
0
 def on_add_item_clicked(self):
     row = self.tab.insert_row()
     epi = get_epi()
     a = epi.add_new_layer(pos=row)
     self.add_row(row, str(a.dy), a.optical_material, a.dos_file, a.pl_file,
                  a.name, a.lumo_file, a.homo_file, a.solve_optical_problem,
                  a.solve_thermal_problem, a.id)
     epi.update_layer_type(row, self.tab.get_value(row, 3).lower())
     epi.save()
     #self.emit_change()
     return
Ejemplo n.º 19
0
    def cell_changed(self, y, x):
        epi = get_epi()

        if x == 0:
            epi.layers[y].name = self.tab.get_value(y, x)
        elif x == 1:
            ret = epi.layers[y].set_dy(self.tab.get_value(y, x))
            if ret == False:
                error_dlg(self, _("You have entered a non numeric value."))
        self.save_model()
        self.emit_structure_changed()
Ejemplo n.º 20
0
    def update(self):
        self.notebook.clear()

        epi = get_epi()
        for i in range(0, len(epi.layers) - 1):
            l0 = epi.layers[i]
            l1 = epi.layers[i + 1]
            if l0.interface_file != "none":
                name = l0.name + "/" + l1.name
                widget = tab_class(l0.interface_file + ".inp")
                self.notebook.addTab(widget, name)
	def save_model(self):
		i=0
		data=inp()
		epi=get_epi()
		for l in epi.layers:
			data.lines.append("#layer_Gnp"+str(i))
			data.lines.append(str(l.Gnp))
			i=i+1

		data.lines.append("#end")
		data.save_as(os.path.join(get_sim_path(),"light_gnp.inp"))
Ejemplo n.º 22
0
	def layer_move_up(self):
		obj=self.gl_objects_get_first_selected()
		if obj!=None:
			name=obj.id_starts_with("layer:")
			if name!=False:
				name=name[len("layer:"):]

				epi=get_epi()
				epi.move_up(name)
				epi.save()
				#print("layer_move_up",self.selected_layer[len("layer:"):])
				self.force_redraw() 
Ejemplo n.º 23
0
    def callback_clone_shape(self):
        tab = self.notebook.currentWidget()
        s = self.epi.find_shape_by_file_name(tab.file_name)
        name = s.name + "_new"

        new_sim_name = dlg_get_text("Clone the shape:", name, "clone.png")
        new_sim_name = new_sim_name.ret

        if new_sim_name != None:
            old_name = os.path.join(get_sim_path(), tab.file_name)
            new_name = get_epi().new_electrical_file("shape")
            my_shape = shape()
            my_shape.load(old_name)
            my_shape.name = new_sim_name
            my_shape.x0 = my_shape.x0 - my_shape.dx
            my_shape.shape_electrical = get_epi().gen_new_electrical_file(
                "electrical")
            my_shape.file_name = new_name
            my_shape.save()

            get_epi().layers[self.layer_index].shapes.append(my_shape)
            get_epi().save()

            my_tab = tab_class(my_shape.file_name + ".inp")
            self.notebook.addTab(my_tab, my_shape.name)
            my_tab.changed.connect(self.callback_edit)
            global_object_run("gl_force_redraw")
Ejemplo n.º 24
0
 def cal_ev(self):
     for l in get_epi().layers:
         file_name = l.dos_file + ".inp"
         if file_name.startswith("dos"):
             f = inp()
             f.load(file_name)
             if self.charge_type == "electron":
                 eV = gen_fermi_from_np(float(self.edit_m3.text()),
                                        float(f.get_token("#Nc")), 300.0)
             else:
                 eV = gen_fermi_from_np(float(self.edit_m3.text()),
                                        float(f.get_token("#Nv")), 300.0)
     return eV
Ejemplo n.º 25
0
    def on_remove_item_clicked(self):
        ids = []
        rows = self.tab.selectionModel().selectedRows()

        for r in rows:
            ids.append(self.tab.get_value(r.row(), 10))

        items = self.tab.remove()
        epi = get_epi()
        print(ids)
        epi.remove_by_id(ids)
        epi.save()
        epi.clean_unused_files()
        global_object_run("gl_force_redraw")
Ejemplo n.º 26
0
	def layer_rename(self):
		epi=get_epi()
		obj=self.gl_objects_get_first_selected()
		if obj!=None:
			s=epi.find_shape_by_id(obj.id[0])
			if s!=None:
				old_name=s.name
				name=dlg_get_text( _("Rename the layer:"), old_name,"rename.png")
				name=name.ret

				if name!=None:
					s.name=name
					epi.save()

			self.force_redraw() 
    def draw_light_profile(self):

        self.gl_objects_remove_regex("light_profile")
        name = inp_get_token_value(os.path.join(get_sim_path(), "light.inp"),
                                   "#light_profile")
        if name != "box":
            epi = get_epi()

            s = shape()
            s.type = name
            s.load_triangles()
            s.triangles.data = triangles_remove_below(s.triangles.data, 0.1)

            a = gl_base_object()
            a.id = ["light_profile"]
            a.type = "open_triangles"

            a.x = gl_scale.project_m2screen_x(0)
            a.y = gl_scale.project_m2screen_y(0)
            a.z = gl_scale.project_m2screen_z(0)

            a.dx = 1.0
            a.dy = scale_get_ymul() * 1.0
            a.dz = 1.0

            a.r = 0.0
            a.g = 1.0
            a.b = 0.0
            a.alpha = 1.0

            my_vec = vec()
            my_vec.x = get_mesh().get_xlen()
            my_vec.y = epi.ylen() * 1.0
            my_vec.z = get_mesh().get_zlen()

            t = triangles_mul_vec(s.triangles.data, my_vec)

            my_vec = vec()
            my_vec.x = 0.0
            my_vec.y = -epi.ylen() * 3.0
            my_vec.z = 0.0

            t = triangles_add_vec(t, my_vec)

            a.triangles = scale_trianges_m2screen(t)
            #triangles_mul_vec(triangles_flip_in_box(s.triangles.data),my_vec)
            #print("bing!",gl_scale.project_m2screen_x(0))
            self.gl_objects_add(a)
Ejemplo n.º 28
0
def set_m2screen():
    global x_mul
    global y_mul
    global z_mul
    global device_x
    global device_y
    global device_z
    global x_start
    global y_start
    global z_start

    mesh_max = 30

    epi = get_epi()
    x_len = get_mesh().get_xlen()
    z_len = get_mesh().get_zlen()

    z_mul = scale(z_len)
    x_mul = scale(x_len)

    #print(x_mul,z_mul)
    mul = x_mul
    if z_len < x_len:
        mul = z_mul

    x_mul = mul
    z_mul = mul

    #print("m",mul)
    #z_mul=mul
    #x_mul=mul

    #print(x_len*x_mul,z_len*z_mul)
    if z_len * z_mul > mesh_max:
        z_mul = mesh_max / z_len

    if x_len * x_mul > mesh_max:
        x_mul = mesh_max / x_len

    y_mul = device_y / epi.ylen()

    device_x = get_mesh().get_xlen() * x_mul
    device_z = get_mesh().get_zlen() * z_mul

    x_start = -device_x / 2.0
    z_start = -device_z / 2.0
    y_start = device_y
Ejemplo n.º 29
0
    def layer_type_edit(self):
        self.tab.blockSignals(True)

        epi = get_epi()
        for i in range(0, self.tab.rowCount()):
            epi.update_layer_type(i, self.tab.get_value(i, 3).lower())
            self.tab.set_value(i, 4, epi.layers[i].dos_file)
            self.tab.set_value(i, 5, epi.layers[i].pl_file)
            self.tab.set_value(i, 6, epi.layers[i].homo_file)
            self.tab.set_value(i, 7, epi.layers[i].lumo_file)

        self.tab.blockSignals(False)

        self.save_model()
        self.emit_change()
        global_object_run("dos_update")
        global_object_run("pl_update")
        global_object_run("interface_update")
Ejemplo n.º 30
0
    def curciut_mesh_add_links(self, z):
        epi = get_epi()
        mesh = get_mesh()
        for zi in range(0, len(z)):

            for x_sub_mesh_index in range(0, len(mesh.x.layers)):

                xl = mesh.x.layers[x_sub_mesh_index]
                if xl.points == 0:  #if there is a gap in the mesh
                    if x_sub_mesh_index != 0 and x_sub_mesh_index != len(
                            mesh.x.layers
                    ) - 1:  #get left and right points to the gap
                        xl_l = mesh.x.layers[x_sub_mesh_index - 1]
                        xl_r = mesh.x.layers[x_sub_mesh_index + 1]

                        x0 = xl_l.mesh[-1]
                        x1 = xl_r.mesh[
                            0]  #look for a shape which fills the gap

                        shapes = epi.get_shapes_between_x(x0, x1)
                        for s in shapes:
                            if s.shape_electrical != "none":
                                f = inp()
                                f.load(s.shape_electrical + ".inp")
                                component = f.get_token(
                                    "#electrical_component")
                                nl = epi.find_layer_by_id(s.id)
                                y0 = epi.layers[nl].start
                                if component == "link":
                                    a = gl_base_object()
                                    a.id = ["electrical_mesh"]
                                    a.type = "line"
                                    a.xyz.x = gl_scale.project_m2screen_x(x0)
                                    a.xyz.y = gl_scale.project_m2screen_y(y0 +
                                                                          s.dy)
                                    a.xyz.z = z[zi]
                                    a.dxyz.x = (x1 - x0) * scale_get_xmul()
                                    a.dxyz.y = s.dy * scale_get_ymul() * 0.9
                                    a.dxyz.z = 0.0
                                    a.r = 1.0
                                    a.g = 0.0
                                    a.b = 0.0
                                    a.alpha = 1.0
                                    self.gl_objects_add(a)