def make_uccsd_ansatz(self, trotter_steps: int=1, initial_amplitudes: typing.Union[(str, Amplitudes, ClosedShellAmplitudes)]='mp2', include_reference_ansatz=True, parametrized=True, threshold=1e-08, add_singles=None, *args, **kwargs) -> QCircuit:
    '\n\n        Parameters\n        ----------\n        initial_amplitudes :\n            initial amplitudes given as ManyBodyAmplitudes structure or as string\n            where \'mp2\', \'cc2\' or \'ccsd\' are possible initializations\n        include_reference_ansatz :\n            Also do the reference ansatz (prepare closed-shell Hartree-Fock) (Default value = True)\n        parametrized :\n            Initialize with variables, otherwise with static numbers (Default value = True)\n        trotter_steps: int :\n\n        initial_amplitudes: typing.Union[str :\n\n        Amplitudes :\n\n        ClosedShellAmplitudes] :\n             (Default value = "cc2")\n\n        Returns\n        -------\n        type\n            Parametrized QCircuit\n\n        '
    if hasattr(initial_amplitudes, 'lower'):
        if ((initial_amplitudes.lower() == 'mp2') and (add_singles is None)):
            add_singles = True
    elif ((initial_amplitudes is not None) and (add_singles is not None)):
        warnings.warn('make_uccsd_anstatz: add_singles has no effect when explicit amplitudes are passed down', TequilaWarning)
    elif (add_singles is None):
        add_singles = True
    if ((self.n_electrons % 2) != 0):
        raise TequilaException('make_uccsd_ansatz currently only for closed shell systems')
    nocc = (self.n_electrons // 2)
    nvirt = (self.n_orbitals - nocc)
    Uref = QCircuit()
    if include_reference_ansatz:
        Uref = self.prepare_reference()
    amplitudes = initial_amplitudes
    if hasattr(initial_amplitudes, 'lower'):
        if (initial_amplitudes.lower() == 'mp2'):
            amplitudes = self.compute_mp2_amplitudes()
        elif (initial_amplitudes.lower() == 'ccsd'):
            amplitudes = self.compute_ccsd_amplitudes()
        else:
            try:
                amplitudes = self.compute_amplitudes(method=initial_amplitudes.lower())
            except Exception as exc:
                raise TequilaException("{}\nDon't know how to initialize '{}' amplitudes".format(exc, initial_amplitudes))
    if (amplitudes is None):
        tia = None
        if add_singles:
            tia = numpy.zeros(shape=[nocc, nvirt])
        amplitudes = ClosedShellAmplitudes(tIjAb=numpy.zeros(shape=[nocc, nocc, nvirt, nvirt]), tIA=tia)
    closed_shell = isinstance(amplitudes, ClosedShellAmplitudes)
    indices = {}
    if (not isinstance(amplitudes, dict)):
        amplitudes = amplitudes.make_parameter_dictionary(threshold=threshold)
        amplitudes = dict(sorted(amplitudes.items(), key=(lambda x: numpy.fabs(x[1])), reverse=True))
    for (key, t) in amplitudes.items():
        assert ((len(key) % 2) == 0)
        if (not numpy.isclose(t, 0.0, atol=threshold)):
            if closed_shell:
                if ((len(key) == 2) and add_singles):
                    angle = (2.0 * t)
                    if parametrized:
                        angle = (2.0 * Variable(name=key))
                    idx_a = ((2 * key[0]), (2 * key[1]))
                    idx_b = (((2 * key[0]) + 1), ((2 * key[1]) + 1))
                    indices[idx_a] = angle
                    indices[idx_b] = angle
                else:
                    assert (len(key) == 4)
                    angle = (2.0 * t)
                    if parametrized:
                        angle = (2.0 * Variable(name=key))
                    idx_abab = (((2 * key[0]) + 1), ((2 * key[1]) + 1), (2 * key[2]), (2 * key[3]))
                    indices[idx_abab] = angle
                    if ((key[0] != key[2]) and (key[1] != key[3])):
                        idx_aaaa = ((2 * key[0]), (2 * key[1]), (2 * key[2]), (2 * key[3]))
                        idx_bbbb = (((2 * key[0]) + 1), ((2 * key[1]) + 1), ((2 * key[2]) + 1), ((2 * key[3]) + 1))
                        partner = tuple([key[2], key[1], key[0], key[3]])
                        anglex = (2.0 * (t - amplitudes[partner]))
                        if parametrized:
                            anglex = (2.0 * (Variable(name=key) - Variable(partner)))
                        indices[idx_aaaa] = anglex
                        indices[idx_bbbb] = anglex
            else:
                raise Exception('only closed-shell supported, please assemble yourself .... sorry :-)')
    UCCSD = QCircuit()
    factor = (1.0 / trotter_steps)
    for step in range(trotter_steps):
        for (idx, angle) in indices.items():
            UCCSD += self.make_excitation_gate(indices=idx, angle=(factor * angle))
    if (hasattr(initial_amplitudes, 'lower') and (initial_amplitudes.lower() == 'mp2') and parametrized and add_singles):
        UCCSD += self.make_upccgsd_layer(indices='upccsd', include_singles=True, include_doubles=False)
    return (Uref + UCCSD)
Parameters
----------
initial_amplitudes :
    initial amplitudes given as ManyBodyAmplitudes structure or as string
    where 'mp2', 'cc2' or 'ccsd' are possible initializations
include_reference_ansatz :
    Also do the reference ansatz (prepare closed-shell Hartree-Fock) (Default value = True)
parametrized :
    Initialize with variables, otherwise with static numbers (Default value = True)
trotter_steps: int :

initial_amplitudes: typing.Union[str :

Amplitudes :

ClosedShellAmplitudes] :
     (Default value = "cc2")

Returns
-------
type
    Parametrized QCircuit
def make_uccsd_ansatz(self, trotter_steps: int=1, initial_amplitudes: typing.Union[(str, Amplitudes, ClosedShellAmplitudes)]='mp2', include_reference_ansatz=True, parametrized=True, threshold=1e-08, add_singles=None, *args, **kwargs) -> QCircuit:
    '\n\n        Parameters\n        ----------\n        initial_amplitudes :\n            initial amplitudes given as ManyBodyAmplitudes structure or as string\n            where \'mp2\', \'cc2\' or \'ccsd\' are possible initializations\n        include_reference_ansatz :\n            Also do the reference ansatz (prepare closed-shell Hartree-Fock) (Default value = True)\n        parametrized :\n            Initialize with variables, otherwise with static numbers (Default value = True)\n        trotter_steps: int :\n\n        initial_amplitudes: typing.Union[str :\n\n        Amplitudes :\n\n        ClosedShellAmplitudes] :\n             (Default value = "cc2")\n\n        Returns\n        -------\n        type\n            Parametrized QCircuit\n\n        '
    if hasattr(initial_amplitudes, 'lower'):
        if ((initial_amplitudes.lower() == 'mp2') and (add_singles is None)):
            add_singles = True
    elif ((initial_amplitudes is not None) and (add_singles is not None)):
        warnings.warn('make_uccsd_anstatz: add_singles has no effect when explicit amplitudes are passed down', TequilaWarning)
    elif (add_singles is None):
        add_singles = True
    if ((self.n_electrons % 2) != 0):
        raise TequilaException('make_uccsd_ansatz currently only for closed shell systems')
    nocc = (self.n_electrons // 2)
    nvirt = (self.n_orbitals - nocc)
    Uref = QCircuit()
    if include_reference_ansatz:
        Uref = self.prepare_reference()
    amplitudes = initial_amplitudes
    if hasattr(initial_amplitudes, 'lower'):
        if (initial_amplitudes.lower() == 'mp2'):
            amplitudes = self.compute_mp2_amplitudes()
        elif (initial_amplitudes.lower() == 'ccsd'):
            amplitudes = self.compute_ccsd_amplitudes()
        else:
            try:
                amplitudes = self.compute_amplitudes(method=initial_amplitudes.lower())
            except Exception as exc:
                raise TequilaException("{}\nDon't know how to initialize '{}' amplitudes".format(exc, initial_amplitudes))
    if (amplitudes is None):
        tia = None
        if add_singles:
            tia = numpy.zeros(shape=[nocc, nvirt])
        amplitudes = ClosedShellAmplitudes(tIjAb=numpy.zeros(shape=[nocc, nocc, nvirt, nvirt]), tIA=tia)
    closed_shell = isinstance(amplitudes, ClosedShellAmplitudes)
    indices = {}
    if (not isinstance(amplitudes, dict)):
        amplitudes = amplitudes.make_parameter_dictionary(threshold=threshold)
        amplitudes = dict(sorted(amplitudes.items(), key=(lambda x: numpy.fabs(x[1])), reverse=True))
    for (key, t) in amplitudes.items():
        assert ((len(key) % 2) == 0)
        if (not numpy.isclose(t, 0.0, atol=threshold)):
            if closed_shell:
                if ((len(key) == 2) and add_singles):
                    angle = (2.0 * t)
                    if parametrized:
                        angle = (2.0 * Variable(name=key))
                    idx_a = ((2 * key[0]), (2 * key[1]))
                    idx_b = (((2 * key[0]) + 1), ((2 * key[1]) + 1))
                    indices[idx_a] = angle
                    indices[idx_b] = angle
                else:
                    assert (len(key) == 4)
                    angle = (2.0 * t)
                    if parametrized:
                        angle = (2.0 * Variable(name=key))
                    idx_abab = (((2 * key[0]) + 1), ((2 * key[1]) + 1), (2 * key[2]), (2 * key[3]))
                    indices[idx_abab] = angle
                    if ((key[0] != key[2]) and (key[1] != key[3])):
                        idx_aaaa = ((2 * key[0]), (2 * key[1]), (2 * key[2]), (2 * key[3]))
                        idx_bbbb = (((2 * key[0]) + 1), ((2 * key[1]) + 1), ((2 * key[2]) + 1), ((2 * key[3]) + 1))
                        partner = tuple([key[2], key[1], key[0], key[3]])
                        anglex = (2.0 * (t - amplitudes[partner]))
                        if parametrized:
                            anglex = (2.0 * (Variable(name=key) - Variable(partner)))
                        indices[idx_aaaa] = anglex
                        indices[idx_bbbb] = anglex
            else:
                raise Exception('only closed-shell supported, please assemble yourself .... sorry :-)')
    UCCSD = QCircuit()
    factor = (1.0 / trotter_steps)
    for step in range(trotter_steps):
        for (idx, angle) in indices.items():
            UCCSD += self.make_excitation_gate(indices=idx, angle=(factor * angle))
    if (hasattr(initial_amplitudes, 'lower') and (initial_amplitudes.lower() == 'mp2') and parametrized and add_singles):
        UCCSD += self.make_upccgsd_layer(indices='upccsd', include_singles=True, include_doubles=False)
    return (Uref + UCCSD)