+1 vote
asked by (320 points)

Hi Miles

I want to use operators which is not included in "electron" or "boson" and so on. The document has used the example "S=3/2" to tell me how to define operators I need. I also need a initial state I set to do time evolution. For example, the "Up" and "Dn" are MPS in "S=1/2" and we can use it to set initial state. How can I define something like "Dn" or "Up" I need?

1 Answer

0 votes
answered by (70.1k points)
selected by
 
Best answer

Hi, it's a good question as we have not documented this, and need to!

For now, a good way to learn how to define these kind of state definitions, such as "Up" and "Dn" for spin systems, is to look at how it is done in our source code, because the code you would need to write is the same. (Of course reading about it in the documentation will be even better once we document it!)

Here is a link to the spinone.jl file where we create the states using the function ITensors.state:

https://github.com/ITensor/ITensors.jl/blob/main/src/physics/site_types/spinone.jl

For the 3/2 example, you would do something like this:

ITensors.state(::StateName"Up", ::SiteType"S=1") = [1.0, 0.0, 0.0, 0.0]

So the key points are:
- you define a function named ITensors.state taking a StateName and SiteTyp
- it returns a vector which can be anything you want, and does not have to have only 1 and 0 entries
- once you define this function, you can immediately use your new states in the productMPS function and elsewhere

Hope that helps and please let us know if you run into any issues.

Miles

commented by (320 points)
After using the ITensors.state and defing a ITensors.space(::SiteType), It works. Thanks a lot.
commented by (70.1k points)
Glad to hear it!
Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...