qiskit-community / qiskit-nature

Qiskit Nature is an open-source, quantum computing, framework for solving quantum mechanical natural science problems.
https://qiskit-community.github.io/qiskit-nature/
Apache License 2.0
301 stars 204 forks source link

Unable to access register_length attribute in FermionicOp class. #1361

Open kvvedavyasa opened 5 months ago

kvvedavyasa commented 5 months ago

Environment

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 = Nsites) 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

woodsp-ibm commented 4 months ago

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