Cost function

When solving a variational method, the quantum state is computed by imposing constraints on properties of the spin state set by target_molecule and number of electrons. Specifically, it is useful in the following situations

  • To impose a constraint on the ground/excited state of a molecule that conserves the number of electrons

  • To find the energy level of an excited state with a specific spin quantum number

  • To find the excited states that are orthogonal to all the eigenstates in the lower energy levels

Type

The following methods are available:

  • NONE: No additional cost function except energy term (Default)

  • SIMPLE: Use the cost function defined as below

As shown in the following equation, we add the penalty term \(\mathcal{L}_{\mathrm{penalty}}\) to the cost function to impose a constraint on the spin quantum number and the number of electrons in the quantum state.

\[\mathcal{L}_{\mathrm{cost}} = \mathcal{L}_{\mathrm{energy}} + \mathcal{L}_{\mathrm{penalty}} = \langle\psi(\vec{\theta})| H |\psi(\vec{\theta})\rangle + \sum_i w_i \langle\psi(\vec{\theta})| ( \hat{O}_i - o_i )^2 |\psi(\vec{\theta})\rangle\]

where \(w_i\) is weight and \(\hat{O}_i\) is an observable that is constrained by the penalty term to be \(o_i\).

Common options

When you one of the following solver:

  • VQE

  • SSVQE

  • MCVQE

  • VQD

you can specify the following options in common.

  • s2_number_weight: the weight \(w_i\) given to the constraint for \(\langle{S}^2\rangle\)

  • sz_number_weight: the weight \(w_i\) given to the constraint for \(\langle{S}_z\rangle\)

  • particle_number_weight: the weight \(w_i\) given to the constraint for the number of electrons \(\langle \hat{N}_{tot} \rangle\).

Input example

"cost_function": {
  "type": "SIMPLE",
  "s2_number_weight": 10,
  "sz_number_weight": 10,
  "particle_number_weight": 10
}

SSVQE options

Options when SSVQE is selected with solver:

  • SSVQE_weights

This is the weight \(w_i\) in the cost function of SSVQE algorithm \(\mathcal{L}_{\mathrm{energies}}\). ({\(|\psi_0(\vec{\theta})\rangle, ..., |\psi_{k-1}(\vec{\theta})\rangle\)} are orthogonal quantum states here)

\[\mathcal{L}_{\mathrm{cost}} = \mathcal{L}_{\mathrm{energies}} + \mathcal{L}_{\mathrm{penalty}} = \sum_{i} w_{i} \langle\psi_{i}(\vec{\theta})|H|\psi_{i}(\vec{\theta})\rangle + \mathcal{L}_{\mathrm{penalty}}\]

Input example

"cost_function": {
  "type": "SIMPLE",
  "SSVQE_weights": [4.0, 1.0]
}

VQD options

Options available when VQD is selected as a solver:

One of the following fields must be set:

  • overlap_weights

  • overlap_weight

Weights \(w_i\) in the penalty term for wave function overlaps \(\mathcal{L}_{\mathrm{overlap}}\) added to VQD algorithm cost function (\(\psi_{i}(\vec{\theta_i}\)) is an eigenstate on a level lower than \(k\)’)

\[\mathcal{L}_{\mathrm{cost}} = \mathcal{L}_{\mathrm{energy}} + \mathcal{L}_{\mathrm{overlap}} + \mathcal{L}_{\mathrm{penalty}} = \langle\psi_{k}(\vec{\theta_k})|H|\psi_{k}(\vec{\theta_k})\rangle + \sum^{k-1}_{i} w_{i} \left| \langle\psi_{i}(\vec{\theta_i})|\psi_{k}(\vec{\theta_k})\rangle \right|^2 + \mathcal{L}_{\mathrm{penalty}}\]

overlap_weights must be given as a list of values of the same size as the number of excited states, while overlap_weight must be given as a single value, in which case the weight of the each overlap penalty term is given the same value.

Input example

"cost_function": {
  "type": "SIMPLE",
  "overlap_weights": [4.0, 1.0]
}
"cost_function": {
    "type": "SIMPLE",
    "overlap_weight": 4.0
}