本文整理汇总了Python中pymatgen.core.structure.IStructure.get_reduced_structure方法的典型用法代码示例。如果您正苦于以下问题:Python IStructure.get_reduced_structure方法的具体用法?Python IStructure.get_reduced_structure怎么用?Python IStructure.get_reduced_structure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.core.structure.IStructure
的用法示例。
在下文中一共展示了IStructure.get_reduced_structure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_transformation
# 需要导入模块: from pymatgen.core.structure import IStructure [as 别名]
# 或者: from pymatgen.core.structure.IStructure import get_reduced_structure [as 别名]
def apply_transformation(self, structure):
# get the new sites
new_sites = self._voronoi_points(structure)
if self._midpoints:
dms = self._delaunay_midpoints(structure)
for i in range(len(new_sites)):
new_sites[i].extend(dms[i])
# insert the new sites with dummy species
se = structure
dummy = DummySpecie()
for i, sites_list in enumerate(new_sites):
for ns in sites_list:
if self._bl == {}:
se.append(self._sp, ns, coords_are_cartesian=True, validate_proximity=False)
elif structure[i].specie in self._bl.keys():
bv = ns - structure[i].coords
bv *= self._bl[structure[i].specie] / np.linalg.norm(bv)
coords = structure[i].coords + bv
se.append_site(self._sp, coords, coords_are_cartesian=True, validate_proximity=False)
logging.debug("Starting moving to unit cell")
se = IStructure.get_reduced_structure(se)
logging.debug("Finished moving to unit cell")
structure = se # .modified_structure
# delete sites that are closer than the bond distance
to_delete = []
for sp, d in self._bl.items():
neighbors = structure.get_all_neighbors(d * 0.999)
for i in range(len(structure)):
if structure[i].specie == dummy:
for n in neighbors[i]:
if n[0].specie == sp:
to_delete.append(i)
break
se.remove_sites(to_delete)
# replace the dummy species to get the correct composition
if self._n:
# amt = self._n / se.modified_structure.composition[dummy]
amt = self._n / se.composition[dummy]
se.replace_species({dummy: {self._sp: amt}})
return se # .modified_structure