Ab initio molecular dynamics study of GeS2: from the crystal to the glass