dfttk.data_extraction

Extract relevant data from VASP output files.

dfttk.data_extraction.extract_atomic_masses(outcar_path)[source]

Extracts the atomic masses from an OUTCAR file and returns them as a dictionary with the species as the key and the mass as the value.

Parameters:

outcar_path (str) – path to an OUTCAR file.

Returns:

dictionary containing the atomic masses.

Return type:

float

dfttk.data_extraction.extract_average_mass(contcar_path, outcar_path, average='arithmetic')[source]

Calculates the average atomic mass of a structure from a CONTCAR file and an OUTCAR file.

Parameters:
  • contcar_path (str) – path to a CONTCAR file.

  • outcar_path (str) – path to an OUTCAR file.

  • average (str) – Type of average to calculate. Must be ‘arithmetic’, ‘geometric’, or ‘harmonic’. Defaults to “arithmetic”.

Raises:

ValueError – If the average type is not recognized.

Returns:

average atomic mass of the structure.

Return type:

float

dfttk.data_extraction.extract_mag_data(outcar_path)[source]

Extracts the magnetization data from an OUTCAR file and returns the data as a pandas DataFrame in the same format and headings as seen in the OUTCAR.

Parameters:

outcar_path (str) – path to an OUTCAR file.

Raises:
  • FileNotFoundError – if the OUTCAR file does not exist.

  • ValueError – if the magnetization headers are not found in the OUTCAR file.

Returns:

DataFrame containing the magnetization data.

Return type:

DataFrame

dfttk.data_extraction.extract_tot_mag_data(outcar_path, contcar_path)[source]

Returns only the ‘tot’ magnetization of the last step for each specified ion.

Parameters:
  • outcar_path (str) – path to an OUTCAR file.

  • contcar_path (str) – path to a CONTCAR file.

Returns:

a pandas DataFrame containing the ‘tot’ magnetization data.

Return type:

DataFrame