Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QMF and QCC capabilities and tests; small fix to scbk transform in statvector_mapping.py when n_spinorbitals == 4. #91

Merged
merged 28 commits into from
Dec 8, 2021

Conversation

MPCoons
Copy link
Collaborator

@MPCoons MPCoons commented Nov 17, 2021

No description provided.

…s and tests; small fix to scbk in transform statvector_mapping.py when n_spinorbitals == 4.
@MPCoons MPCoons changed the title Creating qcc branch off staging-0.3.0; adding QMF and QCC capabilitie… Add QMF and QCC capabilities and tests; small fix to scbk transform in statvector_mapping.py when n_spinorbitals == 4. Nov 17, 2021
@MPCoons
Copy link
Collaborator Author

MPCoons commented Nov 19, 2021

Hey guys, I am struggling to resolve two failures during testing, both related to H4, and need some help. I thought I heard Alexandre say yesterday that H4 issues were resolved, but maybe I misunderstood.

Here are some details:

  1. The functions test_qmf_qcc_H4(self) and test_qcc_H4(self) in test_qcc.py always fail. Both attempt to compute the closed-shell ground state QCC energy for H4 with user-specified generators and variational parameter sets.

  2. The test_qmf_qcc_H4() and test_qcc_H4() functions differ in that the former demonstrates how to create a combined QMF+QCC circuit that treats both parameter sets variationally and the latter shows how to create a combined QMF+QCC circuit where only the QCC parameters are variational.

  3. The JW mapping is used and when used with QCC-based methods, it requires up_then_down=True due to the DIS screening procedure implementation.

  4. The generators and variational parameter sets were obtained by performing VQE simulations using the QMF and QCC classes in qSDK. I used the attached script to do this.

Thanks

qcc_vqe.txt
.

@JamesB-1qbit
Copy link
Contributor

Hi Marc,

The Hamiltonian for H4 that is generated appears to be non-deterministic. I believe this is due to sign switches in the eigenvectors of the Fock-Matrix when generating the mean-field. Three choices.

  1. Use a saved Hamiltonian for H4 as input instead of the molecule.
  2. Remove the the H4 test.
  3. Keep the code there but skip the test. You can always remove the line that skips the test when running it for personal testing.

You can skip the test by using unittest.skip as below.

@unittest.skip("non-deterministic Hamiltonian (or whatever message you think helps)")
def test_qmf_qcc_H4(self):

Copy link
Contributor

@JamesB-1qbit JamesB-1qbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the code structure and flow looks great!

There are multiple syntax issues that would be caught by a python linter. If you need help setting that up let me know.

Other comments:

  1. Spin should be included in state preparation and mapping transform
  2. You should try and include QMF and QCC into BuiltInAnsatz and VQESolver

tangelo/toolboxes/ansatz_generator/_qubit_cc.py Outdated Show resolved Hide resolved
tangelo/toolboxes/ansatz_generator/_qubit_cc.py Outdated Show resolved Hide resolved
tangelo/toolboxes/ansatz_generator/_qubit_cc.py Outdated Show resolved Hide resolved
tangelo/toolboxes/ansatz_generator/_qubit_cc.py Outdated Show resolved Hide resolved
tangelo/toolboxes/ansatz_generator/_qubit_cc.py Outdated Show resolved Hide resolved
tangelo/toolboxes/ansatz_generator/tests/test_qcc.py Outdated Show resolved Hide resolved
tangelo/toolboxes/ansatz_generator/tests/test_qmf.py Outdated Show resolved Hide resolved
tangelo/toolboxes/ansatz_generator/tests/test_qmf.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@alexfleury-sb alexfleury-sb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the separation of the code in many files like _qubit_cc.py and _qubit_mf.py, it is clean.

I only have small comments in my review. I would also suggest to add a test or two in tangelo.algorithms.variational.tests/test_vqe_solver.py for letting the parameter optimization do its thing (after the addition in BuiltInAnsatze like James suggested). It would test the "all default" computation with QCC and/or QMF ansatze.

tangelo/toolboxes/ansatz_generator/_qubit_mf.py Outdated Show resolved Hide resolved
tangelo/toolboxes/ansatz_generator/_qubit_mf.py Outdated Show resolved Hide resolved
tangelo/toolboxes/ansatz_generator/qcc.py Outdated Show resolved Hide resolved
tangelo/toolboxes/ansatz_generator/qmf.py Outdated Show resolved Hide resolved
@MPCoons
Copy link
Collaborator Author

MPCoons commented Nov 30, 2021

James and Alexandre,
Thanks so much for your feedback. It has been helpful for me and I have learned some new things. I think I addressed, or at least attempted to, all the points in both of your reviews. Since a lot of them were formatting related, I decided not to reply to each comment, just a few of them.

James, thanks for mentioning that I should use python linter. I ended up making significant changes (hopefully for the better) to the code as I was playing around with and learning the tool. Also, thanks for pointing out that I should be using spin for state preparation and mapping. I think I have that all squared away now. As I mentioned to Alexandre, QMF and QCC are in VQESolver and I added QMF and QCC tests for H2, H4, and H4+. They seem to be failing though, so I may have to revise that a bit.

@JamesB-1qbit
Copy link
Contributor

James and Alexandre, Thanks so much for your feedback. It has been helpful for me and I have learned some new things. I think I addressed, or at least attempted to, all the points in both of your reviews. Since a lot of them were formatting related, I decided not to reply to each comment, just a few of them.

James, thanks for mentioning that I should use python linter. I ended up making significant changes (hopefully for the better) to the code as I was playing around with and learning the tool. Also, thanks for pointing out that I should be using spin for state preparation and mapping. I think I have that all squared away now. As I mentioned to Alexandre, QMF and QCC are in VQESolver and I added QMF and QCC tests for H2, H4, and H4+. They seem to be failing though, so I may have to revise that a bit.

I think we are very close. Almost everything has been addressed. The only thing that has not been resolved is having only one empty line at the end of each file. Most of your files have 2.

@MPCoons
Copy link
Collaborator Author

MPCoons commented Nov 30, 2021

Great. That is strange. I am looking at the files now and they all have just one line at the end.

Found a few typos and I simplified the Hamiltonian penalty stuff in qmf.py. I will push those changes in a few minutes.

I set a delta to 1e-2 in one of the test_vqe_solver.py tests. Thought it was a bit high but wanted to see if you guys said anything. Is that fine? The QCC H4 energy fluctuates significantly.

@alexfleury-sb
Copy link
Collaborator

alexfleury-sb commented Nov 30, 2021

  • Concerning the set-up of up_then_down=True in VQESolver for QCC, it is not that odd. We already doing this with scBK, but we print a warning just to let the user know. I tried to find this warning (to show it as an example), but I think it has been removed in the last PR, can you confirm @JamesB-1qbit?
  • 1e-2 seems a bit too high. Is it only with H4, or it does the same thing with H2? I would suggest to only keep H2 if the former works fine consistently. A constant QCC circuit for H4 can be a sufficient test in the ansatz_generator like it is already done (without optimizing the whole thing).
  • Thanks for changing the calc_op_expval function definition! I like this better.

Copy link
Collaborator

@ValentinS4t1qbit ValentinS4t1qbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work overall, most comments are me pointing out the same sort of situation several times. overall:

  • Avoid randomness in testing. Either remove the randomness from the algorithm if relevant, or run the random algorithm and "freeze" certain values in the test (e.g provide them as input) to be able to reproduce that thing everytime.

  • If we know exactly what statement may cause an error and can use a if statement to raise the error in the appropriate situation, lets use that instead of try and except.

  • types in docstrings need to be in parentheses, you're not always consistent. The type itself does not matter too much as what you write is read by a human in the docs.

  • Some little tips about list comprehension and sum.

tangelo/algorithms/variational/vqe_solver.py Show resolved Hide resolved
2^nq - 1 generators, where nq is the number of qubits. By constructing the DIS,
it is possible to identify O(N * 2^nq - 1) generators that are strong energy-
lowering candidates for the QCC ansatz at a cost of O(N) gradient evaluations.
In constrast, a brute force strategy requires O(4^nq) gradient evaluations.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contrast
brute-force

"""This module implements functions to create the direct interaction set (DIS)
of generators for the qubit coupled cluster (QCC) ansatz and is based on Ref. 1
below. The DIS consists of generator groups that are characterized by the
magnitude of the QCC energy gradient with respect to a variational paramter tau,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parameter

operators and with an odd number of Y operators.

Args:
qmf_var_params numpy array of float: The QMF variational parameter set {Omega}.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to specify the type in parentheses in the proper way here. We probably have examples online or somewhere else in the codebase.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this was a mistake on my part. I misunderstood a comment from a reviewer for things like list of list or tuple of list, etc. and removed them. I've added them all back in.

tangelo/toolboxes/ansatz_generator/_qubit_cc.py Outdated Show resolved Hide resolved
# Supported reference state initialization
self.supported_reference_state = {"HF"}
# Supported var param initialization
self.supported_initial_var_params = {"zeros", "ones", "random"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment below

with a user-specified Hamiltonian (e.g. a penalized mean field qubit Hamiltonian from
a mean field simulation with the QMF ansatz class). If not None, then the fermionic
Hamiltonian in molecule is ignored. Default, None.
qmf_var_params list or numpy array of float: The QMF parameter variational set {Omega}.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type

If None, build the QCC operator with one generator from each DIS group characterized by
|dEQCC/tau| >= qcc_deriv_thresh. If max_qcc_gens is an int, then use
min(size(DIS), max_qcc_gens) generators to build the QCC operator. Default, None.
qubit_op_list list of QubitOperator: A list of generators to use when building the QCC
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type

"""

import warnings
from random import choice
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be removed depending on what you do with your code

tangelo/toolboxes/ansatz_generator/ansatz.py Outdated Show resolved Hide resolved
…nd its test; a fix suggested suggested for qmf.py could be applied to nearly all other ansatz classes, so it was.
@MPCoons
Copy link
Collaborator Author

MPCoons commented Dec 3, 2021

Hello everyone, I want to let you know that I've finished going through all of the remaining comments from each of your reviews and pushed the code.

Copy link
Collaborator

@ValentinS4t1qbit ValentinS4t1qbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, a few more suggestions. Usually to clarify some code or propose a more concise alternatives. After this batch, we are probably good to merge !

for qham_items in qubit_ham.terms.items())
flip_idxs = list(filter(None, (get_idxs_deriv(q_gen[0], *q_gen[1]) for q_gen in qham_gen)))

candidates = {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ambiguous: please initialize this with dict() or set() :)
It can be underneath your L112 comment too, neatly grouped with the lines saying what it contains

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had that originally but I changed it based on the following output from pylint:

tangelo/toolboxes/ansatz_generator/_qubit_cc.py:108:17: R1735: Consider using {} instead of dict() (use-dict-literal)

No problem to use dict() so I'll change it. But out of curiosity, is this just a matter of style or is pylint making unsound suggestions?

# Create a list of Y operator indices.
xy_idxs = list(combinations(group_idxs, n_y))
for xy_idx in xy_idxs:
gen_list = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about replacing L175-179 by the L177 comment and just:
gen_list = [(idx, "Y") if idx in xy_idx else (idx, "X") for idx in group_idxs]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, i like it.

if verbose:
print_msg = f"Purified QMF_{i} Bloch angles: (theta, phi) = ({pure_var_params[i]},"\
f" {pure_var_params[i + n_qubits]})\n"
print(print_msg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could print it directly, too (L132), unless you feel readability or functionality is impaired

state to the current QMF state.
"""

pure_var_params, n_qubits = qmf_var_params.tolist(), qmf_var_params.size // 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need pure_var_params to be a list ? I see we cast it as a numpy array at L135, and we manipulate it using subscription ([ ])). I'm gonna assume that it's a trick to get a copy of qmf_var_params, which could be done direcly with numpy.copy instead or using a list as proxy: https://numpy.org/doc/stable/reference/generated/numpy.copy.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed a trick from the legacy code that needed adjusted. thanks

# Adjust the theta Bloch angles
for i, theta in enumerate(qmf_var_params[:n_qubits]):
c_0, c_1 = np.cos(0.5 * theta), np.sin(0.5 * theta)
if abs(c_0) >= abs(c_1):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since statements at L127-129 are complementary (e.g they cover all possibilities and the code necessarily takes a branch or the other), the 4 lines L127-130 can be refactored as

pure_var_params[i] = 0. if abs(c_0) >= abs(c_1) else np.pi

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally, the equality was not here and abs(c_0) == abs(c_1) was implied by an else clause that triggered a random choice of either 0 or pi for the theta value. I eliminated this after our discussion about non-deterministic codes. I'm still thinking about what the best thing to do in this situation.

I think I will go with my current plan, which is to use the HF occupation vector and reset the theta value to its original value based on the initial QMF state.

I moved the call to purify the QMF wave function outside of _qubit_cc.py and into qcc.py right before construct_dis is called so the purified qmf_var_params can be passed directly.

initial_var_params = np.array(var_params)
except AssertionError:
raise ValueError(f"Expected {self.n_var_params} variational parameters but received {len(var_params)}.")
elif np.array(var_params).size == self.n_var_params:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment about other ansatz

var_params = np.array(var_params)
except AssertionError:
raise ValueError(f"Expected {self.n_var_params} variational parameters but received {len(var_params)}.")
elif np.array(var_params).size == self.n_var_params:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see other comments

"""

def __init__(self, molecule, mapping="JW", up_then_down=False, qcc_guess=1.e-1,\
qcc_deriv_thresh=1.e-3, max_qcc_gens=None, qubit_op_list=None, qubit_mf_ham=None,\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we please align this with ( ?

tangelo/toolboxes/ansatz_generator/qcc.py Show resolved Hide resolved
initial_var_params = np.zeros((self.n_var_params,), dtype=float)
elif var_params == "qcc_guess":
initial_var_params = self.qcc_guess * np.ones((self.n_var_params,))
elif np.array(var_params).size == self.n_var_params:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments about other ansatz

Copy link
Collaborator

@ValentinS4t1qbit ValentinS4t1qbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, Marc !

@ValentinS4t1qbit ValentinS4t1qbit merged commit dfac037 into staging-0.3.0 Dec 8, 2021
ValentinS4t1qbit added a commit that referenced this pull request Feb 15, 2022
* Sphinx docs (#76)
* Fixing CCSDSolver.get_rdm() with frozen orbitals and energy from RDMs (#81)
* small fixes to allow initial density matrix for faster noisy sampling with cirq (#84)
* Branding (Tangelo, Good Chemistry Company) (#87)
* Name change: backendbuddy -> linq (#93)
* added multi-controls multi-targets, extra gates (#88)
* Add QMF and QCC capabilities and tests (#91)
* JKMN mapping implementation  (#95)
* added inverse function to Circuit (#78)
* added pycodestyle tests (#96)
* Circuit methods (repetition operator, equality, trim and split methods) (#101)
* Staged controlled time (#100)
* Support for name attribute in Circuit class (#110)
* Derandomized + Adaptive Classical Shadows (#111)
* added vsqs ansatz (#109)
* Staged richardson (#99)
* Majorana pool for ADAPT (#114)
* Copy gate data instead of referencing it when instantiation Circuit object (#118)
* Fixed QEMIST Cloud QPU connection ctrl-c in job_result. (#121)
* Estimate QPU cost with QEMIST Cloud API. (#120)
* Improvements for handling exp data with ClassicalShadow (#124)
* Qulacs operator build changed to fix memory leak (#122)


Co-authored-by: ValentinS4t1qbit <[email protected]>
Co-authored-by: AlexandreF-1qbit <[email protected]>
Co-authored-by: James Brown <[email protected]>
Co-authored-by: JamesB-1qbit <[email protected]>
Co-authored-by: MPCoons <[email protected]>
Co-authored-by: elloyd-1qbit <[email protected]>
Co-authored-by: KrzysztofB-1qbit <[email protected]>
Co-authored-by: Rudi Plesch <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
ValentinS4t1qbit added a commit that referenced this pull request Feb 16, 2022
* v0.3.0 into main (#127)

* Sphinx docs (#76)
* Fixing CCSDSolver.get_rdm() with frozen orbitals and energy from RDMs (#81)
* small fixes to allow initial density matrix for faster noisy sampling with cirq (#84)
* Branding (Tangelo, Good Chemistry Company) (#87)
* Name change: backendbuddy -> linq (#93)
* added multi-controls multi-targets, extra gates (#88)
* Add QMF and QCC capabilities and tests (#91)
* JKMN mapping implementation  (#95)
* added inverse function to Circuit (#78)
* added pycodestyle tests (#96)
* Circuit methods (repetition operator, equality, trim and split methods) (#101)
* Staged controlled time (#100)
* Support for name attribute in Circuit class (#110)
* Derandomized + Adaptive Classical Shadows (#111)
* added vsqs ansatz (#109)
* Staged richardson (#99)
* Majorana pool for ADAPT (#114)
* Copy gate data instead of referencing it when instantiation Circuit object (#118)
* Fixed QEMIST Cloud QPU connection ctrl-c in job_result. (#121)
* Estimate QPU cost with QEMIST Cloud API. (#120)
* Improvements for handling exp data with ClassicalShadow (#124)
* Qulacs operator build changed to fix memory leak (#122)


Co-authored-by: ValentinS4t1qbit <[email protected]>
Co-authored-by: AlexandreF-1qbit <[email protected]>
Co-authored-by: James Brown <[email protected]>
Co-authored-by: JamesB-1qbit <[email protected]>
Co-authored-by: MPCoons <[email protected]>
Co-authored-by: elloyd-1qbit <[email protected]>
Co-authored-by: KrzysztofB-1qbit <[email protected]>
Co-authored-by: Rudi Plesch <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
ValentinS4t1qbit added a commit that referenced this pull request Jun 16, 2022
* Bump develop to v0.3.0 (#127) (#128)

* v0.3.0 into main (#127)

* Sphinx docs (#76)
* Fixing CCSDSolver.get_rdm() with frozen orbitals and energy from RDMs (#81)
* small fixes to allow initial density matrix for faster noisy sampling with cirq (#84)
* Branding (Tangelo, Good Chemistry Company) (#87)
* Name change: backendbuddy -> linq (#93)
* added multi-controls multi-targets, extra gates (#88)
* Add QMF and QCC capabilities and tests (#91)
* JKMN mapping implementation  (#95)
* added inverse function to Circuit (#78)
* added pycodestyle tests (#96)
* Circuit methods (repetition operator, equality, trim and split methods) (#101)
* Staged controlled time (#100)
* Support for name attribute in Circuit class (#110)
* Derandomized + Adaptive Classical Shadows (#111)
* added vsqs ansatz (#109)
* Staged richardson (#99)
* Majorana pool for ADAPT (#114)
* Copy gate data instead of referencing it when instantiation Circuit object (#118)
* Fixed QEMIST Cloud QPU connection ctrl-c in job_result. (#121)
* Estimate QPU cost with QEMIST Cloud API. (#120)
* Improvements for handling exp data with ClassicalShadow (#124)
* Qulacs operator build changed to fix memory leak (#122)


Co-authored-by: ValentinS4t1qbit <[email protected]>
Co-authored-by: AlexandreF-1qbit <[email protected]>
Co-authored-by: James Brown <[email protected]>
Co-authored-by: JamesB-1qbit <[email protected]>
Co-authored-by: MPCoons <[email protected]>
Co-authored-by: elloyd-1qbit <[email protected]>
Co-authored-by: KrzysztofB-1qbit <[email protected]>
Co-authored-by: Rudi Plesch <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>

* Recomputing MF when working with atom indices in DMET (#130)

* Recomputing and testing MF when working with atom indexes. Change Localization import level.

* More gates for openqasm translator (#129)

* Added CZ, CY, CRz, CP, CSWAP and SWAP to openqasm translator

* fixed return for return_phase=False in trotterize (#133)

* fixed return for return_phase=False in trotterize

* ONIOM problem reformulation (#119)

* Updated ONIOM notebook use case

* QubitHamiltonian get_operators bug (#131)

* Fixed get_operators bug + added a test.

* Measurement map (#134)

* Measurement map + extending qwc partioning with repetition

* Working state, cleaning is wip.

* Givens gate (#135)

* added givens gate decomposition

Co-authored-by: ValentinS4t1qbit <[email protected]>

* Notebook classical shadow (#123)

Classical shadows notebook. It has been added to tests as well

Co-authored-by: ValentinS4t1qbit <[email protected]>

* added class to prepare or decompute an arbitrary statevector (#137)


* Many small todos (#138)
* Add an explanation how Circuit.reindex_qubits method is working.
* ClassicalShadows.simulate only unique circuit (massive speedup).
* Better management of backend options in VQESolver.
* CS notebook update.
* Comment fix for new return.
* No need of n_electrons with ref_state==zero.
* Change method for simulate (noisy?).

* Diag coulomb (#136)

* diagonalizing circuits implemented and tested

* improvements to jkmn leaf->majorana selection (#139)

* improvements to jkmn leaf->majorana selection

* Use of get_vector function.

* Change constructors -> classmethod.

* Change interface + working state.

* Stage where I have to write tests.

* Test for HybridOperator and Z2 tapering.

* Conformance tests + typos.

* Moved file + typos.

* Added tests for matrix manip.

* Full path of load_operator in tests.

* Permit all active orbitals partially occupied (#146)

* ONIOM capping with chemical groups (#141)

* Implementation for other chemical groups capping in ONIOM. Tests, docs.

* uccgd ansatz (#144)

* uccgd ansatz for use in SA-OO-VQE

* First round + added spin=\=0 fix.

* Support for symmetry, now call pyscf directly (#147)

* call pyscf directly, symmetry now supported

* Rotosolve implementation as an optimizer for parameterized circuits (#142)

* rotosolve implementation and tests

* ONIOM multisolvers (#143)

* Multisolver support in ONIOM
* Added others solvers to ONIOM, added tests and ROHF support (RHF->HF).

* sa_vqe_solver from sa-oo-vqe branch

* added import to __init__

* fixes for PR

* clearer documentation

* change statevector jkmn

* replaced jkmn_prep_circuit with jkmn_prep_vector

* Fixed error message.

* Some reviews.

* JKMN z2 tapering tests.

* Docstrings in tests.

* Speed improvement + bitwise operations + moved collapse function.

* Passing conformance tests.

* added state averaged orbital optimized files

* merged molecule symmetry changes

* Update test_hybridoperator.py

aligning.

* Hybrid -> Multiform.

* Small fixes.

* PR changes

* support for reading in xyz files (#151)

* support for reading in xyz files

* Update z2_tapering.py

* Update sa_oo_vqe_solver.py

* Ilc ansatz (#132)

* Add ILC ansatz class
* updates to qmf, qcc, and ilc ansatz classes
* enable QMF and ILC classes to read-in and process data from OpenFermion *.hdf5 files and other small fixes.

Co-authored-by: ValentinS4t1qbit <[email protected]>

* Updating information, and adding Windows install comment (#155)

* Quantum deflation (#152)

* added deflation
* added ref_states as circuit and to VQESolver
* added ref_state and deflation to adapt vqe

Co-authored-by: ValentinS4t1qbit <[email protected]>

* changed default basis to crenbl in pyscf, added ecp option (#156)

* changed default basis to crenbl for pyscf to retrieve number of electrons & atoms, added ecp option

* Cancel redundant gates (#153)

* Functions / methods to remove small rotations, and remove gates that cancel each other

* Circuit depth (#159)

* Depth method for Circuit class

* MI-FNO link (#157)

* MI-FNO helper class. Added tests + reconstruction of MI energy, support for building sermonic operators for fragments

* Iqcc solver (#154)

* iQCC solver, frobenius norm compression method on QubitOperator

Co-authored-by: ValentinS4t1qbit <[email protected]>

* MIFNO notebook (#161)

* MIFNO notebook. Added to tests and sphinx docs

Co-authored-by: Valentin Senicourt <[email protected]>
Co-authored-by: ValentinS4t1qbit <[email protected]>

* Docs fix + tutorials removal from sphinx docs (#162)

* Docs: requirements.txt no longer needed. Tutorials removed from generated docs (redundant with Github, issues with latex, looks better on github and will display images once repo is public

Co-authored-by: AlexandreF-1qbit <[email protected]>

* readme upgrade (#164)

* readme upgrade and images, contributions.rst for code of conduct mention

* Fixes for docs and readme, files for Pypi (#166)

* Docs and readme fixed with feedback. Pypi file removed as it hinders the installation from source process: a guide will be provided to maintainer team for pypi update.

Co-authored-by: AlexandreF-1qbit <[email protected]>

* Version number and changelogs bumped

Co-authored-by: AlexandreF-1qbit <[email protected]>
Co-authored-by: James Brown <[email protected]>
Co-authored-by: JamesB-1qbit <[email protected]>
Co-authored-by: MPCoons <[email protected]>
Co-authored-by: elloyd-1qbit <[email protected]>
Co-authored-by: KrzysztofB-1qbit <[email protected]>
Co-authored-by: Rudi Plesch <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
ValentinS4t1qbit added a commit that referenced this pull request Jun 16, 2022
* v0.3.0 into main (#127)

* Sphinx docs (#76)
* Fixing CCSDSolver.get_rdm() with frozen orbitals and energy from RDMs (#81)
* small fixes to allow initial density matrix for faster noisy sampling with cirq (#84)
* Branding (Tangelo, Good Chemistry Company) (#87)
* Name change: backendbuddy -> linq (#93)
* added multi-controls multi-targets, extra gates (#88)
* Add QMF and QCC capabilities and tests (#91)
* JKMN mapping implementation  (#95)
* added inverse function to Circuit (#78)
* added pycodestyle tests (#96)
* Circuit methods (repetition operator, equality, trim and split methods) (#101)
* Staged controlled time (#100)
* Support for name attribute in Circuit class (#110)
* Derandomized + Adaptive Classical Shadows (#111)
* added vsqs ansatz (#109)
* Staged richardson (#99)
* Majorana pool for ADAPT (#114)
* Copy gate data instead of referencing it when instantiation Circuit object (#118)
* Fixed QEMIST Cloud QPU connection ctrl-c in job_result. (#121)
* Estimate QPU cost with QEMIST Cloud API. (#120)
* Improvements for handling exp data with ClassicalShadow (#124)
* Qulacs operator build changed to fix memory leak (#122)


Co-authored-by: ValentinS4t1qbit <[email protected]>
Co-authored-by: AlexandreF-1qbit <[email protected]>
Co-authored-by: James Brown <[email protected]>
Co-authored-by: JamesB-1qbit <[email protected]>
Co-authored-by: MPCoons <[email protected]>
Co-authored-by: elloyd-1qbit <[email protected]>
Co-authored-by: KrzysztofB-1qbit <[email protected]>
Co-authored-by: Rudi Plesch <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>

* Update _version.py

* Update to release/v0.3.1 (#167)

* Bump develop to v0.3.0 (#127) (#128)

* v0.3.0 into main (#127)

* Sphinx docs (#76)
* Fixing CCSDSolver.get_rdm() with frozen orbitals and energy from RDMs (#81)
* small fixes to allow initial density matrix for faster noisy sampling with cirq (#84)
* Branding (Tangelo, Good Chemistry Company) (#87)
* Name change: backendbuddy -> linq (#93)
* added multi-controls multi-targets, extra gates (#88)
* Add QMF and QCC capabilities and tests (#91)
* JKMN mapping implementation  (#95)
* added inverse function to Circuit (#78)
* added pycodestyle tests (#96)
* Circuit methods (repetition operator, equality, trim and split methods) (#101)
* Staged controlled time (#100)
* Support for name attribute in Circuit class (#110)
* Derandomized + Adaptive Classical Shadows (#111)
* added vsqs ansatz (#109)
* Staged richardson (#99)
* Majorana pool for ADAPT (#114)
* Copy gate data instead of referencing it when instantiation Circuit object (#118)
* Fixed QEMIST Cloud QPU connection ctrl-c in job_result. (#121)
* Estimate QPU cost with QEMIST Cloud API. (#120)
* Improvements for handling exp data with ClassicalShadow (#124)
* Qulacs operator build changed to fix memory leak (#122)


Co-authored-by: ValentinS4t1qbit <[email protected]>
Co-authored-by: AlexandreF-1qbit <[email protected]>
Co-authored-by: James Brown <[email protected]>
Co-authored-by: JamesB-1qbit <[email protected]>
Co-authored-by: MPCoons <[email protected]>
Co-authored-by: elloyd-1qbit <[email protected]>
Co-authored-by: KrzysztofB-1qbit <[email protected]>
Co-authored-by: Rudi Plesch <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>

* Recomputing MF when working with atom indices in DMET (#130)

* Recomputing and testing MF when working with atom indexes. Change Localization import level.

* More gates for openqasm translator (#129)

* Added CZ, CY, CRz, CP, CSWAP and SWAP to openqasm translator

* fixed return for return_phase=False in trotterize (#133)

* fixed return for return_phase=False in trotterize

* ONIOM problem reformulation (#119)

* Updated ONIOM notebook use case

* QubitHamiltonian get_operators bug (#131)

* Fixed get_operators bug + added a test.

* Measurement map (#134)

* Measurement map + extending qwc partioning with repetition

* Working state, cleaning is wip.

* Givens gate (#135)

* added givens gate decomposition

Co-authored-by: ValentinS4t1qbit <[email protected]>

* Notebook classical shadow (#123)

Classical shadows notebook. It has been added to tests as well

Co-authored-by: ValentinS4t1qbit <[email protected]>

* added class to prepare or decompute an arbitrary statevector (#137)


* Many small todos (#138)
* Add an explanation how Circuit.reindex_qubits method is working.
* ClassicalShadows.simulate only unique circuit (massive speedup).
* Better management of backend options in VQESolver.
* CS notebook update.
* Comment fix for new return.
* No need of n_electrons with ref_state==zero.
* Change method for simulate (noisy?).

* Diag coulomb (#136)

* diagonalizing circuits implemented and tested

* improvements to jkmn leaf->majorana selection (#139)

* improvements to jkmn leaf->majorana selection

* Use of get_vector function.

* Change constructors -> classmethod.

* Change interface + working state.

* Stage where I have to write tests.

* Test for HybridOperator and Z2 tapering.

* Conformance tests + typos.

* Moved file + typos.

* Added tests for matrix manip.

* Full path of load_operator in tests.

* Permit all active orbitals partially occupied (#146)

* ONIOM capping with chemical groups (#141)

* Implementation for other chemical groups capping in ONIOM. Tests, docs.

* uccgd ansatz (#144)

* uccgd ansatz for use in SA-OO-VQE

* First round + added spin=\=0 fix.

* Support for symmetry, now call pyscf directly (#147)

* call pyscf directly, symmetry now supported

* Rotosolve implementation as an optimizer for parameterized circuits (#142)

* rotosolve implementation and tests

* ONIOM multisolvers (#143)

* Multisolver support in ONIOM
* Added others solvers to ONIOM, added tests and ROHF support (RHF->HF).

* sa_vqe_solver from sa-oo-vqe branch

* added import to __init__

* fixes for PR

* clearer documentation

* change statevector jkmn

* replaced jkmn_prep_circuit with jkmn_prep_vector

* Fixed error message.

* Some reviews.

* JKMN z2 tapering tests.

* Docstrings in tests.

* Speed improvement + bitwise operations + moved collapse function.

* Passing conformance tests.

* added state averaged orbital optimized files

* merged molecule symmetry changes

* Update test_hybridoperator.py

aligning.

* Hybrid -> Multiform.

* Small fixes.

* PR changes

* support for reading in xyz files (#151)

* support for reading in xyz files

* Update z2_tapering.py

* Update sa_oo_vqe_solver.py

* Ilc ansatz (#132)

* Add ILC ansatz class
* updates to qmf, qcc, and ilc ansatz classes
* enable QMF and ILC classes to read-in and process data from OpenFermion *.hdf5 files and other small fixes.

Co-authored-by: ValentinS4t1qbit <[email protected]>

* Updating information, and adding Windows install comment (#155)

* Quantum deflation (#152)

* added deflation
* added ref_states as circuit and to VQESolver
* added ref_state and deflation to adapt vqe

Co-authored-by: ValentinS4t1qbit <[email protected]>

* changed default basis to crenbl in pyscf, added ecp option (#156)

* changed default basis to crenbl for pyscf to retrieve number of electrons & atoms, added ecp option

* Cancel redundant gates (#153)

* Functions / methods to remove small rotations, and remove gates that cancel each other

* Circuit depth (#159)

* Depth method for Circuit class

* MI-FNO link (#157)

* MI-FNO helper class. Added tests + reconstruction of MI energy, support for building sermonic operators for fragments

* Iqcc solver (#154)

* iQCC solver, frobenius norm compression method on QubitOperator

Co-authored-by: ValentinS4t1qbit <[email protected]>

* MIFNO notebook (#161)

* MIFNO notebook. Added to tests and sphinx docs

Co-authored-by: Valentin Senicourt <[email protected]>
Co-authored-by: ValentinS4t1qbit <[email protected]>

* Docs fix + tutorials removal from sphinx docs (#162)

* Docs: requirements.txt no longer needed. Tutorials removed from generated docs (redundant with Github, issues with latex, looks better on github and will display images once repo is public

Co-authored-by: AlexandreF-1qbit <[email protected]>

* readme upgrade (#164)

* readme upgrade and images, contributions.rst for code of conduct mention

* Fixes for docs and readme, files for Pypi (#166)

* Docs and readme fixed with feedback. Pypi file removed as it hinders the installation from source process: a guide will be provided to maintainer team for pypi update.

Co-authored-by: AlexandreF-1qbit <[email protected]>

* Version number and changelogs bumped

Co-authored-by: AlexandreF-1qbit <[email protected]>
Co-authored-by: James Brown <[email protected]>
Co-authored-by: JamesB-1qbit <[email protected]>
Co-authored-by: MPCoons <[email protected]>
Co-authored-by: elloyd-1qbit <[email protected]>
Co-authored-by: KrzysztofB-1qbit <[email protected]>
Co-authored-by: Rudi Plesch <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: AlexandreF-1qbit <[email protected]>
Co-authored-by: James Brown <[email protected]>
Co-authored-by: JamesB-1qbit <[email protected]>
Co-authored-by: MPCoons <[email protected]>
Co-authored-by: elloyd-1qbit <[email protected]>
Co-authored-by: KrzysztofB-1qbit <[email protected]>
Co-authored-by: Rudi Plesch <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants