An external magnetic field is on a 1D lattice with N sites where each site has a magnetic moment, which can rotate freely. The magnetic field at the $j^{th}$ site is, $$\mathbf{B}_j = B_0 \cos\left(\frac{2\pi j}{N}\right) \hat{z} + B_0 \sin\left(\frac{2\pi j}{N}\right) \hat{x}.$$ There is no interaction between the magnetic moments.
I need to find the partition function for this system. I have proceeded by trying to evaluate the partition function at the $j^{th} site first$,
\begin{alignat}{1} Z & = \prod_j \int d\Omega_j \, e^{-\beta H_j} \\ & = \prod_j \int_0^{2\pi} d\phi_j \int_0^\pi \sin\theta_j \ d\theta_j \ e^{-\beta H_j} \\ & = \prod_j \int_0^{2\pi} d\phi_j \int_0^\pi \sin\theta_j \ d\theta_j \ e^{\beta m B_0 \left[ \cos\left(\frac{2\pi j}{N}\right) \cos\theta_j + \sin\left(\frac{2\pi j}{N}\right) \sin\theta_j \cos\phi_j \right]} \end{alignat}
where: \begin{alignat}{1} d\Omega_j & = \sin\theta_j \ d\theta_j \ d\phi_j, \\ H_j & = -B_0 \left[ \cos\left(\frac{2\pi j}{N}\right) m_z + \sin\left(\frac{2\pi j}{N}\right) m_x \right] \end{alignat}
I am unable to integrate the partition function at the $j^{th}$ site in the above form, so one way in which I could proceed was orienting the z-axis at each site along the magnetic field at that site. This leads to the same result for the partition function if we had a uniform magnetic field like $\mathbf{B}= B_{o}\hat{z}$ . If this is the correct method, how do I interpret this result?