file_parser

The VASP_PARSER class

class VASP_PARSER(directory, create_files=False)[source]

Class for parsing vasp and chargemol files

Summary goes on one line here

Parameters
  • directory (str) – Location of vasp and chargemol files

  • create_files (bool) – If True, charg2.extxyzstripped and vasprun2.xmlstripped files are generated which compile concatenated DDEC6 charge and vasprun.xml files into a format readable by PANDAS or ASE

Variables
  • freq_dirs (list of str) – List of directories where concatenated vasprun.xml and chargemol files are located.

  • create_files (list of str) – list of preprocessed concatenated DECC6 charge files

get_charge_files(directory=None)[source]

Get list of porcessed concatenated DDEC6 charge files

Parameters

directory (str or None) – directory of concatenated unprocessed concated chargemol files

Returns

charge_files_clean – List of processed concatenated chargemol files

Return type

list of str

get_freq_files(directory=None)[source]

Get list of porcessed concatenated vasprun.xml files

Parameters

directory (str or None) – directory of concatenated unprocessed concated vasprun.xml files

Returns

freq_files_clean – List of processed concatenated vasprun.xml files

Return type

list of str

The explode function

explode(df, lst_cols, fill_value='', preserve_index=True)[source]

Take a pandas data frame with list components and explode so there is a separate line for each value in the list

Parameters
  • df (pandas.dataframe) – Dataframe to expand

  • lst_cols (list) – list of columns names whose cells are lists that are to be expanded into their own rows

  • fill_value (str) – If a column does not does not have the same number of indices as in a specific row as the other cells with lists replace NA with fill_value

  • preserve_index (bool) – Indicates whether the indices of the dataframe should be preserved after expanding

Returns

res – Expanded dataframe

Return type

pandas.dataframe