isqtools.chem package

Submodules

isqtools.chem.utils module

Some useful functions of quantum chemistry. This file is inspired by TenCirChem and OpenFermion. TenCirChem: https://github.com/tencent-quantum-lab/TenCirChem OpenFermion: https://quantumai.google/openfermion

canonical_mo_coeff(mo_coeff)

Make the first large element positive all elements smaller than 1e-5 is highly unlikely (at least 1e10 basis).

Parameters:

mo_coeff (ndarray) – Molecular orbital coefficient.

Return type:

ndarray

Returns:

Molecular orbital coefficient after truncation.

ex_op_to_fop(ex_op, with_conjugation=False)

Excited operators to Fermion operators.

Parameters:
  • ex_op (list) – Excitation operators.

  • with_conjugation (bool) – Conjugate or not.

Return type:

Any

Returns:

Fermion operators.

get_codeff_from_Hf(hf)
Parameters:

hf (Any)

get_int_from_hf(hf, active_space=None)

Use pyscf to get one- and two-electron integrals, as well as electron energies from Hartree-Fock.

Parameters:
  • hf (Any) – Hartree-Fock from pyscf.

  • active_space (tuple) – active space for CASCI calculation.

Return type:

tuple[ndarray, ndarray, float]

Returns:

Electronic integrals and electronic energy.

get_int_from_mol(mol, C)

Use pyscf to get one- and two-electron integrals, as well as electron energies from mol. Do not use Hartree-Fock molecular coefficients as a starting point.

Parameters:
  • mol (Any) – molecule(mol) from pyscf.

  • C (array) – Custom orbital coefficients.

Return type:

tuple[ndarray, ndarray, float]

Returns:

Electronic integrals and electronic energy.

get_isq_pauli_gates(gates_group, num_qubits)

Convert the Pauli operator into a list to facilitate isq recognition.

Parameters:
  • gates_group (list) – Pauli operators from openfermion_to_pauligates.

  • num_qubits (int) – Number of qubits.

Return type:

list

Returns:

Isq representation of Pauli operator.

get_molecular_hamiltonian(hf)

Get get molecular hamiltonian.

Parameters:

hf (Any) – Hartree-Fock from pyscf.

Return type:

Any

Returns:

Molecular hamiltonian by openfermion.

openfermion_to_pauligates(qubit_hamiltonian)

Extract coefficients and gates of qubit hamiltonian.

Parameters:

qubit_hamiltonian – Qubit hamiltonian.

Returns:

Coefficients and corresponding Pauli operators.

parity(fermion_operator, n_modes, n_elec)

Performs parity transformation.

Parameters:
  • fermion_operator (Any) – The fermion operator.

  • n_modes (int) – The number of spin-orbitals.

  • n_elec (int) – The number of electrons.

Return type:

Any

Returns:

Qubit operators.

reverse_fop_idx(op, n_qubits)

Reverse fermion operators.

Parameters:
  • op (Any)

  • n_qubits (int)

Return type:

Any

reverse_qop_idx(op, n_qubits)

Reverse qubit operators.

Parameters:
  • op (Any)

  • n_qubits (int)

Return type:

Any

spin_orb_from_int(int1e, int2e)

Spin orbital coefficients obtained from electron integrals.

Parameters:
  • int1e (ndarray) – Single electron integration.

  • int2e (ndarray) – Double electron integration.

Return type:

tuple[ndarray, ndarray]

Returns:

One body coefficients and two body coefficients.

Module contents

Quantum computers have a wide range of applications in chemistry. This library mainly packages some tools used by quantum computers when performing chemical simulations.