dirsfull.append(maindir+dir) print dirs if structi == structselect[0]: [mmax, ibest] = getibest(dirs) print 'energy of structure 1, multiplier %i, index %i used as ebest' % (mmax, ibest) #ibest = 17 ###################TEMP ONLY !!!!!!!!!!!!!!!!!!!!! writeEnergiesOszicar(dirsfull) writefermi(dirsfull) #skip so don't have to read it every time writedirnames(dirsfull) writeNkIBZ(dirsfull) #writeNk(dirsfull) writeElConverge(dirsfull) writeElSteps(dirsfull) writeCPUtime(dirsfull) parts = enerparts(dirsfull) dets = getdata(dirsfull,'detL') #supercell volume in terms of unit cell volume dets = [float(dets[i]) for i in range(len(dets))] NkfullBZ = getdata(dirsfull,'detM') #Nk without symmetry reduction lattypes = getdata(dirsfull,'lattype') ms = array(getms(dirsfull),dtype = int) filesstructselect = sorted([f for f in os.listdir(os.getcwd())]) #os.chdir(mainDir) file = open(tempdir+'energies','r') energies = nstrip(file.readlines()) file.close() os.system('mv %s %s' % ('energies', 'energies'+structi))
#reallatt = zeros((3,3)) os.chdir(maindir) dirs = sorted([d for d in os.listdir(os.getcwd()) if os.path.isdir(d)]) #file1 = open('varypf.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): print dirs writeEnergiesOszicar(dirs) writedirnames(dirs) writeNkIBZ(dirs) writeNk(dirs) writeElConverge(dirs) writeElSteps(dirs) writeCPUtime(dirs) parts = enerparts(dirs) #print'parts'; print parts #find deviation from average for each part means = mean(parts, axis=0) #print'means';print means deviations = abs(parts - means) + 1e-16 #last term to handle zero entries #print'deviations';print deviations try: file2 = open('lattype', 'r') lattype = file2.read() file2.close() except: lattype = '' ################# summary ################# outfile = open('vary_N.csv', 'w')
for maindir in [path + 'structs.cubmesh/']: os.chdir(maindir) dirs = sorted([d for d in os.listdir(os.getcwd()) if os.path.isdir(d)]) print dirs if 'structselect' in dirs: dirs.remove('structselect') [mmax, ibest] = getibest(dirs) print 'energy of structure 1, multiplier %i, index %i used as ebest' % (mmax, ibest) writeEnergiesOszicar(dirs) # writefermi(dirs) #skip if don't want to read it every time writedirnames(dirs) writeNkIBZ(dirs) #writeNk(dirs) writeElConverge(dirs) writeElSteps(dirs) writeCPUtime(dirs) parts = enerparts(dirs) dets = getdata(dirs,'detL') #supercell volume in terms of unit cell volume dets = [float(dets[i]) for i in range(len(dets))] NkfullBZ = getdata(dirs,'detM') #Nk without symmetry reduction lattypes = getdata(dirs,'lattype') ms = array(getms(dirs),dtype = int) ################# summary ################# outfile = open('vary_n.csv','w') outfile.write('Struct_m,n_mesh,energy,efermi,Natoms,energy/atom,energy err,fermi err,el converged,el steps,NIBZ,cputime(min\n') #os.chdir(mainDir) file = open(maindir+'names','r') names = nstrip(file.readlines()) file.close() file = open(maindir+'energies','r') energies = nstrip(file.readlines())