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

prune=False flag in freeze_orbitals seems have no effect #660

Closed
davidzsoltmanrique opened this issue Sep 11, 2020 · 3 comments
Closed

prune=False flag in freeze_orbitals seems have no effect #660

davidzsoltmanrique opened this issue Sep 11, 2020 · 3 comments

Comments

@davidzsoltmanrique
Copy link

new_operator = prune_unused_indices(new_operator)

@davidzsoltmanrique davidzsoltmanrique changed the title prune=False flag in freeze_orbitals seems not have effect prune=False flag in freeze_orbitals seems have no effect Sep 11, 2020
@ncrubin
Copy link
Collaborator

ncrubin commented Oct 17, 2020

Hi @davidzsoltmanrique, thanks for flagging this. Could you provide a bit more information about this issue? maybe a code snippet you are using to test the effect?

@ncrubin
Copy link
Collaborator

ncrubin commented Dec 18, 2020

Closing due to inactivity.

@ncrubin ncrubin closed this as completed Dec 18, 2020
@mafaldaramoa
Copy link
Contributor

Hello,

I came across this problem also.

Here's a snippet:

from openfermion import FermionOperator
from openfermion.transforms import freeze_orbitals

operator = FermionOperator("1^ 0",1) + FermionOperator("3^ 2",0.5)
print(f"Original Operator:\n{operator}")
new_operator = freeze_orbitals(operator,occupied=[0,1],prune=False)
print(f"\nNew operator:\n{new_operator}")

Output:

Original Operator:
1 [1^ 0] +
0.5 [3^ 2]

New operator:
0.5 [1^ 0]

It eliminated the 1 [1^ 0] term as expected, but renumbered the 2,3 orbitals as 0,1, even though I set prune=False. So now the 0.5 [3^ 2] term reads 0.5 [1^ 0], which is not what I wanted.

I took a look at the source code for freeze_orbitals and at no point is the prune flag used.

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

No branches or pull requests

3 participants