本文整理汇总了Python中pymatgen.analysis.structure_analyzer.VoronoiCoordFinder.get_voronoi_polyhedra方法的典型用法代码示例。如果您正苦于以下问题:Python VoronoiCoordFinder.get_voronoi_polyhedra方法的具体用法?Python VoronoiCoordFinder.get_voronoi_polyhedra怎么用?Python VoronoiCoordFinder.get_voronoi_polyhedra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.analysis.structure_analyzer.VoronoiCoordFinder
的用法示例。
在下文中一共展示了VoronoiCoordFinder.get_voronoi_polyhedra方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_coord_no_sites_chrg
# 需要导入模块: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 别名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_voronoi_polyhedra [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
示例2: _get_coord_no_sites_chrg
# 需要导入模块: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 别名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_voronoi_polyhedra [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
示例3: compute
# 需要导入模块: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 别名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_voronoi_polyhedra [as 别名]
def compute(self, structure, n):
params = self._params
vor = VoronoiCoordFinder(structure, **params)
vorp = vor.get_voronoi_polyhedra(n)
cdict = {}
for i in vorp:
if i.species_string not in cdict:
cdict[i.species_string] = vorp[i]
else:
cdict[i.species_string] += vorp[i]
return cdict
示例4: _coord_find
# 需要导入模块: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 别名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_voronoi_polyhedra [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)
示例5: VoronoiCoordFinderTest
# 需要导入模块: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 别名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_voronoi_polyhedra [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)
示例6: VoronoiCoordFinderTest
# 需要导入模块: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 别名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_voronoi_polyhedra [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)
示例7: substructures_from_structure
# 需要导入模块: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 别名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_voronoi_polyhedra [as 别名]
def substructures_from_structure(structure, weight_cutoff=1e-2):
"""
Helper method to calculate substructural components from a
pymatgen structure object.
Args:
structure (Structure): Input structure
weight_cutoff (float): minimum solid angle weight for
inclusion in a substructure
Returns:
A list of Substructure objects for the given structure
"""
vcf = VoronoiCoordFinder(structure)
substructures = []
for i, site in enumerate(structure):
charge = sum([getattr(specie, "oxi_state", 0) * amt
for specie, amt in site.species_and_occu.items()])
central_subspecies = SubStructureSpecie(site.specie.symbol,
oxidation_state=charge,
properties=site.properties,
weight=1.0)
peripheral_subspecies = []
for peripheral_site, weight in vcf.get_voronoi_polyhedra(i).iteritems():
if weight > weight_cutoff:
charge = sum([getattr(specie, "oxi_state", 0) * amt
for specie, amt in
peripheral_site.species_and_occu.items()])
peripheral_subspecies.append(
SubStructureSpecie(peripheral_site.specie.symbol,
oxidation_state=charge,
properties=peripheral_site.properties,
weight=weight))
substructures.append(SubStructure(peripheral_subspecies, central_sub_species=central_subspecies))
return substructures
示例8: VoronoiCoordFinderTest
# 需要导入模块: from pymatgen.analysis.structure_analyzer import VoronoiCoordFinder [as 别名]
# 或者: from pymatgen.analysis.structure_analyzer.VoronoiCoordFinder import get_voronoi_polyhedra [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)