NetKet V2.0b1
Created by: gcarleo
Summary for version 2.0
This PR introduces the first beta version for NetKet 2.0.
Major changes in version 2.0
- NetKet now fully exposes its internal types and classes, thus becoming a full-fledged python library built on a monolithic c++ core
- Python Bindings are provided using pybind11, thus fully addressing issue #8 (closed)
- As a result of this transformation, JSON input is not accepted anymore and the
netket
executable does not exist anymore - A great deal of flexibility in the usage of NetKet comes with these changes, removing the majority of constraints coming from the JSON-based input and usage pattern
- Bindings are provided for the great majority of
NetKet
classes, with the exception of some internals, that don't need python exposure.
Reasons behind these changes
- The most common current usage pattern of NetKet is not to write directly the JSON file, but use the python scripts we have in the
Tutorials/
folder. That's why moving to a python library is a desirable goal, improving the user experience and opening the way to a number of applications previously hard or impossible to perform - With a full-fledged python library it is also much easier to submit multiple jobs with different parameters, and have more flexibility on the output
- There is a substantial overhead for maintaining the JSON support. Supporting all the possible ways of putting together the NetKet classes, in a consistent way, does not scale well given the increasing size of this project.
- It becomes easier to interface to a whole spectrum of Python-only libraries, including advanced visualization tools and state-of-the-art machine learning libraries (pytorch, tensorflow etc)
- New generations of students (unfortunately?) are not very familiar with c++, and strive to have a pure Python library
Installing, Tutorials, Examples
To install the latest development version do
pip install .
The directory /Tutorials/
contains pynotebook tutorials. More will be added.
Several example codes showcasing a specific application are contained in /Examples
.
Other remarks
-
Version 2.0 removes all "glue" classes, such as
Graph
,Hamiltonian
etc. The corresponding abstract interfaces remain, with little changes. -
We introduce the concept of
Operator
, which generalizesHamiltonian
,Observable
etc.Hamiltonian
andObservable
disappear. -
We introduce a
LocalOperator
, and all associated overloaded operations, for example
hi=nk.Spin(s=0.5,graph=g)
X=[[0,1],[1,0]]
o=nk.LocalOperator(hi,X,[0])*(nk.LocalOperator(hi,X,[1]))
defines a quantum operator X(0)*X(1), automatically performing the tensor product. Other operations such as product times a scalar and addition of local operators are also supported.