First- and Second-Principles Studies of Perovskites