Effects of Mg2+, K+, and H+ on an equilibrium between alternative conformations of an RNA pseudoknot