adapt

A Python package to run ADAPT-VQE.

Submodules

Package Contents

Classes

Xiphos

Class representing an individual XIPHOS calculation

Functions

t_ucc_state(params, ansatz, pool, ref)

t_ucc_E(params, ansatz, H_vqe, pool, ref)

kup_E(params, k, H_vqe, pool, ref)

t_ucc_grad(params, ansatz, H_vqe, pool, ref)

t_ucc_hess(params, ansatz, H_vqe, pool, ref)

t_ucc_jac(params, ansatz, H_vqe, pool, ref)

adapt_vqe(ansatz, H_vqe, pool, ref)

wfn_grid(op, pool, ref, xiphos)

multi_vqe(params, ansatz, H_vqe, pool, ref, xiphos[, ...])

full_scan(ansatz, H_vqe, pool, ref, xiphos[, gridpoints])

multi_kup(H_vqe, ref, xiphos[, k, guesses])

multi_vqe_square(params, ansatz, H_vqe, pool, ref, xiphos)

detailed_kup(params, seed, k, xiphos)

vqe(params, ansatz, H_vqe, pool, ref[, strategy, energy])

detailed_vqe(params, ansatz, seed, xiphos[, jac_svd, ...])

solution_analysis(L, ansatz, H_vqe, pool, ref, seeds, ...)

Attributes

Eh

versions

adapt.Eh = 627.5094740631
class adapt.Xiphos(H, ref, system, pool, v_pool, H_adapt=None, H_vqe=None, sym_ops=None)[source]

Class representing an individual XIPHOS calculation

rebuild_ansatz(A)[source]
ucc_E(params, ansatz)[source]
comm(A, B)[source]
ucc_grad_zero(ansatz)[source]
ucc_hess_zero(ansatz)[source]
ucc_diag_jerk_zero(ansatz)[source]
cubic_energy(x, grad, hess, jerk)[source]
ucc_inf_d_E(params, ansatz, E0, grad, hess)[source]
tucc_inf_d_E(params, ansatz, E0, grad, hess)[source]
H_eff_analysis(params, ansatz)[source]
param_scan(params, ansatz, ref, a, b, save_file='params.csv', gridpoints=100)[source]
two_vec_interpolate(theta_a, theta_b, ansatz)[source]
grad_variance(params, ansatz, ref, shots=10, r=2 * math.pi, seed_base=0)[source]
pretend_adapt(params, ansatz, ref, order, guesses=0)[source]
random_adapt(params, ansatz, ref, gtol=None, Etol=None, max_depth=None, criteria='grad', guesses=0)[source]
breadapt(params, ansatz, ref, gtol=None, Etol=None, max_depth=None, guesses=0, n=1, hf=True, threads=1, seed=0, criteria='grad')[source]

Run one or more ADAPT^N Calculations without generator diagonalization

Parameters:
  • params, ansatz (list) – Lists of parameters and operator indices to use as the initial ansatz and parameters Only recommend using non-empty lists for N = 1

  • ref (scipy sparse matrix) – Reference matrix

  • gtol, Etol (float) – gradient norm and energy thresholds

  • max_depth (int) – Max number of operators to use

  • guesses (int) – Number of random guesses to try at each step

  • hf (bool) – Whether to try the HF (all zeros) initialization at each step

  • threads (int) – Number of threads to use for multiple BFGS threads

  • seed (int) – Seed for random number generator

  • criteria (string) – Criterion to use for operator addition

Returns:

error – The error from exact diagonalization

Return type:

float

gd_t_ucc_state(params, ansatz)[source]
gd_t_ucc_E(params, ansatz)[source]
gd_t_ucc_grad(params, ansatz)[source]
gd_adiabatic_vqe(params, ansatz, F=None, steps=100)[source]
gd_detailed_vqe(params, ansatz, seed)[source]
gd_multi_vqe(params, ansatz, guesses=0, hf=True, threads=1, F=None, follow=0, diags=None, unitaries=None)[source]
gd_pretend_adapt(params, ansatz, ref, order=[], gtol=None, Etol=None, max_depth=None, guesses=0, hf=True, threads=1, seed=0, F=None, steps=100)[source]

Run one or more ADAPT calculations with diagonalized generators

Parameters:
  • params, ansatz (list) – Lists of parameters and operator indices to use as the initial ansatz and parameters Only recommend using non-empty lists for N = 1

  • ref (scipy sparse matrix) – Reference matrix

  • gtol, Etol (float) – gradient norm and energy thresholds

  • max_depth (int) – Max number of operators to use

  • guesses (int) – Number of random guesses to try at each step

  • hf (bool) – Whether to try the HF (all zeros) initialization at each step

  • threads (int) – Number of threads to use for multiple BFGS threads

  • seed (int) – Seed for random number generator

  • F (scipy sparse matrix) – Fock operator for adiabatic optimizer

  • steps (int) – Number of adiabatic steps to take

Returns:

error – The error from exact diagonalization

Return type:

float

gd_adapt(params, ansatz, ref, gtol=None, Etol=None, max_depth=None, guesses=0, hf=True, threads=1, seed=0, F=None, steps=100, follow=0)[source]

Run one or more ADAPT calculations with diagonalized generators

Parameters:
  • params, ansatz (list) – Lists of parameters and operator indices to use as the initial ansatz and parameters Only recommend using non-empty lists for N = 1

  • ref (scipy sparse matrix) – Reference matrix

  • gtol, Etol (float) – gradient norm and energy thresholds

  • max_depth (int) – Max number of operators to use

  • guesses (int) – Number of random guesses to try at each step

  • hf (bool) – Whether to try the HF (all zeros) initialization at each step

  • threads (int) – Number of threads to use for multiple BFGS threads

  • seed (int) – Seed for random number generator

  • F (scipy sparse matrix) – Fock operator for adiabatic optimizer

  • steps (int) – Number of adiabatic steps to take

  • follow (int) – Which solution to follow. (I.e. 0 uses the recycled guess to pick the next operator. 1 uses HF if HF is True, etc.)

Returns:

error – The error from exact diagonalization

Return type:

float

graph(ansatz, ref)[source]
graph_nick(ansatz, ref)[source]
is_in(det, dets)[source]
adapt.t_ucc_state(params, ansatz, pool, ref)[source]
adapt.t_ucc_E(params, ansatz, H_vqe, pool, ref)[source]
adapt.kup_E(params, k, H_vqe, pool, ref)[source]
adapt.t_ucc_grad(params, ansatz, H_vqe, pool, ref)[source]
adapt.t_ucc_hess(params, ansatz, H_vqe, pool, ref)[source]
adapt.t_ucc_jac(params, ansatz, H_vqe, pool, ref)[source]
adapt.adapt_vqe(ansatz, H_vqe, pool, ref)[source]
adapt.wfn_grid(op, pool, ref, xiphos)[source]
adapt.multi_vqe(params, ansatz, H_vqe, pool, ref, xiphos, energy=None, guesses=0, hf=True, threads=1, F=None)[source]
adapt.full_scan(ansatz, H_vqe, pool, ref, xiphos, gridpoints=100)[source]
adapt.multi_kup(H_vqe, ref, xiphos, k=1, guesses=0)[source]
adapt.multi_vqe_square(params, ansatz, H_vqe, pool, ref, xiphos, energy=None, guesses=0)[source]
adapt.detailed_kup(params, seed, k, xiphos)[source]
adapt.vqe(params, ansatz, H_vqe, pool, ref, strategy='bfgs', energy=None)[source]
adapt.detailed_vqe(params, ansatz, seed, xiphos, jac_svd=False, hess_diag=False)[source]
adapt.solution_analysis(L, ansatz, H_vqe, pool, ref, seeds, param_list, E0s, xiphos, guess='recycled')[source]
adapt.versions