Znn3bq.jpeg
²é¿´: 2707  |  »Ø¸´: 16
¡¾½±Àø¡¿ ±¾Ìû±»ÆÀ¼Û13´Î£¬×÷ÕßÈñÀûµÄË鯬Ôö¼Ó½ð±Ò 10 ¸ö
µ±Ç°Ö»ÏÔʾÂú×ãÖ¸¶¨Ìõ¼þµÄ»ØÌû£¬µã»÷ÕâÀï²é¿´±¾»°ÌâµÄËùÓлØÌû

ÈñÀûµÄË鯬

ľ³æ (ÕýʽдÊÖ)


[×ÊÔ´] ¡¾Ô­´´¡¿´¦ÀíelkÄÜ´øµÄ³ÌÐò

×Ô¼ºÐ´µÄÓÃpython´¦ÀíelkÄÜ´øµÄ³ÌÐò
»Ø¸´´ËÂ¥

» ÊÕ¼±¾ÌûµÄÌÔÌûר¼­ÍƼö

²ÄÁϼÆËãÄ£ÄâʵÓü¼ÇÉ µÚÒ»ÐÔÔ­Àí¼ÆË㸨Öú¹¤¾ß

» ²ÂÄãϲ»¶

» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:

ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

¡ï¡ï¡ï¡ï¡ï ÎåÐǼ¶,ÓÅÐãÍÆ¼ö

¡ï¡ï¡ï¡ï¡ï ÎåÐǼ¶
6Â¥2011-02-26 16:30:45
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
²é¿´È«²¿ 17 ¸ö»Ø´ð

ÈñÀûµÄË鯬

ľ³æ (ÕýʽдÊÖ)


ÓÃÃæÏò¶ÔÏóÖØÐÂдÁËÒ»±é³ÌÐò£¬ÏÖÔÚֻдÁËelkµÄÀ࣬´¦ÀíÆäËû³ÌÐò£¨±ÈÈçvasp£©½á¹ûµÄ³ÌÐò¿ÉÒԺܷ½±ãµÄ¼Ó½øÀ´¡£Ö÷³ÌÐò²¿·Öûд£¬Õâ¸öÓ¦¸ÃûÓжàÄÑ¡£
CODE:
class Band():
    def write_data(self):
        if self.nspin==1:
            fout=file('band.data','w')
            for i in range(self.ndiv):
                fout.write("%12.8f "%self.band[0][i])
                for j in range(self.nband):
                    fout.write("%12.8f "%self.band[j+1][i])
                fout.write('\n')
            fout.close()
        elif self.nspin==2:
            foutup=file('bandup.data','w')
            foutdn=file('banddn.data','w')
            for i in range(self.ndiv):
                foutup.write("%12.8f "%self.band[0][i])
                foutdn.write("%12.8f "%self.band[0][i])
                for j in range(self.nband/2):
                    foutup.write("%12.8f "%self.band[j+1][i])
                foutup.write('\n')
                for j in range(self.nband/2,self.nband):
                    foutdn.write("%12.8f "%self.band[j+1][i])
                foutdn.write('\n')
            foutup.close()
            foutdn.close()

    def view_band(self,emin,emax,title,xlabel,ylabel):
        import numpy as np
        import matplotlib.pyplot as plt
        #plot setup
        plt.title(title)
        plt.xlabel(xlabel)
        plt.ylabel(ylabel)
        plt.xlim(self.kpos[0],self.kpos[-1])
        plt.ylim(emin,emax)
        plt.xticks(self.kpos,self.kpname)
        plt.grid(linestyle='-')
        plt.gca().xaxis.grid(True)
        plt.gca().yaxis.grid(False)
        #plot bands
        for i in range(self.nband):
            x=self.band[0]
            y=self.band[i+1]
            if np.min(y)emax:
                continue
            else:
                if self.nspin==1:
                    plt.plot(x,y,'r-')
                elif self.nspin==2:
                    if i                         plt.plot(x,y,'r-')
                    else:
                        plt.plot(x,y,'b--')
        plt.plot([self.kpos[0],self.kpos[-1]],[0.0,0.0],\
                 color='black',linestyle='--')
        plt.text(0.0,0.1,r'$E_F$=%6.3f eV'%self.fermi)
        plt.show()

class ElkBand(Band):
    def __init__(self):
        import sys
        import numpy as np
        try:
            fmain=file('elk.in','r')
            fpos=file('BANDLINES.OUT','r')
            fband=file('BAND.OUT','r')
            ffermi=file('EFERMI.OUT','r')
        except IOError:
            print 'Error in open nessary inputs. Check your input file'
            sys.exit()
        # initalize
        self.kpname=[] #names of kpoints
        self.kpos=[] #positions of special kpoints in G space
        self.nspin=1 #number of spins
        self.nband=0 #number of band
        self.band=[] #banddata
        # get self.nspin self.kpname self.nkp(number of special kpoints)
        # self.ndiv
        while True:
            tmp=fmain.readline()
            if len(tmp)==0:
                break
            if tmp.strip()=='spinpol':
                if fmain.readline().strip()=='.true.':
                    self.nspin=2
            if tmp.strip()=='plot1d':
                self.nkp,self.ndiv=fmain.readline().split()[0:2]
                self.nkp=int(self.nkp)
                self.ndiv=int(self.ndiv)
                for i in range(self.nkp):
                    self.kpname.append('$'+str(fmain.readline().split()[3])+'$')
        # get self.kpos
        while True:
            tmp=fpos.readline()
            if len(tmp)==0:
                break
            self.kpos.append(float(tmp.split()[0]))
            fpos.readline()
            fpos.readline()
        # get self.fermi
        self.fermi=27.2114*float(ffermi.readline().strip())
        # get self.nband self.band
        while True:
            tmp=fband.readline()
            if len(tmp)==0:
                break
            if len(tmp.strip())==0 and len(tmp)!=0:
                self.nband=self.nband+1
        rawband=np.loadtxt('BAND.OUT')
        kp=rawband[0:self.ndiv,0]
        self.band.append(kp)
        for i in range(self.nband):
            eig=27.2114*rawband[i*self.ndiv:(i+1)*self.ndiv,1]
            self.band.append(eig)
        #close files
        fmain.close()
        fpos.close()
        fband.close()
        ffermi.close()

    def write_data(self):
        Band.write_data(self)

    def view_band(self,emin=-10.0,emax=15.0,title='Band Plot',\
                 xlabel='K-Path',ylabel='Energy / eV'):
        Band.view_band(self,emin,emax,title,xlabel,ylabel)

[ Last edited by ÈñÀûµÄË鯬 on 2011-2-26 at 12:17 ]
2Â¥2011-02-26 09:15:54
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ö§³ÖÔ­´´£¬ÔÞÒ»¸ö£¬¶¥£¡£¡
4Â¥2011-02-26 13:26:03
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

lixiao85

Òø³æ (СÓÐÃûÆø)


¡ï¡ï¡ï¡ï¡ï ÎåÐǼ¶,ÓÅÐãÍÆ¼ö

»òÐíÒÔºóÄÜÓÃÉÏ
5Â¥2011-02-26 14:49:39
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
¼òµ¥»Ø¸´
xh5128Â¥
2012-01-06 07:17   »Ø¸´  
ÎåÐÇºÃÆÀ  ¶¥Ò»Ï£¬¸Ðл·ÖÏí£¡
tanloer9Â¥
2012-02-13 15:28   »Ø¸´  
ÎåÐÇºÃÆÀ  ¶¥Ò»Ï£¬¸Ðл·ÖÏí£¡
mink10Â¥
2014-06-18 07:40   »Ø¸´  
ÎåÐÇºÃÆÀ  ¶¥Ò»Ï£¬¸Ðл·ÖÏí£¡
102424790011Â¥
2014-07-03 21:32   »Ø¸´  
ÎåÐÇºÃÆÀ  ¶¥Ò»Ï£¬¸Ðл·ÖÏí£¡
zwynu12Â¥
2014-09-24 21:57   »Ø¸´  
ÎåÐÇºÃÆÀ  ¶¥Ò»Ï£¬¸Ðл·ÖÏí£¡
Toapollo13Â¥
2015-03-28 20:58   »Ø¸´  
ÈýÐÇºÃÆÀ  ¶¥Ò»Ï£¬¸Ðл·ÖÏí£¡
¡î ÎÞÐǼ¶ ¡ï Ò»ÐǼ¶ ¡ï¡ï¡ï ÈýÐǼ¶ ¡ï¡ï¡ï¡ï¡ï ÎåÐǼ¶
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] ÊÕµ½¸´ÊÔµ÷¼Áµ«ÊÇÈ¥²»ÁË +8 СÎÏÅ£* 2026-04-16 8/400 2026-04-18 11:15 by zixin2025
[¿¼ÑÐ] ¼±Ðèµ÷¼Á +9 ¾ø²»·ÅÆú22 2026-04-15 10/500 2026-04-18 08:09 by chixmc
[¿¼ÑÐ] »¯¹¤Ñ§Ë¶294·Ö£¬Çóµ¼Ê¦ÊÕÁô +33 yzyzx 2026-04-12 37/1850 2026-04-17 23:00 by wunaiy88
[¿¼ÑÐ] 320Çóµ÷¼Á +4 Éî½¼akm 2026-04-17 4/200 2026-04-17 17:32 by Ò»ÇÐOK
[¿¼ÑÐ] 295·ÖÇóµ÷¼Á +5 ?ÒªÉϰ¶? 2026-04-17 5/250 2026-04-17 16:51 by fenglj492
[¿¼ÑÐ] Ò»Ö¾Ô¸»¦9£¬326ÇóÉúÎïѧµ÷¼Á +11 Áõīī 2026-04-13 11/550 2026-04-17 15:35 by wanganpin
[¿¼ÑÐ] »¯Ñ§070300 Çóµ÷¼Á +28 ¹þ¹þ¹þ^_^ 2026-04-12 28/1400 2026-04-16 21:36 by ´óÁ¦Ë®ÊÖÁ¦´óÎÞÇ
[¿¼ÑÐ] 279ѧ˶ʳƷרҵÇóµ÷¼ÁԺУ 20+7 ¹Â¶ÀµÄÀǰ®³ÔÑò 2026-04-12 29/1450 2026-04-16 09:00 by screening
[¿¼ÑÐ] 085404 22408 309·ÖÇóµ÷¼Á +9 lzmk 2026-04-14 10/500 2026-04-15 20:02 by ѧԱJpLReM
[¿¼ÑÐ] ÉúÎïѧµ÷¼Á +9 Ö½ÉÈzhishan 2026-04-13 9/450 2026-04-15 18:28 by ANÁ÷800
[¿¼ÑÐ] 0854µ÷¼Á +13 ³¤¹­°Á 2026-04-12 16/800 2026-04-15 13:45 by fenglj492
[¿¼ÑÐ] ²ÄÁϹ¤³Ì281»¹Óе÷¼Á»ú»áÂð +43 xaw. 2026-04-11 44/2200 2026-04-15 12:46 by Î÷±±Íû¡ª·çɳ
[¿¼ÑÐ] µ÷¼Á +12 ÔÂ@163.com 2026-04-11 12/600 2026-04-14 15:37 by zs92450
[¿¼ÑÐ] ʳƷÓëÓªÑø£¨0955£©271Çóµ÷¼Á +15 Éý¸ñ°¢´ï 2026-04-12 16/800 2026-04-14 13:18 by ¸¡Èô_°²Éú
[¿¼ÑÐ] 085600²ÄÁÏÓ뻯¹¤329·ÖÇóµ÷¼Á +24 Ò¶zilin 2026-04-13 25/1250 2026-04-14 09:20 by ÊÔ¹ÜÆÆÁÑ
[¿¼ÑÐ] Çóµ÷¼Á +3 ÎÒ°®¸ßÊý¸ßÊý°®Î 2026-04-12 3/150 2026-04-14 01:00 by Íõ¬Bè±
[¿¼ÑÐ] 2026˶ʿµ÷¼Á_Äܶ¯_ºÓÄÏũҵ´óѧ +4 ºÓÄÏũҵ´óѧ-ÄÜ 2026-04-12 4/200 2026-04-13 22:01 by bljnqdcc
[¿¼ÑÐ] 0854µ÷¼Á +10 ³¤¹­°Á 2026-04-11 11/550 2026-04-13 10:38 by wp06
[¿¼ÑÐ] 346·Ö£¬¹¤¿Æ0854Çóµ÷¼Á£¬×¨Ë¶ +6 moser233 2026-04-12 7/350 2026-04-12 22:11 by fqwang
[¿¼ÑÐ] 339Çóµ÷¼Á +8 hanwudada 2026-04-11 9/450 2026-04-12 15:36 by laoshidan
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û