I'm trying to come up with an expression for the partition function of a system of spin-1/2 ideal gas particles on a line of length $L$. The total number of particles $N$ is fixed, with $N = N_\uparrow + N_\downarrow$. Here, $N_\uparrow$ is the number of spin-up particles and $N_\downarrow$ is the number of spin-down particles in a particular microstate.
I have the following Hamiltonian for the particles of mass $m$.
$$H = \sum_{i=1}^{N}{\frac{(p_i + \beta s_i)^2}{2m} -b s_i} $$
Here, $s_i = 1$ for the spin-up $N_\uparrow$ particles and $s_i = -1$ for the spin-down $N_\uparrow$ particles. $\beta$ and $b$ are constants.
I'm trying to use the Hamiltonian to write down the energy for the spin-up and spin-down particles so I can write down the partition function. If I expand the Hamiltonian, I get:
$$H = \sum_{i=1}^{N}{\frac{p_i^2}{2m} + \frac{p_i \beta s_i}{m} - b s_i + \beta^2} $$
How do I find the energy of the two sets of spin particles from this and use it to come up with the partition function? Is the energy of the particles just?
$$E_\uparrow = \frac{p_i^2}{2m} + \frac{p_i \beta}{m} - b + \beta^2$$ $$E_\downarrow = \frac{p_i^2}{2m} + \frac{-p_i \beta}{m} + b + \beta^2$$
How would one evaluate this in the canonical partition function:
$$Z = \sum_{\mu_s}e^{-\beta H}$$
where $\mu_s$ is the summing over all microstates. I'm not sure how to evaluate this.