Giter VIP home page Giter VIP logo

netket_fidelity's Introduction

projected time-dependent Variational Monte Carlo (p-tVMC)

DOI Tests status Slack

This is a package for the projected time-dependent Variational Monte Carlo (p-tVMC) method based on infidelity optimization for variational simulation of quantum dynamics. See the paper "Unbiasing time-dependent Variational Monte Carlo by projected quantum evolution" (https://doi.org/10.22331/q-2023-10-10-1131) for reference.

The p-tVMC can be used to simulate the evolution generated by an arbitrary transformation U, by iteratively minimizing the infidelity among the variational ansatz with free parameters |ψ⟩ and the state U|ϕ⟩ where U is an arbitrary transformation and |ϕ⟩ is a known state (such as an ansatz with known parameters). There are no restrictions on U from the moment a function that computes its connected elements is implemented. The package supports the possibility to sample from the states |ψ⟩ and U|ϕ⟩, which can be used for any transformation U (unitary and non-unitary), and to sample from the states |ψ⟩ and |ϕ⟩, which is possible only for a unitary U (exploiting the norm conservation). To sample from U|ϕ⟩ a jax compatible operator for U must be used, and the package exports few examples of them (the Ising Transverse Field Ising Hamiltonian, Rx and Ry single qubit rotations and the Hadamard gate). In addition, the code includes the possibility to use the Control Variates (CV) correction on the infidelity stochastic estimator to improve its signal to noise ratio and reduce the sampling overhead by orders of magnitudes.

Content of the repository

  • netket_fidelity : folder containing the following several subfolders:
    • infidelity: contains the infidelity operator.
    • operator: contains the jax-compatible operators for U.
    • driver: contains the driver for infidelity optimization.
  • examples: folder containing some examples of application.
  • test: folder containing tests for the infidelity stochastic estimation and for the jax-compatible rotation operators.

Installation

This package is not registered on PyPi, so you must install it directly from GitHub. You can install either:

  • The latest version of the code available on GitHub, which might or might not work at the moment (in case it does not work, do open an issue with us). To do so, run the following line in your commandline:
pip install git+https://github.com/netket/netket_fidelity
  • The version corresponding to the revised version of the manuscript we submitted on the ArXiV/Quantum Journal (September 2023).
pip install "git+https://github.com/netket/[email protected]"
  • You can download this repository and install it manually in editable mode
git clone https://github.com/netket/netket_fidelity
pip install -e ./netket_fidelity

Example of usage

import netket as nk
import netket_fidelity as nkf

# Create the Hilbert space and the variational states |ψ⟩ and |ϕ⟩
hi = nk.hilbert.Spin(0.5, 4)
sampler = nk.sampler.MetropolisLocal(hilbert=hi, n_chains_per_rank=16)
model = nk.models.RBM(alpha=1, param_dtype=complex, use_visible_bias=False)
phi = nk.vqs.MCState(sampler=sampler, model=model, n_samples=100)
psi = nk.vqs.MCState(sampler=sampler, model=model, n_samples=100)

# Transformation U
U = nkf.operator.Hadamard(hi, 0)

# Create the driver
optimizer = nk.optimizer.Adam(learning_rate=0.01)
te =  nkf.driver.InfidelityOptimizer(phi, optimizer, U=U, U_dagger=U, variational_state=psi, is_unitary=True, cv_coeff=-1/2)

# Run the driver
te.run(n_iter=100)

How to cite

If you use netket_fidelity in your work, please consider citing it as:

@software{netket_fidelity,
    author = {Sinibaldi, Alessandro and Vicentini, Filippo},
    title = {netket\_fidelity package},
    url = {https://github.com/netket/netket_fidelity},
    doi = {10.5281/zenodo.8344170},
    version = {0.0.2},
    year = {2023}
    }

netket_fidelity's People

Contributors

philipvinc avatar allesini99 avatar mboky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.