Exemplo n.º 1
0
    def test_topography_analyzer(self):
        # check interstitial sites for FePO4 using Voronoi Tessellation
        vor_feo4 = TopographyAnalyzer(self.feo4,
                                      framework_ions=["O"],
                                      cations=["P", "Fe"],
                                      check_volume=False)
        vor_feo4.cluster_nodes(tol=1.2)
        vor_feo4.remove_collisions(1.2)
        s_feo4 = vor_feo4.get_structure_with_nodes()
        sites_feo4 = np.array([
            s_feo4[i].frac_coords for i in range(len(s_feo4))
            if s_feo4[i].species_string == "X0+"
        ])

        # check total number of vnodes
        self.assertAlmostEqual(len(vor_feo4.vnodes), 24)

        # check four sites that match Li sites in LiFePO4(mp-19017)
        site_predicted = [[0, 0, 0], [0.5, 0.5, 0.5], [0.5, 0, 0.5],
                          [0, 0.5, 0]]
        for i in range(0, 4):
            is_site_matched = False
            for site in sites_feo4:
                distance = s_feo4.lattice. \
                    get_distance_and_image(site, site_predicted[i])
                if distance[0] < 0.01:
                    is_site_matched = True
                else:
                    continue
            self.assertTrue(is_site_matched)
Exemplo n.º 2
0
    def test_topography_analyzer(self):
        # check interstitial sites for FePO4 using Voronoi Tessellation
        vor_feo4 = TopographyAnalyzer(self.feo4, framework_ions=["O"],
                                      cations=["P", "Fe"], check_volume=False)
        vor_feo4.cluster_nodes(tol=1.2)
        vor_feo4.remove_collisions(1.2)
        s_feo4 = vor_feo4.get_structure_with_nodes()
        sites_feo4 = np.array(
            [s_feo4[i].frac_coords for i in range(len(s_feo4)) if
             s_feo4[i].species_string == "X0+"])

        # check total number of vnodes
        self.assertAlmostEqual(len(vor_feo4.vnodes), 24)

        # check four sites that match Li sites in LiFePO4(mp-19017)
        site_predicted = [[0, 0, 0], [0.5, 0.5, 0.5], [0.5, 0, 0.5],
                          [0, 0.5, 0]]
        for i in range(0, 4):
            is_site_matched = False
            for site in sites_feo4:
                distance = s_feo4.lattice. \
                    get_distance_and_image(site, site_predicted[i])
                if distance[0] < 0.01:
                    is_site_matched = True
                else:
                    continue
            self.assertTrue(is_site_matched)
Exemplo n.º 3
0
    def __init__(self, structure, element):
        """
        Initializes an Interstitial generator using Voronoi sites
        Args:
            structure (Structure): pymatgen structure object
            element (str or Element or Specie): element for the interstitial
        """
        self.structure = structure
        self.element = element

        framework = list(self.structure.symbol_set)
        get_voronoi = TopographyAnalyzer(self.structure,
                                         framework, [],
                                         check_volume=False)
        get_voronoi.cluster_nodes()
        get_voronoi.remove_collisions()

        # trim equivalent nodes with symmetry analysis
        struct_to_trim = self.structure.copy()
        for poss_inter in get_voronoi.vnodes:
            struct_to_trim.append(self.element,
                                  poss_inter.frac_coords,
                                  coords_are_cartesian=False)

        symmetry_finder = SpacegroupAnalyzer(struct_to_trim, symprec=1e-1)
        equiv_sites_list = symmetry_finder.get_symmetrized_structure(
        ).equivalent_sites

        self.equiv_site_seq = []
        for poss_site_list in equiv_sites_list:
            if poss_site_list[0] not in self.structure:
                self.equiv_site_seq.append(poss_site_list)

        self.count_def = 0  # for counting the index of the generated defect
Exemplo n.º 4
0
    def __init__(self, structure, element):
        """
        Initializes an Interstitial generator using Voronoi sites
        Args:
            structure (Structure): pymatgen structure object
            element (str or Element or Specie): element for the interstitial
        """
        self.structure = structure
        self.element = element

        framework = list(self.structure.symbol_set)
        get_voronoi = TopographyAnalyzer(self.structure, framework, [], check_volume=False)
        get_voronoi.cluster_nodes()
        get_voronoi.remove_collisions()

        # trim equivalent nodes with symmetry analysis
        struct_to_trim = self.structure.copy()
        for poss_inter in get_voronoi.vnodes:
            struct_to_trim.append(self.element, poss_inter.frac_coords, coords_are_cartesian=False)

        symmetry_finder = SpacegroupAnalyzer(struct_to_trim, symprec=1e-1)
        equiv_sites_list = symmetry_finder.get_symmetrized_structure().equivalent_sites

        self.equiv_site_seq = []
        for poss_site_list in equiv_sites_list:
            if poss_site_list[0] not in self.structure:
                self.equiv_site_seq.append(poss_site_list)

        self.count_def = 0  # for counting the index of the generated defect
Exemplo n.º 5
0
    def __init__(self, structure, element):
        """
        Initializes an Interstitial generator using Voronoi sites
        Args:
            structure (Structure): pymatgen structure object
            element (str or Element or Species): element for the interstitial
        """
        self.structure = structure
        self.element = element

        framework = list(self.structure.symbol_set)
        get_voronoi = TopographyAnalyzer(self.structure,
                                         framework, [],
                                         check_volume=False)
        get_voronoi.cluster_nodes()
        get_voronoi.remove_collisions()

        # trim equivalent nodes with symmetry analysis
        struct_to_trim = self.structure.copy()
        for poss_inter in get_voronoi.vnodes:
            struct_to_trim.append(self.element,
                                  poss_inter.frac_coords,
                                  coords_are_cartesian=False)

        symmetry_finder = SpacegroupAnalyzer(struct_to_trim, symprec=1e-1)
        equiv_sites_list = symmetry_finder.get_symmetrized_structure(
        ).equivalent_sites

        # do additional screening for sublattice equivalent
        # defects which may have slipped through
        pdc = PointDefectComparator()
        self.unique_defect_seq = []
        for poss_site_list in equiv_sites_list:
            poss_site = poss_site_list[0]
            if poss_site not in self.structure:
                now_defect = Interstitial(self.structure, poss_site)
                append_defect = True
                for unique_defect in self.unique_defect_seq:
                    if pdc.are_equal(now_defect, unique_defect):
                        append_defect = False
                if append_defect:
                    self.unique_defect_seq.append(now_defect)

        self.count_def = 0  # for counting the index of the generated defect
Exemplo n.º 6
0
    def __init__(self, structure, element):
        """
        Initializes an Interstitial generator using Voronoi sites
        Args:
            structure (Structure): pymatgen structure object
            element (str or Element or Specie): element for the interstitial
        """
        self.structure = structure
        self.element = element

        framework = list(self.structure.symbol_set)
        get_voronoi = TopographyAnalyzer(self.structure, framework, [], check_volume=False)
        get_voronoi.cluster_nodes()
        get_voronoi.remove_collisions()

        # trim equivalent nodes with symmetry analysis
        struct_to_trim = self.structure.copy()
        for poss_inter in get_voronoi.vnodes:
            struct_to_trim.append(self.element, poss_inter.frac_coords, coords_are_cartesian=False)

        symmetry_finder = SpacegroupAnalyzer(struct_to_trim, symprec=1e-1)
        equiv_sites_list = symmetry_finder.get_symmetrized_structure().equivalent_sites

        # do additional screening for sublattice equivalent
        # defects which may have slipped through
        pdc = PointDefectComparator()
        self.unique_defect_seq = []
        for poss_site_list in equiv_sites_list:
            poss_site = poss_site_list[0]
            if poss_site not in self.structure:
                now_defect = Interstitial( self.structure, poss_site)
                append_defect = True
                for unique_defect in self.unique_defect_seq:
                    if pdc.are_equal( now_defect, unique_defect):
                        append_defect = False
                if append_defect:
                    self.unique_defect_seq.append( now_defect)

        self.count_def = 0  # for counting the index of the generated defect