FeaturizeCOXX#

class lobsterpy.featurize.core.FeaturizeCOXX(path_to_coxxcar, path_to_icoxxlist, path_to_structure, feature_type, e_range=[-10.0, 0.0], are_cobis=False, are_coops=False)[source]#

Bases: object

Class to featurize COHPCAR, COBICAR or COOPCAR data.

Parameters:
  • path_to_coxxcar (str | Path) – path to COXXCAR.lobster (e.g., COXXCAR.lobster)

  • path_to_icoxxlist (str | Path) – path to ICOXXLIST.lobster (e.g., ICOXXLIST.lobster)

  • path_to_structure (str | Path) – path to structure file (e.g., CONTCAR (preferred), POSCAR)

  • feature_type (Literal['bonding', 'antibonding', 'overall']) – set the feature type for moment features and fingerprints. Possible options are bonding, antibonding or overall.

  • are_cobis (bool) – bool indicating if file contains COBI/ICOBI data.

  • are_coops (bool) – bool indicating if file contains COOP/ICOOP data.

  • e_range (list[float]) – range of energy relative to fermi for which moment features needs to be computed

get_coxx_fingerprint_df(ids=None, label_list=None, orbital=None, per_bond=True, spin_type='summed', binning=True, n_bins=56, normalize=True)[source]#

Generate a COXX fingerprints dataframe.

Parameters:
  • ids (str | None) – set index name in the pandas dataframe. Default is None. When None, LOBSTER calc directory name is used as index name.

  • spin_type (Literal['up', 'down', 'summed']) – Specify spin type. Can accept ‘{summed/up/down}’ (default is summed)

  • binning (bool) – If true coxxs will be binned

  • n_bins (int) – Number of bins to be used in the fingerprint (default is 256)

  • normalize (bool) – If true, normalizes the area under fp to equal to 1 (default is True)

  • label_list (list[str] | None) – Specify bond labels as a list for which cohp fingerprints are needed

  • orbital (str | None) – Orbital for which fingerprint needs is to be computed. Cannot be used independently. Always a needs label_list.

  • per_bond (bool) – Will scale cohp values by number of bonds i.e. length of label_list arg (Only affects when label_list is not None)

Raises:
  • Exception – If spin_type is not one of the accepted values {summed/up/down}.

  • ValueError – If feature_type is not one of the accepted values {bonding/antibonding/overall}.

Returns:

A pandas dataframe with the COXX fingerprint of format (energies, coxx, fp_type, spin_type, n_bins, bin_width)

Return type:

DataFrame

static get_coxx_center(coxx, energies, e_range)[source]#

Get the bandwidth, defined as the first moment of the COXX.

Parameters:
  • coxx (ndarray[floating]) – COXX array

  • energies (ndarray[floating]) – energies corresponding COXX

  • e_range (list[float]) – range of energy to compute coxx center

Returns:

coxx center in eV

Return type:

float

static get_n_moment(n, coxx, energies, e_range, center=True)[source]#

Get the nth moment of COXX.

Parameters:
  • n (float) – The order for the moment

  • coxx (ndarray[floating]) – COXX array

  • energies (ndarray[floating]) – energies array

  • e_range (list[float] | None) – range of energy to compute nth moment

  • center (bool) – Take moments with respect to the COXX center

  • e_range – range of energy to compute nth moment

Returns:

COXX nth moment in eV

Return type:

float

static get_cohp_edge(coxx, energies, e_range)[source]#

Get the highest peak position of hilbert transformed COXX.

Parameters:
  • coxx (ndarray[floating]) – COXX array

  • energies (ndarray[floating]) – energies array

  • e_range (list[float] | None) – range of energy to coxx edge (max peak position)

Returns:

COXX edge (max peak position) in eV

get_summarized_coxx_df(ids=None, label_list=None, per_bond=True)[source]#

Get a pandas dataframe with COXX features.

Features consist of weighted ICOXX, effective interaction number and moment features of COXX in the selected energy range.

Parameters:
  • ids (str | None) – set index name in the pandas dataframe. Default is None. When None, LOBSTER calc directory name is used as index name.

  • label_list (list[str] | None) – list of bond labels to be used for generating features from COHPCAR.lobster or COOPCAR.lobster or COBICAR.lobster. Default is None. When None, all bond labels are used.

  • per_bond (bool) – Defaults to True. When True, features are normalized by total number of bonds in the structure.

Returns:

Returns a pandas dataframe with cohp/cobi/coop related features as per input file

Return type:

DataFrame