A new approach towards finding the optimal potential for a set of proteins - A lattice model study