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

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 the file .qutiprc in the 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:

# QuTiP Graphics
qutip_graphics="YES"
# use auto tidyup
auto_tidyup=True
# detect hermiticity
auto_herm=True
# use auto tidyup absolute tolerance
auto_tidyup_atol=1e-12
# number of cpus
num_cpus=4
# debug
debug=False