surfaxe.vasp_data module

surfaxe.vasp_data.core_energy(core_atom, bulk_nn, orbital='1s', ox_states=None, nn_method=<Mock name='mock()' id='140141492551248'>, outcar='OUTCAR', structure='POSCAR')[source]

Parses the structure and OUTCAR files for the core level energy. Check the validity of nearest neighbour method on the bulk structure before using it on slabs.

  • core_atom (str, optional) – The symbol of atom the core state energy level should be parsed from.

  • bulk_nn (list, optional) – The symbols of the nearest neighbours of the core_atom.

  • orbital (str, optional) – The orbital of core state. Defaults to 1s.

  • ox_states (None, list or dict, optional) –

    Add oxidation states to the structure. Different types of oxidation states specified will result in different pymatgen functions used. The options are:

    • if supplied as list: The oxidation states are added by site

      e.g. [3, 2, 2, 1, -2, -2, -2, -2]

    • if supplied as dict: The oxidation states are added by element

      e.g. {'Fe': 3, 'O':-2}

    • if None: The oxidation states are added by guess.

    Defaults to None.

  • nn_method (class instance, optional) – The coordination number algorithm used. Because the nn_method is a class, the class needs to be imported from pymatgen.analysis.local_env before it can be instantiated here. Defaults to CrystalNN().

  • outcar (str, optional) – Path to the OUTCAR file. Defaults to ./OUTCAR.

  • structure (str, optional) – Path to the structure file in any format supported by pymatgen. Defaults to ./POSCAR. Can also accept a pymaten.core.Structure object directly.


Core state energy

surfaxe.vasp_data.process_data(bulk_per_atom, parse_hkl=True, path_to_fols=None, hkl_dict=None, parse_core_energy=False, core_atom=None, bulk_nn=None, parse_vacuum=False, save_csv=True, csv_fname='data.csv', **kwargs)[source]

Parses the folders to collect all final data on relevant input and output parameters, and optionally core and vacuum level energies.

If you are processing data for folder structures generated with generation make sure you use convergence.parse_fols function. This function is for parsing full sets of information from the output of production run calculations.

The folder structure for parsing of data is fairly flexible and can be: 1. automatically parsed if parse_hkl=True - the function searches for folders with names three digits long in cwd (default)

e.g. it finds folders cwd/100 and cwd/010 that correspond to Miller indices (1,0,0) and (0,1,0)

2. automatically parsed from a specific working directory if path_to_fols is specified 3. manually specified using hkl_dict, where the Miller index is mapped directly to the path to where the files are. If you are only interested in the specified folders, do not forget to change parse_hkl=False.

e.g. hkl_dict = {(0,1,1): ‘path/to/001/files/’,

(2,0,1): ‘path/to/201/files/’}

4. automatically parsed from cwd or a specific working directory in addition to a defined hkl_dict

Each of the folders must contain POSCAR and vasprun.xml files and optionally LOCPOT (or potential.csv) and OUTCAR files if vacuum or core energy are parsed.

The function returns None by default and saves the DataFrame to a csv file. Optionally, it can return the DataFrame.

  • bulk_per_atom (float) – Bulk energy per atom in eV per atom.

  • parse_hkl (bool, optional) – If True the script parses the names of the folders to get the Miller indices. Defaults to True.

  • path_to_fols (str, optional) – Path to where surfaxe should look for the hkl folders are. Defaults to None which searches in cwd.

  • hkl_dict (dict, optional) – dictionary of tuples of Miller indices and paths to the folders the relevant outputs. Defaults to None. E.g. If the outputs of the calculations on the (1,-1,2) slab are in folder path/to/folder/112, the hkl_dict would be: {(1,-1,2): ‘path/to/folder/112’}

  • parse_core_energy (bool, optional) – If True the scripts attempts to parse core energies from a supplied OUTCAR. Defaults to False.

  • core_atom (str, optional) – The symbol of atom the core state energy level should be parsed from. Defaults to None.

  • bulk_nn (list, optional) – The symbols of the nearest neighbours of the core_atom. Defaults to None.

  • parse_vacuum (bool, optional) – if True the script attempts to parse LOCPOT using analysis.electrostatic_potential to use the maximum value of planar potential as the vacuum energy level. Defaults to True.

  • save_csv (bool, optional) – If True, it writes data to a csv file. Defaults to True.

  • csv_fname (str, optional) – The filename of the csv. Defaults to data.csv




Gets the energy of the vacuum level. It either parses potential.csv file if available or tries to calculate planar potential from LOCPOT. If neither file is available, function returns np.nan.


path (str, optional) – the path to potential.csv or LOCPOT files. Can be the path to a directory in which either file is or you can specify a path that must end in .csv or contain LOCPOT. Defaults to looking for potential.csv or LOCPOT in cwd.


Maximum value of planar potential