def METHOD_NAME(structure, filename, write_atomnames=False, prec=6):
    """Output an XYZ file.
    Parameters
    ----------
    structure : parmed.Structure
        ParmEd structure object
    filename : str
        Path of the output file
    write_atomnames : bool
        Write the `atom.name` attribute of the parmed structure
        to the first column of the xyz file rather than the element
    prec : int
        The number of decimal places to write to the output file
    Notes
    -----
    Coordinates are written in Angstroms. By default, the first column is the
    element. These choices follow the conventions for the XYZ file format.
    The XYZ file format neglects many important details, notably as bonds,
    residues, and box information.
    """
    if isinstance(structure, mb.Compound):
        raise ValueError("Expected a ParmEd structure, got an mbuild.Compound")
    xyz = np.array([[atom.xx, atom.xy, atom.xz] for atom in structure.atoms])
    if write_atomnames:
        names = [atom.name for atom in structure.atoms]
    else:
        names = [atom.element_name for atom in structure.atoms]
    with open(filename, "w") as xyz_file:
        xyz_file.write(str(len(structure.atoms)))
        xyz_file.write("\n" + filename + " - created by mBuild\n")
        for name, (x, y, z) in zip(names, xyz):
            xyz_file.write(
                f"{name} {x:11.{prec}f} {y:11.{prec}f} {z:11.{prec}f}\n"
            )