openfermion
Guide OpenFermion workflows for fermionic and qubit operator algebra, Hamiltonian construction, quantum-chemistry data, circuit synthesis, sparse analysis, measurements, and resource-oriented utilities.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- openfermion
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Guide OpenFermion workflows for fermionic and qubit operator algebra, Hamiltonian construction, quantum-chemistry data, circuit synthesis, sparse analysis, measurements, and resource-oriented utilities.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-index.md4.6 KB
- 参考文档references/repo-provenance.md2.2 KB
- 参考文档references/repo-routing-metadata.json331 B
- 参考文档references/troubleshooting.md4.8 KB
- 脚本scripts/check_openfermion.py1.9 KB
03 SKILL.md 正文
OpenFermion
Use this skill when a task names OpenFermion or asks for Python workflows around fermionic systems, second quantization, qubit Hamiltonians, quantum chemistry, Jordan–Wigner/Bravyi–Kitaev mappings, Trotter/UCC circuits, RDMs, measurement grouping, or sparse operator analysis.
Fast route
- Install and smoke-check. Install the public
openfermiondistribution in Python >=3.10, then runpython -c "import openfermion; print(openfermion.__version__)". The package uses Cirq core, NumPy, SciPy, SymPy, HDF5, and related runtime dependencies. See troubleshooting for optional extras and import failures. - Select the owning route. Use the focused sub-skill that matches the
user's artifact, not the source package directory name:
- operators-and-transforms for symbolic operators, normal ordering, and fermion-to-qubit mappings.
- hamiltonians-and-chemistry for Hubbard/jellium/model Hamiltonians and molecular metadata or tensors.
- circuits-and-simulation for Trotter, UCC, Slater/Gaussian preparation, Cirq circuits, and VPE circuits.
- analysis-and-measurements for sparse matrices, eigensolvers, RDMs, measurement grouping, and resource functionals.
- Record the contract before computing. Preserve operator family, mode or
qubit ordering, coefficient units, tensor shapes,
n_qubits, boundary or particle-number choices, optional dependency state, and the expected output. - Keep numerical work bounded. Construct tiny fixtures first; validate dimensions and Hermiticity before matrix conversion, dense diagonalization, RDM contraction, or circuit expansion. Do not infer scalability from a smoke test.
- Handoff across routes explicitly. A model builder supplies an operator contract to the mapping route; a mapping supplies a qubit operator to the circuit or analysis route; analysis returns shapes, convergence signals, and numerical results. Do not silently choose conventions at a boundary.
Public package boundary
OpenFermion is primarily a Python library, not a package-specific command-line
application. Install external simulators, electronic-structure packages, or
hardware plugins separately. The optional resources extra adds PySCF, JAX,
JAXlib, and ASE for selected resource-estimation workflows; it is not required
for core operator, transform, Hamiltonian, circuit, or sparse-analysis usage.
PubChem lookup is network-dependent even though the base distribution includes
its client library. Never claim that MolecularData metadata is a completed
quantum-chemistry calculation.
For verified signatures and return-shape notes, read api-index.md. For cross-cutting install, optional package, file, network, and numerical failures, read troubleshooting.md. Run scripts/check_openfermion.py for a safe public import and capability diagnostic; it performs no network access or file writes. Read repo-provenance.md before deciding whether this skill is stale for a particular OpenFermion checkout.
Self-contained smoke helpers
Each route owns a tiny helper that is independent of the original checkout:
operators-and-transforms/scripts/smoke_transform.pymaps a two-mode hopping term and can report a sparse shape.hamiltonians-and-chemistry/scripts/build_tiny_hamiltonian.pyemits a small Hubbard or molecular-metadata summary without writing files.circuits-and-simulation/scripts/circuit_smoke.pyreports a bounded Cirq circuit and optional Slater preparation.analysis-and-measurements/scripts/sparse_analysis_smoke.pyconverts a tiny qubit operator and checks a ground-state residual.
Use --help first and keep all input dimensions within the helper's documented
bounds. These are structural checks, not scientific benchmarks.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).