Electronic structure and energetics of ordered titanium carbides of composition Ti2C