Exemplo n.º 1
0
    def get_nnn_distance_summary(
            self, site_index: int) -> Dict[int, Dict[str, List[float]]]:
        """Gets the next nearest neighbor distance summary for a site.

        Args:
            site_index: The site index (zero based).

        Returns:
            The connectivity distance data for the site, formatted as::

                {
                    to_site: {
                        connectivity_a: [distance_1, distance_2, ...]
                        connectivity_b: [distance_1, distance_2, ...]
                    }
                }

            Where ``to_site`` is the index of a next nearest neighbor site,
            ``connectivity_a`` etc are the bonding connectivity type, e.g.
            ``'edge'`` or ``'corner'`` (for edge-sharing and corner-sharing
            connectivity), and ``distance_1`` etc are the bond angles as
            :obj:`float`.
        """
        connectivities = defaultdict(lambda: defaultdict(list))

        for nnn_site in self.get_next_nearest_neighbors(
                site_index, inc_inequivalent_site_index=True):
            to_site = nnn_site["inequiv_index"]
            connectivity = nnn_site["connectivity"]
            connectivities[to_site][connectivity].append(nnn_site["distance"])

        return defaultdict_to_dict(connectivities)
Exemplo n.º 2
0
    def get_bond_distance_summary(self,
                                  site_index: int) -> Dict[int, List[float]]:
        """Gets the bond distance summary for a site.

        Args:
            site_index: The site index (zero based).

        Returns:
            The bonding data for the site, formatted as::

                {to_site: [dist_1, dist_2, dist_3, ...]}

            Where ``to_site`` is the index of a nearest neighbor site
            and ``dist_1`` etc are the bond distances as :obj:`float`.
        """
        bonds = defaultdict(list)
        for nn_site in self.get_nearest_neighbors(site_index):
            to_site = nn_site["inequiv_index"]
            bonds[to_site].append(nn_site["dist"])

        return defaultdict_to_dict(bonds)