本文整理汇总了Python中structure.Structure.read_poscar方法的典型用法代码示例。如果您正苦于以下问题:Python Structure.read_poscar方法的具体用法?Python Structure.read_poscar怎么用?Python Structure.read_poscar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类structure.Structure
的用法示例。
在下文中一共展示了Structure.read_poscar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_result
# 需要导入模块: from structure import Structure [as 别名]
# 或者: from structure.Structure import read_poscar [as 别名]
def get_result(self, result_name, sim):
result = obj()
input = self.input
if result_name == "structure":
# OUTCAR structure is not as precise as CONTCAR structure
# pa = self.load_analyzer_image()
# elem = input.poscar.elem
# elem_count = input.poscar.elem_count
# atoms = []
# for i in range(len(elem)):
# atoms += elem_count[i]*[elem[i]]
##end for
# structure = Structure(
# units = 'A',
# axes = pa.lattice_vectors.copy(),
# elem = atoms,
# pos = pa.position.copy()
# )
# get structure from CONTCAR
ccfile = os.path.join(self.locdir, self.identifier + ".CONTCAR")
if not os.path.exists(ccfile):
self.error("CONTCAR file does not exist for relax simulation at " + self.locdir)
# end if
contcar = Poscar(ccfile)
structure = Structure()
if contcar.elem != None:
structure.read_poscar(ccfile)
else:
elem, elem_count = self.system.structure.order_by_species()
structure.read_poscar(ccfile, elem=elem)
# end if
if input.poscar.dynamic != None:
structure.freeze(input.poscar.dynamic, negate=True)
# end if
result.structure = structure
else:
self.error("ability to get result " + result_name + " has not been implemented")
# end if
return result