def from_directory(dpath): collection = Ensemble() subdirs = filter( lambda x: os.path.isdir(os.path.join(dpath, x)), os.listdir(dpath) ) for i in subdirs: try: crystal = from_file(i+'/CONTCAR', 'vasp') except: print 'Error reading structure in folder %s' %i else: try: with open(i+'/OUTCAR', 'r') as fid: tmpdata = fid.readlines() enthalpy = float( next( x for x in reversed(tmpdata) if 'TOTEN' in x ).split()[4] ) except: print 'Error reading enthalpy in folder %s' %i else: collection.ensemble.append([crystal, enthalpy]) return collection
#!/usr/bin/env python # # This file is part of <Crystal Spells Package> # # Copyright Xiaoyu Wang ([email protected]) # # Department of Wizardary and Alchemical Engineering # State University of New York at Buffalo, U.S.A. # # Fall 2019 # # "icryst.py" # # A quick tool to check crystal information import sys sys.path.append( '/home/xwang224/crystalspells2/src' ) sys.path.append( '/projects/academic/ezurek/xiaoyu/crystalspells2/src' ) from crystal import from_file print from_file(sys.argv[1], 'vasp').to('adf')
#!/usr/bin/env python # # This file is part of <Crystal Spells Package> # # Copyright Xiaoyu Wang ([email protected]) # # Department of Wizardary and Alchemical Engineering # State University of New York at Buffalo, U.S.A. # # Fall 2019 # # "icryst.py" # # A quick tool to check crystal information import sys sys.path.append( '/home/xwang224/crystalspells2/src' ) sys.path.append( '/projects/academic/ezurek/xiaoyu/crystalspells2/src' ) from crystal import from_file print from_file(sys.argv[1], 'qe').to('vasp')
#!/usr/bin/env python # # This file is part of <Crystal Spells Package> # # Copyright Xiaoyu Wang ([email protected]) # # Department of Wizardary and Alchemical Engineering # State University of New York at Buffalo, U.S.A. # # Fall 2019 # # "icryst.py" # # A quick tool to check crystal information import sys sys.path.append('/home/xwang224/crystalspells2/src') sys.path.append('/projects/academic/ezurek/xiaoyu/crystalspells2/src') from crystal import from_file crystal = from_file(sys.argv[1], 'vasp') print crystal print crystal.rescale(25.729705037425987) print crystal.rescale(25.729705037425987).to('vasp')
# # Department of Wizardary and Alchemical Engineering # State University of New York at Buffalo, U.S.A. # # Fall 2019 # # "icryst.py" # # A quick tool to check crystal information import sys sys.path.append('/home/xwang224/crystalspells2/src') sys.path.append('/projects/academic/ezurek/xiaoyu/crystalspells2/src') from crystal import from_file try: print from_file(sys.argv[1], 'vasp') except: try: print from_file(sys.argv[1], 'qe') except: try: print from_file(sys.argv[1], 'dftb+') except: try: print from_file(sys.argv[1], 'lmto') except: print 'unsupported structure file' sys.exit(-1)