File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -415,6 +415,27 @@ function periodic_boundary_conditions(H::InfiniteMPOHamiltonian, L=length(H))
415415 return remove_orphans! (FiniteMPOHamiltonian (output))
416416end
417417
418+ """
419+ open_boundary_conditions(mpo::InfiniteMPO, L::Int) -> FiniteMPO
420+
421+ Convert an infinite MPO into a finite MPO of length `L`, by applying open boundary conditions.
422+ """
423+ function open_boundary_conditions (mpo:: InfiniteMPO{O} ,
424+ L= length (mpo)) where {O<: SparseBlockTensorMap }
425+ mod (L, length (mpo)) == 0 ||
426+ throw (ArgumentError (" length $L is not a multiple of the infinite unitcell" ))
427+
428+ # Make a FiniteMPO, filling it up with the tensors of H
429+ # Only keep top row of the first and last column of the last MPO tensor
430+
431+ # allocate output
432+ output = Vector (repeat (copy (parent (mpo)), L ÷ length (mpo)))
433+ output[1 ] = output[1 ][1 , :, :, :]
434+ output[end ] = output[end ][:, :, :, 1 ]
435+
436+ return FiniteMPO (output)
437+ end
438+
418439"""
419440 open_boundary_conditions(mpo::InfiniteMPOHamiltonian, L::Int) -> FiniteMPOHamiltonian
420441
You can’t perform that action at this time.
0 commit comments