Updated 27 Apr 2016
H2DBLAB is a Matlab companion to the H2db code , a package that
solves for the wavefunctions and eigenergies of the hydrogen atom in
a magnetic field. H2DBLAB contains matlab scripts for importing the
wavefunctions and calculating matrix elements. There are also
functions for correlating the high field and low field quantum
numbers. The software is developed on Mac OS, but should work also on
Linux. Small changes may need to be made for compatibility with
The included fortran h2db code is almost identical to that provided
by Schimeczek et. al. . However, small modifications from the
provided code were made in order to create the 'savewavefunction.f90'
and 'zerofieldquantumnumbers.f90' scripts.
These functions have been tested extensively, but no gaurantee is
made to their accuracy. The accuracy of calculated matrix elements
depends on the size of the rho-z mesh used.
To run, also install DGradient, available at:
Executables were created using 64-bit Mac OS X, and can either be
generated yourself or downloaded from my personal website
(www.toddkarin.com/code), and add to the h2dblab directory.
 C. Schimeczek and G. Wunner. "Accurate 2d finite element
calculations for hydrogen in magnetic fields of arbitrary strength."
Computer Physics Communications. 185, 614-621 (2014).
h2db, h2dblab, hydrogen, atom, magnetic field
h2db_filenameList - list of filenames in a folder at specified beta
h2db_generateCompatibleMesh - put two wavefunctions on the same grid
h2db_generateRzMesh - generate 2D mesh grid for coordinates r and z
h2db_import2dbb - import an h2db solution into matlab
h2db_matrixElement - compute matrix elements
h2db_matrixElementDresselhaus - compute Dresselhaus matrix elements
h2db_matrixElementEikr - compute matrix element of Eikr
h2db_plotWavefunction - contour plot of wavefunction
h2db_smoothWavefunction - smooths out discontinuities
h2db_stateSpecification - convert high field QN to low field QN
h2db_wavefunctionPrefixes - find types of stored wavefunctions
h2db_wavefuntionNorm - norm of a wavefunction
splitByChar - split a string at a specified character
findElement - Find the element of a vector closest to a value.
Todd Karin (2023). h2dblab (https://www.mathworks.com/matlabcentral/fileexchange/56792-h2dblab), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: DGradient
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.