First-principles calculations of the atomic structure and electronic states of LixFeF3