Beispiel #1
0
def collate_plots(tablelist, plotName1, plotName2):
    '''Creates an HTML page with the plots and labels'''
    import sys, os, subprocess
    import numpy as num
    sys.path.append(
        '/fslhome/bch/pythonscripts/pythonscripts_gr/half_graphane_scripts/analysis_scripts'
    )
    from analysisTools import getElement
    if not os.path.exists('plots'):
        subprocess.call(['mkdir', 'plots'])
    nRow = 7  # put in periodic table order, with duplicates at end
    plotType = plotName1.split('.')[-2]
    print plotType
    collatefile = open('%splots.htm' % plotType, 'w')
    collatefile.write(' <html>\n <HEAD>\n<TITLE> %s </TITLE>\n</HEAD>\n' %
                      plotType)
    collatefile.write(
        ' <BODY>\n <p style="font-size:20px"> <table border="1">\n <tr>\n'
    )  #start row
    iImage = 0
    for path in tablelist:
        element = getElement('adatom_', path)
        elementPlotName = element + plotName2
        try:
            subprocess.call(
                ['cp',
                 '%s%s' % (path, plotName1), 'plots/' + elementPlotName])
        except:
            print 'copy plot failed', path
        if not element in ['Cr_pv', 'Mn_pv'
                           ]:  # don't want these in first table
            iImage += 1
            collatefile.write(
                '<td><p><img src="plots/%s" ></p><p>%s</p></td>\n' %
                (elementPlotName, element))  #Image and element under it
            if num.mod(iImage, nRow) == 0:
                collatefile.write('</tr>\n<tr>\n')  #end of row, begin new
    collatefile.write(' </tr></table> \n')  #end of row and table
    for path in tablelist:
        #get element name
        element = getElement('adatom_', path)
        elementPlotName = element + plotName2
        if element in ['Cr_pv', 'Mn_pv']:  # put these last
            collatefile.write(
                '<td><p><img src="plots/%s" ></p><p>%s</p></td>\n' %
                (elementPlotName, element))  #Image and element under it
    collatefile.write(' </BODY> </html>')  #end of file
    collatefile.close()
Beispiel #2
0
def collate_plots(checkedList,plotName):
    import sys, os, subprocess
    import numpy as num
    sys.path.append('/fslhome/bch/pythonscripts/pythonscripts_gr/half_graphane_scripts/analysis_scripts')
    from analysisTools import getElement
    
    '''Creates an HTML page with the plots and labels'''
    if not os.path.exists('plots'):
        subprocess.call(['mkdir','plots'])
    nRow = 7  # put in periodic table order, with duplicates at end
    plotType = plotName.split('.')[-2]
    print plotType
    collatefile  = open('%splots.htm' % plotType,'w')
    collatefile.write(' <html>\n <HEAD>\n<TITLE> %s </TITLE>\n</HEAD>\n' % plotType)
    collatefile.write(' <BODY>\n <p style="font-size:20px"> <table border="1">\n <tr>\n') #start row
    iImage = 0        
    for path in checkedList:
        element = getElement('adatom_',path)
        elementPlotName = element + plotName
        try: 
            subprocess.call(['cp','%s%s' % (path,plotName),'plots/'+elementPlotName])     
        except:
            print 'copy plot failed', path      
        if not element in ['Cr_pv', 'Mn_pv']: # don't want these in first table
            iImage += 1            
            collatefile.write('<td><p><img src="plots/%s" ></p><p>%s</p></td>\n' % (elementPlotName,element))#Image and element under it
            if num.mod(iImage,nRow) == 0: 
                collatefile.write('</tr>\n<tr>\n') #end of row, begin new
    collatefile.write(' </tr></table> \n') #end of row and table                
    for path in checkedList:
        #get element name
        element = getElement('adatom_',path)
        elementPlotName = element + plotName              
        if element  in ['Cr_pv', 'Mn_pv']: # put these last            
            collatefile.write('<td><p><img src="plots/%s" ></p><p>%s</p></td>\n' % (elementPlotName,element))#Image and element under it  
    collatefile.write(' </BODY> </html>') #end of file 
    collatefile.close() 
Beispiel #3
0
print("Checking to see which folders contain "+run+"\n")
time.sleep(1)
os.chdir(dir)
print("Searching all Directories in " + dir+"\n")

tools.CheckFoldersDOS()
checkedList=sorted(checkedList)
toRunList=sorted(toRunList)

#Copy contcars to poscars
from analysisTools import getElement
#pathparts2 = contcardir.split('/')
#nparts2 = len(pathparts2)
#print nparts2
for path1 in checkedList:
    path2 = contcardir.replace('Co',getElement('adatom_',path1))
    print("cp CONTCAR" + path2)
    print('to POSCAR'+ path1)
    os.system('cp ' + path2 + 'CONTCAR ' + path1 +'POSCAR')
os.chdir(dir)

tools.removeCsPOSCAR(toRunList)

print "\nThe following folders will be run:"
for i in toRunList:
    print("toRunList contains : " + i)
raw_input("Press enter to submit jobs")
print"\n"
for folder in toRunList:
    newFolder = folder
    print folder
Beispiel #4
0
print("Checking to see which folders contain " + run + "\n")
time.sleep(1)
os.chdir(dir)
print("Searching all Directories in " + dir + "\n")

tools.CheckFoldersDOS()
checkedList = sorted(checkedList)
toRunList = sorted(toRunList)

#Copy contcars to poscars
from analysisTools import getElement
#pathparts2 = contcardir.split('/')
#nparts2 = len(pathparts2)
#print nparts2
for path1 in checkedList:
    path2 = contcardir.replace('Co', getElement('adatom_', path1))
    print("cp CONTCAR" + path2)
    print('to POSCAR' + path1)
    os.system('cp ' + path2 + 'CONTCAR ' + path1 + 'POSCAR')
os.chdir(dir)

tools.removeCsPOSCAR(toRunList)

print "\nThe following folders will be run:"
for i in toRunList:
    print("toRunList contains : " + i)
raw_input("Press enter to submit jobs")
print "\n"
for folder in toRunList:
    newFolder = folder
    print folder