Metadata-Version: 2.4
Name: jVMC
Version: 2.0.0
Summary: jVMC: Versatile and performant variational Monte Carlo
Author-email: Markus Schmitt <markus.schmitt@ur.de>
License: MIT License
Project-URL: Documentation, https://jvmc.readthedocs.io/en/latest/#
Project-URL: Repository, https://github.com/markusschmitt/vmc_jax
Project-URL: Issues, https://github.com/markusschmitt/vmc_jax/issues
Keywords: Neural quantum states,Variational Monte Carlo
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2
Requires-Dist: jax>=0.10.1
Requires-Dist: jaxlib>=0.10.1
Requires-Dist: flax>=0.12
Requires-Dist: optax
Requires-Dist: tqdm
Requires-Dist: h5py
Requires-Dist: chex
Requires-Dist: scipy
Provides-Extra: dev
Requires-Dist: jVMC[docs,examples]; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-mpi; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=8; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=3; extra == "docs"
Requires-Dist: myst-nb>=1.1; extra == "docs"
Provides-Extra: examples
Requires-Dist: matplotlib; extra == "examples"
Requires-Dist: openfermion; extra == "examples"
Provides-Extra: cuda12
Requires-Dist: jax[cuda12]>=0.10.1; extra == "cuda12"
Requires-Dist: jaxmg[cuda12]; extra == "cuda12"
Provides-Extra: cuda13
Requires-Dist: jax[cuda13]>=0.10.1; extra == "cuda13"
Requires-Dist: jaxmg[cuda13]; extra == "cuda13"
Provides-Extra: cuda12-local
Requires-Dist: jax[cuda12-local]>=0.10.1; extra == "cuda12-local"
Requires-Dist: jaxmg[cuda12-local]; extra == "cuda12-local"
Provides-Extra: cuda13-local
Requires-Dist: jax[cuda13-local]>=0.10.1; extra == "cuda13-local"
Requires-Dist: jaxmg[cuda13-local]; extra == "cuda13-local"
Dynamic: license-file

[![Documentation Status](https://readthedocs.org/projects/jvmc/badge/?version=latest)](https://jvmc.readthedocs.io/en/latest/?badge=latest)
[![PyPi version](https://badgen.net/pypi/v/jVMC/)](https://pypi.org/project/jVMC/)
[![arXiv](https://img.shields.io/badge/arXiv-2108.03409-b31b1b.svg)](https://arxiv.org/abs/2108.03409)

# jVMC
This is an impementation of Variational Monte Carlo (VMC) for quantum many-body dynamics using the [JAX library](https://jax.readthedocs.io "JAX library") (and [Flax](https://flax.readthedocs.io "FLAX library") on top) to exploit the blessings of automatic differentiation for easy model composition and just-in-time compilation for execution on accelerators.

1. [Documentation](#documentation)
2. [Installation](#installation)
3. [Migrating from jVMC 1.x](#migrating-from-jvmc-1x)
4. [Using jVMC with AI coding agents](#using-jvmc-with-ai-coding-agents)
5. [Online example](#online-example)
6. [Important gotchas](#important-gotchas)
7. [Citing jVMC](#citing-jvmc)

Please report bugs as well as other issues or suggestions on our [issues page](https://github.com/markusschmitt/vmc_jax/issues).

## Documentation

Documentation is available [here](https://jvmc.readthedocs.io/en/latest/ "Documentation").

## Installation

### Option 1: ``pip``-install

        pip install jVMC

To install jVMC with GPU support, use

        pip install jVMC[cuda12]

or ``pip install jVMC[cuda13]`` depending on your CUDA version. This is assuming, that `jax[cuda12]`/`jax[cuda13]` will work for you (see the [JAX documentation](https://docs.jax.dev/en/latest/installation.html#pip-installation-nvidia-gpu-cuda-installed-via-pip-easier)), and additionally installs `jaxmg` for distributed linear algebra across multiple GPUs.

On a cluster where CUDA is already provided (e.g. via an environment module) rather than pip-installed, use the ``-local`` variant instead, e.g. ``pip install jVMC[cuda12-local]`` or ``pip install jVMC[cuda13-local]``.

### Option 2: Clone and ``pip``-install for development

1. Clone the jVMC repository and check out the development branch:

        git clone https://github.com/markusschmitt/vmc_jax.git
        cd vmc_jax

2. ``pip``-install the package  

        pip install -e ".[dev]"

Test that everything worked, e.g. run 'python -c "import jVMC"' from a place different than ``vmc_jax``.


## Migrating from jVMC 1.x

jVMC 2.0 changes most of the API. See [MIGRATION.md](MIGRATION.md) for what changed and how to port existing scripts.

## Using jVMC with AI coding agents

The folder [`skills/jvmc`](skills/jvmc/SKILL.md) is an [Agent Skill](https://agentskills.io) that teaches coding agents how to use jVMC 2.0. Without it, agents tend to write code for the 1.x API. To install it for Claude Code, copy the folder into your skills directory, using the tag of the jVMC version you have installed:

        git clone --depth 1 --branch <version tag> https://github.com/computational-quantum-science/jvmc-2.0.git jvmc-src
        cp -r jvmc-src/skills/jvmc ~/.claude/skills/

Use `<your project>/.claude/skills/` instead of `~/.claude/skills/` to enable it for one project only. For other agents, copy the folder into their skills directory.

## Online example

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/markusschmitt/vmc_jax/blob/master/examples/ex0_ground_state_search.ipynb)

Click on the badge above to open a notebook that implements an exemplary ground state search in Google Colab.

## Important gotchas
### Out-of-memory issues and batching
Memory requirements grow with increasing network sizes. To avoid out-of-memory issues, the ``batch_size`` parameter of the ``NQS`` class has to be adjusted. The ``batch_size`` indicates on how many input configurations the network is evaluated concurrently. Out-of-memory issues are usually resolved by reducing this number. The ``num_chains`` parameter of the ``Sampler`` class for Markov Chain Monte Carlo sampling plays a similar role, but its optimal values in terms of computational speed are typically not memory critical.

## Citing jVMC

If you use the jVMC package for your research, please cite our reference paper [SciPost Phys. Codebases 2 (2022)](https://scipost.org/10.21468/SciPostPhysCodeb.2)

        @Article{jVMC,
                title={{jVMC: Versatile and performant variational Monte Carlo leveraging automated differentiation and GPU acceleration}},
                author={Markus Schmitt and Moritz Reh},
                journal={SciPost Phys. Codebases},
                pages={2},
                year={2022},
                publisher={SciPost},
                doi={10.21468/SciPostPhysCodeb.2},
                url={https://scipost.org/10.21468/SciPostPhysCodeb.2},
        }
