forked from microsoft/Quantum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquantum.qs
22 lines (18 loc) · 1.01 KB
/
quantum.qs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace Microsoft.Quantum.Samples {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Chemistry.JordanWigner;
open Microsoft.Quantum.Characterization;
open Microsoft.Quantum.Simulation;
operation TrotterEstimateEnergy (qSharpData: JordanWignerEncodingData, nBitsPrecision : Int, trotterStepSize : Double) : (Double, Double) {
let (nSpinOrbitals, data, statePrepData, energyShift) = qSharpData!;
// Order of integrator
let trotterOrder = 1;
let (nQubits, (rescaleFactor, oracle)) = TrotterStepOracle(qSharpData, trotterStepSize, trotterOrder);
// Prepare ProductState
let statePrep = PrepareTrialState(statePrepData, _);
let phaseEstAlgorithm = RobustPhaseEstimation(nBitsPrecision, _, _);
let estPhase = EstimateEnergyWithAdiabaticEvolution(nQubits, statePrep, NoOp<Qubit[]>, oracle, phaseEstAlgorithm);
let estEnergy = estPhase * rescaleFactor + energyShift;
return (estPhase, estEnergy);
}
}