This is just a quick request for clarification about a particular bit of TenPy syntax. I'm trying to initialise a product state in TenPy's spin chain class which allows me to rotate individual spins by some specified angle, before doing TDVP and computing the quench dynamics starting from this state. I see how to initialise spins in "up" or "down" states using the keywords, and that in the documentation it is written that "For Spin S=1/2, you could get a state with all sites pointing in negative x-direction with:
neg_x_state = np.array([1., -1.])...". This is probably a very basic question, but I'm looking for clarification as to what the two numbers in the array actually refer to? I can't find it clearly stated in the documentation in the case of spins.
I'm asking because if I set the the spin state equal to
np.array([np.sin(theta/2), np.cos(theta/2)]), where theta is my angle of rotation, I seem to get the desired result, but before I get too far with this calculation, I want to clarify that the syntax does indeed mean what I think it means. The following code snippet should hopefully illustrate what I'm trying to do, here for the case of a single rotated spin in the centre of a chain of up spins:
Code: Select all
model_params = dict(L=L, Jx=J, Jy=J, Jz=J, bc_MPS='finite', conserve=None, verbose=0) M = SpinChain(model_params) theta_state = np.array([np.sin(theta/2), np.cos(theta/2)]) product_state = ["up"]*L product_state[L//2] = theta_state/np.linalg.norm(theta_state) psi = MPS.from_product_state(M.lat.mps_sites(), product_state, bc=M.lat.bc_MPS)