OK, here is the thing I was working on. The main weird thing going on here is that the lattice has multiple different types of sites and some weird choices of quantum numbers (if you really want to know why I am trying this, I can explain). If I had to guess, the main thing that is probably causing the error is the weird quantum number stuff that I am trying to define, especially since I noticed some weird business when I tried to run DMRG on this state. However, the error when trying to add states shows up even if I just initialize a state and don't run DMRG, so I will open a separate question for that issue once I have more information on it. In any case, here is the code. It might seem like a lot, but a lot of the code is just to intialize a state given a list of strings representing the initial state.

# defines weird quantum number stuff

ferm_full = QN("Sz",-1) => 1

ferm_vac = QN("Sz",0) => 1

antiferm_full = QN("Sz",+1) => 1

antiferm_vac = QN("Sz",0) => 1

even_link_p1 = QN("Sz",+2) => 1 # p1 = "positive 1"

even_link_0 = QN("Sz",0) => 1

even_link_n1 = QN("Sz",-2) => 1 # n1 = "negative 1"

odd_link_p1 = QN("Sz",-2) => 1

odd_link_0 = QN("Sz",0) => 1

odd_link_n1 = QN("Sz",+2) => 1

# defines sites, given number of spatial sites

function Kogut_Susskind_sites(num_spatial_sites)

sites = Index[]

for i = 1:num_spatial_sites

push!(sites, Index(ferm_full,ferm_vac; tags="Site,S=1/2,n=$(4*i-3)"))

push!(sites, Index(odd_link_p1,odd_link_0,odd_link_n1; tags="Site,S=1,n=$(4*i-2)"))

push!(sites, Index(antiferm_full,antiferm_vac; tags="Site,S=1/2,n=$(4*i-1)"))

push!(sites, Index(even_link_p1,even_link_0,even_link_n1; tags="Site,S=1,n=$(4*i)"))

end

return sites

end

# returns a state vector for a given list of link values

function basis_state(link_value_list)

if length(link_value_list) % 2 == 1

error("number of links must be even (twice the number of spatial sites).")

end

num_spatial_sites = length(link_value_list) รท 2 # division symbol denotes integer division

basis_state = ["Up" for n = 1:4*num_spatial_sites] # just to initialize

for j=1:2*num_spatial_sites

# find status of particle (fermion/antifermion/vacuum) at site immediately before

if j == 1

if link_value_list[j] - link_value_list[2*num_spatial_sites] == 0

basis_state[2*j-1] = "Dn"

elseif link_value_list[j] - link_value_list[2*num_spatial_sites] == -1

basis_state[2*j-1] = "Up"

else

error("invalid link configuration: change not equal to 0 or -1 at fermion site")

end

elseif j % 2 == 1

if link_value_list[j] - link_value_list[j-1] == 0

basis_state[2*j-1] = "Dn"

elseif link_value_list[j] - link_value_list[j-1] == -1

basis_state[2*j-1] = "Up"

else

error("invalid link configuration: change not equal to 0 or -1 at fermion site")

end

else # j % 2 == 0

if link_value_list[j] - link_value_list[j-1] == 0

basis_state[2*j-1] = "Up"

elseif link_value_list[j] - link_value_list[j-1] == +1

basis_state[2*j-1] = "Dn"

else

error("invalid link configuration: change not equal to 0 or +1 at antifermion site")

end

end

# fill in link value

if link_value_list[j] == +1

basis_state[2*j] = "Up"

elseif link_value_list[j] == 0

basis_state[2*j] = "Z0"

elseif link_value_list[j] == -1

basis_state[2*j] = "Dn"

else

error("invalid link configuration: all link values must be +1, 0, or -1")

end

end

return basis_state

end

# initialize state and try to add state to itself

num_spatial_sites = 2

sites = Kogut_Susskind_sites(num_spatial_sites)

init_state = ["Dn", "Z0", "Up", "Z0", "Dn", "Z0", "Up", "Z0"] # fully empty lattice

psi0 = productMPS(sites, init_state)

psi_test = add(psi0, psi0; maxdim=100, cutoff=1E-12)