1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/mirrors-quantum

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
GetEnergyVQE.qs 1.8 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Guen Prawiroatmodjo Отправлено 03.06.2021 20:09 9f06abe
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Microsoft.Quantum.Chemistry.VQE {
open Microsoft.Quantum.Core;
open Microsoft.Quantum.Chemistry;
open Microsoft.Quantum.Chemistry.JordanWigner;
open Microsoft.Quantum.Chemistry.JordanWigner.VQE;
open Microsoft.Quantum.Intrinsic;
/// # Summary
/// Get the molecular energy using the Variational Quantum Eigensolver.
///
/// # Input
/// ## JWEncodedData
/// Jordan-Wigner encoded data.
/// ## theta1
/// Input state coefficient to use for first singly-excited state
/// ## theta2
/// Input state coefficient to use for second singly-excited state
/// ## theta3
/// Input state coefficient to use for doubly-excited state
/// ## nSamples
/// Number of samples
///
/// # Output
/// Estimated energy.
operation GetEnergyVQE (JWEncodedData: JordanWignerEncodingData, theta1: Double, theta2: Double, theta3: Double, nSamples: Int) : Double {
let (nSpinOrbitals, fermionTermData, inputState, energyOffset) = JWEncodedData!;
let (stateType, JWInputStates) = inputState;
let inputStateParam = (
stateType,
[
JordanWignerInputState((theta1, 0.0), [2, 0]), // singly-excited state
JordanWignerInputState((theta2, 0.0), [3, 1]), // singly-excited state
JordanWignerInputState((theta3, 0.0), [2, 3, 1, 0]), // doubly-excited state
JWInputStates[0] // Hartree-Fock state from Broombridge file
]
);
let JWEncodedDataParam = JordanWignerEncodingData(
nSpinOrbitals, fermionTermData, inputState, energyOffset
);
return EstimateEnergy(
JWEncodedDataParam, nSamples
);
}
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/mirrors-quantum.git
git@api.gitlife.ru:oschina-mirror/mirrors-quantum.git
oschina-mirror
mirrors-quantum
mirrors-quantum
main