• full name: tenpy.console_main

  • parent module: tenpy

  • type: function


Command line interface.

For the python interface see run_simulation() and run_seq_simulations().

When tenpy is installed correctly via pip/conda, a command line script called tenpy-run is set up, which calls this function, i.e., you can do the following in the terminal:

tenpy-run --help

Equivalently, you can also invoke the tenpy module from your python interpreter like this:

python -m tenpy --help
usage: tenpy-run [-h] [--import-module MODULE] [--sim-class SIM_CLASS] [--merge MERGE]
                 [--option KEY VALUE] [--version]
                 [parameters_file [parameters_file ...]]

Command line interface to run a TeNPy simulation.

positional arguments:
        Yaml (*.yml) file with the simulation parameters/options. Multiple files get merged
        according to MERGE; see for details.

optional arguments:
    -h, --help
        show this help message and exit
    --import-module MODULE, -i MODULE
        Import the given python MODULE before setting up the simulation. This is useful if the
        module contains user-defined subclasses. Use python-style names like `numpy` without the
        .py ending.
    --sim-class SIM_CLASS, -c SIM_CLASS
        selects the Simulation (sub)class, e.g. 'GroundStateSearch' (default) or
    --merge MERGE, -m MERGE
        Selects how to merge conflicts in case of multiple yaml files. Options are 'error',
        'first' or 'last'.
    --option KEY VALUE, -o KEY VALUE
        Allows overwriting some options from the yaml files. KEY can be recursive separated by
        `.`, e.g. ``algorithm_params.trunc_params.chi``. VALUE is initialized by python's
        ``eval(VALUE)`` with `np`, `scipy` and `tenpy` defined. Thus ``'1.2'`` and
        ``'2.*np.pi*1.j/6'`` or ``'np.linspace(0., 1., 6)'`` will work if you include the quotes
        on the command line to ensure that the VALUE is passed as a single argument.
    --version, -v
        show program's version number and exit


In the simplest case, you just give a single yaml file with all the parameters as argument:

    tenpy-run my_params.yml

If you implemented a custom simulation class called ``MyGreatSimulation`` in a
file ````, you can use it like this:

    tenpy-run -i my_simulations -c MyGreatSimulation my_params.yml

Further, you can overwrite one or multiple options of the parameters file:

    tenpy-run my_params.yml -o output_filename '"rerun_Jz_2.h5"' -o model_params.Jz 2.

Note that string values for the options require double quotes on the command line.