pymatgen.electronic_structure.cohp module

class Cohp(efermi, energies, cohp, are_coops=False, icohp=None)[source]

Bases: monty.json.MSONable

Basic COHP object.

Args/attributes:

are_coops: Indicates whether this object describes COHPs or COOPs.

efermi: Fermi energy.

energies: A sequence of energies.

cohp ({Spin: np.array}): representing the COHP for each spin.

icohp ({Spin: np.array}): representing the ICOHP for each spin.

as_dict()[source]

Json-serializable dict representation of COHP.

classmethod from_dict(d)[source]

Returns a COHP object from a dict representation of the COHP.

get_cohp(spin=None, integrated=False)[source]

Returns the COHP or ICOHP for a particular spin.

Parameters:
  • spin – Spin. Can be parsed as spin object, integer (-1/1) or str (“up”/”down”)
  • integrated – Return COHP (False) or ICOHP (True)
Returns:

Returns the CHOP or ICOHP for the input spin. If Spin is None and both spins are present, both spins will be returned as a dictionary.

get_icohp(spin=None)[source]

Convenient alternative to get the ICOHP for a particular spin.

get_interpolated_value(energy, integrated=False)[source]

Returns the COHP for a particular energy.

Parameters:energy – Energy to return the COHP value for.
class CompleteCohp(structure, avg_cohp, cohp_dict, bonds=None, are_coops=False, orb_res_cohp=None)[source]

Bases: pymatgen.electronic_structure.cohp.Cohp

A wrapper class that defines an average COHP, and individual COHPs.

Parameters:
  • structure – Structure assosciated with this COHP.
  • avg_cohp – The average cohp as a COHP object.
  • cohps – A dict of COHP objects for individual bonds of the form {label: COHP}
  • bonds – A dict containing information on the bonds of the form {label: {key: val}}. The key-val pair can be any information the user wants to put in, but typically contains the sites, the bond length, and the number of bonds. If nothing is supplied, it will default to an empty dict.
  • are_coops – indicates whether the Cohp objects are COHPs or COOPs. Defauls to False for COHPs.
  • orb_res_cohp – Orbital-resolved COHPs.
as_dict()[source]

Json-serializable dict representation of CompleteCohp.

classmethod from_dict(d)[source]

Returns CompleteCohp object from dict representation.

classmethod from_file(fmt, filename=None, structure_file=None, are_coops=False)[source]

Creates a CompleteCohp object from an output file of a COHP calculation. Valid formats are either LMTO (for the Stuttgart LMTO-ASA code) or LOBSTER (for the LOBSTER code).

Parameters:
  • cohp_file – Name of the COHP output file. Defaults to COPL for LMTO and COHPCAR.lobster/COOPCAR.lobster for LOBSTER.
  • are_coops – Indicates whether the populations are COOPs or COHPs. Defaults to False for COHPs.
  • fmt – A string for the code that was used to calculate the COHPs so that the output file can be handled correctly. Can take the values “LMTO” or “LOBSTER”.
  • structure_file – Name of the file containing the structure. If no file name is given, use CTRL for LMTO and POSCAR for LOBSTER.
Returns:

A CompleteCohp object.

get_cohp(label, spin=None, integrated=False)[source]

Get specific COHP or ICOHP. If label is not in the COHP labels, try reversing the order of the sites.

Parameters:
  • spin – Spin. Can be parsed as spin object, integer (-1/1) or str (“up”/”down”)
  • integrated – Return COHP (False) or ICOHP (True)
Returns:

Returns the CHOP or ICOHP for the input spin. If Spin is None and both spins are present, both spins will be returned as a dictionary.

get_icohp(label, spin=None)[source]

Convenient alternative to get a specific ICOHP.

get_orbital_resolved_cohp(label, orbitals)[source]

Get orbital-resolved COHP.

Parameters:
  • label – bond label (Lobster: labels as in ICOHPLIST/ICOOPLIST.lobster).
  • orbitals – The orbitals as a label, or list or tuple of the form [(n1, orbital1), (n2, orbital2)]. Orbitals can either be str, int, or Orbital.
Returns:

A Cohp object if CompleteCohp contains orbital-resolved cohp, or None if it doesn’t.

Note: It currently assumes that orbitals are str if they aren’t the
other valid types. This is not ideal, but the easiest way to avoid unicode issues between python 2 and python 3.
class IcohpCollection(list_labels, list_atom1, list_atom2, list_length, list_translation, list_num, list_icohp, is_spin_polarized, are_coops=False)[source]

Bases: monty.json.MSONable

Class to store IcohpValues :param is_spin_polarized: Boolean to indicate if the Lobster calculation was done spin polarized or not Boolean to indicate if the Lobster calculation was done spin polarized or not :param are_coops: Boolean to indicate whether ICOHPs or ICOOPs are stored :param list_labels: list of labels for ICOHP/ICOOP values :param list_atom1: list of str of atomnames e.g. “O1” :param list_atom2: list of str of atomnames e.g. “O1” :param list_length: list of lengths of corresponding bonds in Angstrom :param list_translation: list of translation list, e.g. [0,0,0] :param list_num: list of equivalent bonds, usually 1 starting from Lobster 3.0.0 :param list_icohp: list of dict={Spin.up: icohpvalue for spin.up, Spin.down: icohpvalue for spin.down}

are_coops
Boolean to indicate whether ICOHPs or ICOOPs are stored
is_spin_polarized
Boolean to indicate if the Lobster calculation was done spin polarized or not
are_coops
extremum_icohpvalue(summed_spin_channels=True, spin=<Spin.up: 1>)[source]

get ICOHP/ICOOP of strongest bond :param summed_spin_channels: Boolean to indicate whether the ICOHPs/ICOOPs of both spin channels should be summed :param spin: if summed_spin_channels is equal to False, this spin indicates which spin channel should be returned

Returns:lowest ICOHP/largest ICOOP value (i.e. ICOHP/ICOOP value of strongest bond)
get_icohp_by_label(label, summed_spin_channels=True, spin=<Spin.up: 1>)[source]

get an icohp value for a certain bond as indicated by the label (bond labels starting by “1” as in ICOHPLIST/ICOOPLIST) :param label: label in str format (usually the bond number in Icohplist.lobster/Icooplist.lobster :param summed_spin_channels: Boolean to indicate whether the ICOHPs/ICOOPs of both spin channels should be summed :param spin: if summed_spin_channels is equal to False, this spin indicates which spin channel should be returned

Returns:float describing ICOHP/ICOOP value
get_icohp_dict_by_bondlengths(minbondlength=0.0, maxbondlength=8.0)[source]

get a dict of IcohpValues corresponding to certaind bond lengths :param minbondlength: defines the minimum of the bond lengths of the bonds :param maxbondlength: defines the maximum of the bond lengths of the bonds

Returns:dict of IcohpValues, the keys correspond to the values from the initial list_labels
get_icohp_dict_of_certain_site(site, minsummedicohp=None, maxsummedicohp=None, minbondlength=0.0, maxbondlength=8.0)[source]

get a dict of IcohpValue for a certain site (indicated by integer) :param site: integer describing the site of interest, order as in Icohplist.lobster/Icooplist.lobster, starts at 0 :param minsummedicohp: minimal icohp/icoop of the bonds that are considered. It is the summed ICOHP value from both spin channels for spin polarized cases :param maxsummedicohp: maximal icohp/icoop of the bonds that are considered. It is the summed ICOHP value from both spin channels for spin polarized cases :param minbondlength: defines the minimum of the bond lengths of the bonds :param maxbondlength: defines the maximum of the bond lengths of the bonds

Returns:dict of IcohpValues, the keys correspond to the values from the initial list_labels
get_summed_icohp_by_labellist(labellist, divisor=1.0, summed_spin_channels=True, spin=<Spin.up: 1>)[source]

get the sum of several ICOHP values that are indicated by a list of labels (labels of the bonds are the same as in ICOHPLIST/ICOOPLIST) :param labellist: list of labels of the ICOHPs/ICOOPs that should be summed :param divisor: is used to divide the sum :param summed_spin_channels: Boolean to indicate whether the ICOHPs/ICOOPs of both spin channels should be summed :param spin: if summed_spin_channels is equal to False, this spin indicates which spin channel should be returned

Returns:float that is a sum of all ICOHPs/ICOOPs as indicated with labellist
is_spin_polarized
class IcohpValue(label, atom1, atom2, length, translation, num, icohp, are_coops=False)[source]

Bases: monty.json.MSONable

Class to store information on an ICOHP or ICOOP value :param label: label for the icohp :param atom1: str of atom that is contributing to the bond :param atom2: str of second atom that is contributing to the bond :param length: float of bond lengths :param translation: translation list, e.g. [0,0,0] :param num: integer describing how often the bond exists :param icohp: dict={Spin.up: icohpvalue for spin.up, Spin.down: icohpvalue for spin.down}

num_bonds
number of bonds used for the average cohp (relevant for Lobster versions <3.0) (int)
are_coops
Boolean to indicate whether ICOOP or not
icohp
dict={Spin.up: icohpvalue for spin.up, Spin.down: icohpvalue for spin.down}
summed_icohp:
sum of icohp/icoop of both spin channels
are_coops

tells if ICOOPs or not :returns: Boolean

icohp

dict with icohps for spinup and spindown :returns: icohpvalue for spin.up, Spin.down: icohpvalue for spin.down} :rtype: dict={Spin.up

icohpvalue(spin=<Spin.up: 1>)[source]
Parameters:spin – Spin.up or Spin.down
Returns:icohpvalue (float) corresponding to chosen spin
is_spin_polarized

tells if spin polarized calculation or not :returns: Boolean

num_bonds

tells the number of bonds for which the ICOHP value is an average :returns: Int

summed_icohp

Adds ICOHPs of both spin channels for spin polarized compounds :returns: icohp value in eV