# Custom lattices and custom "initial" states

**URL:** <https://itensor.discourse.group/t/custom-lattices-and-custom-initial-states/1956>\
**Category:** DMRG and Numerical Methods\
**Created:** [September 3, 2024, 3:42pm UTC](https://itensor.discourse.group/t/custom-lattices-and-custom-initial-states/1956 "2024-09-03T15:42:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![miles](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/miles/32/6_2.png) [@miles](https://itensor.discourse.group/u/miles)\
**Post date:** [September 3, 2024, 7:39pm UTC](https://itensor.discourse.group/t/custom-lattices-and-custom-initial-states/1956/2 "2024-09-03T19:39:38Z")

</div>

For #1, I assume you mean how to make an MPO you can input into DMRG or TDVP that is a Hamiltonian defined on an arbitrary / more complicated lattice?

The way to do this is to assign an “ordering” on the sites of your lattice. This just means an assignment of sites of your lattice to integers 1,2,3… Then each interaction (assuming two-site interactions) is just a pair of integers like (4,7) or (1,2). Finally, you can loop over all of these interaction bonds (or “edges” in graph jargon) and use our OpSum system to make your operator, like this:

```julia
terms = OpSum()
for bond in bonds
  terms += "Sz",bond[1], "Sz", bond[2]
end

```

where to be concrete, I’ve used the example of interactions like S^z\_i S^z\_j but of course it can be any pair of operators you like. As a made-up example, the array `bonds` here could be something like `bonds = [(1,2),(2,3),(3,1)]` which would make a periodic ring of 3 sites (e.g. a single triangle).

The above pattern is all that our helper functions like `square_lattice` or `triangular_lattice` do, which you can find inside the [ITensorMPS package here](https://github.com/ITensor/ITensors.jl/blob/main/src/lib/ITensorMPS/src/lattices/lattices.jl). They return an array of structs (called `LatticeBond`, but you don’t have to use this struct) which hold a pair of integers labeling pairs of sites corresponding to the bonds of the lattice. Studying these functions and printing out their output for various inputs could be helpful.

For #2, this is a pretty broad question. Mainly the answer is “set the tensors of your initial MPS to be the right ones that define the state you want” and how to do that depends on the state you are trying to make and how complicated it is etc. For product states we offer an interface to make this process easy. For a Gutzwiller state it depends… Are you talking about a free-fermion eigenstate (Slater determinant) that is then projected? We have a package called [`ITensorGaussianMPS`](https://github.com/ITensor/ITensorGaussianMPS.jl) that can help with making MPS of Slater determinants which would then be straightforward to Gutzwiller project. I can help you more with that package if that’s what you are asking.

---

_[View the full topic](https://itensor.discourse.group/t/custom-lattices-and-custom-initial-states/1956)._
