# biotite.structure.io.mmtf.set_structure¶

biotite.structure.io.mmtf.set_structure(file, array)

Set the relevant fields of an MMTF file with the content of an AtomArray or AtomArrayStack.

All required and some optional fields of the MMTF file will be set or overriden if the field does already exist. Fields are removed when they are optional and when setting the structure information could invalidate its content (e.g. altLocList).

Parameters
fileMMTFFile

The file object.

arrayAtomArray or AtomArrayStack

The structure to be written. If a stack is given, each array in the stack will be in a separate model.

Notes

As the MMTF format only supports one unit cell, individual unit cells for each model are not supported. Instead only the first box in an AtomArrayStack is written into the file.

Examples

>>> import os.path
>>> file = MMTFFile()
>>> set_structure(file, atom_array)
>>> file.write(os.path.join(path_to_directory, "structure.mmtf"))