def get_icohp_dict_of_site(self, site, minsummedicohp=None, maxsummedicohp=None, minbondlength=0.0,
                               maxbondlength=8.0, only_bonds_to=None):
        """
        get a dict of IcohpValue for a certain site (indicated by integer)
        Args:
            site: integer describing the site of interest, order as in Icohplist.lobster/Icooplist.lobster, starts at 0
            minsummedicohp: float, minimal icohp/icoop of the bonds that are considered. It is the summed ICOHP value from both spin channels for spin polarized cases
            maxsummedicohp: float, maximal icohp/icoop of the bonds that are considered. It is the summed ICOHP value from both spin channels for spin polarized cases
            minbondlength: float, defines the minimum of the bond lengths of the bonds
            maxbondlength: float, defines the maximum of the bond lengths of the bonds
            only_bonds_to: list of strings describing the bonding partners that are allowed, e.g. ['O']
        Returns:
             dict of IcohpValues, the keys correspond to the values from the initial list_labels
        """

        newicohp_dict = {}
        for key, value in self._icohplist.items():
            atomnumber1 = int(re.split(r'(\d+)', value._atom1)[1]) - 1
            atomnumber2 = int(re.split(r'(\d+)', value._atom2)[1]) - 1
            if site == atomnumber1 or site == atomnumber2:
                # manipulate order of atoms so that searched one is always atom1
                if site == atomnumber2:
                    save = value._atom1
                    value._atom1 = value._atom2
                    value._atom2 = save

                if only_bonds_to is None:
                    second_test = True
                else:
                    second_test = (re.split(r'(\d+)', value._atom2)[0] in only_bonds_to)
                if value._length >= minbondlength and value._length <= maxbondlength and second_test:
                    if minsummedicohp is not None:
                        if value.summed_icohp >= minsummedicohp:
                            if maxsummedicohp is not None:
                                if value.summed_icohp <= maxsummedicohp:
                                    newicohp_dict[key] = value
                            else:
                                newicohp_dict[key] = value
                    else:
                        if maxsummedicohp is not None:
                            if value.summed_icohp <= maxsummedicohp:
                                newicohp_dict[key] = value
                        else:
                            newicohp_dict[key] = value

        return newicohp_dict
def get_icohp_dict_of_site ( self , site , minsummedicohp = None , maxsummedicohp = None , minbondlength = 0.0 , maxbondlength = 8.0 , only_bonds_to = None ) : newicohp_dict = { } for key , value in self . _icohplist . items ( ) : atomnumber1 = int ( re . split ( r'(\d+)' , value . _atom1 ) [ 1 ] ) - 1 atomnumber2 = int ( re . split ( r'(\d+)' , value . _atom2 ) [ 1 ] ) - 1 if site == atomnumber1 or site == atomnumber2 : if site == atomnumber2 : save = value . _atom1 value . _atom1 = value . _atom2 value . _atom2 = save if only_bonds_to is None : second_test = True else : second_test = ( re . split ( r'(\d+)' , value . _atom2 ) [ 0 ] in only_bonds_to ) if value . _length >= minbondlength and value . _length <= maxbondlength and second_test : if minsummedicohp is not None : if value . summed_icohp >= minsummedicohp : if maxsummedicohp is not None : if value . summed_icohp <= maxsummedicohp : newicohp_dict [ key ] = value else : newicohp_dict [ key ] = value else : if maxsummedicohp is not None : if value . summed_icohp <= maxsummedicohp : newicohp_dict [ key ] = value else : newicohp_dict [ key ] = value return newicohp_dict
get a dict of IcohpValue for a certain site (indicated by integer)
        Args:
            site: integer describing the site of interest, order as in Icohplist.lobster/Icooplist.lobster, starts at 0
            minsummedicohp: float, minimal icohp/icoop of the bonds that are considered. It is the summed ICOHP value from both spin channels for spin polarized cases
            maxsummedicohp: float, maximal icohp/icoop of the bonds that are considered. It is the summed ICOHP value from both spin channels for spin polarized cases
            minbondlength: float, defines the minimum of the bond lengths of the bonds
            maxbondlength: float, defines the maximum of the bond lengths of the bonds
            only_bonds_to: list of strings describing the bonding partners that are allowed, e.g. ['O']
        Returns:
             dict of IcohpValues, the keys correspond to the values from the initial list_labels