BaTiO3: Energy, geometrical and electronic structure, relationship between optical constant and density from first-principles calculations