diff --git a/src/abstractindsnetwork.jl b/src/abstractindsnetwork.jl index d25f5abb..eda958f6 100644 --- a/src/abstractindsnetwork.jl +++ b/src/abstractindsnetwork.jl @@ -138,9 +138,13 @@ function insert_linkinds( for e in edges # TODO: Change to check if it is empty. if !isassigned(indsnetwork, e) - iₑ = Index(link_space, edge_tag(e)) - # TODO: Allow setting with just `Index`. - indsnetwork[e] = [iₑ] + if !isnothing(link_space) + iₑ = Index(link_space, edge_tag(e)) + # TODO: Allow setting with just `Index`. + indsnetwork[e] = [iₑ] + else + indsnetwork[e] = [] + end end end return indsnetwork diff --git a/src/formnetworks/bilinearformnetwork.jl b/src/formnetworks/bilinearformnetwork.jl index 306cb4a1..19ca7568 100644 --- a/src/formnetworks/bilinearformnetwork.jl +++ b/src/formnetworks/bilinearformnetwork.jl @@ -65,7 +65,7 @@ function BilinearFormNetwork( @assert issetequal(flatten_siteinds(bra), flatten_siteinds(ket)) operator_inds = union_all_inds(siteinds(ket), dual_site_index_map(siteinds(ket))) # TODO: Define and use `identity_network` here. - O = ITensorNetwork(Op("I"), operator_inds) + O = ITensorNetwork(Op("I"), operator_inds; link_space=nothing) return BilinearFormNetwork(O, bra, ket; dual_site_index_map, kwargs...) end