def getVCmesh(dir,method,targetNmesh,meshtype): lastDir = os.getcwd() meshc = dynamicPacking6.dynamicPack() #instance [descriptor, scale, latticevecs, reciplatt, natoms, postype, positions] = readposcar('POSCAR',dir) # create_poscar('POSCAR',descriptor, scale, latticevecs, natoms, postype, positions, path) #just to remove the scale problem os.chdir(dir) totatoms = sum(natoms) atype = 1 aTypes = [] for natom in natoms: for i in range(natom): aTypes.append(atype) atype += 1 aTypes = array(aTypes) statusOK,nops = meshc.pack(latticevecs,reciplatt,totatoms,aTypes,postype,transpose(positions),targetNmesh,meshtype,dir,method) os.chdir(lastDir) return statusOK,nops
def getVCmesh(dir,targetNmesh,meshtype,params) : lastDir = os.getcwd() meshc = dynamicPacking7.dynamicPack() #instance [descriptor, scale, latticevecs, reciplatt, natoms, postype, positions] = readposcar('POSCAR',dir) # create_poscar('POSCAR',descriptor, scale, latticevecs, natoms, postype, positions, path) #just to remove the scale problem os.chdir(dir) totatoms = sum(natoms) atype = 1 aTypes = [] for natom in natoms: for i in range(natom): aTypes.append(atype) atype += 1 aTypes = array(aTypes) statusOK,nops = meshc.pack(latticevecs,reciplatt,totatoms,aTypes,postype,transpose(positions),targetNmesh,meshtype,dir,params) os.chdir(lastDir) return statusOK,nops
if os.path.exists('meshsummary.csv'): file1 = open('meshsummary.csv','a') else: file1 = open('meshsummary.csv','w') file1.write('Structure,Lattice,amax/amin,pfB,pf_orth,pf_orth2fcc,pf_maxpf, pf_pf2fcc, pfmax, meshtype' + ',' \ + 'Improvement,fcc compatibility,Nmesh,TargetNmesh,Nmesh/Target,cbest' + '\n') #for i,dir in enumerate(dirs): for dir in dirs: path = maindir+'/'+dir if testfile in os.listdir(path): print print dir + '==========================================================' os.chdir(path) # print readposcar('POSCAR',path) [descriptor, scale, latticevecs, reciplatt, natoms, postype, positions] = readposcar('POSCAR',path) # create_poscar('POSCAR',descriptor, scale, latticevecs, natoms, postype, positions, path) #just to remove the scale problem os.chdir(maindir) # print 'reciprocal lattice vectors (rows)';print reciplatt totatoms = sum(natoms) targetNmesh = Nkppra/totatoms atype = 1 aTypes = [] for natom in natoms: for i in range(natom): aTypes.append(atype) atype += 1 aTypes = array(aTypes) meshc.pack(latticevecs,reciplatt,totatoms,aTypes,postype,transpose(positions),targetNmesh,meshtype,path,method) sys.exit('stop')
file1 = open('meshsummary.csv', 'a') file1.write('Structure,Lattice,amax/amin,pfB,pf_orth,pf_orth2fcc,pf_maxpf, pf_pf2fcc, pfmax, meshtype' + ',' \ + 'Improvement,fcc compatibility,Nmesh,TargetNmesh,Nmesh/Target,cbest' + '\n') #for i,directory in enumerate(dirs): for directory in dirs: path = maindir + directory + '/' if testfile in os.listdir(path): print print directory + '==========================================================' os.chdir(path) # print readposcar('POSCAR',path) [ descriptor, scale, latticevecs, reciplatt, natoms, postype, positions ] = readposcar('POSCAR', path) # create_poscar('POSCAR', descriptor, scale, latticevecs, natoms, postype, positions, path) #just to remove the scale problem os.chdir(maindir) # print 'reciprocal lattice vectors (rows)';print reciplatt totatoms = sum(natoms) Nmesh = Nkppra / totatoms #RESTORE THIS [meshvecs, Nmesh, targetNmesh, lattype, pfB, pf_orth, pf_orth2fcc, pf_maxpf, pf_pf2fcc, pfmax, meshtype, fcctype,cbest, status] = bestmeshIter(reciplatt,Nmesh) # for trials where we want to vary pf for testing meshesfile = open('meshesfile', 'w') meshesfile.write(directory + ' ============\n') [ meshvecs, Nmesh, targetNmesh, lattype, pfB, pf_orth, pf_orth2fcc, pf_maxpf, pf_pf2fcc, pfmax, meshtype, fcctype, cbest, status
print print '(* {} *)'.format(struct), #get bounds from local data bounds = [[], []] blines = readfile('{}/{}/bounds'.format(paths[0], struct)) for line in blines: bounds[0].append( array([float(str) for str in line.split()[:3]])) bounds[1].append(float(line.split()[3])) #read sym operators #get first run folder dir1 = os.listdir(os.getcwd())[0] [ descriptor, scale, latticevecs, reciplatt, natoms, postype, positions ] = readposcar('POSCAR', dir1) totatoms = sum(natoms) atype = 1 aTypes = [] for natom in natoms: for i in range(natom): aTypes.append(atype) atype += 1 aTypes = array(aTypes) [symopsList, fracsList] = get_spaceGroup(transpose(latticevecs), aTypes, positions, 1e-3, postype.lower()[0] == 'd') # get_spaceGroup(transpose(A),aTypes,transpose(aPos),1e-3,postype.lower()[0] == 'd') nops = len(symopsList) symops = zeros((3, 3, nops), dtype=float)
#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*') slurms = [f for f in os.listdir(os.getcwd()) if 'slurm' in f] for slurm in slurms:
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*') slurms = [f for f in os.listdir(os.getcwd()) if 'slurm' in f] for slurm in slurms: