Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

8 changes: 8 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
image: python:3.6

test:
tags:
- github
script:
- pip install -r requirements.txt
- pytest
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include LICENSE
include NOTICE
include README.md
include requirements.txt
include VERSION.txt
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
The Rigetti Forest Plugin for OpenFermion
=========================================

> **NOTE**: This repository is not being actively developed at Rigetti, and therefore we have
decided to archive it. It should work in its current state, but if you find issues or would like
to suggest that we re-open development on this project (or, even better, if you would like to
develop it!) please send us an email at [[email protected]](mailto:[email protected]).

[![pipeline status](https://gitlab.com/rigetti/forest/forest-openfermion/badges/master/pipeline.svg)](https://gitlab.com/rigetti/forest/forest-openfermion/commits/master)
[![Build Status][semaphore-badge]][semaphore-project]

[OpenFermion](http://openfermion.org) is an open source package for compiling and analyzing
[OpenFermion](http://openfermion.org) is an open-source package for compiling and analyzing
quantum algorithms that simulate fermionic systems. This plugin library allows the circuit
construction and simulation environment [Forest](http://www.rigetti.com/forest) to
interface with OpenFermion.
Expand All @@ -26,13 +32,13 @@ pip install -e .
Alternatively, one can install the last major release from PyPI via:

```bash
pip install forestopenfermion
pip install forest-openfermion
```

Development and Testing
-----------------------

We use `pytest` for testing. Tests can be executed from the top-level directory by simply running:
Tests can be executed from the top-level directory by simply running:

```bash
pytest
Expand Down
1 change: 1 addition & 0 deletions forest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
30 changes: 30 additions & 0 deletions forest/openfermion/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from forest.openfermion.pyquil_circuit_generator import exponentiate, TimeEvolution

from forest.openfermion.pyquil_connector import pyquilpauli_to_qubitop, qubitop_to_pyquilpauli

from forest.openfermion.rdm_estimation import (pauli_terms_for_tpdm,
pauli_to_tpdm,
pauli_terms_for_tpdm_aa,
pauli_terms_for_tpdm_bb,
pauli_terms_for_tpdm_ab,
pauli_to_tpdm_aa,
pauli_to_tpdm_bb,
pauli_to_tpdm_ab)

from forest.openfermion.rdm_utilities import (get_sz_spin_adapted,
unspin_adapt,
pauli_term_from_string,
pauli_term_relabel,
pauli_dict_relabel)
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"""
An interface from OpenFermion QubitObjects to some of the circuit generating functionality in pyquil
"""
from forestopenfermion.pyquil_connector import qubitop_to_pyquilpauli
from openfermion.ops import QubitOperator

from pyquil.quil import Program
from pyquil.paulis import exponentiate as pyquil_exponentiate

from forest.openfermion.pyquil_connector import qubitop_to_pyquilpauli


def exponentiate(qubit_operator):
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
"""
A module for generating pauli terms corresponding to the 2-RDMs
"""
import numpy as np
from itertools import product
from grove.measurements.estimation import (remove_imaginary_terms,
estimate_pauli_sum,

import numpy as np
from grove.measurements.estimation import (remove_imaginary_terms, estimate_pauli_sum,
remove_identity)
from grove.measurements.term_grouping import commuting_sets_by_zbasis
from pyquil.paulis import PauliTerm, PauliSum

from openfermion.transforms import jordan_wigner
from openfermion.ops import FermionOperator
from forestopenfermion.rdm_utilities import (pauli_dict_relabel,
pauli_term_relabel)
from forestopenfermion.pyquil_connector import qubitop_to_pyquilpauli
from pyquil.paulis import PauliTerm, PauliSum

from forest.openfermion.rdm_utilities import pauli_dict_relabel, pauli_term_relabel
from forest.openfermion.pyquil_connector import qubitop_to_pyquilpauli


def _measure_list_of_pauli_terms(pauli_terms, variance_bound, program,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""
Utilities for RDMs
"""
import numpy as np
from itertools import product

import numpy as np
from pyquil.paulis import PauliTerm, PauliSum


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"""
import pytest
import numpy as np
from openfermion.ops import (FermionOperator,
from openfermion.ops import (FermionOperator,
QubitOperator, InteractionOperator,
InteractionRDM)
from openfermion.utils import hermitian_conjugated
from openfermion.transforms import jordan_wigner
from forestopenfermion.pyquil_connector import (pyquilpauli_to_qubitop,
qubitop_to_pyquilpauli)
from pyquil.paulis import PauliTerm, PauliSum

from forest.openfermion.pyquil_connector import pyquilpauli_to_qubitop, qubitop_to_pyquilpauli


def test_confirm_interface():
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Testing interface to pyqui.paulis"""
import numpy as np
import pytest
import numpy as np
from openfermion.ops import QubitOperator, FermionOperator
from forestopenfermion.pyquil_circuit_generator import exponentiate, TimeEvolution
from pyquil.gates import H, RX, CNOT, RZ
from pyquil.quil import Program

from forest.openfermion.pyquil_circuit_generator import exponentiate, TimeEvolution


def test_exponentiate():
one_pauli_term = QubitOperator('X0 Y2 Z3')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
Test RDM acquisition for accuracy
"""
import os

import numpy as np
from forestopenfermion.rdm_estimation import (pauli_terms_for_tpdm,
from openfermion.config import DATA_DIRECTORY
from openfermion.hamiltonians import MolecularData
from pyquil.paulis import term_with_coeff

from forest.openfermion.pyquil_connector import pyquilpauli_to_qubitop
from forest.openfermion.rdm_estimation import (pauli_terms_for_tpdm,
pauli_to_tpdm,
pauli_terms_for_tpdm_aa,
pauli_terms_for_tpdm_bb,
pauli_terms_for_tpdm_ab,
pauli_to_tpdm_aa,
pauli_to_tpdm_bb,
pauli_to_tpdm_ab)

from forestopenfermion.rdm_utilities import get_sz_spin_adapted

from forestopenfermion.pyquil_connector import pyquilpauli_to_qubitop
from openfermion.config import DATA_DIRECTORY
from openfermion.hamiltonians import MolecularData
from pyquil.paulis import term_with_coeff
from forest.openfermion.rdm_utilities import get_sz_spin_adapted


def test_h2_tpdm_build():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"""
import os
import numpy as np
from forestopenfermion.rdm_utilities import (get_sz_spin_adapted, unspin_adapt,
pauli_term_from_string,
pauli_dict_relabel,
pauli_term_relabel)
from openfermion.config import DATA_DIRECTORY
from openfermion.hamiltonians import MolecularData
from pyquil.paulis import PauliTerm

from forest.openfermion.rdm_utilities import (get_sz_spin_adapted, pauli_dict_relabel,
pauli_term_from_string, pauli_term_relabel,
unspin_adapt)


def test_spin_adapt_h2():
"""
Expand Down
File renamed without changes.
32 changes: 0 additions & 32 deletions forestopenfermion/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ quantum-grove < 2.0.0

# for testing
pytest

12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from setuptools import setup

if sys.version_info < (3, 6):
raise ImportError('The forestopenfermion library requires Python 3.6 or above.')
raise ImportError('The forest-openfermion library requires Python 3.6 or above.')

with open('README.md', 'r') as f:
long_description = f.read()
Expand All @@ -28,15 +28,15 @@
__version__ = f.read().strip()

# save the source code in version.py
with open('forestopenfermion/version.py', 'r') as f:
with open('forest/openfermion/version.py', 'r') as f:
version_file_source = f.read()

# overwrite version.py in the source distribution
with open('forestopenfermion/version.py', 'w') as f:
with open('forest/openfermion/version.py', 'w') as f:
f.write(f'__version__ = \'{__version__}\'\n')

setup(
name='forestopenfermion',
name='forest-openfermion',
version=__version__,
author='Rigetti Computing',
author_email='[email protected]',
Expand All @@ -51,10 +51,10 @@
'pyquil >= 2.0.0, < 3.0.0',
'quantum-grove < 2.0.0'
],
packages=['forestopenfermion'],
packages=['forest.openfermion'],
python_requires='>=3.6'
)

# restore version.py to its previous state
with open('forestopenfermion/version.py', 'w') as f:
with open('forest/openfermion/version.py', 'w') as f:
f.write(version_file_source)