Modifying Internal QuTiP Settings

Contents

User Accessible Settings

n 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 (Default first)
`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. `1e-12`, Any `Float` value $>0$.
`atol` General absolute tolerance. `1e-12`, Any `Float` value $>0$.
`num_cpus` Number of CPU's used for multiprocessing. `Int` between 1 and # of CPU's
`debug` Show debug print outs. `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

In [1]:
from IPython.core.display import HTML
def css_styling():
    styles = open("../styles/guide.css", "r").read()
    return HTML(styles)
css_styling()


Out[1]: