[go: up one dir, main page]

Menu

[4729d2]: / README.Python  Maximize  Restore  History

Download this file

80 lines (63 with data), 3.2 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Description
-----------

The Python bindings allows access to the WavePacket classes via Python.
This can be useful because debugging and experimenting is somewhat simpler
and faster in Python as compared to C++.

Currently, this is still a prototype, with only a handful of classes
offered in the Python interface to check that everything works.
In particular, two demos have been converted, with a "demo.py" file in the
directory:
- FreeParticle/Gaussian_1D/1
- HarmonicOscillator/Gaussian_2D/2


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

This module is not a Python package with a "Python look&feel", but a
binding to a C++ library. It may feel awkward at times as a byproduct.
For example, you need to wrap all CTensors in numpy.arrays for proper
manipulation.


Requirements
------------

To even start to install the bindings, you need some software installed.
Once you have pip installed and assuming that you call the python interpreter
on the command line with "python", you can download and install all further
packages via "python -m pip install <package>". Unix users generally also have
access to prebuild packages through their distribution.

* A python installation (Python2 and 3 should be supported)
* Pip (the python installer)
* The numpy package
* The setuptools package
* The pybind11 package


Installation
------------

Let's assume you have all requirements installed, and that you have a command line
where the command "python" fires up your python interpreter of choice, the installation
should be straight-forward:

* Build and install the wavepacket library. See the README file on how to do it.
* In the build directory (the one where you ran cmake), switch to the directory "python"
* Run the following three commands:
     python setup.py build
     python setup.py test
     python setup.py install
  The first builds the python bindings, which takes some moments.
  The second command runs the tests for the bindings, which should all succeed.
  The third command installs the bindings in the python distribution directory;
  usually you will need administration permissions for that step.


Some notes regarding the installations:

* If you are the only user, you may run the installation with
     python setup.py install --user
  This installs the wavepacket bindings in a python distribution path inside your home
  directory, which does not require admin permissions.
* If you want to uninstall the bindings again (for example because you want to upgrade
  your wavepacket version), run
     python -m pip uninstall wavepacket
* A major drawback of C++ is that the binary format is almost completely undefined and
  can vary between different compilers, compiler versions or even compiler flags. As a
  consequence, the Python bindings should be compiled with similar flags and the same
  compiler and version as the actual library.
  Under Unix, this should rarely be a problem, because g++ seems to be a fairly widespread
  standard, and because the default flags are rather conservative, but if you use rather
  exotic compilers (Intel?) or tweak the flags excessively, be aware of this problem.
* For advanced settings in the installation, run
     python setup.py --help
     python setup.py build --help
     etc.