Procar reader

Module Contents#



Reader for PROCAR file


class easyunfold.procar.Procar(fobjs_or_paths=None, is_soc=False, normalise=True)#

Bases: monty.json.MSONable

Reader for PROCAR file


Read the PROCAR(.gz) file from a handle or path

  • fobjs_or_paths – Either a string or list of file-like objs or paths

  • is_soc – Whether the PROCAR(.gz) is from a calculation with spin-orbit coupling

  • normalise – Whether to normalise the projection for every band or not

_read(fobj, parsed_kpoints=None)#

Main function for reading in the data


Normalise the projections

For each nspin, nkpt, nband, normalise the sum of projections over nion and proj_names to be 1. Atomic & orbital projections do not sum to 1 in most cases in VASP, as only those falling inside the atomic radii and overlapping with spd spherical harmonics are counted.


Read the header, nion and proj_names from the PROCAR


Read and amalgamate the data from a list of PROCARs

get_projection(atom_idx: List[int], proj: Union[List[str], str], weight_by_k=False)#

Get projection for specific atoms and specific projectors

  • atom_idx – A list of index of the atoms to be selected

  • proj – A list of the projector names to be selected

  • weight_by_k – Apply k weighting or not.


The projection summed over the selected atoms and the projectors

as_dict() dict#

Convert the object into a dictionary representation (so it can be saved to json)

classmethod from_dict(d)#

Reconstructs Procar object from a dict representation, without calling init().

Args: d (dict): dict representation of Procar

Returns: Procar object