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)
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. extend_collection can be a number, which determines the maximum branching for each transformation. """ 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) super(CifTransmuter, self).__init__(transformed_structures, transformations, extend_collection)