def write_NEM(filename, vertices, faces):
    """Writes mesh files used by the Mesh tool included in Nemoh

    Parameters
    ----------
    filename : str
        name of the mesh file to be written on disk
    vertices: ndarray
        numpy array of the coordinates of the mesh's nodes
    faces: ndarray
        numpy array of the faces' nodes connectivities

    Note
    ----
    This file format is different from that used by Nemoh itself. It is only used by the Mesh tool.
    """
    ofile = open(filename, 'w')
    ofile.write('%u\n' % vertices.shape[0])
    ofile.write('%u\n' % faces.shape[0])
    for vertex in vertices:
        ofile.write('%15.6f\t%15.6f\t%15.6f\n' % (vertex[0], vertex[1],
            vertex[2]))
    for face in (faces + 1):
        ofile.write('%10u\t%10u\t%10u\t%10u\n' % (face[0], face[1], face[2],
            face[3]))
    ofile.close()
