def __init__(self, directory='.'): self.directory = directory with cd(directory): try: self.meta = VASPMeta.from_file('vaspmeta.yaml') except FileNotFoundError as e: raise FileNotFoundError( f'vaspmeta.yaml not found in {directory}') self.parse_vasprun() self.print_methods = { 'title': self.print_title, 'description': self.print_description, 'notes': self.print_notes, 'type': self.print_type, 'status': self.print_status, 'stoichiometry': self.print_stoichiometry, 'potcar': self.print_potcar, 'eatom': self.print_eatom, 'energy': self.print_energy, 'k-points': self.print_kpoints, 'functional': self.print_functional, 'encut': self.print_encut, 'plus_u': self.print_plus_u, 'ediffg': self.print_ediffg, 'ibrion': self.print_ibrion, 'converged': self.print_converged, 'version': self.print_version, 'md5': self.print_vasprun_md5, 'directory': self.print_directory, 'lreal': self.print_lreal, 'vbm': self.print_vbm, 'cbm': self.print_cbm, 'track': self.print_file_tracking, 'nelect': self.print_nelect } if not set(self.print_methods.keys()) == set(self.supported_flags): print(set(self.print_methods.keys())) print('--------------') print(set(self.supported_flags.keys())) raise (ValueError)
def __init__( self, directory='.' ): self.directory = directory with cd( directory ): try: self.meta = VASPMeta.from_file( 'vaspmeta.yaml' ) except FileNotFoundError as e: raise type(e)( str(e) + ' in {}'.format( directory )).with_traceback( sys.exc_info()[2] ) self.parse_vasprun() self.print_methods = { 'title': self.print_title, 'description': self.print_description, 'notes': self.print_notes, 'type': self.print_type, 'status': self.print_status, 'stoichiometry': self.print_stoichiometry, 'potcar': self.print_potcar, 'eatom': self.print_eatom, 'energy': self.print_energy, 'k-points': self.print_kpoints, 'functional': self.print_functional, 'encut': self.print_encut, 'plus_u': self.print_plus_u, 'ediffg': self.print_ediffg, 'ibrion': self.print_ibrion, 'converged': self.print_converged, 'version': self.print_version, 'md5': self.print_vasprun_md5, 'directory': self.print_directory, 'lreal': self.print_lreal, 'vbm': self.print_vbm, 'cbm': self.print_cbm, 'track': self.print_file_tracking, 'nelect': self.print_nelect } if not set( self.print_methods.keys() ) == set( self.supported_flags ): print( set( self.print_methods.keys() ) ) print( '--------------' ) print( set( self.supported_flags.keys() ) ) raise( ValueError )