def gro_wrong_length(request, gro_reference, tmpdir_factory):  # pylint: disable=redefined-outer-name
    """
    Generate a GRO file with a wrong number of atoms on line 2.
    """
    path_in, _ = gro_reference
    path_out = tmpdir_factory.mktemp("data").join("wrong.gro")
    with open(str(path_in)) as infile, open(str(path_out), 'w') as outfile:
        outfile.write(next(infile))
        outfile.write('{}\n'.format(request.param))
        for line in infile:
            outfile.write(line)
    return path_out