The calculation leading toderivation of the zero magnetic moment (the so called Bohr-van Leeuwen theorem) from the canonical probability distribution is mathematically correct. However, theThe reason the magnetic moment obtained is zero is not merely in the fact all directions of motion are equally possible; it is also the resultuse of the artificial restriction thatcanonical probability distribution, which says the particle has equalconstant position probability distribution inside the box butand all directions of velocity are equally probable everywhere.
The equality of all directions of motion is reasonable for a system in a box, because the particle cannot go past the walls. As and as a result, the particle cannot exercise its natural circular motion in magnetic field for all initial states, but if close enough to the wall. If the particle hits the wall, it gets reflected each timeand this makes it hitsreasonable to assume all directions are equally probable, even if particle is close to the wall. It thus forms electric current that cancels the contributions of
If the unaffectedwalls are removed, charged particle exercises circular trajectories insidemotion without encountering obstacles and this results in magnetic moment pointing in the box todirection determined by the integral expressing average magnetic momentfield (or any othermagnetic moment will oppose magnetic quantityfield - this is called diamagnetism). It is quite easy to calculate this magnetic moment as a function of particle's energy. When many such particles are allowed to move without this restriction, large net magnetic moment may be obtained. This is possible because the velocity probability distribution at the edges of the system is not isotropic anymore.
The box calculationCanonical distribution is thus inappropriate for calculating magnetic effects - being a function of energy only, it cannot capture the fact the velocity distribution at the edges of the system is not isotropic, but prefers the direction of circulation of the current determined by the external magnetic field. It assumes magnetized state of matter is what should happen when single non-interacting charged particle is put in a box, but that is physically wrong.
Frequent use of this this calculation as an example of inadequacy of non-quantum physics for magnetism is thus misconceived right from the start. In contrast to other uses of an imaginary box in calculations of statistical physics, for magnetic effects of external field the box's effect on the system cannot be ignored. Magnetic moment of uniformly magnetized body can be entirely cancelled out with the right surface current. In this case, reflections from the walls of the box provide such cancelling current.
If the walls are removed, charged particle will exercise circular motion without encountering obstacles and this results in magnetic moment pointing in the direction determined by the magnetic field (magnetic moment will oppose magnetic field - this is called diamagnetism). It is quite easy to calculate this magnetic moment as a function of particle's energy. When many such particles are allowed to move without restriction, large net magnetic moment may be obtained.
The quantum calculation is very different. First, eigenvalues of the Hamiltonian are found and then box is introduced as well. This time, however, it is used only to limit the position of the center of the wave function mentally, not all of its support throughout the space - there. There is no physical interaction of the walls with the system involved that would make it possible for the velocity probability distribution to be isotropic everywhere. Also the partition functionsfunction is calculated very differently - as a sum over quantum numbers, instead of an integral over phase space. It is thus not that much surprising that the calculation leads to non-trivial magnetic properties - in the quantum calculation, the box is "not really there".