Пример #1
0
dirs= sorted([d for d in os.listdir(os.getcwd()) if os.path.isdir(d)])
#standardout = sys.__stdout__
#sys.stdout = open('testvasp.dat', 'w')
for dir in dirs:
    print
    print dir +'   ***************'
    if testfile in os.listdir(dir):
        currdir = maindir + dir +'/'
        os.chdir(currdir)
        print currdir
        file1 = open(testfile,'r')
        vaspout = file1.readlines()
        file1.close()
        for i in [4,5,6,7]:
            print vaspout[i].replace('\n','')
        kmesh = km.getkpts_vasp(currdir)
        print kmesh, kmesh[0]*kmesh[1]*kmesh[2] 
        [descriptor, scale, reallatt, natoms, type_pos, positions] [natoms,reallatt,reciplatt] = km.readposcar('POSCAR',currdir) 
        Nkppra = 10000
        N = np.rint(Nkppra/natoms).astype(int)
        print 'natoms', natoms
        print 'reciplatt'
        print reciplatt
        print 'mesh', km.svmesh(N,reciplatt)
#        os.system('grep -i "bad news" slurm*')
#        os.system('grep -i kpts slurm*')
#        os.system('grep -i exceed slurm*')
#        os.system('grep -i sgrcon slurm*') 
#        os.system('grep -i bad vasp.out')
#        print subprocess.call(['grep','-i','bad','vasp.out']) 
#        slurm = os.system('find slurm*')
Пример #2
0
dirs = sorted([d for d in os.listdir(os.getcwd()) if os.path.isdir(d)])
#standardout = sys.__stdout__
#sys.stdout = open('testvasp.dat', 'w')
for dir in dirs:
    print
    print dir + '   ***************'
    if testfile in os.listdir(dir):
        currdir = maindir + dir + '/'
        os.chdir(currdir)
        print currdir
        file1 = open(testfile, 'r')
        vaspout = file1.readlines()
        file1.close()
        for i in [4, 5, 6, 7]:
            print vaspout[i].replace('\n', '')
        kmesh = km.getkpts_vasp(currdir)
        print kmesh, kmesh[0] * kmesh[1] * kmesh[2]
        [descriptor, scale, reallatt, natoms, type_pos,
         positions][natoms, reallatt,
                    reciplatt] = km.readposcar('POSCAR', currdir)
        Nkppra = 10000
        N = np.rint(Nkppra / natoms).astype(int)
        print 'natoms', natoms
        print 'reciplatt'
        print reciplatt
        print 'mesh', km.svmesh(N, reciplatt)
        #        os.system('grep -i "bad news" slurm*')
        #        os.system('grep -i kpts slurm*')
        #        os.system('grep -i exceed slurm*')
        #        os.system('grep -i sgrcon slurm*')
        #        os.system('grep -i bad vasp.out')
Пример #3
0
for dir in dirs:
    if testfile in os.listdir(dir):
        print
        print dir
        file1 = open(maindir + dir + '/' + testfile, 'r')
        poscar = file1.readlines()
        file1.close()
        if len(poscar) > 0:
            scale = np.sum(np.array(float(poscar[1])))
            #            print 'natoms', np.array(poscar[5].split(),dtype=np.int16)
            N = np.rint(
                Nkppra /
                np.sum(np.array(poscar[5].split(), dtype=np.int16))).astype(
                    int)  # number of kpts desired
            reallatt[0, :] = np.array(poscar[2].split())
            reallatt[1, :] = np.array(poscar[3].split())
            reallatt[2, :] = np.array(poscar[4].split())
            reallatt = scale * reallatt.astype(np.float)
            #            print reallatt
            reciplatt = 2 * np.pi * np.transpose(np.linalg.inv(reallatt))
            #            print reciplatt
            mesh_ns = km.svmesh(N, reciplatt)
            print mesh_ns, 's/v method'
            if 'KPOINTS.relax1' in os.listdir(dir):
                os.chdir(dir)
                os.system('cp KPOINTS.relax1 KPOINTS')
                os.chdir(maindir)
            print km.getkpts_vasp(dir), 'Aflow'
#            writekpts_vasp(dir, mesh_ns)
#
print 'Done'
Пример #4
0
reallatt = np.zeros((3,3))
os.chdir(maindir)
dirs= sorted([d for d in os.listdir(os.getcwd()) if os.path.isdir(d)])
for dir in dirs:
    if testfile in os.listdir(dir):
        print
        print dir
        file1 = open(maindir+dir+'/'+testfile,'r')
        poscar = file1.readlines()
        file1.close()
        if len(poscar) >0:
            scale = np.sum(np.array(float(poscar[1])))
#            print 'natoms', np.array(poscar[5].split(),dtype=np.int16)
            N = np.rint(Nkppra/np.sum(np.array(poscar[5].split(),dtype=np.int16))).astype(int) # number of kpts desired
            reallatt[0,:] = np.array(poscar[2].split())
            reallatt[1,:] = np.array(poscar[3].split())
            reallatt[2,:] = np.array(poscar[4].split())
            reallatt = scale*reallatt.astype(np.float)        
#            print reallatt
            reciplatt = 2*np.pi*np.transpose(np.linalg.inv(reallatt))
#            print reciplatt
            mesh_ns = km.svmesh(N,reciplatt)
            print mesh_ns, 's/v method'
            if 'KPOINTS.relax1' in os.listdir(dir):
                os.chdir(dir)
                os.system('cp KPOINTS.relax1 KPOINTS')
                os.chdir(maindir)               
            print km.getkpts_vasp(dir), 'Aflow'
#            writekpts_vasp(dir, mesh_ns)
#                        
print 'Done'