Menu

Reference.Programs.qm_init

Burkhard Schmidt

qm_init: Initialize WavePacket simulations

Before running any of the programs of the WavePacket MATLAB package, you'll have to initialize a few of the global variables characterizing your simulation task. If you don't want to do it manually, this can be done in a MATLAB function, typically called qm_init.m (other naming also permitted) . If you don't know how to write such a function, it is best (and easiest!) to study our plethora of demo examples available in the WavePacket central Wiki.

To declare the variables where the parameters are specified, as global, see the following example

global hamilt plots space state time

Afterwards, you have to set all parameters that are required for the calculation or that you wish to modify. Feel free to use the above-mentioned demo files as templates. Parameters must be given in atomic units, see our WavePacket central Wiki, angles in radians. Examples are

hamilt.coupling.n_eqs = 3;     % Sets the number of (coupled!) Schrödinger or Liouville equations
plots.density = vis.contour;   % Represent densities by contour plots

Input is often not checked, so if you get a strange error without doing something unusual, it is likely that you misspelled or forgot something. Giving too much input usually does not hurt; any obsolete parameters are ignored.

While most of the examples found in the demos available in the WavePacket central Wiki do not require any further input parameters, the use of input parameters may be useful in situations where a simulation task is to be repeated in a loop, with one (or more) parameters varying, see e.g. the end of Sec. 2 of our first article in Computer Physics Communications.

The programming strategy followed throughout the Matlab version of WavePacket is to use rather few but highly structured variables, for a complete list of them see here. These variables are made globally visible to all parts of the codes. This avoids passing them through argument lists since - at least in some older versions - Matlab uses to pass variables by value which causes an overly large memory consumption. Hence, care should be taken when changing any global variables; there is always a risk of unwanted side effects.


Related

Blog: 2019/02/version-530-released-30-may-2017
Blog: 2019/02/version-600-released-20-dec-2018
Blog: 2022/06/version-700-released-01-jun-2022-
Wiki: FAQ.Main
Wiki: Reference.Programs.Main
Wiki: Reference.Programs.qm_H2model
Wiki: Reference.Programs.qm_abncd
Wiki: Reference.Programs.qm_balance
Wiki: Reference.Programs.qm_bound
Wiki: Reference.Programs.qm_matrix
Wiki: Reference.Programs.qm_movie
Wiki: Reference.Programs.qm_optimal
Wiki: Reference.Programs.qm_propa
Wiki: Reference.Programs.qm_truncate
Wiki: Reference.Variables.Main
Wiki: Reference.Variables.atomic
Wiki: Reference.Variables.plots
Wiki: Users.Basics.Main
Wiki: Users.Graphics.Movies
Wiki: Users.Graphics.Plots
Wiki: Users.Grids.Main

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.