def read_data( verbose=True ): dir_list = find_vasp_calculations() if not dir_list: raise ValueError( 'Did not find any subdirectories containing vasprun.xml or vasprun.xml.gz files' ) data = [] for d in dir_list: converged = True try: with warnings.catch_warnings(record=True) as w: vasprun = read_vasprun( match_filename( d + 'vasprun.xml' ) ) for warning in w: if isinstance( warning.message, UnconvergedVASPWarning ): converged = False else: print( warning.message ) except: continue poscar = Poscar.from_file( d + 'POSCAR' ) data.append( [ poscar.scaling, vasprun.final_structure.volume, vasprun.final_energy, converged ] ) column_titles = [ 'scaling', 'volume', 'energy', 'converged' ] df = pd.DataFrame( data, columns=column_titles ).sort_values( by='scaling' ) df = df.reset_index( drop=True ) df['scaling_factor'] = df.volume / df.scaling**3 scaling_factor_round = 4 if verbose: print( df.to_string(index=False) ) if len( set( df.scaling_factor.round( scaling_factor_round ) ) ) != 1: raise ValueError( "POSCAR scaling factors and volumes are inconsistent" ) return df
def main(): args = parse_command_line_arguments() poscar = Poscar.from_file( args.poscar ) potcars = potcar_spec( args.potcar ) for i, ( species, potcar ) in enumerate( zip( poscar.atoms, potcars ), 1 ): matching_potcar = potcar.startswith( species ) if not matching_potcar: raise AttributeError( 'Species {} mismatch:\nPOSCAR contains {}\nPOTCAR contains {}'.format( i, species, potcar ) ) if args.ppset: this_ppset = potcars[potcar] if args.ppset != this_ppset: raise AttributeError( 'Pseudopotential set mismatch: {}'.format( potcars.values() ) )
def main(): args = parse_command_line_arguments() poscar = Poscar.from_file(args.poscar) potcars = potcar_spec(args.potcar) for i, (species, potcar) in enumerate(zip(poscar.atoms, potcars), 1): matching_potcar = potcar.startswith(species) if not matching_potcar: raise AttributeError( 'Species {} mismatch:\nPOSCAR contains {}\nPOTCAR contains {}'. format(i, species, potcar)) if args.ppset: this_ppset = potcars[potcar] if args.ppset != this_ppset: raise AttributeError('Pseudopotential set mismatch: {}'.format( potcars.values()))