[go: up one dir, main page]

Menu

[4c31d3]: / README.Python  Maximize  Restore  History

Download this file

35 lines (28 with data), 1.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
The Python interface is currently experimental and incomplete.
If you still want to try it out, the following describes how:

0. Prerequisites: You need Python installed with NumPy.
1. Configure a new Wavepacket build (see the README on how)
2. Enable the Python interface:
	- in the build directory, run "ccmake ${WP_SRCDIR}"
	- set the option "Opt_BuildPython" to "ON"
	- [c]onfigure and [g]enerate again
3. Build the whole library as usual.
4. In the build directory, go to the subdirectory "python"

Now you can run python _in this subdirectory_. By calling
"import wavepacket", you can import all the functionality that
is defined so far.

For now, two demos have been transferred:
- Demos/HarmOscillator/Gaussian_2D/1/demo.py
- Demos/FreeParticle/Gaussian_1D/1/demo.py


Limitations
-----------

* Only a handful of classes have a python interface right now.
  So far, I was not interested in completeness, but in verifying
  that everything I need is supported.
* There is no installation target or anything. To use the python
  interface, you need to run python in ${Build_DIR}/python, because
  also the position of the underlying WavePacket library is hardcoded.
  To run the demos, you also need to copy the demo.py into this directory
  (or run it from a python instance started there)
* The interface is still quite inconvenient. For example, you need to
  wrap all CTensors in numpy.arrays for proper manipulation.