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

Unable to access register_length attribute in FermionicOp class. #1361

Open
kvvedavyasa opened this issue May 6, 2024 · 1 comment
Open
Labels

Comments

@kvvedavyasa
Copy link

Environment

  • Qiskit Nature version:0.7.2
  • Python version: 3.12
  • Operating system: windows

What is happening?

In the below code, I am getting an error like TypeError: FermionicOp.init() got an unexpected keyword argument 'register_length'.

Why is not taking in register_length?What corrections should I make to the code?

How can we reproduce the issue?

''' N_sites = 5
hopping_terms = []

for ii in range (N_sites - 1):
hopping_terms.append(sum(FermionicOp(label,register_length = N_sites)
for label in ["+%i -%i" % (ii, ii+1),
"+%i -%i" % (ii+1, ii)])) '''

What should happen?

The code should create the fermionic operators for a given system of linear lattice with 5 sites. But, it is showing error in accepting the register_length keyword.

Any suggestions?

No response

@kvvedavyasa kvvedavyasa added the bug label May 6, 2024
@woodsp-ibm
Copy link
Member

There was an earlier FermionicOp in qiskit_nature.operators that took a register length. These were all deprecated and removed - the version that now exists takes num_spin_orbitals https://qiskit-community.github.io/qiskit-nature/stubs/qiskit_nature.second_q.operators.FermionicOp.html You can see an instance created in this tutorial https://qiskit-community.github.io/qiskit-nature/tutorials/12_deuteron_binding_energy.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants