Beispiel #1
0
    def init(self):
        total = 0
        self.pos = 0
        lines = inp_load_file(lines, "mesh_y.inp")
        if lines != False:
            total = inp_sum_items(lines, "#mesh_layer_points0")

        lines = inp_load_file(lines, "dump.inp")
        if lines != False:
            self.pos = str2bool(
                inp_search_token_value(lines, "#dump_energy_slice_pos"))

        label = gtk.Label("Energy slice dump")
        label.show()
        self.pack_start(label, True, True, 0)

        check = gtk.CheckButton("Enable")
        self.pack_start(check, True, True, 0)

        print("total=", total)
        adj = gtk.Adjustment(self.pos, 0, total, 1.0, 1.0, 1.0)
        adj.connect("value_changed", self.scroll)
        self.vscale = gtk.HScale(adj)
        self.vscale.set_size_request(150, 30)
        self.pack_start(self.vscale, True, True, 0)
        self.vscale.show()

        self.enable = False
        lines = inp_load_file(lines, "dump.inp")
        if lines != False:
            self.enable = str2bool(
                inp_search_token_value(lines, "#dump_energy_slice_switch"))

        check.set_active(self.enable)
        self.vscale.set_sensitive(self.enable)

        check.unset_flags(gtk.CAN_FOCUS)
        check.connect("clicked", self.check_clicked)
	def init(self):
		total=0
		self.pos=0
		lines=[]
		if inp_load_file(lines,"mesh.inp")==True:
			total=inp_sum_items(lines, "#mesh_layer_points0")

		if inp_load_file(lines,"dump.inp")==True:
			self.pos=str2bool(inp_search_token_value(lines, "#dump_energy_slice_pos"))


		label=gtk.Label("Energy slice dump")
		label.show()
		self.pack_start(label, True, True, 0)

		check = gtk.CheckButton("Enable")
		self.pack_start(check, True, True, 0)

		print "total=",total
		adj=gtk.Adjustment(self.pos, 0, total, 1.0, 1.0, 1.0)
		adj.connect("value_changed", self.scroll)
		self.vscale = gtk.HScale(adj)
		self.vscale.set_size_request(150, 30)
		self.pack_start(self.vscale, True, True, 0)
		self.vscale.show()


		self.enable=False
		if inp_load_file(lines,"dump.inp")==True:
			self.enable=str2bool(inp_search_token_value(lines, "#dump_energy_slice_switch"))

		check.set_active(self.enable)
		self.vscale.set_sensitive(self.enable)

		check.unset_flags(gtk.CAN_FOCUS)
		check.connect("clicked", self.check_clicked)
Beispiel #3
0
	def draw_graph(self):
		lines=[]
		total=10
		pos=0
		bands=10

		#circle1=plt.Circle((10,10),4,color='r')

		if inp_load_file(lines,"mesh.inp")==True:
			total=inp_sum_items(lines, "#mesh_layer_points0")

		if inp_load_file(lines,"dump.inp")==True:
			pos=int(inp_search_token_value(lines, "#dump_energy_slice_pos"))

		files=epitaxy_get_dos_files()
		if len(files)>0:
			if inp_load_file(lines,files[0])==True:
				bands=int(inp_search_token_value(lines, "#srh_bands"))

		n=0
		
		self.fig.clf()
		
		self.fig.subplots_adjust(bottom=0.2)
		self.fig.subplots_adjust(left=0.1)
		self.ax1 = self.fig.add_subplot(111)
		#ax2 = ax1.twinx()
		x_pos=0.0
		layer=0
		color =['r','g','b','y','o','r','g','b','y','o']

		self.ax1.set_ylabel('Energy (eV)')
		#ax2.set_ylabel('Energy (eV)')
		self.ax1.set_xlabel('Position (nm)')
		try:

			t,Ec_data = loadtxt(os.path.join("equilibrium","Ec.dat"), unpack=True)
			t=t*1e9
			Ec, = self.ax1.plot(t,Ec_data, 'ro-', linewidth=3 ,alpha=0.5)

			t,Ev_data = loadtxt(os.path.join("equilibrium","Ev.dat"), unpack=True)
			t=t*1e9
			Ev,=self.ax1.plot(t,Ev_data, 'go-', linewidth=3 ,alpha=0.5)

			if len(files)>0:
				if self.emesh_editor.mesh_dump_ctl.enable==True:

					Ec_max=max(Ec_data)
					Ev_min=min(Ev_data)

					x_len=t[len(t)-1]-t[0]
					y_len=Ec_max-Ev_min

					x_pos=t[0]+(x_len)*(float(pos)/float(total))
					x_size=(x_len)/float(total)/4
					start=float(Ev_data[pos])
					stop=float(Ec_data[pos])
					y_pos=start
					dy=(stop-start)/(bands*2)
					while y_pos<stop:
						self.ax1.add_patch(Ellipse((x_pos, y_pos), x_size,x_size*(y_len/x_len), facecolor='red', edgecolor=(0,0.0,0.0), linewidth=0, alpha=1.0))
						y_pos=y_pos+dy


			t,s = loadtxt(os.path.join("equilibrium","Fi.dat"), unpack=True)
			t=t*1e9
			Fi,=self.ax1.plot(t,s, 'bo-', linewidth=3 ,alpha=0.5)

			if self.show_key==True:
				self.fig.legend((Ec, Ev, Fi), ('LUMO', 'H**O', 'Fi'), 'upper right')
			else:
				self.ax1.legend_ = None
			#self.fig.canvas.draw()
		
		except:
			print "No mode file\n"