Skip to content

Progress bar for VMC driver

Vicentini Filippo requested to merge github/fork/orialb/progress-bar into v2.1

Created by: orialb

This PR implements a progress bar that can be displayed during the VMC run, as discussed in https://github.com/netket/netket/issues/341. The progress bar is implemented using tqdm, which is now added as a dependency.

With this PR, one can call vmc_driver.run with an extra argument show_progress that is used to enable the progress bar. The options for show_progress are:

  1. None (deafult) - progress bar is disabled.
  2. list/tuple containing names of observables (e.g. ["Energy", "Sx"])- the observables' mean values will be displayed in the progress bar. Observables which were not added to the driver using add_obsrvable will be ignored.
  3. True/[] or any other value not listed above- display the progress bar without any information about observables. (If wanted I could add a check that makes sure that show_progress is either True/[] or the values above and throws an error otherwise).

I also added an argument show_progress_fmt which allows controlling the formatting of the printed mean values (default is ".4f"). But if this is an overkill I can remove it.

In a Jupyter notebook the progress bar looks like this: image

Merge request reports