Implementing Custom Gates by using Qiskit Pulse in Qiskit 1.0.0
Quantum Computing SEArchived Apr 02, 2026✓ Full text saved
I'm using Qiskit 1.0.0. I'm trying to define a custom gate from a certain wavefunction and insert it in a quantum circuit that I want to run and measure the counts. The relevant code for the question is as follows: backend = FakePerth() custom_gate_ch1 = Gate('ch1', 1, []) circ = QuantumCircuit(4) passmanager = generate_preset_pass_manager(optimization_level=1, backend=backend) with builder.build() as ch1_gate: builder.play(wave, DriveChannel(0)) backend.target.add_instruction( custom_gate_ch1,
Full text archived locally
✦ AI Summary· Claude Sonnet
Implementing Custom Gates by using Qiskit Pulse in Qiskit 1.0.0
Ask Question
Asked 2 years, 1 month ago
Modified today
Viewed 264 times
1
I'm using Qiskit 1.0.0.
I'm trying to define a custom gate from a certain wavefunction and insert it in a quantum circuit that I want to run and measure the counts.
The relevant code for the question is as follows:
backend = FakePerth()
custom_gate_ch1 = Gate('ch1', 1, [])
circ = QuantumCircuit(4)
passmanager = generate_preset_pass_manager(optimization_level=1, backend=backend)
with builder.build() as ch1_gate:
builder.play(wave, DriveChannel(0))
backend.target.add_instruction(
custom_gate_ch1,
{(0,): InstructionProperties(calibration=ch1_gate)},
)
circ.append(custom_gate_ch1, [0])
circ.measure_all()
circ = passmanager.run(circ)
tqc = transpile(circ, backend, scheduling_method='asap')
counts = backend.run(tqc).result().get_counts()
With this code, I'm able to obtain the transpiled circuits correctly, but when I try to run it I get the following error:
qiskit.providers.basic_provider.exceptions.BasicProviderError: 'basic_simulator encountered unrecognized operation "ch1"'
Where am I going wrong?
qiskitopenpulse
Share
Improve this question
Follow
asked Feb 20, 2024 at 15:06
Roberto Schiattarella
1956
6 bronze badges
Add a comment
1 Answer
Sorted by:
Highest score (default)
Date modified (newest first)
Date created (oldest first)
0
have you found a solution? I think that there is nothing wrong in particular with your code. Just the transition to Qiskit 1.0.x did not happen as smoothly as hoped and not all functionality was kept.
I am facing the same issue with a sub-circuit including parameters for BasicSimulator. I found the solution by decomposing the circuit with abstract gates/circuits into the basic gate set before sending it to the BasicSimulator. Maybe it helps you.
decomposed = transpile(qc, basis_gates=['cx', 'id', 'rz', 'sx', 'x'])
backend = BasicSimulator()
job_results = backend.run(decomposed, shots=1).result()
Share
Improve this answer
Follow
answered Mar 13, 2024 at 9:57
J.D.
1
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. –
Community
Bot
Commented
Mar 13, 2024 at 16:09
Add a comment
Your Answer
Sign up or log in
Sign up using Google
Sign up using Email and Password
Post as a guest
Name
Email
Required, but never shown
Post Your Answer
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Ask question
Explore related questions
qiskitopenpulse
See similar questions with these tags.
The Overflow Blog
How can you test your code when you don’t know what’s in it?
Related
2
OpenPulse: Modifying pulse sequence for basic gates
3
Implementing noise model in Qiskit using arbitrary basis gates
1
Qiskit Pulse Notebook
0
Faster pulse generation in Qiskit
4
TranspilerError: 'The input circuit None is not scheduled'
2
Qiskit experiments state tomography maximum allowed dimension exceeded for pulse gates
0
Qiskit pulse with qiskit >1.0
Hot Network Questions
How to construct a re-arming mechanism for a medieval crossbow using medieval technology?
How to correctly parse tokens and preserve command-argument structure in expl3?
Prepending a number to each inner list of lists
Unable to speak like humans
Getting angles between adjacent roads at intersection in QGIS
Why does gauge symmetries cause differential operator in action to be singular?
Old story about space-walking humans
Is sampling a signal with 2-channel ADC, where the second channel is delayed by 90° at sampling frequency actually I/Q sampling?
Do those who later identify as “ex-Christians” remain saved under the “once saved, always saved” doctrine?
Different black color codes in Illustrator (CMYK for printing)
Io, Europa, Ganymede, . . . Calypso?
The Emperor’s Command: All Roads Lead to Rome
Does On-Chip Decoupling Negate the Need for PCB PDN Analysis
Blender Glare Nodes
Thousand Character Classic - 千字文 : meaning of line "奄宅曲阜"
TypeError when adding a sphere object using the primitive_ico_sphere_add operator and a custom location and scale
The area of a rectangle containing a curved line of a known length
Can a journal correct a misspelling of a name in the acknowledgements?
Do most philosophers believe that foreknowledge means that God has to determine everything?
On zombies: What's it like to be nobody?
Semi-intelligent, super-advanced starship called "Grayle"
First SIMD program
Is the Complex NP a syntactic island for "relativization movement"?
Is the log of density operator a linear operator?
Question feed
By continuing to use this website, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. By exiting this window, default cookies will be accepted. To reject cookies, select an option from below.
Customize settings
Cookie Consent Preference Center
When you visit any of our websites, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences, or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and manage your preferences. Please note, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
Cookie Policy
Accept all cookies
Manage Consent Preferences
Strictly Necessary Cookies
Always Active
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
Targeting Cookies
Targeting Cookies
These cookies are used to make advertising messages more relevant to you and may be set through our site by us or by our advertising partners. They may be used to build a profile of your interests and show you relevant advertising on our site or on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device.
Performance Cookies
Performance Cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
Functional Cookies
Functional Cookies
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
Cookie List
Clear
checkbox label label
Apply Cancel
Consent Leg.Interest
checkbox label label
checkbox label label
checkbox label label
Necessary cookies only Confirm My Choices