This module provides classes to perform analyses of the local environments (e.g., finding near neighbors) of single sites in molecules and structures based on bonding analysis with Lobster.

class LobsterLightStructureEnvironments(strategy, coordination_environments=None, all_nbs_sites=None, neighbors_sets=None, structure=None, valences=None, valences_origin=None)[source]

Bases: LightStructureEnvironments

Class to store LightStructureEnvironments based on Lobster outputs

Constructor for the LightStructureEnvironments object.

  • strategy – ChemEnv strategy used to get the environments.

  • coordination_environments – The coordination environments identified.

  • all_nbs_sites – All the possible neighbors for each site in the structure.

  • neighbors_sets – The neighbors sets of each site in the structure.

  • structure – The structure.

  • valences – The valences used to get the environments (if needed).

  • valences_origin – How the valences were obtained (e.g. from the Bond-valence analysis or from the original structure).


Bson-serializable dict representation of the LightStructureEnvironments object. :return: Bson-serializable dict representation of the LightStructureEnvironments object.

classmethod from_Lobster(list_ce_symbol, list_csm, list_permutation, list_neighsite, list_neighisite, structure: Structure, valences=None)[source]

Will set up a LightStructureEnvironments from Lobster

  • structure – Structure object

  • list_ce_symbol – list of symbols for coordination environments

  • list_csm – list of continuous symmetry measures

  • list_permutation – list of permutations

  • list_neighsite – list of neighboring sites

  • list_neighisite – list of neighboring isites (number of a site)

  • valences – list of valences

Returns: LobsterLightStructureEnvironments

property uniquely_determines_coordination_environments[source]

True if the coordination environments are uniquely determined.

class LobsterNeighbors(are_coops=False, filename_ICOHP=None, valences=None, limits=None, structure=None, additional_condition=0, only_bonds_to=None, perc_strength_ICOHP=0.15, valences_from_charges=False, filename_CHARGE=None, which_charge='Mulliken', adapt_extremum_to_add_cond=False, add_additional_data_sg=False, filename_blist_sg1=None, filename_blist_sg2=None, id_blist_sg1='ICOOP', id_blist_sg2='ICOBI')[source]

Bases: NearNeighbors

This class combines capabilities from LocalEnv and ChemEnv to determine coordination environments based on bonding analysis

  • are_coops – (bool) if True, the file is a ICOOPLIST.lobster and not a ICOHPLIST.lobster; only tested for

  • far (ICOHPLIST.lobster so) –

  • filename_ICOHP – (str) Path to ICOHPLIST.lobster

  • valences (Mulliken) instead of) – (list of integers/floats) gives valence/charge for each element

  • limits – limit to decide which ICOHPs should be considered

  • structure – (Structure Object) typically constructed by: Structure.from_file(“POSCAR”) (Structure object

  • pymatgen.core.structure) (from) –


  • only_bonds_to – (list of str) will only consider bonds to certain elements (e.g. [“O”] for oxygen)

  • perc_strength_ICOHP – if no limits are given, this will decide which icohps will still be considered (

  • to (relative) –

  • ICOHP) (the strongest) –

  • valences_from_charges – if True and path to CHARGE.lobster is provided, will use Lobster charges (

  • valences

  • filename_CHARGE – (str) Path to Charge.lobster

  • which_charge – (str) “Mulliken” or “Loewdin”

  • adapt_extremum_to_add_cond – (bool) will adapt the limits to only focus on the bonds determined by the

  • condition (additional) –

  • add_additional_data_sg – (bool) will add the information from filename_add_bondinglist_sg1,

  • filename_blist_sg1 – (str) Path to additional ICOOP, ICOBI data for structure graphs

  • filename_blist_sg2 – (str) Path to dditional ICOOP, ICOBI data for structure graphs

  • id_blist_sg1 – (str) Identity of data in filename_blist_sg1, e.g., “icoop” or “icobi”

  • id_blist_sg2 – (str) Identity of data in filename_blist_sg2, e.g., “icoop” or “icobi”


Return the types of anions present in crystal structure Returns:

get_info_cohps_to_neighbors(path_to_COHPCAR='COHPCAR.lobster', isites=None, only_bonds_to=None, onlycation_isites=True, per_bond=True, summed_spin_channels=False)[source]

Return info about the cohps from all sites mentioned in isites with neighbors

  • path_to_COHPCAR – str, path to COHPCAR

  • isites – list of int that indicate the number of the site

  • only_bonds_to – list of str, e.g. [“O”] to only show cohps of anything to oxygen

  • onlycation_isites – if isites=None, only cation sites will be returned

  • per_bond – will normalize per bond

  • summed_spin_channels – will sum all spin channels

Returns: label for cohp (str), CompleteCohp object which describes all cohps of the sites as given by isites and the other parameters

get_info_icohps_between_neighbors(isites=None, onlycation_isites=True)[source]

Return infos about interactions between neighbors of a certain atom

  • isites – list of site ids, if isite==None, all isites will be used

  • onlycation_isites – will only use cations, if isite==None


summed_icohps, list_icohps, number_bonds, label_list, atoms_list

Return type:


get_info_icohps_to_neighbors(isites=None, onlycation_isites=True)[source]

this method Return information of cohps of neighbors

  • isites – list of site ids, if isite==None, all isites will be used to add the icohps of the neighbors

  • onlycation_isites – will only use cations, if isite==[]


sum of icohps of neighbors to certain sites [given by the id in structure], number of bonds to this site, labels (from ICOHPLIST) for these bonds [the latter is useful for plotting summed COHP plots], list of the central isite for each label

get_light_structure_environment(only_cation_environments=False, only_indices=None)[source]

Return a LobsterLightStructureEnvironments object if the structure only contains coordination environments smaller 13

  • only_cation_environments – only data for cations will be returned

  • only_indices – will only evaluate the list of isites in this list

Returns: LobsterLightStructureEnvironments Object

get_nn_info(structure: Structure, n, use_weights=False)[source]

Get coordination number, CN, of site with index n in structure.

  • structure (Structure) – input structure.

  • n (int) – index of site for which to determine CN.

  • use_weights (bool) – flag indicating whether (True) to use weights for computing the coordination number or not (False, default: each coordinated site has equal weight). True is not implemented for LobsterNeighbors


coordination number.

Return type:

cn (integer or float)

property molecules_allowed[source]

can this NearNeighbors class be used with Molecule objects?


Boolean property

plot_cohps_of_neighbors(path_to_COHPCAR='COHPCAR.lobster', isites=None, onlycation_isites=True, only_bonds_to=None, per_bond=False, summed_spin_channels=False, xlim=None, ylim=(-10, 6), integrated=False)[source]

Will plot summed cohps (please be careful in the spin polarized case (plots might overlap (exactly!))

  • isites – list of site ids, if isite==[], all isites will be used to add the icohps of the neighbors

  • onlycation_isites – bool, will only use cations, if isite==[]

  • only_bonds_to – list of str, only anions in this list will be considered

  • per_bond – bool, will lead to a normalization of the plotted COHP per number of bond if True,

  • sum (otherwise the) –

  • plotted (will be) –

  • xlim – list of float, limits of x values

  • ylim – list of float, limits of y values

  • integrated – bool, if true will show integrated cohp instead of cohp


plt of the cohps

property structures_allowed[source]

can this NearNeighbors class be used with Structure objects?


Boolean property