plot_bandproj

Script to process projection data

Functions

find_all_indices(lst, element)

Find all indices of a specific element in a list.

main()

Main function to execute the program

Classes

DataProcessor([structure_file, proj_file])

A class to process projection data in "proj.out*" format from QE calculations.

PROCARProcessor(procar_file, band_file)

A class to process PROCAR file and extract band information.

class plot_bandproj.PROCARProcessor(procar_file, band_file)[source]

A class to process PROCAR file and extract band information.

Parameters: - procar_file (str): Path to the PROCAR file. - band_file (str): Path to the band file.

Attributes: - nkpoint (int): Number of k-points. - nband (int): Number of bands. - nion (int): Number of ions. - ncol (int): Number of columns in the PROCAR data. - col (list): List of column labels. - data (numpy.ndarray): Processed PROCAR data. - nspin (int): Number of spin channels. - elements (list): List of elements parsed from structure file. - nkpoint_extra (int): Additional k-points in PROCAR file not in band file.

Methods: - write_band_orbital(orb): Writes band orbital data to the specified file. - write_band_element(elm): Writes band element data to the specified file. - extract_data(elm, orb): Extracts data for a specific element and orbital. - extract_data_2(elm, orb): Extracts data for a specific element and orbital, summing over suborbitals. - print_info(): Prints available options for elements and orbitals. - clean(): Cleans up temporary files created during processing.

Example: ```python # Instantiate PROCARProcessor >>> procar_processor = PROCARProcessor(“PROCAR”, “BANDS”)

# Print available options >>> procar_processor.print_info()

# Extract data for a specific element and orbital >>> procar_processor.extract_data(‘Fe’, ‘s’)

# Write band orbital data to a file >>> procar_processor.write_band_orbital(‘s’)

# Write band element data to a file >>> procar_processor.write_band_element(‘Fe’)

# Clean up temporary files >>> procar_processor.clean() ```

print_info()[source]

Print available options for elements and orbitals.

clean()[source]

Clean up temporary files created during processing.

extract_data(elm, orb)[source]

Extract data for a specific element and orbital.

Parameters: - elm (str): Element symbol. - orb (str): Orbital type.

extract_data_2(elm, orb)[source]

Extract data for a specific element and orbital, summing over suborbitals.

Parameters: - elm (str): Element symbol. - orb (str): Orbital type.

write_band_orbital(orb)[source]

Write orbital data to the specified file.

Parameters: - output_file (str): Path to the output file.

write_band_element(elm)[source]

Write element data to the specified file.

Parameters: - output_file (str): Path to the output file.

plot_bandproj.find_all_indices(lst, element)[source]

Find all indices of a specific element in a list.

Parameters: - lst (list): List to search. - element (str): Element to find.

Returns: - indices (list): List of indices where the element is found.

class plot_bandproj.DataProcessor(structure_file='scf.in', proj_file='proj.out*')[source]

A class to process projection data in “proj.out*” format from QE calculations.

projdata

The projection data.

Type:

str

nkpoint

The number of k-points.

Type:

int

nband

The number of bands.

Type:

int

nrow

The number of rows in the data.

Type:

int

dict_

A dictionary for storing projection data.

Type:

dict

dict_2

Another dictionary for storing data with keys as elements and values as list storing orbital info.

Type:

dict

dict_1

Similar to dict_1, but only with useful orbital info.

Type:

dict

ref_data

Reference data to initialize numpy array.

Type:

str

proj_dict

Dictionary for projection data.

Type:

dict

final_dict

Dictionary for final data for unique element-orbital combination.

Type:

dict

In a compound like A2B3, when combining orbital contributions for elements A and B,
we need to consider the stoichiometry.
For example, if we're summing contributions from the pz orbital
- For element A, the contribution from the pz orbital should be summed 2 times

(since there are 2 A atoms).

- For element B, the contribution from the pz orbital should be summed 3 times

(since there are 3 B atoms).

This ensures that the overall contribution is correctly weighted by the number
of atoms of each element in the compound.

Example: >>> processor = DataProcessor(structure_file=”scf.in”, proj_file=”proj.out*”)

convert_gnu(filename)[source]

Convert data file to GNU plot format.

Parameters:

filename (str) – The filename of the data file to be converted.

clean(delete_file)[source]

Deleting file

write_proj_elm_orbi()[source]

Write projection data for each element/orbital combination.

print_info()[source]

Printing available options

extract_data(elm, name)[source]

Extract projection data for a specific element and orbital and save it to a file.

Parameters:
  • elm (str) – Element for which projection data is extracted.

  • name (str) – Name of the orbital for which projection data is extracted.

extract_data_2(elm, name)[source]

Extract projection data for a specific element and orbital and save it to a file, while summing contributions from multiple suborbitals if applicable. Here, orbitals are “p”, “d” instead of suborbitals “px”, “py”, “pz”, etc.

Parameters:
  • elm (str) – Element for which projection data is extracted.

  • name (str) – Name of the orbital or orbital type for which projection data is extracted.

combine_element(elm)[source]

Combine projection data for a specific element and save it to a file.

Parameters:

elm (str) – Element for which projection data is combined.

combine_orbital(orb)[source]

Combine projection data for a specific orbital and save it to a file.

Parameters:

orb (str) – Orbital type for which projection data is combined.

convert_to_numpy(input_data)[source]

Convert input data to a NumPy array.

Parameters:

input_data (list) – List of strings representing data.

Returns:

NumPy array containing the converted data.

Return type:

numpy.ndarray

plot_bandproj.main()[source]

Main function to execute the program