Skip to content

Pythonize NetKet for a simple user experience

Created by: quantshah

Hi, thank you very much for releasing this tool. I am sure many in the community are looking forward to its use.

I was wondering if it is possible to take full advantage of the Python ecosystem and develop this tool in a way similar to any Python-based scientific computing library. More specifically, the installation of the package can be made as simple as pip install netket or conda install netket. Python can handle running C++ code in the background and allows the use of notebooks such as this one on superradiance. It is a recent tool for dealing with permutational symmetry that we have developed and the package can be found in PIQS.

The current workflow where a JSON parameters file is created and then the C++ code is run using it can be completely done behind the scenes by wrapping everything up in a Python-based package. This will allow users to simply run your code in a python script or inside a Jupyter notebook. A simple prototype example could be:

from netket.graph import Hypercube
from netket.machine import RbmSpinSymm
from netket.hamiltonian import BoseHubbard
from netket import ground

graph = Hypercube(L=12, dim=1)
hamiltonian = BoseHubbard(4.0, nmax=3, bosons=12)
machine = RbmSpinSymm(alpha=4.0)

ground_state = ground(hamiltonian, graph, machine, method="Sr", learning_rate=0.1)
print(ground_state)

I am opening this issue in case you would like to develop this into a Python package.