Skip to content

read_opsum

Reads an OpSum object from a TOML file.

Sources read.hpp, read.cpp


Definition

OpSum read_opsum(FileToml file, std::string tag);
read_opsum(file::FileToml, tag::String)::OpSum

Parameters

Name Description
file FileToml object from which the OpSum is read
tag tag which holds the information in the TOML file about the OpSum

Data format

An OpSum can be defined in a TOML file as a simple list. The entries of the list are themselves also lists, which contain two or more entries:

  1. The first entry must be either a string or a real / complex number denoting the coupling constant of the term.
  2. The second entry must be a string and denotes the operator type
  3. The (optional) following entries are integer numbers which denote the sites of the Op

Here is typical example of a OpSum specification in a TOML file:

Interactions = [
  ['J1', 'SdotS', 0, 1],
  ['J1', 'SdotS', 1, 2],
  ['J1', 'SdotS', 2, 0],
  ['Jchi', 'ScalarChirality', 0, 1, 2],
]

Usage Example

std::string file = XDIAG_DIRECTORY "/misc/data/triangular.9.hop.sublattices.tsl.toml";
auto fl = FileToml(file);
auto ops = read_opsum(fl, "Interactions");
XDIAG_SHOW(ops);
file = "triangular.9.hop.sublattices.tsl.toml"
fl = FileToml(file)
ops = read_opsum(fl, "Interactions")
@show ops