Optimization of the electrostatic interactions in proteins of different functional and folding type