We report a fast and accurate computational method to calculate the pH dependent electrostatic effects in protein molecules. The method combines the Generalized Born approximation with an iterative mobile clustering approach to predict the equilibria of proton binding to multiple titratable sites in a macromolecule. The computational protocol also includes a novel algorithm to construct and refine the coordinates of all hydrogen atoms at a given pH. The tests on a set of 24 proteins demonstrate a high accuracy of the predicted pKa values with an average r.m.s. error close to 0.5 pK units. The comparisons to the available neutron-diffraction data also show a high accuracy of the predicted hydrogen positions. The use of the GBIM (Generalized Born with Implicit Membrane) approach makes the method applicable not only to water soluble proteins but also to proteins embedded in membrane. The method is implemented as a computational protocol in the Accelrys Discovery Studio software. We will demonstrate the function of this protocol based on a study of the activation mechanism of Beta 2-adrenergic receptor. The protonation states of the receptor and ligands and the binding energy of agonists and inverse agonists are calculated as a function of pH and at different stages of molecular dynamics trajectories.