I am simulating a (small) spinchain with exact diagonalization and dynamics. I would like to track the entanglement entropy of half the chain with the other part of the chain.
I have the vectors of my state $|\Psi(t)>$ in the basis $|s_1, s_2, .., s_i, .. , s_n>$ which are the spins at each sites at a certain time. I know you can get the density matrix of this by taking the outer product $\rho = |\Psi(t)>< \Psi(t)|$ which is a $n \times n$ matrix, but this is a pure state so entanglement entropy will be zero, so now I want the density matrix of the subsystem which includes the first (or last) half of the spin chain. This probably includes tracing out certain parts of the density matrix $\rho$ to $\rho_A$, but how do I do this specifically, what parts?
This is specifically a computational question because I am simulating in Python, but it's not the coding part that's troublesome, I really have no idea how to get the "first half of the chain" out of this full density matrix.