Thermodynamics and galaxy clustering: Nonlinear theory of high order correlations