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

Bugfix: DMET fragment object initialization from IntegralSolver fixed #355

Merged

Conversation

alexfleury-sb
Copy link
Collaborator

A bug was causing this code to crash

from tangelo import SecondQuantizedMolecule
from tangelo.problem_decomposition.dmet.dmet_problem_decomposition import Localization, DMETProblemDecomposition

xyz_H4 = [("H", [0.0, 0.0, i*2.5]) for i in range(4)]
mol = SecondQuantizedMolecule(xyz_H4, q=0, spin=0, basis="sto-3g")

my_backend_options = {"target": "qulacs", "n_shots": None, "noise_model": None}
solvers_options = {"backend_options": my_backend_options}

opt_dmet = {"molecule": mol,
            "fragment_atoms": [1]*4,
            "fragment_solvers": ["vqe"]*4,
            "solvers_options": [solvers_options]*4,
            "electron_localization": Localization.meta_lowdin,
            "verbose": True
            }

# Run DMET
dmet = DMETProblemDecomposition(opt_dmet)
dmet.build()

energy = dmet.simulate()

print(energy)

The root cause of this was because the initial_var_params for the UCCSD ansatz is set to MP2. The code portiuon computing those parameter was checking the solver attribute of the provided molecule, and SecondQuantizedDMETFragment did not have that attribute.

The test were not failing because when no solvers_options is defined, the initial_var_params for VQE are set to ones. Setting the solvers_options without specifying the initial_var_params was reverting them to MP2 for the default ansatz (UCCSD).

@alexfleury-sb alexfleury-sb marked this pull request as ready for review November 28, 2023 20:42
@ValentinS4t1qbit ValentinS4t1qbit changed the title Set an IntegralSolver in DMET fragment object Bugfix: DMET fragment object initialization from IntegralSolver fixed Nov 29, 2023
@ValentinS4t1qbit ValentinS4t1qbit merged commit c666bf3 into sandbox-quantum:develop Nov 29, 2023
7 of 9 checks passed
@alexfleury-sb alexfleury-sb deleted the dmet_fragment_mp2 branch November 30, 2023 15:40
ValentinS4t1qbit added a commit that referenced this pull request Dec 20, 2023
* Helper class and functions for iFCI fragment import (#351)
* Set the instance in a Qiskit runtime job (#352)
* Added trim_qubits option to Circuit.split() (#353)
* Measurement Controlled operations (CMEASURE) (#334)
* Fix after qiskit update: qiskit_noise_model (#354)
* Bugfix: DMET fragment object initialization from IntegralSolver fixed (#355)
* added explicit mo_coeff for H4_cation (#356)
* VQE get_rdm performance improvements (#357)
* Implementation of Frozen Natural Orbitals (FNO) (#358)
* UHF reference symmetry labels. (#360)
* FNO: NotImplementedError for ROHF (#362)
* Iterative Quantum Phase Estimation (#359)
* README minor changes + feature overview link (#363)
* Add feature list (#364) (#365)

---------

Co-authored-by: Valentin Senicourt <41597680+ValentinS4t1qbit@users.noreply.github.com>
Co-authored-by: AlexandreF-1qbit <76115575+AlexandreF-1qbit@users.noreply.github.com>
Co-authored-by: James Brown <84878946+JamesB-1qbit@users.noreply.github.com>
Co-authored-by: James Brown <james.brown@1qbit.com>
Co-authored-by: ValentinS4t1qbit <valentin@goodchemistry.gmail>
ValentinS4t1qbit added a commit that referenced this pull request Dec 20, 2023
* Main to catch up with develop (#344)
* Helper class and functions for iFCI fragment import (#351)
* Set the instance in a Qiskit runtime job (#352)
* Added trim_qubits option to Circuit.split() (#353)
* Measurement Controlled operations (CMEASURE) (#334)
* Fix after qiskit update: qiskit_noise_model (#354)
* Bugfix: DMET fragment object initialization from IntegralSolver fixed (#355)
* added explicit mo_coeff for H4_cation (#356)
* VQE get_rdm performance improvements (#357)
* Implementation of Frozen Natural Orbitals (FNO) (#358)
* UHF reference symmetry labels. (#360)
* FNO: NotImplementedError for ROHF (#362)
* Iterative Quantum Phase Estimation (#359)
* README minor changes + feature overview link (#363)
* Add feature list (#364) (#365)

---------

Co-authored-by: Valentin Senicourt <41597680+ValentinS4t1qbit@users.noreply.github.com>
Co-authored-by: AlexandreF-1qbit <76115575+AlexandreF-1qbit@users.noreply.github.com>
Co-authored-by: James Brown <84878946+JamesB-1qbit@users.noreply.github.com>
Co-authored-by: James Brown <james.brown@1qbit.com>
Co-authored-by: ValentinS4t1qbit <valentin@goodchemistry.gmail>
cburdine pushed a commit to cburdine/Tangelo that referenced this pull request May 31, 2024
* Helper class and functions for iFCI fragment import (sandbox-quantum#351)
* Set the instance in a Qiskit runtime job (sandbox-quantum#352)
* Added trim_qubits option to Circuit.split() (sandbox-quantum#353)
* Measurement Controlled operations (CMEASURE) (sandbox-quantum#334)
* Fix after qiskit update: qiskit_noise_model (sandbox-quantum#354)
* Bugfix: DMET fragment object initialization from IntegralSolver fixed (sandbox-quantum#355)
* added explicit mo_coeff for H4_cation (sandbox-quantum#356)
* VQE get_rdm performance improvements (sandbox-quantum#357)
* Implementation of Frozen Natural Orbitals (FNO) (sandbox-quantum#358)
* UHF reference symmetry labels. (sandbox-quantum#360)
* FNO: NotImplementedError for ROHF (sandbox-quantum#362)
* Iterative Quantum Phase Estimation (sandbox-quantum#359)
* README minor changes + feature overview link (sandbox-quantum#363)
* Add feature list (sandbox-quantum#364) (sandbox-quantum#365)

---------

Co-authored-by: Valentin Senicourt <41597680+ValentinS4t1qbit@users.noreply.github.com>
Co-authored-by: AlexandreF-1qbit <76115575+AlexandreF-1qbit@users.noreply.github.com>
Co-authored-by: James Brown <84878946+JamesB-1qbit@users.noreply.github.com>
Co-authored-by: James Brown <james.brown@1qbit.com>
Co-authored-by: ValentinS4t1qbit <valentin@goodchemistry.gmail>
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.

2 participants