def test_connectivity_description(self):
     """Test Routine Connectivity Description on BCC Fe"""
     central_species = ['Fe']
     peripheral_species = ['Fe']
     fe_matrix, fe_polyhedra, supercell = \
         connectivity.get_connectivity_matrix(self.fe_structure, False, 2.8, peripheral_species, central_species)
     fe_descriptions = connectivity.get_connectivity_description(fe_matrix, fe_polyhedra, self.fe_structure, False)
     for cation in fe_descriptions.keys():
         self.assertIn(cation, fe_matrix.keys())
         self.assertTrue(isinstance(fe_descriptions[cation], str)
                         or isinstance(fe_descriptions[cation], unicode),
                         "Descriptions are not type str or unicode")
 def test_connectivity_description_sites_diff(self):
     """Test Routine Connectivity Description on LiCoO2"""
     licoo2_matrix, licoo2_polyhedra, supercell = \
         connectivity.get_connectivity_matrix(self.licoo2_structure, True)
     licoo2_descriptions = connectivity.get_connectivity_description(licoo2_matrix, licoo2_polyhedra, self.licoo2_structure, True)
     for cation in licoo2_descriptions.keys():
         in_matrix_keys = False
         for keys in licoo2_matrix.keys():
             if cation in keys:
                 in_matrix_keys = True
         self.assertTrue(in_matrix_keys, "Cation being described not in connectivity matrix")
         self.assertTrue(isinstance(licoo2_descriptions[cation], str)
                         or isinstance(licoo2_descriptions[cation], unicode),
                         "Descriptions are not type str or unicode")
__author__ = 'Tina_Chen'
__contributor__ = 'Anubhav Jain'

if __name__ == '__main__':

    # path to structure file
    path = 'LiCoO2.cif'

    # optional list of strings with central/target species abbreviations
    # (i.e. we aim to find connectivity between polyhedra with these species at the center)
    central_species = ['Li']

    # optional list of strings with peripheral species abbreviations
    # (i.e. we aim to find connectivity where these species are surrounding the central/target species)
    peripheral_species = None

    # radius from the central/target sites to which we look for peripheral species
    # only needs to be changed if central species is very large (eg: Ba, Sr)
    radius = 2.6

    structure = Structure.from_file(path, True, True)
    print structure
    connectivity_matrix, all_polyhedra, supercell = \
        connectivity.get_connectivity_matrix(structure, True, radius, peripheral_species, central_species)
    descriptions = connectivity.get_connectivity_description(connectivity_matrix, all_polyhedra, structure, True, anions=peripheral_species)

    for cation in descriptions:
        print ""
        print descriptions[cation]