Wavepacket C++ is a C++ library to numerically solve the Schroedinger equation
for distinguishable particles. You can also build a Python interface with some
utility functions for plotting.
The code is under the permissive ISC license. See the file
license/Wavepacket.txt for further details.
The current detailed status of what is implemented can be found in the wiki
https://sourceforge.net/p/wavepacket/cpp/wiki/Features/
If you lack a feature that you would like to have, drop a mail to ulf@wppy.org.
Depending on the complexity of the feature, this will lead to an immediate,
rapid, or priorized implementation.
Wavepacket offers three different modes of installation:
Binary Python package under Windows
Download Python, download a zip file,
use Wavepacket somewhat like a normal Python module.
Installation in a virtual environment
Download a virtualization environment, run a script to provision a virtual machine,
use a Jupyter notebook to run Python scripts.
Building from sources
Set up your system, build and go.
When you are done, you can start to use Wavepacket.
The Binary package is bundled manually for Windows and comes with an own Readme.
It can be found under python/Readme_PythonPackage.md.
The huge advantage is Plug&Play: With essentially three commands, you get
WavePacket compiled and running. In particular, WavePacket runs on Windows that way.
However, there are a few drawbacks:
Install VirtualBox from https://www.virtualbox.org.
In the WavePacket root directory (== the directory that contains this file),
modify the VagrantFile with a text editor. Most importantly, you may want to
adjust the lines in the highlighted block, in particular config.vm.synced_folder
You now have a working VM with WavePacket installed.
If you ever want to remove it again, just type "vagrant destroy" in the wavepacket root.
You can always recreate the VM with "vagrant up" after destruction.
The VM is configured such that it runs a Jupyter notebook server on the VM, and
you control it from a browser on your host machine.
I recommend to get a basic understanding of Jupyter notebooks / Python. In particular,
the tab-autocompletion, the '?' operator and the help() function will make an
exploration of the Wavepacket API much simpler.
I also recommend to put all Jupyter notebooks in the synchronized folder.
Then you have them safely tucked away on your host system and can always destroy
the VM, for example because you want to install another WavePacket version.
Under Windows, there are two incompatible ways of running a VM. Either the VM
takes special privileges, or you use the Windows-internal hypervisor (HyperV).
HyperV is disabled by default, but required for certain VM programs, in particular
WSL2 or Docker. VirtualBox does not currently work together with HyperV.
If you are one of the unlucky persons using HyperV, you need to use this as backend.
Append "--provider hyperv" to all vagrant calls, and modify the "hyperv" provider
settings in the Vagrantfile instead of the "virtualbox" one.
Wavepacket uses CMake for the build, and requires a handful of external libraries.
Instead of spending many lines on detailing the build, I will assume you know the
basics of building a library and point you to the information you need.
You can either write C++ programs that use the Wavepacket library,
or you can use the Python bindings and run Wavepacket in Python. Note,
however, that Wavepacket is not a native Python library, so it may
feel awkward here and there.
The package documentation is available online:
http://wavepacket.sourceforge.net/cpp-doc/current/index.xhtml
and also optionally compiled when building the library.
It contains a small tutorial that should cover the basic concepts of the library.
Also, some special use-cases/demos are discussed in depth. Several solutions to
common problems can be found under the demos (everything below directory
Demos/), and in the acceptance tests under test/acceptance/.
The installation also installs a build script to simplify the compilation of your
own programs. The syntax is
wp-build.sh <executable_name> <source_file></source_file></executable_name>
The script is documented and can be found under library/ for additional
details. The building is also documented in the package documentation (the
"Hello, world" tutorial). Check also the "Demos" subdirectory where you
can find some demo source code to try this out.
Under Linux, this is usually part of the system installation,
but you may want to also install FFMPeg to write out plot animations.
The first step whenever you do something with Python. Run
python3 -m venv <dir_to_venv></dir_to_venv>
Windows users probably run "py.exe" instead. From now on only
use the programs in <dir_to_venv>/bin (Windows: <dir_to_venv scripts="">).</dir_to_venv></dir_to_venv>
<venv_bin>/pip install -r <wavepacket_root>/python/requirements.txt</wavepacket_root></venv_bin>
a) set the environment variable PYTHONPATH; in a bash:
export PYTHONPATH='<install_root>/lib/wavepacket_python'
b) start Python, and execute</install_root>
import sys
sys.path.append("<install_root>/lib/wavepacket_python")
Afterwards, you can just "import wavepacket" and use all classes from this namespace, e.g.,
"wavepacket.PlaneWaveDof(...)". See the tutorial and the demos for more information.