Hi Alex,
Yes there are the following two functions provided in ITensor:
writeToFile(string filename, T const& obj)
readFromFile(string filename)
or
readFromFile(string filename, T & obj)
The writeToFile function is a template function that automatically deduces the type of the second argument (the object you want to write to the file).
The readFromFile functions come in two versions. The first one above requires you to specify the type of the object you expect to be stored in the file, so like:
auto T = readFromFile("mytensor");
The second one is able to deduce the type, so no need for the template stuff, but can be more awkward to use sometimes since it can require more lines of code:
ITensor T;
readFromFile("mytensor",T);
By the way, the ITensor read and write system has the ability to read and write certain common container types, such as std::vector. So you can do things like write an entire std::vector to a file like so:
auto v = vector(5);
for(auto& t : v) t = randomTensor(i,j,k,l); //makes random ITensors
writeToFile("vector_itensors",v);
Miles