本文整理匯總了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