To save the result of a calculation (in a MATLAB/Octave formatted binary file), you have to set a couple of properties of object "state", normally within the ''qm_init.m'' function. A typical setting is shown here
state.save_export = true;
state.save_dir = '/scratch/wavepacket_saves';
state.save_file = 'MyFirstSave';
where state can be an object of class wave (wavefunction) or class traj (trajectory swarm) or any of the other WavePacket main classes.
With this setup, WavePacket will save the calculated wavefunctions or trajectory bundles or etc at each main time step. After the calculation, the directory ''/scratch/wavepacket_saves'' will contain two or more files. The file ''wave_0.mat'' contains all global variables saved in the standard Matlab/Octave formatted binary file format. The other files called ''wave_1.mat'', ''wave_2.mat'', ... 'or 'traj_1.mat'', ''traj_2.mat'', ... store the actual wavefunctions or trajectory bundles. Note that data to be saved are first cached in memory until a certain limit is reached (by default 500 MB to avoid blowing up a typical user's memory), after which this cache is written to a file, after which the process is repeated.
As mentioned above, wavefunctions or trajectory bundles or etc that are to be saved are first cached in memory before being written to a file. This consumes some amount of memory, which you also have to plan for later when you load the wave function again. Note that this strategy avoids producing too many data files, which would be a bit annoying. To fine-tune the behavior, you can set two variables
state.save_mem
state.save_step
The first variable (default: 500×220B → 500 MB) gives the (approximate) maximum amount of memory (in units of bytes) that should be used for caching. The second parameter gives a number of time-steps after which the cache is written to a file. You can set both parameters, in which case the tighter limit applies. However, at least one wavefunction is always cached.
Loading proceeds in two steps. First, you retrieve all the global variables of the saved calculation, then you can load the wave functions or trajectory bundles at various time steps.
The first step is using the function ''load_0'' to retrieve the setup that was used in the saved calculation. The syntax is
load_0 ( state, choice );
where the directory and the file template for the saved calculation are taken from the respective properties of object "state" given as the first argument, see above. If a second (integer) parameter "choice" is supplied and set to 1 or 2, this function will also overwrite the following global variables with those from the saved calculation: expect, hamilt, info, space, time. (Global variable "plots" is not set because that would interfere with the functionality of qm_movie).
After you have loaded the general setup, you can then go on to retrieve the saved (wave function or trajectory bundle) objects. The syntax is
load (state, step)
Required parameters are the object "state", into which the desired data will be loaded, and an integer that gives the time step at which you want to retrieve the wave function or trajectory bundle or etc. Counting starts at 1 for the initial state at the starting time. You will find the loaded data in the following places
Wiki: FAQ.Main
Wiki: Reference.Classes.Main
Wiki: Reference.Classes.traj
Wiki: Reference.Classes.wave
Wiki: Reference.Files.Main
Wiki: Reference.Programs.qm_bound
Wiki: Reference.Programs.qm_matrix
Wiki: Reference.Programs.qm_movie
Wiki: Reference.Programs.qm_propa
Wiki: Users.Basics.Main
Wiki: Users.Main