tvha
Implementation of the (truncated) Variational Hamiltonian Ansatz (VHA/tVHA) for calculation of ground state energies of molecular systems as well as other systems described by Hamiltonians consisting of Fermionic operators.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.2%) to scientific vocabulary
Repository
Implementation of the (truncated) Variational Hamiltonian Ansatz (VHA/tVHA) for calculation of ground state energies of molecular systems as well as other systems described by Hamiltonians consisting of Fermionic operators.
Basic Info
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
truncated Variational Hamiltonian Ansatz
This repository contains the source code for the Variational Hamiltonian Ansatz VHA and its variant truncated Variational Hamiltonian Ansatz tVHA. It is based on the code of Qiskit and Qiskit Nature.
Installation
Download this package from tVHA homepage or clone it via git git clone git@github.com:cpossel/tvha.git.
Go into the main folder of the downloaded folder and run
bash
pip install .
For developers it is recommended to run
bash
pip install -e .[develop]
To check whether the installation was successful, one can run pip show tvha.
If you are on a Linux system or use WSL, installation is complete after above step. On Windows systems, please check below section.
First steps
The best starting point is to go to the examples folder and check out the files there.
Chemistry Drivers for Windows
A computational chemistry program/library, called "driver", is needed in addition to the Python packages listed in pyproject.toml.
By default, PySCF is already installed on Linux when you follow above instructions.
Since the recommended driver PySCF does not support Windows, the recommended way is to install WSL. If you still want to stick to Windows, you can find the installation instructions below.
For Windows, these drivers are available:
Please be aware that the code must be adjusted in some places to use these drivers instead of PySCF.
PSI4 (Windows)
powershell
cd path/to/this/repo
conda create -n my_qiskit_env
conda activate my_qiskit_env
conda install psi4 python=3.12 -c psi4 -c conda-forge
pip install .
Above commands create a new conda environment called my_qiskit_psi4_env and install all required packages into it.
Since installing PSI4 is sometimes troublesome, please follow above commands closely.
It is important to create a new empty environment from the command line without any python version or package specified before installing PSI4 as done with above commands.
Using the Anaconda GUI to create an empty environment didn't work during testing.
Test in a python shell if the installation of PSI4 succeeded:
python
import psi4
PyQuante (Windows)
powershell
conda install -c rpmuller pyquante2_pure
PyQuante is not actively maintained and contains only very basic functionality. So, use it only if you have no other choice.
Gaussian (Windows)
See Qiskit/Gaussian and Gaussian.
Below guide assumes Gaussian is installed in C:\G16W\. You should adjust the path accordingly.
Add
g16.exetoPATHIn conda environment (easiest permanent solution; see also https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#setting-environment-variables):
powershell conda env config vars set PATH="$env:PATH;C:\G16W"Check if it succeeded (might need
conda activate <my_env>for changes to take place):powershell $env:PATHor
powershell conda env config vars listIf successful, a warning about overwriting the
PATHenvironment variable arises everytime the conda environment is launched. During 'overwriting' only a path is appended and nothing deleted, so this shouldn't (hopefully) pose any problem.Alternatively one of the following approaches can be used (non-permanent):
- In python (before all other imports):
```python
import os
os.environ["PATH"] += ";C:\G16W"
```
- Or in powershell (before starting the python script):
```powershell
$env:Path += ";C:\G16W"
```
Set GAUSS_EXEDIR environment variable
Add
GAUSS_EXEDIR=C:\G16Wpermanently to the currently active conda environment:powershell conda env config vars set GAUSS_EXEDIR=C:\G16WCheck if it succeeded (might need
conda activate <my_env>for changes to take place):powershell $env:GAUSS_EXEDIRor
powershell conda env config vars listNow everything should be set up correctly.
You might get one of the following errors:
ImportError: DLL load failed while importing qcmatrixio: Das angegebene Modul wurde nicht gefunden.(The specified module was not found.)qiskit_nature.exceptions.QiskitNatureError: 'qcmatrixio extension not found. See Gaussian driver readme to build qcmatrixio.F using f2py'
The missing module can be installed via
powershell conda install -c anaconda intel-fortran-rtAlternatively, one can try
conda install icc_rt.
Troubleshooting
If you have issues and the documentation didn't help, feel free to open an issue (see also CONTRIBUTING) or write an email to clemens.possel@ict.fraunhofer.de. Be aware that this software comes with no warranty and all support is purely voluntarily.
Contribute your own code
See CONTRIBUTING
How to cite this work
Feel free to use this software. Please be aware that any work and results based on this software shall cite this work (see also license). Therefore use the following publication (or extract it from CITATION.cff):
Possel, C., Hahn, W., Shirazi, R., Walt, M., Pinski, P., Wilhelm, F. K., & Bagrets, D. (2025). Truncated Variational Hamiltonian Ansatz: efficient quantum circuit design for quantum chemistry and material science. arXiv preprint arXiv:2505.19772.
Further publications based on this software are listed here:
Illésová, S., Novák, V., Bezděk, T., Beseda, M., & Possel, C. (2025). Numerical Optimization Strategies for the Variational Hamiltonian Ansatz in Noisy Quantum Environments. arXiv preprint arXiv:2505.22398.
Owner
- Name: Clemens Possel
- Login: cpossel
- Kind: user
- Repositories: 1
- Profile: https://github.com/cpossel
Citation (CITATION.cff)
cff-version: 1.2.0
title: truncated Variational Hamiltonian Ansatz
authors:
- given-names: Clemens
family-names: Possel
email: clemens.possel@ict.fraunhofer.de
affiliation: Fraunhofer Institute for Chemical Technology ICT
orcid: "https://orcid.org/0000-0002-1859-7533"
message: >-
If you use this software, please cite it as below.
type: software
identifiers:
- type: url
value: "https://github.com/cpossel/tvha"
repository-code: "https://github.com/cpossel/tvha"
abstract: >-
Implementation of the (truncated) Variational Hamiltonian Ansatz (VHA/tVHA)
for calculation of ground state energies of molecular systems as well as
other systems described by Hamiltonians consisting of Fermionic operators.
keywords:
- quantum computing
- quantum chemistry
- Variational Quantum Eigensolver VQE
- Variational Hamiltonian Ansatz VHA
- NISQ
- active space methods
license: CC-BY-4.0
preferred-citation:
type: misc
title: "Truncated Variational Hamiltonian Ansatz: efficient quantum circuit design for quantum chemistry and material science"
authors:
- given-names: Clemens
family-names: Possel
email: clemens.possel@ict.fraunhofer.de
affiliation: Fraunhofer Institute for Chemical Technology ICT
orcid: "https://orcid.org/0000-0002-1859-7533"
- given-names: Walter
family-names: Hahn
email: walter.hahn@iaf.fraunhofer.de
affiliation: Fraunhofer Institute for Applied Solid-State Physics IAF
orcid: "https://orcid.org/0000-0003-4355-2019"
- given-names: Reza
family-names: Shirazi
email: reza.shirazi@quantumsimulations.de
affiliation: HQS Quantum Simulations GmbH
orcid: "https://orcid.org/0009-0000-7622-3161"
- given-names: Marina
family-names: Walt
email: marina.walt@quantumsimulations.de
affiliation: HQS Quantum Simulations GmbH
orcid: "https://orcid.org/0000-0002-4147-9420"
- given-names: Peter
family-names: Pinski
email: peter.pinski@quantumsimulations.de
affiliation: HQS Quantum Simulations GmbH
orcid: "https://orcid.org/0000-0003-2874-6843"
- given-names: Frank K.
family-names: Wilhelm
email: f.wilhelm-mauch@fz-juelich.de
affiliation: Forschungszentrum Jülich
orcid: "https://orcid.org/0000-0003-1034-8476"
- given-names: Dmitry
family-names: Bagrets
email: d.bagrets@fz-juelich.de
affiliation: Forschungszentrum Jülich
orcid: "https://orcid.org/0000-0002-3985-4834"
doi: "10.48550/arXiv.2505.19772"
year: 2025
archivePrefix: arXiv
primaryClass: quant-ph
url: https://arxiv.org/abs/2505.19772,
abstract: >-
Quantum computing has the potential to revolutionize quantum
chemistry and material science by offering solutions to complex problems unattainable
with classical computers. However, the development of efficient quantum algorithms
that are efficient under noisy conditions remains a major challenge. In this article, we
introduce the truncated Variational Hamiltonian Ansatz (tVHA), a novel circuit design
for conducting quantum calculations on Noisy Intermediate-Scale Quantum (NISQ)
devices. tVHA provides a promising approach for a broad range of applications
by utilizing principles from the adiabatic theorem in solid state physics. The
proposed ansatz significantly reduces the parameter count and can decrease circuit
size substantially, with a trade-off in accuracy. Thus, tVHA facilitates easier
convergence within the variational quantum eigensolver framework compared to state-
of-the-art ans ̈atze such as Unitary Coupled Cluster (UCC) and Hardware-Efficient
Ansatz (HEA). While this article concentrates on the practical applications of tVHA
in quantum chemistry, demonstrating its suitability for both weakly and strongly
correlated systems and its compatibility with active space calculations, its underlying
principles suggest a wider applicability extending to the broader field of material science
computations on quantum computing platforms.
GitHub Events
Total
- Release event: 2
- Watch event: 1
- Push event: 1
- Create event: 4
Last Year
- Release event: 2
- Watch event: 1
- Push event: 1
- Create event: 4
Dependencies
- matplotlib >=3.10
- nlopt >=2.9
- numpy >=2.2
- opt_einsum >=3.4
- pandas >=2.2
- pyjson5 >=1.6
- pyscf >=2.9;sys_platform=='linux'
- qiskit >=1.4,<2
- qiskit_algorithms >=0.3.1
- qiskit_machine_learning >=0.9
- qiskit_nature >=0.7
- tqdm >=4.67