Modifying Internal QuTiP Settings

User Accessible Parameters

In this section we show how to modify a few of the internal parameters used by QuTiP. The settings that can be modified are given in the following table:

Setting Description Options
auto_herm Automatically calculate the hermicity of quantum objects. True / False
auto_tidyup Automatically tidyup quantum objects. True / False
auto_tidyup_atol Tolerance used by tidyup any float value > 0
atol General tolerance any float value > 0
num_cpus Number of CPU’s used for multiprocessing. int between 1 and # cpu’s
debug Show debug printouts. True / False
openmp_thresh NNZ matrix must have for OPENMP. Int

Example: Changing Settings

The two most important settings are auto_tidyup and auto_tidyup_atol as they control whether the small elements of a quantum object should be removed, and what number should be considered as the cut-off tolerance. Modifying these, or any other parameters, is quite simple:

>>> qutip.settings.auto_tidyup = False

These settings will be used for the current QuTiP session only and will need to be modified again when restarting QuTiP. If running QuTiP from a script file, then place the qutip.setings.xxxx commands immediately after from qutip import * at the top of the script file. If you want to reset the parameters back to their default values then call the reset command:

>>> qutip.settings.reset()

Persistent Settings

When QuTiP is imported, it looks for a file named qutiprc in a folder called .qutip user’s home directory. If this file is found, it will be loaded and overwrite the QuTiP default settings, which allows for persistent changes in the QuTiP settings to be made. A sample qutiprc file is show below. The syntax is a simple key-value format, where the keys and possible values are described in the table above:


Note that the openmp_thresh value is automatically generatd by QuTiP. It is also possible to set a specific compiler for QuTiP to use when generating runtime Cython code for time-dependent problems. For example, the following section in the qutiprc file will set the compiler to be clang-3.9:

cc = clang-3.9
cxx = clang-3.9