Generally use periodic boundary conditions, where the lattice wraps around on itself to form a torus. This has been shown to give the smallest finite size effects.
But then must be careful that in measuring the correlation function,
can only take measurements to for a lattice of size L, since
a distance n is equivalent to a distance
on a lattice that
wraps around on itself.