# Ansatz#

This section is about setting the Ansatz that will prepare the quantum state you want to find.

## Type#

The following types are available for ansatz.

• HARDWARE_EFFICIENT [Kan17][Details]

• SYMMETRY_PRESERVING [Gar20]

• UCCD [Per14, Sok20]

• UCCSD [Per14, Sok20][Details]

### Note:#

When you are using either UCCD or UCCSD for finding excited states, spin_adapted_ref_state must be set to true.

## References#

[Kan17] “Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets,” by A. Kandala et al. in Nature 549, 242-246 ( 2017).

[Gar20] “Efficient symmetry-preserving state preparation circuits for the variational quantum eigensolver algorithm”, B. T. Gard, L. Zhu, G. S. Barron, N. J. Mayhall, S. E. Economou, and E. Barnes, npj Quantum Information volume 6, Article number: 10 (2020). .

[Per14] “A variational eigenvalue solver on a photonic quantum processor,” A. Peruzzo et al, Nature Communications 5, 4213 (2014). .

[Sok20] “Quantum orbital-optimized unitary coupled cluster methods in the strongly correlated regime: Can quantum algorithms outperform their classical equivalents?”, I. O. Sokolov et al., The Journal of Chemical Physics volume 152, 124107 (2020).

[Gri19] “An adaptive variational algorithm for exact molecular simulations on a quantum computer”, H. R. Grimsley et al, Nature Communications 10, 3007 (2019) ).

## Common options#

The options that can be specified for all Ansatz are as follows:

• reference_state: You can choose from the following reference states:.

• RHF: Restricted Hartree-Fock state (default)

• CIS: Configuration Interaction Singles State. CIS cannot be used with periodic boundary condition.

• Note: With MCVQE, the reference state is always CIS.

• spin_adapted_ref_state: If true, in the case where RHF is chosen for reference_state and multiplicity or sz_number or both are specified in target_molecule, the generated reference states are chosen to satisfy those quantum numbers (default value is false).

• spin_state_list: If spin_adapted_ref_state is set to true, each reference state can be specified by multiplicity and sz, provided as a list. If not specified, the values of multiplicity and sz provided in target_molecule are used.

• initial_parameter: The initial parameter of Ansatz. For VQD, the initial parameters of each ground and excited state can be given as a nested list.

• use_random_initial_guess: Use a random value for Ansatz’s initial parameter (default value is true).

• randomness_type: If use_random_initial_guess is true, then the distribution of randomness can be chosen from the following options:

• UNIFORM: Continuous uniform distribution (default)

• GAUSSIAN: Normal (Gaussian) distribution. If initial_parameter is given, it creates a distribution around it.

• randomness_variance: Variance of normally distributed random numbers when randomness_type is gaussian.

• init_param_random_seed: If use_random_initial_guess is true, the seed of the random number to use (default value is 1).

## Options for UCCD and UCCSD#

If the ansatz is either of

• UCCD

• UCCSD

the following option is required:

• trotter_steps: Steps $$n$$ of the Trotter-Suzuki expansion ($$e^{\hat{A} + \hat{B}} \approx [e^{\hat{A}/n} e^{\hat{B}/n}]^n$$).

If the ansatz is UCCSD, the following option is available:

• is_spin_restricted_uccsd: When set to true, the excitation operators of UCCSD ansatz are restricted so they preserve total spin symmetry ($$S^2$$). (The default is false.)

## Input example#

"ansatz": {
"type": "UCCD",
"reference_state": "RHF",
"is_spin_restricted_uccsd": true,
"trotter_steps": 1,
"initial_parameter": [0],
"use_random_initial_guess": false
}

"ansatz": {
"type": "UCCSD",
"reference_state": "RHF",
"spin_state_list": [
{
"state": 0,
"multiplicity": 1,
"sz": 0
},
{
"state": 1,
"multiplicity": 3,
"sz": 0
}
],
"trotter_steps": 1,
"use_random_initial_guess": true,
"randomness_type": "GAUSSIAN",
"randomness_variance": 0.1
}


## Options for hardware efficient and symmetry preserving ansatzes#

If the ansatz is either of

• HARDWARE_EFFICIENT

• SYMMETRY_PRESERVING

the following option is required:

• depth: Number of gate layers in a repeated circuit.

• is_state_real: When set to true, the state vector is kept real. (The default is true.)

Options that needs to be specified for SYMMETRY_PRESERVING ansatz:

• entanglement_pattern: An option to specify the pattern in which the entanglement gate is placed. If LINEAR is specified, the n-qubit pairs of (0, 1), (1, 2), … (n-2, n-1) qubit pairs in the n-qubit circuit are entangled. If CIRCULAR is specified, these plus the (n-1, 0) qubits are also entangled. If no input is given, then LINEAR is the default value.

## Input example#

"ansatz": {
"type": "SYMMETRY_PRESERVING",
"is_state_real": true,
"reference_state": "RHF",
"depth": 4,
"use_random_initial_guess": true,
"randomness_variance": 0.75,
"randomness_type": "GAUSSIAN",
"init_param_random_seed": 1,
"entanglement_pattern": "LINEAR",
}


• adaptive_gtol: threshold for the slope of the rotation gate $$e^{i \theta \hat{G}}$$ to be added to Ansatz in the next iteration.
In the case of potential energy surface scans, molecular dynamics simulations, etc., the parameters of the previous converged VQE can be set as the initial parameters of the VQE in order to speed up the convergence. You can set the opt_params of vqe_result in the previous output as the initial_parameter of ansatz in the input.
If multiple molecular structures are set to target_molecule and use_previous_result is true, the opt_params obtained from the previous calculation is automatically set to initial parameters.