本文整理汇总了Python中pymatgen.alchemy.materials.TransformedStructure.from_cif_string方法的典型用法代码示例。如果您正苦于以下问题:Python TransformedStructure.from_cif_string方法的具体用法?Python TransformedStructure.from_cif_string怎么用?Python TransformedStructure.from_cif_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymatgen.alchemy.materials.TransformedStructure
的用法示例。
在下文中一共展示了TransformedStructure.from_cif_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pymatgen.alchemy.materials import TransformedStructure [as 别名]
# 或者: from pymatgen.alchemy.materials.TransformedStructure import from_cif_string [as 别名]
def __init__(self, cif_string, transformations=None, primitive=True,
extend_collection=False):
"""
Generates a Transmuter from a cif string, possibly
containing multiple structures.
Args:
cif_string:
A string containing a cif or a series of cifs
transformations:
New transformations to be applied to all structures
primitive:
Whether to generate the primitive cell from the cif.
extend_collection:
Whether to use more than one output structure from one-to-many
transformations.
"""
transformed_structures = []
lines = cif_string.split("\n")
structure_data = []
read_data = False
for line in lines:
if re.match("^\s*data", line):
structure_data.append([])
read_data = True
if read_data:
structure_data[-1].append(line)
for data in structure_data:
tstruct = TransformedStructure.from_cif_string("\n".join(data), [],
primitive)
transformed_structures.append(tstruct)
StandardTransmuter.__init__(self, transformed_structures,
transformations, extend_collection)