Agent skill

Mq Quantum Chemistry

by mindspore-ai in mindspore-ai/mindquantum

Run quantum chemistry simulations with MindQuantum. An agent skill from mindspore-ai/mindquantum.

Apache-2.0Auto-check passedResearch & Science

Install Mq Quantum Chemistry

skills CLI
$ npx skills add mindspore-ai/mindquantum --skill mq-quantum-chemistry -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mindspore-ai/mindquantum mq-quantum-chemistry --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mindspore-ai/mindquantum.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/mq-quantum-chemistry .claude/skills/mq-quantum-chemistry && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mq-quantum-chemistry
GitHub stars
102
Token cost
~2.2k tokens
SKILL.md length
211 words
Files
1
Skills in repo
6
Repo updated
First seen
Licence
Apache-2.0

At a glance

Run quantum chemistry simulations with MindQuantum. An agent skill from mindspore-ai/mindquantum.

  • Works in 5 steps: Molecular Definition → Hamiltonian Construction → Fermion-to-Qubit Transforms → …
  • The user wants to simulate molecules
  • SKILL.md covers The Chemistry Pipeline, Quick Start: H₂ Ground State, Step-by-Step Breakdown and mqchem: CI-Subspace Chemistry, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Mq Quantum Chemistry is an agent skill from mindspore-ai/mindquantum. Run quantum chemistry simulations with MindQuantum. Covers the molecule-to-VQE pipeline: molecular definition, Hartree-Fock reference states, FermionOperator construction, fermion-to-qubit transforms (Jordan-Wigner, Parity, Bravyi-Kitaev, ternary tree, Bravyi-Kitaev Superfast), UCCSD and HEA ansätze, VQE optimization, and the mqchem CI-subspace module. Use when the user wants to simulate molecules, compute ground state energies, do quantum chemistry, use UCCSD, run VQE for chemistry, map fermion operators to…

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Research & Science, covering Quantum computing. The repository describes itself as: MindQuantum is a quantum machine learning library that can be used to build and train different quantum neural networks. The licence is Apache-2.0.

When your agent uses it

  • The user wants to simulate molecules
  • Compute ground state energies
  • Do quantum chemistry
  • Run VQE for chemistry

Example prompts

  • “/mq-quantum-chemistry”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Molecular Definition
  2. Hamiltonian Construction
  3. Fermion-to-Qubit Transforms
  4. Ansatz Construction
  5. VQE Optimization

What it can do on your machine

Read from SKILL.md and the folder at commit 2a0ca08. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mq Quantum Chemistry loads about 2.2k tokens when it runs. Until then it costs about 139 tokens; SKILL.md has 211 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~139
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mindspore-ai/mindquantum at commit 2a0ca08, republished under its Apache-2.0 licence (© mindspore-ai). 211 words, ~2,208 tokens.

Download SKILL.mdSave it as .claude/skills/mq-quantum-chemistry/SKILL.md (or your agent's skills folder).
name
mq-quantum-chemistry
description
Run quantum chemistry simulations with MindQuantum. Covers the molecule-to-VQE pipeline: molecular definition, Hartree-Fock reference states, FermionOperator construction, fermion-to-qubit transforms (Jordan-Wigner, Parity, Bravyi-Kitaev, ternary tree, Bravyi-Kitaev Superfast), UCCSD and HEA ansätze, VQE optimization, and the mqchem CI-subspace module. Use when the user wants to simulate molecules, compute ground state energies, do quantum chemistry, use UCCSD, run VQE for chemistry, map fermion operators to qubits, or use mqchem.

Quantum Chemistry with MindQuantum

MindQuantum provides a complete pipeline for variational quantum chemistry, from molecular specification to ground state energy computation.

The Chemistry Pipeline

text
Molecule → Classical Pre-calc → FermionOperator → Qubit Transform → Ansatz → VQE → Ground State Energy
  (geometry)   (HF, integrals)    (second quant.)   (JW/Parity/BK)   (UCCSD)  (optimize)

Quick Start: H₂ Ground State

python
from openfermion import MolecularData
from openfermionpyscf import run_pyscf
from mindquantum.algorithm.nisq import generate_uccsd
from mindquantum.core.operators import Hamiltonian
from mindquantum.simulator import Simulator
import numpy as np
from scipy.optimize import minimize

# 1. Define and compute molecule classically
geometry = [("H", (0, 0, 0)), ("H", (0, 0, 0.74))]
mol = MolecularData(geometry, "sto-3g", multiplicity=1, charge=0)
mol = run_pyscf(mol, run_ccsd=True, run_fci=True)
print(f"FCI energy: {mol.fci_energy:.6f} Ha")

# 2. Generate everything at once
ansatz_circuit, init_amplitudes, param_names, qubit_ham, n_qubits, n_electrons = generate_uccsd(mol)

# 3. Prepare Hartree-Fock initial state
from mindquantum.core.circuit import Circuit
from mindquantum.core.gates import X

hf_state = Circuit()
for i in range(n_electrons):
    hf_state += X.on(i)

full_circuit = hf_state + ansatz_circuit

# 4. Run VQE
sim = Simulator("mqvector", n_qubits)
ham = Hamiltonian(qubit_ham)
grad_ops = sim.get_expectation_with_grad(ham, full_circuit)


def energy_and_grad(params):
    f, g = grad_ops(params)
    return np.real(f)[0, 0], np.real(g)[0, 0]


result = minimize(energy_and_grad, init_amplitudes, method="BFGS", jac=True)
print(f"VQE energy: {result.fun:.6f} Ha")
print(f"Error:      {abs(result.fun - mol.fci_energy):.2e} Ha")

Step-by-Step Breakdown

Step 1: Molecular Definition
python
from openfermion import MolecularData
from openfermionpyscf import run_pyscf

# Geometry: list of (atom, (x, y, z)) in Angstroms
geometry = [("Li", (0, 0, 0)), ("H", (0, 0, 1.6))]

mol = MolecularData(geometry=geometry, basis="sto-3g", multiplicity=1, charge=0)  # Basis set  # 2S+1  # Net charge

# Run classical methods for reference energies
mol = run_pyscf(
    mol,
    run_scf=True,  # Hartree-Fock
    run_ccsd=True,  # CCSD (provides initial amplitudes)
    run_fci=True,  # FCI (exact reference energy)
)

print(f"HF energy:   {mol.hf_energy:.6f}")
print(f"CCSD energy: {mol.ccsd_energy:.6f}")
print(f"FCI energy:  {mol.fci_energy:.6f}")
print(f"n_qubits:    {mol.n_qubits}")
print(f"n_electrons: {mol.n_electrons}")
Step 2: Hamiltonian Construction
python
from mindquantum.algorithm.nisq.chem import get_qubit_hamiltonian

# Method 1: Direct conversion
qubit_ham = get_qubit_hamiltonian(mol)

# Method 2: Manual — more control
from mindquantum.core.operators import FermionOperator, InteractionOperator

# Convert OpenFermion molecular integrals to MindQuantum FermionOperator
ham_of = mol.get_molecular_hamiltonian()
inter_ops = InteractionOperator(*ham_of.n_body_tensors.values())
fermion_ham = FermionOperator(inter_ops)

# Transform to qubit representation
from mindquantum.algorithm.nisq import Transform

qubit_ham = Transform(fermion_ham).jordan_wigner()

# Wrap for simulation
from mindquantum.core.operators import Hamiltonian

ham = Hamiltonian(qubit_ham)
Step 3: Fermion-to-Qubit Transforms

MindQuantum provides these transforms:

python
from mindquantum.algorithm.nisq import Transform

fop = fermion_hamiltonian  # FermionOperator

# Jordan-Wigner transform
qop_jw = Transform(fop).jordan_wigner()

# Parity transform
qop_p = Transform(fop).parity()

# Bravyi-Kitaev transform
qop_bk = Transform(fop).bravyi_kitaev()

# Ternary-tree transform
qop_tt = Transform(fop).ternary_tree()

# Bravyi-Kitaev Superfast transform
qop_bks = Transform(fop).bravyi_kitaev_superfast()
Step 4: Ansatz Construction
UCCSD
python
from mindquantum.algorithm.nisq import generate_uccsd

# All-in-one helper
circuit, init_amps, param_names, qubit_ham, n_qubits, n_elec = generate_uccsd(mol)

# Or manual construction
from mindquantum.algorithm.nisq import uccsd_singlet_generator, Transform
from mindquantum.core.operators import TimeEvolution

ucc_ops = uccsd_singlet_generator(mol.n_qubits, mol.n_electrons)
qubit_ucc = Transform(ucc_ops).jordan_wigner()
ansatz = TimeEvolution(qubit_ucc.imag, 1.0).circuit
Get Initial Amplitudes from CCSD
python
from mindquantum.algorithm.nisq import uccsd_singlet_get_packed_amplitudes

init_amplitudes = uccsd_singlet_get_packed_amplitudes(
    mol.ccsd_single_amps, mol.ccsd_double_amps, mol.n_qubits, mol.n_electrons
)
Hardware-Efficient Ansatz
python
from mindquantum.algorithm.nisq import HardwareEfficientAnsatz
from mindquantum.core.gates import RY, RZ, X

ansatz = HardwareEfficientAnsatz(n_qubits=mol.n_qubits, single_rot_gate_seq=[RY, RZ], entangle_gate=X, depth=4).circuit
Step 5: VQE Optimization
python
sim = Simulator("mqvector", n_qubits)
grad_ops = sim.get_expectation_with_grad(ham, hf_state + ansatz)


def energy_and_grad(params):
    f, g = grad_ops(params)
    return np.real(f)[0, 0], np.real(g)[0, 0]


# Use any SciPy optimizer compatible with this value-and-gradient function.
result = minimize(energy_and_grad, init_amplitudes, method="L-BFGS-B", jac=True, options={"maxiter": 500})

print(f"VQE energy: {result.fun:.8f} Ha")
print(f"Difference from FCI: {abs(result.fun - mol.fci_energy):.8f} Ha")

mqchem: CI-Subspace Chemistry

MindQuantum's mqchem module operates in a Configuration Interaction subspace instead of the full Hilbert space.

python
from mindquantum.simulator import mqchem

# 1. Prepare components from molecular data
hamiltonian, ansatz_circuit, init_amps = mqchem.prepare_uccsd_vqe(
    mol, threshold=1e-6  # Filter small excitation operators
)

# 2. Create CI-subspace simulator
vqe_sim = mqchem.MQChemSimulator(mol.n_qubits, mol.n_electrons, seed=42)

# 3. Get gradient operator
grad_ops = vqe_sim.get_expectation_with_grad(hamiltonian, ansatz_circuit)

# 4. Optimize
result = minimize(grad_ops, init_amps, method="L-BFGS-B", jac=True)
print(f"mqchem VQE energy: {result.fun:.8f} Ha")
mqchem Key Classes
ClassPurpose
mqchem.CIHamiltonianHamiltonian optimized for CI subspace
mqchem.UCCExcitationGateUCC excitation as a gate: $e^{\theta(T - T^\dagger)}$
mqchem.MQChemSimulatorSimulator operating in CI subspace
mqchem.prepare_uccsd_vqeAll-in-one: molecule → (hamiltonian, circuit, init_params)

Potential Energy Surface Scan

Compute energy at multiple bond lengths:

python
import numpy as np
from scipy.optimize import minimize

distances = np.arange(0.4, 3.0, 0.1)
energies = []

for d in distances:
    geometry = [("H", (0, 0, 0)), ("H", (0, 0, d))]
    mol = MolecularData(geometry, "sto-3g", 1, 0)
    mol = run_pyscf(mol, run_ccsd=True)

    circ, init_amps, param_names, qham, nq, ne = generate_uccsd(mol)

    hf = Circuit()
    for i in range(ne):
        hf += X.on(i)

    sim = Simulator("mqvector", nq)
    grad_ops = sim.get_expectation_with_grad(Hamiltonian(qham), hf + circ)

    def cost(p):
        f, g = grad_ops(p)
        return np.real(f)[0, 0], np.real(g)[0, 0]

    res = minimize(cost, init_amps, method="BFGS", jac=True)
    energies.append(res.fun)
    print(f"d={d:.1f} Å, E={res.fun:.6f} Ha")

Source-Backed Notes

  1. Default simulator precision: Simulator(..., dtype=None) uses mindquantum.complex128; pass dtype explicitly if a different precision is required.
  2. generate_uccsd: This helper returns the UCCSD circuit, initial amplitudes, parameter names, qubit Hamiltonian, qubit count, and electron count.
  3. Reference states: UCCAnsatz does not include the Hartree-Fock reference state; prepare it separately before appending the ansatz circuit.
  4. Reference energies: If run_pyscf(..., run_fci=True) was used and mol.fci_energy is available, compare VQE output to that reference explicitly.
  5. Dependencies: Quantum chemistry workflows using MolecularData and run_pyscf require openfermion and openfermionpyscf.

© mindspore-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/mq-quantum-chemistry of mindspore-ai/mindquantum.

Open the folder on GitHubat commit 2a0ca08

Compare with similar skills

Mq Quantum Chemistry next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mq Quantum Chemistry compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mq Quantum Chemistry this skillmindspore-ai/mindquantum102—~2.2kAutomated safety check: PassApache-2.0
Qiskit 2.x Quantum ML Referenceaiming-lab/AutoResearchClaw15k—~4.7kAutomated safety check: PassMIT
QutipzLanqing/codex-claude-academic-skills4.7k8 repos~2.3kAutomated safety check: PassBSD-3-Clause
Cirqdavila7/claude-code-templates33k11 repos~2.7kAutomated safety check: PassMIT
Qiskitdavila7/claude-code-templates33k9 repos~2.2kAutomated safety check: PassMIT
Pennylanedavila7/claude-code-templates33k7 repos~1.9kAutomated safety check: PassMIT

Similar skills

  • Qiskit 2.x Quantum ML Reference

    aiming-lab/AutoResearchClaw

    Reference patterns for writing qiskit 2.x code for variational quantum machine learning: feature maps, VQC training, VQE for chemistry, MPS circuits and noise models.

    15k GitHub stars~4.7k tokensUpdated 1 mo ago
    Research & ScienceAuto-check passed
  • Qutip

    zLanqing/codex-claude-academic-skills

    Quantum physics simulation library for open quantum systems.

    4.7k GitHub starsUsed in 8 repos~2.3k tokens
    Research & ScienceAuto-check passed
  • Cirq

    davila7/claude-code-templates

    Quantum computing framework for building, simulating, optimizing, and executing quantum circuits.

    33k GitHub starsUsed in 11 repos~2.7k tokens
    Research & ScienceAuto-check passed
  • Qiskit

    davila7/claude-code-templates

    Comprehensive quantum computing toolkit for building, optimizing, and executing quantum circuits.

    33k GitHub starsUsed in 9 repos~2.2k tokens
    Research & ScienceAuto-check passed
  • Pennylane

    davila7/claude-code-templates

    Cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry.

    33k GitHub starsUsed in 7 repos~1.9k tokens
    Research & ScienceAuto-check passed
  • Qiskit

    K-Dense-AI/scientific-agent-skills

    Builds, simulates, transpiles, and executes quantum circuits with Qiskit and IBM Quantum Runtime.

    48k GitHub starsUsed in 1 repo~3.3k tokens
    Research & ScienceAuto-check passed

More from mindspore-ai/mindquantum

  • Mindquantum

    mindspore-ai/mindquantum

    Build, simulate, and analyze quantum circuits with MindQuantum.

    102 GitHub stars~2.3k tokensUpdated 20 days ago
    Auto-check passed
  • Mq Circuit Compiler

    mindspore-ai/mindquantum

    Compile and optimize quantum circuits for hardware execution using MindQuantum's compiler pipeline.

    102 GitHub stars~1.7k tokensUpdated 20 days ago
    Auto-check passed
  • Mq Noisy Simulation

    mindspore-ai/mindquantum

    Simulate noisy quantum circuits with MindQuantum. An agent skill from mindspore-ai/mindquantum.

    102 GitHub stars~2.2k tokensUpdated 20 days ago
    Auto-check passed
  • Mq Qaia Solver

    mindspore-ai/mindquantum

    Solve Ising/QUBO-style combinatorial optimization problems using MindQuantum's Quantum Annealing-Inspired Algorithms (QAIA).

    102 GitHub stars~2.2k tokensUpdated 20 days ago
    Auto-check passed
  • Mq Variational Training

    mindspore-ai/mindquantum

    Build and train variational quantum algorithms (VQE, QAOA, QML, QNN) with MindQuantum.

    102 GitHub stars~2.5k tokensUpdated 20 days ago
    Auto-check passed

Questions about Mq Quantum Chemistry

What does Mq Quantum Chemistry do?

Run quantum chemistry simulations with MindQuantum. An agent skill from mindspore-ai/mindquantum. Mq Quantum Chemistry is an agent skill from mindspore-ai/mindquantum. Run quantum chemistry simulations with MindQuantum.

When should I use Mq Quantum Chemistry?

Mq Quantum Chemistry fits situations like: the user wants to simulate molecules; compute ground state energies; do quantum chemistry; run VQE for chemistry.

How do I install Mq Quantum Chemistry in Claude Code?

Run `npx skills add mindspore-ai/mindquantum --skill mq-quantum-chemistry -a claude-code`. Or copy the skill folder (skills/mq-quantum-chemistry in mindspore-ai/mindquantum) into .claude/skills/mq-quantum-chemistry in your project. Claude Code loads it when a task matches its description.

How do I install Mq Quantum Chemistry in Codex?

Run `npx skills add mindspore-ai/mindquantum --skill mq-quantum-chemistry -a codex`. Or copy the skill folder (skills/mq-quantum-chemistry in mindspore-ai/mindquantum) into .agents/skills/mq-quantum-chemistry in your project. Codex loads it when a task matches its description.

Can I use Mq Quantum Chemistry in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mindspore-ai/mindquantum --skill mq-quantum-chemistry -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mq-quantum-chemistry, .gemini/skills/mq-quantum-chemistry, .github/skills/mq-quantum-chemistry and .opencode/skills/mq-quantum-chemistry in your project.

What does Mq Quantum Chemistry need to run?

SKILL.md names no scripts, command-line tools or credentials: Mq Quantum Chemistry is instructions for the agent only. Our summary lists: Python 3.

Does Mq Quantum Chemistry access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Mq Quantum Chemistry safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Mq Quantum Chemistry use?

Mq Quantum Chemistry is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mq Quantum Chemistry use?

About 2.2k tokens (SKILL.md is roughly 8.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Mq Quantum Chemistry?

Skills that share tags, products or a category with Mq Quantum Chemistry: Qiskit 2.x Quantum ML Reference (aiming-lab/AutoResearchClaw, 15k stars), Qutip (zLanqing/codex-claude-academic-skills, 4.7k stars), Cirq (davila7/claude-code-templates, 33k stars) and Qiskit (davila7/claude-code-templates, 33k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mq Quantum Chemistry?

mindspore-ai (a GitHub organization) maintains it in mindspore-ai/mindquantum, which has 102 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on September 21, 2026.

Source: mindspore-ai/mindquantum on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.