Commensurate and incommensurate ground states in a one-dimensional model