, array, data_block=None)[source]

Set the atom_site category with atom information from an AtomArray or AtomArrayStack.

This will save the coordinates, the mandatory annotation categories and the optional annotation categories 'atom_id', 'b_factor', 'occupancy' and 'charge'. If the atom array (stack) contains the annotation 'atom_id', these values will be used for atom numbering instead of continuous numbering.


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.

data_blockstr, optional

The name of the data block. Default is the first (and most times only) data block of the file.


>>> import os.path
>>> file = PDBxFile()
>>> set_structure(file, atom_array, data_block="structure")
>>> file.write(os.path.join(path_to_directory, "structure.cif"))