當前位置: 首頁>>代碼示例>>Python>>正文


Python VoronoiCoordFinder.get_coordinated_sites方法代碼示例

本文整理匯總了Python中pymatgen.analysis.structure_analyzer.VoronoiCoordFinder.get_coordinated_sites方法的典型用法代碼示例。如果您正苦於以下問題:Python VoronoiCoordFinder.get_coordinated_sites方法的具體用法?Python VoronoiCoordFinder.get_coordinated_sites怎麽用?Python VoronoiCoordFinder.get_coordinated_sites使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pymatgen.analysis.structure_analyzer.VoronoiCoordFinder的用法示例。


在下文中一共展示了VoronoiCoordFinder.get_coordinated_sites方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: from_bulk_and_miller

# 需要導入模塊: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 別名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_coordinated_sites [as 別名]
    def from_bulk_and_miller(cls, structure, miller_index, min_slab_size=5.0,
                             min_vacuum_size=10.0, max_normal_search=None, 
                             center_slab = True, selective_dynamics=False,
                             undercoord_threshold = 0.09):
        """
        This method constructs the adsorbate site finder from a bulk 
        structure and a miller index, which allows the surface sites 
        to be determined from the difference in bulk and slab coordination, 
        as opposed to the height threshold.
        
        Args:
            structure (Structure): structure from which slab
                input to the ASF is constructed
            miller_index (3-tuple or list): miller index to be used
            min_slab_size (float): min slab size for slab generation
            min_vacuum_size (float): min vacuum size for slab generation
            max_normal_search (int): max normal search for slab generation
            center_slab (bool): whether to center slab in slab generation
            selective dynamics (bool): whether to assign surface sites
                to selective dynamics
            undercoord_threshold (float): threshold of "undercoordation"
                to use for the assignment of surface sites.  Default is
                0.1, for which surface sites will be designated if they
                are 10% less coordinated than their bulk counterpart
        """
        # TODO: for some reason this works poorly with primitive cells
        vcf_bulk = VoronoiCoordFinder(structure)
        bulk_coords = [len(vcf_bulk.get_coordinated_sites(n))
                       for n in range(len(structure))]
        struct = structure.copy(site_properties = {'bulk_coordinations':bulk_coords})
        slabs = generate_all_slabs(struct, max_index=max(miller_index), 
                                   min_slab_size=min_slab_size,
                                   min_vacuum_size=min_vacuum_size,
                                   max_normal_search = max_normal_search,
                                   center_slab = center_slab)

        slab_dict = {slab.miller_index:slab for slab in slabs}
        
        if miller_index not in slab_dict:
            raise ValueError("Miller index not in slab dict")

        this_slab = slab_dict[miller_index]

        vcf_surface = VoronoiCoordFinder(this_slab, allow_pathological=True)
        surf_props = []
        this_mi_vec = get_mi_vec(this_slab.miller_index)
        mi_mags = [np.dot(this_mi_vec, site.coords) for site in this_slab]
        average_mi_mag = np.average(mi_mags)
        for n, site in enumerate(this_slab):
            bulk_coord = this_slab.site_properties['bulk_coordinations'][n]
            slab_coord = len(vcf_surface.get_coordinated_sites(n))
            mi_mag = np.dot(this_mi_vec, site.coords)
            undercoord = (bulk_coord - slab_coord)/bulk_coord
            if undercoord > undercoord_threshold and mi_mag > average_mi_mag:
                surf_props += ['surface']
            else:
                surf_props += ['subsurface']
        new_site_properties = {'surface_properties':surf_props}
        new_slab = this_slab.copy(site_properties=new_site_properties)
        return cls(new_slab, selective_dynamics)
開發者ID:zulissi,項目名稱:pymatgen,代碼行數:62,代碼來源:adsorption.py

示例2: _get_coord_no_sites_chrg

# 需要導入模塊: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 別名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_coordinated_sites [as 別名]
    def _get_coord_no_sites_chrg(self, site):
        """
        Compute the coordination number and coordination charge

        Args:
            site:
                pymatgen.core.sites.Site
        """
        struct = self._structure.copy()
        struct.append(site.specie.symbol, site.frac_coords)
        coord_finder = VoronoiCoordFinder(struct)
        coord_no = coord_finder.get_coordination_number(-1)
        coord_sites = coord_finder.get_coordinated_sites(-1)

        # In some cases coordination sites to interstitials include
        # interstitials also. Filtering them.
        def no_inter(site):
            return not site.specie.symbol == 'X'
        coord_sites = filter(no_inter, coord_sites)

        coord_chrg = 0
        for site, weight in coord_finder.get_voronoi_polyhedra(-1).items():
            if not site.specie.symbol == 'X':
                coord_chrg += weight * self._valence_dict[site.species_string]

        return coord_no, coord_sites, coord_chrg
開發者ID:zeroelement,項目名稱:pymatgen,代碼行數:28,代碼來源:point_defects.py

示例3: _get_coord_no_sites_chrg

# 需要導入模塊: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 別名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_coordinated_sites [as 別名]
    def _get_coord_no_sites_chrg(self, site):
        """
        Compute the coordination number and coordination charge

        Args:
            site:
                pymatgen.core.sites.Site
        """
        struct = self._structure.copy()
        struct.append(site.species_string, site.frac_coords)
        coord_finder = VoronoiCoordFinder(struct)
        coord_no = coord_finder.get_coordination_number(-1)
        coord_sites = coord_finder.get_coordinated_sites(-1)

        # In some cases coordination sites to interstitials include 
        # interstitials also. 
        sites_to_be_deleted = []
        for i in range(len(coord_sites)):
            if coord_sites[i].species_string == 'X':
                sites_to_be_deleted.append(i)
        sites_to_be_deleted.reverse()  # So index won't change in between
        for ind in sites_to_be_deleted:
            del coord_sites[ind]

        coord_chrg = 0
        for site, weight in coord_finder.get_voronoi_polyhedra(-1).items():
            if not site.species_string == 'X':
                coord_chrg += weight * self._valence_dict[site.species_string]

        return coord_no, coord_sites, coord_chrg
開發者ID:akashneo,項目名稱:pymatgen,代碼行數:32,代碼來源:point_defects.py

示例4: _coord_find

# 需要導入模塊: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 別名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_coordinated_sites [as 別名]
 def _coord_find(self):
     """
     calls VoronoiCoordFinder to compute the coordination number,
     coordination charge
     """
     for i in range(self.defect_count()):
         struct = self._structs[i].copy()
         coord_finder = VoronoiCoordFinder(struct)
         self._coord_no.append(coord_finder.get_coordination_number(-1))
         self._coord_sites.append(coord_finder.get_coordinated_sites(-1))
         coord_chrg = 0
         for site, weight in coord_finder.get_voronoi_polyhedra(-1).items():
             coord_chrg += weight * self._valence_dict[site.species_string]
         self._coord_charge_no.append(coord_chrg)
開發者ID:zeroelement,項目名稱:pymatgen,代碼行數:16,代碼來源:point_defects.py

示例5: VoronoiCoordFinderTest

# 需要導入模塊: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 別名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_coordinated_sites [as 別名]
class VoronoiCoordFinderTest(PymatgenTest):
    def setUp(self):
        s = self.get_structure('LiFePO4')
        self.finder = VoronoiCoordFinder(s, [Element("O")])

    def test_get_voronoi_polyhedra(self):
        self.assertEqual(len(self.finder.get_voronoi_polyhedra(0).items()), 8)

    def test_get_coordination_number(self):
        self.assertAlmostEqual(self.finder.get_coordination_number(0),
                               5.809265748999465, 7)

    def test_get_coordinated_sites(self):
        self.assertEqual(len(self.finder.get_coordinated_sites(0)), 8)
開發者ID:setten,項目名稱:pymatgen,代碼行數:16,代碼來源:test_structure_analyzer.py

示例6: __init__

# 需要導入模塊: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 別名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_coordinated_sites [as 別名]
    def __init__(self, structure, valences, radii):
        """
        Args:
            structure:
                pymatgen.core.structure.Structure
            valences:
                valences of elements as a dictionary 
            radii:
                Radii of elements as a dictionary
        """

        self._structure = structure
        self._valence_dict = valences
        self._rad_dict = radii
        # Store symmetrically distinct sites, their coordination numbers
        # coordinated_sites, effective charge
        symm_finder = SymmetryFinder(self._structure)
        symm_structure = symm_finder.get_symmetrized_structure()
        equiv_site_seq = symm_structure.equivalent_sites

        self._defect_sites = []
        for equiv_sites in equiv_site_seq:
            self._defect_sites.append(equiv_sites[0])

        self._vac_site_indices = []
        for site in self._defect_sites:
            for i in range(len(self._structure.sites)):
                if site == self._structure[i]:
                    self._vac_site_indices.append(i)

        coord_finder = VoronoiCoordFinder(self._structure)
        self._defectsite_coord_no = []
        self._defect_coord_sites = []
        for i in self._vac_site_indices:
            self._defectsite_coord_no.append(
                coord_finder.get_coordination_number(i)
            )
            self._defect_coord_sites.append(
                coord_finder.get_coordinated_sites(i)
            )

        # Store the ionic radii for the elements in the structure
        # (Used to  computing the surface are and volume)
        # Computed based on valence of each element

        self._vac_eff_charges = None
        self._vol = None
        self._sa = None
開發者ID:hgfb,項目名稱:pymatgen,代碼行數:50,代碼來源:point_defects.py

示例7: VoronoiCoordFinderTest

# 需要導入模塊: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 別名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_coordinated_sites [as 別名]
class VoronoiCoordFinderTest(unittest.TestCase):

    def setUp(self):
        filepath = os.path.join(test_dir, 'vasprun.xml')
        reader = Vasprun(filepath)
        s = reader.final_structure
        self.finder = VoronoiCoordFinder(s,[Element("O")])
    
    def test_get_voronoi_polyhedra(self):
        self.assertEqual(len(self.finder.get_voronoi_polyhedra(0).items()),10, "Incorrect number of results returned for get_voronoi_polyhedra")
        
    def test_get_coordination_number(self):
        print self.finder.get_coordination_number(0)
        self.assertAlmostEqual(self.finder.get_coordination_number(0), 5.60588600732, 7, "Incorrect coordination number returned!")                

    def test_get_coordinated_sites(self):
        self.assertEqual(len(self.finder.get_coordinated_sites(0)), 10)
開發者ID:chenweis,項目名稱:pymatgen,代碼行數:19,代碼來源:test_structure_analyzer.py

示例8: VoronoiCoordFinderTest

# 需要導入模塊: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 別名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_coordinated_sites [as 別名]
class VoronoiCoordFinderTest(unittest.TestCase):

    def setUp(self):
        filepath = os.path.join(test_dir, 'LiFePO4.cif')
        parser = CifParser(filepath)
        s = parser.get_structures()[0]
        self.finder = VoronoiCoordFinder(s, [Element("O")])

    def test_get_voronoi_polyhedra(self):
        self.assertEqual(len(self.finder.get_voronoi_polyhedra(0).items()), 8,
                         "Incorrect number of results returned for " +
                         "get_voronoi_polyhedra")

    def test_get_coordination_number(self):
        self.assertAlmostEqual(self.finder.get_coordination_number(0),
                               5.809265748999465, 7)

    def test_get_coordinated_sites(self):
        self.assertEqual(len(self.finder.get_coordinated_sites(0)), 8)
開發者ID:jesuansito,項目名稱:pymatgen,代碼行數:21,代碼來源:test_structure_analyzer.py


注:本文中的pymatgen.analysis.structure_analyzer.VoronoiCoordFinder.get_coordinated_sites方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。