This work explores the quantum dynamics of the interaction between scalar (matter) and vectorial (intermediate) particles and studies their thermodynamic equilibrium in the grandcanonical ensemble. The aim of the article is to clarify the connection between the physical degrees of freedom of a theory in both the quantization process and the description of the thermodynamic equilibrium, in which we see an intimate connection between physical degrees of freedom, Gibbs free energy and the equipartition theorem. We have split the work into two sections. First, we analyze the quantum interaction in the context of the generalized scalar Duffin-Kemmer-Petiau quantum electrodynamics (GSDKP) by using the functional formalism. We build the Hamiltonian structure following the Dirac methodology, apply the Faddeev-Senjanovic procedure to obtain the transition amplitude in the generalized Coulomb gauge and, finally, use the Faddeev-Popov-DeWitt method to write the amplitude in covariant form in the no-mixing gauge. Subsequently, we exclusively use the Matsubara-Fradkin (MF) formalism in order to describe fields in thermodynamical equilibrium. The corresponding equations in thermodynamic equilibrium for the scalar, vectorial and ghost sectors are explicitly constructed from which the extraction of the partition function is straightforward. It is in the construction of the vectorial sector that the emergence and importance of the ghost fields are revealed: they eliminate the extra non-physical degrees of freedom of the vectorial sector thus maintaining the physical degrees of freedom. * andsogueira@hotmail.com †