How to define custom states in ITensor c++?

As I know we can do custom state definition in julia like:

ITensors.state(::StateName"+", ::SiteType"Electron") = [0, 1/sqrt(2), 1/sqrt(2), 0]

But I haven’t get similar method in ITensor c++. In the source code I only find this:

IndexVal
    state(std::string const& state)
        {
        if(state == "0" || state == "Emp") 
            {
            return s(1);
            }
        else 
        if(state == "+" || state == "Up") 
            {
            return s(2);
            }
        else 
        if(state == "-" || state == "Dn") 
            {
            return s(3);
            }
        else 
        if(state == "S" || state == "UpDn") 
            {
            return s(4);
            }
        else
            {
            throw ITError("State " + state + " not recognized");
            }
        return IndexVal{};
        }

So is it possible to define custom states in c++ version?

It’s a good question, but no, we did not design such a system to do custom states or sites (meaning outside of the ones provided by the library) in the C++ version, mainly because in C++11 we found it difficult to do this without a lot of tricks involving pointers etc. It might be easier now with C++20 but we have been focusing our development activities on the Julia version.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.