A boundary condition with adjustable slip length for lattice Boltzmann simulations