Ab initio study on a chain model of the Cr8 molecular magnet