## actions.write_structure() — write out the model coordinates

`write_structure(skip, filepattern, write_all_atoms=True, first=False, last=False, start=0)`

> This action writes out a file containing the current optimizer structure, every skip steps during the optimization. It should be specified in the actions argument to an optimizer object (e.g., conjugate_gradients() or molecular_dynamics()).

> filepattern is a C-style format string, used to construct filenames. It should contain a `%d` format, which is substituted with the model number (e.g., specifying `'file%d.pdb'` would generate files called `'file0.pdb'`, `'file1.pdb'`, `'file2.pdb'`, etc). The model number will start with start (or 0, if not given).

> If write_all_atoms is `True` (the default) then all atoms in the model are written out to the structure file, whether or not they are selected. If `False`, only selected atoms are written out.

> If first is `True`, then the structure at step 0 (before the optimization) is also written out. If last is `True`, then the structure of the last step is written, regardless of whether it is a multiple of skip. By default, both are `False`.

Example: See conjugate_gradients() command.