def test_species_from_light_structure_chemenv(self):
        """Test finding the ce's (mp symbols) of a species but starting from a Light Structure Environment object"""
        s1_finder = polyfinder.LocalGeometryFinder()
        s1_finder.setup_structure(self.structure)
        s1_finder.setup_parameters(centering_type='standard', structure_refinement='none')
        environments = s1_finder.compute_structure_environments_detailed_voronoi(maximum_distance_factor=1.5)

        light_se = se.LightStructureEnvironments(strategies.SimplestChemenvStrategy(), environments)

        ces = find_species_ce_from_light_se(light_se, self.first_site.species_string)

        for ce in ces:
            with open(self.path_to_jsons+"/%s.json" % ce) as json_file:
                data = json.load(json_file)
            self.assertEqual(data['mp_symbol'], "O:6", "Li polyhedra should be 6-coordinated octahedron")
            self.assertEqual(data['coordination'], 6, "Li polyhedra should be 6-coordinated octahedron")
            self.assertEqual(data['name'], "Octahedron", "Li polyhedra should be 6-coordinated octahedron")
def get_connectivity_description_2(structure, radius=2.6, peripheral_species=None, central_species=None):
    """
    Writes a verbal description of the connectivity between cations in a structure and does not differentiate between
    species on different sites in the unit cell. Uses the Chemenv module in Pymatgen to calculate the coordination
    environment for specific species.

    :param structure: (Structure) target Structure
    :param radius: (float) radius within which to determine whether a nearby atom is a peripheral ion
    :param peripheral_species: (List of Strings) list of species strings of what we consider the peripheral species of
    the polyhedra in the structure
    :param central_species: (List of Strings) list of species strings of what we consider the central species of the
    polyhedra in the structure
    :return: (dict) dictionary of strings containing verbal descriptions of connectivites between cations in the given
    structure; keys = cation tag (eg: Li1, Na2, where the letters represent the species and the number distinguishes
    the species from the other instances of that same species in the unit cell); dict values = String descriptions of
    connectivity
    """

    if peripheral_species is None:
        peripheral_species = ['O2-', 'O', 'F-', 'F', 'Cl-', 'Cl', 'I-', 'I', 'Br-', 'Br', 'S2-', 'S', 'N', 'N3-']
    if central_species is None:
        central_species = []

    connectivity_matrix, all_polyhedra, supercell = \
        get_connectivity_matrix(structure, True, radius, peripheral_species, central_species)

    lgf = polyfinder.LocalGeometryFinder()
    lgf.setup_parameters(centering_type='standard', structure_refinement='none')
    lgf.setup_structure(supercell)
    environments = lgf.compute_structure_environments_detailed_voronoi(maximum_distance_factor=1.5)
    light_se = se.LightStructureEnvironments(strategies.SimplestChemenvStrategy(), environments)
    path_to_jsons = os.path.dirname(cg_files.__file__)

    descriptions = {}
    for cation_1 in connectivity_matrix.keys():
        descriptions[cation_1] = ""
    for cation_1 in connectivity_matrix.keys():
        site_ces1 = find_species_ce_from_light_se(light_se, cation_1)
        cn1 = []
        for ce in site_ces1:
            with open(path_to_jsons+"/%s.json" % ce) as json_file:
                data1 = json.load(json_file)
            cn1.append(data1['name'])

        descriptions[cation_1] += cation_1 + " are " + cn1 + ". \n"
        for cation_2 in connectivity_matrix[cation_1].keys():
            connected = False
            for connectivity_type in connectivity_matrix[cation_1][cation_2].keys():
                if connectivity_matrix[cation_1][cation_2][connectivity_type] != 0:
                    connected = True
            if connected:
                descriptions[cation_1] += "They are "
                first = True
                for connectivity_type in connectivity_matrix[cation_1][cation_2].keys():
                    if connectivity_matrix[cation_1][cation_2][connectivity_type] != 0:
                        if first:
                            descriptions[cation_1] += connectivity_type + "-connected "
                            first = False
                        else:
                            descriptions[cation_1] += "and " + connectivity_type + "-connected "

                site_ces2 = find_species_ce_from_light_se(light_se, cation_1)
                cn2 = []
                for ce in site_ces2:
                    with open(path_to_jsons+"/%s.json" % ce) as json_file:
                        data2 = json.load(json_file)
                    cn2.append(data2['name'])
                descriptions[cation_1] += "to " + cn2 + " " + cation_2 + ". "
    return descriptions