Being based on previous Fortran versions, most of the code of the Matlab/Octave version of WavePacket project was originally written in a traditional (i.e. procedural, function-oriented) style. In the course of the years 2017/8 there was a major re-write using object-oriented programming techniques leading to version 6.0, based on the concepts of polymorphism, encapsulation and inheritance. With the introduction of the main classes listed below, it has become possible to perform fully classical, mixed quantum-classical and fully quantum mechanical simulations, both for closed and open systems, on an equal footing. In particular, by introducing the WavePacket main classes, the function qm_propa has been made polymorph, i. e., being able to propagate quantum, classical, etc. objects alike.
The inheritance scheme of the WavePacket main classes is illustrated in the following figure
For use with the propagation function qm_propa (and partly also the other WavePacket main functions), all of the above class definitions have to provide the following methods. (In future releases, to be made mandatory by using Matlab/Octave concept of abstract classes?)
method | explanation | related variables |
---|---|---|
adiabatic | Transform forth and back between diabatic and adiabatic representation | hamilt.coupling |
apply_ham | Apply Hamiltonian to the respective type of object | hamilt |
init_ham | Initialize Hamiltonian for use with the respective type of object | hamilt |
init_obj | Provide initial state of a propagation | time.dof and time.corr |
propagate | Perform numerical propagation of a state | time |
observe | Calculate expectation values of various observables of interest | expect |
save/load | Save/load the propagated objects for each timestep | |
save_0/load_0 | Save/load additional information, e.g. the Hamiltonian, expectation values etc. |
In addition, all of the above class definitions have to provide the following properties, concerning saving and loading of propagated objects, i.e. wavefunctions or trajectory bundles etc. These properties are defined in the superclass generic.
property | explanation | default |
---|---|---|
save_export | If this is set to true, the propagated objects will be saved | false |
save_dir | Directory where to store the propagated objects | pwd |
save_file | File name template for the stored objects. Metadata is stored in file_0.mat, while the objects themselves are stored in file_1.dat, file_2.dat etc. |
Class of object, i.e. 'wave', 'traj', ... |
save_suffix | File name suffix for the stored objects. To be used in the context of dimension reduction with qm_balance and qm_truncate and qm_H2model |
empty |
save_step | Start a new file for saving objects every step main time steps. This overrides the setting of save_mem if set. |
empty |
save_mem | Start a new file for saving objects as soon as mem bytes have been filled. Larger files may offer slightly higher speed, but consume more memory (The saved objects are cached in memory before written to the file in one go) |
500 Megabytes |
Wiki: Reference.Classes.ket_rho
Wiki: Reference.Classes.sht
Wiki: Reference.Classes.traj
Wiki: Reference.Classes.wave
Wiki: Reference.Files.Main
Wiki: Reference.Main
Wiki: Reference.Programs.Main
Wiki: Reference.Programs.qm_H2model
Wiki: Reference.Programs.qm_balance
Wiki: Reference.Programs.qm_propa
Wiki: Reference.Programs.qm_setup
Wiki: Reference.Programs.qm_truncate
Wiki: Reference.Variables.Main
Wiki: Reference.Variables.expect
Wiki: Reference.Variables.hamilt.coupling
Wiki: Reference.Variables.hamilt
Wiki: Reference.Variables.state
Wiki: Reference.Variables.time.corr
Wiki: Reference.Variables.time.dof
Wiki: Reference.Variables.time
Wiki: Users.Graphics.Main
Wiki: Users.Grids.Main
Wiki: Users.Matlab.Main
Wiki: Users.Saving.Main