I would like to use a general entangler in the entanglement_block of the TwoLocal function. The function seems to work with 'cz', 'cx', 'swap' gates, but it fails for 'iswap' gate. Below is the error message. Any help would be appreciated
from qiskit.circuit.library import TwoLocal
ansatz = TwoLocal(num_spin_orbitals, ['ry', 'rz'], entanglement_blocks = 'iswap', entanglement='linear')
Gives the following error
Traceback (most recent call last):
File "<ipython-input-34-5d8e95fd9811>", line 2, in <module>
ansatz = TwoLocal(num_spin_orbitals, ['ry', 'rz'], entanglement_blocks = 'iswap', entanglement='linear')
File "/opt/conda/lib/python3.8/site-packages/qiskit/circuit/library/n_local/two_local.py", line 177, in __init__
super().__init__(num_qubits=num_qubits,
File "/opt/conda/lib/python3.8/site-packages/qiskit/circuit/library/n_local/n_local.py", line 140, in __init__
self.entanglement_blocks = entanglement_blocks
File "/opt/conda/lib/python3.8/site-packages/qiskit/circuit/library/n_local/n_local.py", line 248, in entanglement_blocks
self._entanglement_blocks = [self._convert_to_block(block) for block in blocks]
File "/opt/conda/lib/python3.8/site-packages/qiskit/circuit/library/n_local/n_local.py", line 248, in <listcomp>
self._entanglement_blocks = [self._convert_to_block(block) for block in blocks]
File "/opt/conda/lib/python3.8/site-packages/qiskit/circuit/library/n_local/two_local.py", line 248, in _convert_to_block
raise ValueError(f'Unknown layer name `{layer}`.') from ex
ValueError: Unknown layer name `iswap`.