本文整理汇总了Python中pymatgen.io.vaspio.Poscar.get_string方法的典型用法代码示例。如果您正苦于以下问题:Python Poscar.get_string方法的具体用法?Python Poscar.get_string怎么用?Python Poscar.get_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.io.vaspio.Poscar
的用法示例。
在下文中一共展示了Poscar.get_string方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_aconvasp_command
# 需要导入模块: from pymatgen.io.vaspio import Poscar [as 别名]
# 或者: from pymatgen.io.vaspio.Poscar import get_string [as 别名]
def run_aconvasp_command(command, structure):
"""
Helper function for calling aconvasp with different arguments
"""
from pymatgen.io.vaspio import Poscar
poscar = Poscar(structure)
p = subprocess.Popen(command, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
output = p.communicate(input=poscar.get_string())
return output
示例2: Poscar
# 需要导入模块: from pymatgen.io.vaspio import Poscar [as 别名]
# 或者: from pymatgen.io.vaspio.Poscar import get_string [as 别名]
structure = parser.get_structures()[0]
structure_name = cif_file.split('.')[0]
poscar_obj = Poscar(structure=structure,comment=structure_name)
poscar_string = poscar_obj.to_string()
poscar_filename = '{}/{}.poscar'.format(poscar_directory_name,structure_name)
with open(poscar_filename,'w') as f:
f.write(poscar_string)
#------------------------------------------------------------------------------
cif_filenames = GetFilenamesInDirectory(directoryName=cif_directory_name)
crystal_system_names = [cif_filename.split('.')[0] for cif_filename in cif_filenames]
EnsureDirectoryExists(directoryName=poscar_directory_name)
for cif_file in cif_filenames:
cif_filename = "{}/{}".format(cif_directory_name,cif_file)
structure_name = cif_file.split('.')[0]
# Parse .cif file into a pymatgen structure file
parser = CifParser(cif_filename)
structure = parser.get_structures()[0]
# Create the poscar object and write it to file
poscar_obj = Poscar(structure=structure,comment=structure_name)
poscar_string = poscar_obj.get_string()
poscar_filename = '{}/{}.poscar'.format(poscar_directory_name,structure_name)
with open(poscar_filename,'w') as f:
f.write(poscar_string)