本文整理汇总了Python中pymatgen.Structure.get_neighbors方法的典型用法代码示例。如果您正苦于以下问题:Python Structure.get_neighbors方法的具体用法?Python Structure.get_neighbors怎么用?Python Structure.get_neighbors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.Structure
的用法示例。
在下文中一共展示了Structure.get_neighbors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: is_equivalent
# 需要导入模块: from pymatgen import Structure [as 别名]
# 或者: from pymatgen.Structure import get_neighbors [as 别名]
def is_equivalent(structure : Structure, atoms_1 : tuple, atoms_2 : tuple , eps=0.05):
"""
Find Vacancy Strucutres for diffusion into and out of the specified atom_i site.
:param structure: Structure
Structure to calculate diffusion pathways
:param atom_i: int
Atom to get diffion path from
:return: [ Structure ]
"""
# To Find Pathway, look for voronoi edges
structure = structure.copy() # type: Structure
coords = get_midpoint(structure, atoms_1[0], atoms_1[1])
structure.append('H', coords)
coords = get_midpoint(structure, atoms_2[0], atoms_2[1])
structure.append('H', coords)
dist_1 = structure.get_neighbors(structure[-2], 3)
dist_2 = structure.get_neighbors(structure[-1], 3)
dist_1.sort(key=lambda x: x[1])
dist_2.sort(key=lambda x: x[1])
for (site_a, site_b) in zip(dist_1, dist_2):
if abs(site_a[1] - site_b[1]) > eps:
return False
elif site_a[0].specie != site_b[0].specie:
return False
return True