Coder Social home page Coder Social logo

javinoram / vqepy Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 1.82 MB

An open source Python package for molecular and condensed matter VQE research

License: MIT License

Python 100.00%
condensed-matter-physics quantum-chemistry quantum-computing variational-quantum-eigensolver quantum-simulation

vqepy's Introduction

VqePy

Installation

VqePy requires Python 3.9 or newer.

To install VqePy on macOS or Linux, open a terminal and run:

python3 -m pip install vqepy

Other way to do it, is clone the repository and and call all the functions adding the PATH.

Tesis project

This library was a project to get a degree in computer science in the UTFSM University.

The main idea is implement a few variational quantum algorithms to study condensed matter and chemistry models and give a basic template to study complex phenomena. This project didnt want to be another quantum library. This should be see as a high level implementation to study systems with a fixed route to be executed, so, the user only need to give the parameters and just the minimun programming is needed.

Parameters

Here, all the parameters of each class are listed.

Hamiltonians

Molecules

The parameters considered here, come from the definition of the methods defined in pennylane Molecular. Here we list the ones considered:

  1. Mapping (mapping).
  2. Charge (charge).
  3. Multiplicity (mult).
  4. Basis set (basis).
  5. Differential method (method).
  6. Active electrons (active_electrons).
  7. Active orbitals (active_orbitals).

We recomended to not let any of this as a None value, to have a correct execution.

Fermi-Hubbard

The parameters considered here, come from the definition of the hamiltonian indicated here Tenpy Hamiltonian. Here we list the ones considerated:

  1. t hopping (hopping).
  2. On-site potencial U (U).
  3. Potencial V (V).
  4. Electric field (E).
  5. Number of sites (sites).

We recomended to not let any of this as a None value, to have a correct execution.

Fermi-Hubbard

The parameters considered here, come from the definition of the hamiltonian indicated here Wikipedia Hamiltonian. Here we list the ones considerated:

  1. Exchange's vector (J): [Jx, Jy, Jz] .
  2. Magnetic field's vector (h): [hx, hy, hz] .
  3. Number of spins (sites).

The values of the exchange and magnetic field are the same for all the corresponding terms. We recomended to not let any of this as a None value, to have a correct execution.

Ansatz

Here there are a lot of element of the base library to take into account, i recommended review:

  1. Base
  2. Interface
  3. Differential method

UCCSD Ansatz

This ansatz should be use with molecules and Fermi-Hubbard hamiltonian

  1. Number of repetitions of the curcuit (repetitions): Here the number should 1
  2. Base structure for circuits execution(base)
  3. Interface of execution of the circuits (interface)
  4. Number of electrons of the system (electrons)
  5. Number of qubits of the circuit (qubits).
  6. Differential method of the ansatz (diff_method): adjoint and best is recommended.

k-UpCCGSD Ansatz

This ansatz should be use with molecules and Fermi-Hubbard hamiltonian

  1. Number of repetitions of the curcuit (repetitions)
  2. Base structure for circuits execution(base)
  3. Interface of execution of the circuits (interface)
  4. Number of electrons of the system (electrons)
  5. Number of qubits of the circuit (qubits).
  6. Differential method of the ansatz (diff_method): adjoint and best is recommended.

Hardware Efficient Ansatz

This ansatz should be use with spin system

  1. Number of repetitions of the curcuit (repetitions)
  2. Base structure for circuits execution(base)
  3. Interface of execution of the circuits (interface)
  4. Number of electrons of the system (electrons)
  5. Number of qubits of the circuit (qubits).
  6. Differential method of the ansatz (diff_method): adjoint and best is recommended.
  7. Pattern of the non local gates (pattert): chain or ring

There also the begin state of size 2**n that is needed.

Custom Ansatz

This ansatz should be use with molecules and Fermi-Hubbard hamiltonian

  1. Number of repetitions of the curcuit (repetitions)
  2. Base structure for circuits execution(base)
  3. Interface of execution of the circuits (interface)
  4. Number of electrons of the system (electrons)
  5. Number of qubits of the circuit (qubits).
  6. Differential method of the ansatz (diff_method): adjoint and best is recommended.

Other elements are the set of singles and doubled given gates obteined from the ADAPT-VQE. There also the begin state of size 2**n.

Optimizers

Pennylane's optimizers

  1. Number of parameters (number).
  2. Maximum number of iterations (maxiter).
  3. Theta optimizer (theta): list of optimizer (generic, adam or adagrad) and learning rate.
  4. X optimizer (x): list of optimizer (generic, adam or adagrad) and learning rate.
  5. Tolerance of relative error (tol).

Scipy's optimizers

  1. Number of parameters (number).
  2. Maximum number of iterations (maxiter).
  3. Optimizer scipy method section (type).
  4. Tolerance of relative error (tol).

Adapt optimizer

  1. Maximum number of iterations (maxiter).
  2. Optimizer (theta): list of optimizer (generic) and learning rate.
  3. Tolerance of relative error (tol).
  4. Number of electrons (electrons).
  5. Number of qubits (qubits).
  6. Sz proyection value (sz) (I recommend keek that value as 0).

Jax's optimizers

  1. Number of parameters (number).
  2. Maximum number of iterations (maxiter).
  3. Theta optimizer (theta): list of optimizer (adam or adagrad) and learning rate.
  4. X optimizer (x): list of optimizer (adam or adagrad) and learning rate.
  5. Tolerance of relative error (tol).

Lattice

For the construction of the lattice, we use the library networkx, for the purpose of the code, the parameters are the following:

  1. Bound type (bound): boolean value, open (false) and periodic (close).
  2. Lattice type (lattice): chain, triangle, square, hexagon.
  3. Size of the lattice (size): tuple of integers (x,y).

I recommended reviewing my repository my codes, where I have a few workflows using this code to compute VQE in molecules and 1D Fermi-Hubbard. This could be helpful to understand how to use it.

vqepy's People

Contributors

javinoram avatar

Stargazers

 avatar

Watchers

 avatar

vqepy's Issues

Refactor code

Considering the new versions of the libraries, do an review and correction of any changes that affect the workflows and see new functionalities.

Adding custom lattice

Create functions that allows us to create customs lattices for fermi-hubbard and spin 0.5, the output should be equal to the library networkx.
Input: List of tuples that represent the lattice.
Output: List of nodes and paths in networkx format.

Compute exact diagonalization

Numpy matrix

Create a function that can take Pennylane's hamiltonian into a numpy array, this function should be into the classes

Numpy eigenvector and eigenvalues

Create a general function that can compute the eigenvector and eigenvalues of any square matrix.

Test for the H2

Construct a test that build the hamiltonian for the H2 molecule using different optimizers and see that give the same value (with a tolerance of 1e-6).

Add new model

Add an spin model for an arbitrary value of spin, a boson-fermi hubbard and a fermi hubbard that consider more than two fermions per site.

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.