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

correct openshell errors in qchem #5655

Merged
merged 37 commits into from
May 24, 2024

Conversation

ddhawan11
Copy link
Contributor

Context:
Changes openshell warnings.

Description of the Change:
Changed openshell warnings to work with new molecular_hamiltonian function

Benefits:
molecular_hamiltonian function works with openshell molecules when method is pyscf

Possible Drawbacks:

Related GitHub Issues:

@ddhawan11 ddhawan11 requested a review from soranjh May 6, 2024 17:12
@soranjh soranjh changed the title [skip ci] corrected openshell warnings [WIP] corrected openshell warnings May 6, 2024
@soranjh soranjh changed the title [WIP] corrected openshell warnings [WIP] correct openshell warnings in qchem May 6, 2024
@@ -107,6 +107,11 @@ def _electron_integrals(*args):
Returns:
tuple[array[float]]: 1D tuple containing core constant, one- and two-electron integrals
"""
if mol.n_electrons % 2 == 1 or mol.mult != 1:
raise ValueError(
"Openshell systems are not supported. Change the charge or spin multiplicity of the molecule."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Openshell systems are not supported. Change the charge or spin multiplicity of the molecule."
"Open shell systems are not supported. Change the charge or spin multiplicity of the molecule."

Should there be a space?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shall we add a hyphen instead(open-shell) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

The literature contains different formats. Let's use open-shell everywhere.

ddhawan11 and others added 2 commits May 8, 2024 04:52
Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
@ddhawan11 ddhawan11 changed the title [WIP] correct openshell warnings in qchem correct openshell errors in qchem May 10, 2024
Copy link

codecov bot commented May 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.67%. Comparing base (494980c) to head (5aa8202).
Report is 19 commits behind head on qchem_feature_branch.

Additional details and impacted files
@@                   Coverage Diff                    @@
##           qchem_feature_branch    #5655      +/-   ##
========================================================
- Coverage                 99.67%   99.67%   -0.01%     
========================================================
  Files                       415      416       +1     
  Lines                     38615    38788     +173     
========================================================
+ Hits                      38490    38662     +172     
- Misses                      125      126       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ddhawan11
Copy link
Contributor Author

[sc-61760]

Copy link
Contributor

@austingmhuang austingmhuang left a comment

Choose a reason for hiding this comment

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

Nice work @ddhawan11!

To understand things better on my end...
Everything (Hamiltonian, HF, and OpenFermion) other than molecule does not support open-shell systems? Only molecule.py supports open-shell systems?

pennylane/qchem/molecule.py Show resolved Hide resolved
tests/qchem/test_hartree_fock.py Outdated Show resolved Hide resolved
tests/qchem/test_hamiltonians.py Outdated Show resolved Hide resolved
ddhawan11 and others added 2 commits May 16, 2024 12:34
Co-authored-by: Austin Huang <65315367+austingmhuang@users.noreply.github.com>
Co-authored-by: Austin Huang <65315367+austingmhuang@users.noreply.github.com>
@ddhawan11 ddhawan11 changed the base branch from molecule_central_object to qchem_feature_branch May 17, 2024 14:24
Copy link
Contributor

@austingmhuang austingmhuang left a comment

Choose a reason for hiding this comment

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

Nice work @ddhawan11. Looks good to me!

pennylane/qchem/openfermion_obs.py Outdated Show resolved Hide resolved
Co-authored-by: Austin Huang <65315367+austingmhuang@users.noreply.github.com>
Copy link
Contributor

@soranjh soranjh left a comment

Choose a reason for hiding this comment

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

Thanks @ddhawan11, looks good. Please address my comments and I will approve.

pennylane/qchem/hamiltonian.py Outdated Show resolved Hide resolved
pennylane/qchem/molecule.py Outdated Show resolved Hide resolved
pennylane/qchem/openfermion_obs.py Outdated Show resolved Hide resolved
tests/qchem/test_hamiltonians.py Outdated Show resolved Hide resolved
tests/qchem/test_hartree_fock.py Outdated Show resolved Hide resolved
pennylane/qchem/hamiltonian.py Outdated Show resolved Hide resolved
pennylane/qchem/openfermion_obs.py Outdated Show resolved Hide resolved
pennylane/qchem/openfermion_obs.py Outdated Show resolved Hide resolved
pennylane/qchem/openfermion_obs.py Show resolved Hide resolved
ddhawan11 and others added 2 commits May 23, 2024 14:04
Co-authored-by: soranjh <40344468+soranjh@users.noreply.github.com>
@ddhawan11 ddhawan11 merged commit 8b982a0 into qchem_feature_branch May 24, 2024
39 checks passed
@ddhawan11 ddhawan11 deleted the openshell_warnings_corrected branch May 24, 2024 17:32
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.

None yet

5 participants