qutip
Skill này làm gì
Skill này dạy agent cách chạy mô phỏng vật lý lượng tử bằng thư viện QuTiP trong Python. Skill dành cho nghiên cứu và giảng dạy vật lý, không dành cho việc xây dựng mạch tính toán lượng tử.
Khi nào nên dùng
- ✓Khi nhà vật lý cần mô phỏng mất kết hợp hoặc phương trình Lindblad.
- ✓Khi nhà nghiên cứu học quang học lượng tử hoặc QED khoang bằng mô hình số.
- ✓Khi sinh viên muốn một mô phỏng lượng tử đơn giản cho bài học vật lý.
Liên kết skill
https://github.com/zLanqing/codex-claude-academic-skills/blob/main/scientific-toolkit-skill/references/scientific-skills/qutip/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Mô phỏng cách qubit của tôi bị mất kết hợp theo thời gian trong một script Python và vẽ kết quả.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent xây dựng các trạng thái và toán tử lượng tử, chọn bộ giải phù hợp cho hệ, rồi tính cách hệ thay đổi theo một danh sách thời điểm. Sau đó agent vẽ các giá trị kỳ vọng.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
QuTiP: Quantum Toolbox in Python
Overview
QuTiP provides comprehensive tools for simulating and analyzing quantum mechanical systems. It handles both closed (unitary) and open (dissipative) quantum systems with multiple solvers optimized for different scenarios.
Installation
uv pip install qutip
Optional packages for additional functionality:
# Quantum information processing (circuits, gates)
uv pip install qutip-qip
# Quantum trajectory viewer
uv pip install qutip-qtrl
Quick Start
from qutip import *
import numpy as np
import matplotlib.pyplot as plt
# Create quantum state
psi = basis(2, 0) # |0⟩ state
# Create operator
H = sigmaz() # Hamiltonian
# Time evolution
tlist = np.linspace(0, 10, 100)
result = sesolve(H, psi, tlist, e_ops=[sigmaz()])
# Plot results
plt.plot(tlist, result.expect[0])
plt.xlabel('Time')
plt.ylabel('⟨σz⟩')
plt.show()
Core Capabilities
1. Quantum Objects and States
Create and manipulate quantum states and operators:
# States
psi = basis(N, n) # Fock state |n⟩
psi = coherent(N, alpha) # Coherent state |α⟩
rho = thermal_dm(N, n_avg) # Thermal density matrix
# Operators
a = destroy(N) # Annihilation operator
H = num(N) # Number operator
sx, sy, sz = sigmax(), sigmay(), sigmaz() # Pauli matrices
# Composite systems
psi_AB = tensor(psi_A, psi_B) # Tensor product
See references/core_concepts.md for comprehensive coverage of quantum objects, states, operators, and tensor products.
2. Time Evolution and Dynamics
Multiple solvers for different scenarios:
# Closed systems (unitary evolution)
result = sesolve(H, psi0, tlist, e_ops=[num(N)])
# Open systems (dissipation)
c_ops = [np.sqrt(0.1) * destroy(N)] # Collapse operators
result = mesolve(H, psi0, tlist, c_ops, e_ops=[num(N)])
# Quantum trajectories (Monte Carlo)
result = mcsolve(H, psi0, tlist, c_ops, ntraj=500, e_ops=[num(N)])
Solver selection guide:
sesolve: Pure states, unitary evolutionmesolve: Mixed states, dissipation, general open systemsmcsolve: Quantum jumps, photon counting, individual trajectoriesbrmesolve: Weak system-bath couplingfmmesolve: Time-periodic Hamiltonians (Floquet)
See references/time_evolution.md for detailed solver documentation, time-dependent Hamiltonians, and advanced options.
3. Analysis and Measurement
Compute physical quantities:
# Expectation values
n_avg = expect(num(N), psi)
# Entropy measures
S = entropy_vn(rho) # Von Neumann entropy
C = concurrence(rho) # Entanglement (two qubits)
# Fidelity and distance
F = fidelity(psi1, psi2)
D = tracedist(rho1, rho2)
# Correlation functions
corr = correlation_2op_1t(H, rho0, taulist, c_ops, A, B)
w, S = spectrum_correlation_fft(taulist, corr)
# Steady states
rho_ss = steadystate(H, c_ops)
See references/analysis.md for entropy, fidelity, measurements, correlation functions, and steady state calculations.
4. Visualization
Visualize quantum states and dynamics:
# Bloch sphere
b = Bloch()
b.add_states(psi)
b.show()
# Wigner function (phase space)
xvec = np.linspace(-5, 5, 200)
W = wigner(psi, xvec, xvec)
plt.contourf(xvec, xvec, W, 100, cmap='RdBu')
# Fock distribution
plot_fock_distribution(psi)
# Matrix visualization
hinton(rho) # Hinton diagram
matrix_histogram(H.full()) # 3D bars
See references/visualization.md for Bloch sphere animations, Wigner functions, Q-functions, and matrix visualizations.
5. Advanced Methods
Specialized techniques for complex scenarios:
# Floquet theory (periodic Hamiltonians)
T = 2 * np.pi / w_drive
f_modes, f_energies = floquet_modes(H, T, args)
result = fmmesolve(H, psi0, tlist, c_ops, T=T, args=args)
# HEOM (non-Markovian, strong coupling)
from qutip.nonmarkov.heom import HEOMSolver, BosonicBath
bath = BosonicBath(Q, ck_real, vk_real)
hsolver = HEOMSolver(H_sys, [bath], max_depth=5)
result = hsolver.run(rho0, tlist)
# Permutational invariance (identical particles)
psi = dicke(N, j, m) # Dicke states
Jz = jspin(N, 'z') # Collective operators
See references/advanced.md for Floquet theory, HEOM, permutational invariance, stochastic solvers, superoperators, and performance optimization.
Common Workflows
Simulating a Damped Harmonic Oscillator
# System parameters
N = 20 # Hilbert space dimension
omega = 1.0 # Oscillator frequency
kappa = 0.1 # Decay rate
# Hamiltonian a
Câu hỏi thường gặp
Nó có chạy mạch lượng tử trên phần cứng thật không?
Không. Skill nói tính toán lượng tử dựa trên mạch thuộc về các thư viện khác như qiskit, cirq hoặc pennylane.
QuTiP được cài đặt thế nào?
Skill hướng dẫn cài bằng uv pip install qutip, với các gói bổ sung tùy chọn.
Nó có xử lý hệ lượng tử mở không?
Có. Skill nói nó bao gồm cả hệ kín lẫn hệ mở, có tiêu tán.
Chi tiết
Mô tả gốc của tác giả
Quantum physics simulation library for open quantum systems. Use when studying master equations, Lindblad dynamics, decoherence, quantum optics, or cavity QED. Best for physics research, open system dynamics, and educational simulations. NOT for circuit-based quantum computing—use qiskit, cirq, or pennylane for quantum algorithms and hardware execution.
Độ phổ biến
- Sao GitHub
- 5.6k
- Vị trí xếp hạng
- #14770
- Giấy phép
- MIT
- Cập nhật
- 14/5/2026
Bình luận
- …
Thêm skill từ kho mã này
office-academic-skill
5.6kGiúp agent của bạn biến bài báo khoa học thành báo cáo Word và tạo slide PowerPoint học thuật có thể chỉnh sửa, ưu tiên tiếng Trung, kèm ghi chú người trình bày và kiểm tra bố cục.
research-writing-skill
5.6kGiúp agent của bạn viết, sửa và trau chuốt các phần của bài báo khoa học, tóm tắt và phản hồi cho phản biện, giữ nguyên công thức, tiêu đề và trích dẫn.
scientific-toolkit-skill
5.6kGiúp agent của bạn viết và gỡ lỗi mã khoa học MATLAB hoặc Python cho xử lý tín hiệu và ảnh, thống kê, mô phỏng và biểu đồ sẵn sàng cho công bố.
matlab
5.6kGiúp agent của bạn viết và gỡ lỗi script MATLAB và GNU Octave cho phép toán ma trận, xử lý tín hiệu và ảnh, phương trình vi phân, tối ưu hóa và biểu đồ.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.