Added a fix_variational_parameters() method to the Circuit class, allowing for all variational gates to be converted to non-variational gates. (This is used for converting Circuit objects passed via the reference_state argument in an Ansatz constructor.
:construction: Changes to Existing Features
Added support for Circuit objects being passed via the reference_state in an Ansatz constructor. Previously, the only supported reference states were in string format (e.g. "HF" to denote a circuit that prepares the Hartree-Fock state for a given ansatz). If an instance of a Circuit object is passed as reference_state to an ansatz constructor, a copy of this Circuit with all variational parameters fixed is used as the ansatz reference state circuit.
The following Ansatz classes were changed to support this feature:
HEA
AdaptAnsatz (for a reference_state circuit passed via ansatz_options)
ILC*
QCC*
QMF
UCCGD
UCCSD
UpCCGSD
(* These ansatzes require a QMF reference state, where a copy of a circuit passed via reference_state is used as the associated qmf_circuit. In this copied circuit, variational parameters are not fixed. This is reflected in the constructor docstring.)
Support for reference state circuits was not added to the VSQS, RUCC or VariationalCircuit ansatzes because the reference_state argument is either not supported.
This is a PR to resolve Issue #384: Circuit as reference state in the ansatz definition.
:sparkles: New Features
fix_variational_parameters()
method to theCircuit
class, allowing for all variational gates to be converted to non-variational gates. (This is used for convertingCircuit
objects passed via thereference_state
argument in an Ansatz constructor.:construction: Changes to Existing Features
Added support for
Circuit
objects being passed via thereference_state
in an Ansatz constructor. Previously, the only supported reference states were in string format (e.g."HF"
to denote a circuit that prepares the Hartree-Fock state for a given ansatz). If an instance of aCircuit
object is passed asreference_state
to an ansatz constructor, a copy of this Circuit with all variational parameters fixed is used as the ansatz reference state circuit.The following
Ansatz
classes were changed to support this feature:HEA
AdaptAnsatz
(for areference_state
circuit passed viaansatz_options
)ILC
*QCC
*QMF
UCCGD
UCCSD
UpCCGSD
(* These ansatzes require a QMF reference state, where a copy of a circuit passed via
reference_state
is used as the associatedqmf_circuit
. In this copied circuit, variational parameters are not fixed. This is reflected in the constructor docstring.)VSQS
,RUCC
orVariationalCircuit
ansatzes because thereference_state
argument is either not supported.