best book for statistical mechanics

please note that among all the books listed in Axel’s link, some books from Bill Hoover are available (at the moment) on his website:

His “Computational statistical mechanics” book starts from thermodynamics and goes through molecular dynamics in several ensembles (including some out of equilibrium cases) so it might be what you were looking for.
Also note that the book was published in the early 90’s so the algorithms presented are old and not fully representative of the ones implemented in LAMMPS. They still give a fair example of the link between statistical mechanics and molecular dynamics.