def _write_rigid_information(xml_file, rigid_bodies):
    """Write rigid body information.

    Parameters
    ----------
    xml_file : file object
        The file object of the hoomdxml file being written
    rigid_bodies : list, len=n_particles
        The rigid body that each particle belongs to (-1 for none)

    """

    if not all(body is None for body in rigid_bodies):
        xml_file.write('<body>\n')
        for body in rigid_bodies:
            if body is None:
                body = -1
            xml_file.write('{}\n'.format(int(body)))
        xml_file.write('</body>\n')