A theory for structural phase transitions in BaTiO3 single crystal and PbZrO3 -xPbTiO3 solid solution