The document describes the Hamiltonian operator (H) and its application to the Hartree-Fock wavefunction (|ΦHF⟩) to obtain energy eigenvalues (E0, E1, etc.). The Hartree-Fock wavefunction can be expressed as a linear combination of Slater determinants (|Ψ0⟩, |Ψ1⟩, etc.). Applying the exponential of the Hamiltonian operator over time (eiHt) to |ΦHF⟩ yields the time-dependent Hartree-Fock wavefunction.
24. #! STO-3G H2 Hartree-Fock Energy Point
# see also: http://pubchemqc.riken.jp/cgi-bin/molecularquery.py?name=hydrogen
molecule h2 {
H 0.0 0.0 0.0
H 0.0 0.0 1.4
unit bohr
}
set {
basis STO-3G
}
thisenergy = energy('hf')
25.
26.
27. #! STO-3G H2 Hartree-Fock Energy Point
# see also: http://pubchemqc.riken.jp/cgi-bin/molecularquery.py?name=hydrogen
molecule h2 {
H 0.0 0.0 0.0
H 0.0 0.0 1.4
unit bohr
}
set {
basis STO-3G
}
thisenergy = energy('hf')
28. ****
H 0
S 3 1.00
3.42525091 0.15432897
0.62391373 0.53532814
0.16885540 0.44463454
29.
30.
31. en, wfn = energy('hf', return_wfn=True)
nbf = wfn.nso()
mints = psi4.core.MintsHelper(wfn.basisset())
S = np.asarray(mints.ao_overlap())
for i in range(nbf):
for j in range(nbf):
print (i+1,j+1, S[i,j])
39. |Ψ0⟩
|Ψ⟩ = c0 |Φ0⟩ +
occ
∑
i
vir
∑
a
ca
i |Φa
i ⟩ +
occ
∑
i<j
vir
∑
a<b
cab
ij |Φab
ij ⟩ +
occ
∑
i<j<k
vir
∑
a<b<c
cabc
ijk |Φabc
ijk ⟩ + ⋯
|Φ0⟩
|Φ0⟩ = |χ1χ2⋯χa χb⋯χN⟩
|Φa
i ⟩
|Φa
i ⟩ = |χ1χ2⋯χi−1χa χi+1⋯χN⟩
|Φab
ij ⟩
|Φab
ij ⟩ = |χ1χ2⋯χi−1χa χi+1⋯χj−1χb χj+1⋯χN⟩
ca
i , cab
ij
40. |Ψ⟩ = c0 |Φ0⟩ +
occ
∑
i
vir
∑
a
ca
i |Φa
i ⟩ +
occ
∑
i<j
vir
∑
a<b
cab
ij |Φab
ij ⟩ +
occ
∑
i<j<k
vir
∑
a<b<c
cabc
ijk |Φabc
ijk ⟩ + ⋯
min
⟨Ψ|Ψ⟩=1
⟨Ψ| ̂H|Ψ⟩
43. #! STO-3G H2 FullCI Energy Point
# see also: http://pubchemqc.riken.jp/cgi-bin/molecularquery.py?name=hydrogen
molecule h2 {
H 0.0 0.0 0.0
H 0.0 0.0 1.4
unit bohr
}
set {
basis STO-3G
}
thisenergy = energy(‘fci')
82. $ cd Quantum/Samples/src/Teleportation
$ dotnet run
Round 0: Sent True, got True.
Teleportation successful!!
Round 1: Sent False, got False.
Teleportation successful!!
Round 2: Sent False, got False.
Teleportation successful!!
Round 3: Sent True, got True.
Teleportation successful!!
Round 4: Sent False, got False.
Teleportation successful!!
Round 5: Sent True, got True.
Teleportation successful!!
Round 6: Sent True, got True.
Teleportation successful!!
Round 7: Sent False, got False.
Teleportation successful!!
83. operation Teleport (msg : Qubit, target : Qubit) : Unit {
using (register = Qubit()) {
// Create some entanglement that we can use to send our message.
H(register);
CNOT(register, target);
// Encode the message into the entangled pair,
// and measure the qubits to extract the classical data
// we need to correctly decode the message into the target qubit:
CNOT(msg, register);
H(msg);
let data1 = M(msg);
let data2 = M(register);
// decode the message by applying the corrections on
// the target qubit accordingly:
if (data1 == One) { Z(target); }
if (data2 == One) { X(target); }
// Reset our "register" qubit before releasing it.
Reset(register);
}
}
84. // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Microsoft.Quantum.Simulation.Simulators;
using System.Linq;
namespace Microsoft.Quantum.Samples.Teleportation {
class Program
{
static void Main(string[] args)
{
using (var sim = new QuantumSimulator())
{
var rand = new System.Random();
foreach (var idxRun in Enumerable.Range(0, 8))
{
var sent = rand.Next(2) == 0;
var received = TeleportClassicalMessage.Run(sim, sent).Result;
System.Console.WriteLine($"Round {idxRun}:tSent {sent},tgot
{received}.");
System.Console.WriteLine(sent == received ? "Teleportation
successful!!n" : "n");
}
}
}
}
}
98. Exact molecular Hydrogen ground state energy: -1.137260278.
----- Performing quantum energy estimation by Trotter simulation algorithm
Rep #1/5: Energy estimate: -1.16005261648883; Phase estimate: -0.424487268195532
Rep #2/5: Energy estimate: -1.11126176600452; Phase estimate: -0.404970928001809
Rep #3/5: Energy estimate: -1.14194138176224; Phase estimate: -0.417242774304894
Rep #4/5: Energy estimate: -1.12383014703564; Phase estimate: -0.409998280414257
Rep #5/5: Energy estimate: -1.11126176600452; Phase estimate: -0.404970928001809
----- End Performing quantum energy estimation by Trotter simulation algorithm
----- Performing quantum energy estimation by Qubitization simulation algorithm
Rep #1/1: Energy estimate: -1.1347488350418; Phase estimate: -0.581804128657449
----- End Performing quantum energy estimation by Qubitization simulation algorithm
99. namespace Microsoft.Quantum.Chemistry.Samples.Hydrogen
{
class Program
{
static void Main(string[] args)
{
//////////////////////////////////////////////////////////////////////////
// Introduction //////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// In this example, we will create a spin-orbital representation of the molecular
// Hydrogen Hamiltonian `H`, given ovelap coefficients for its one- and
// two - electron integrals.
// We when perform quantum phase estimation to obtain an estimate of
// the molecular Hydrogen ground state energy.
#region Building the Hydrogen Hamiltonian through orbital integrals
// One of the simplest representations of Hydrogen uses only two
// molecular orbitals indexed by `0` and `1`.
var nOrbitals = 2;
// This representation also has two occupied spin-orbitals.
var nElectrons = 2;
// The Coulomb repulsion energy between nuclei is
var energyOffset = 0.713776188;
// One-electron integrals are listed below
// <0|H|0> = -1.252477495
// <1|H|1> = -0.475934275
// Two-electron integrals are listed below
// <00|H|00> = 0.674493166
// <01|H|01> = 0.181287518
// <01|H|10> = 0.663472101
// <11|H|11> = 0.697398010
•
$ psi4 07_h2_sto3g_hf_dumpint
1 electron integral
1 1 -1.25247730398
2 2 -0.475934461144
2 electron integral
1 1 1 1 0.674493103326
1 2 1 2 0.181287535812
2 2 1 1 0.663472044861
2 2 2 2 0.69739794982
100. // We initialize a fermion Hamiltonian data structure and add terms to it
var fermionHamiltonian = new
OrbitalIntegralHamiltonian(orbitalIntegrals).ToFermionHamiltonian();
// These orbital integral terms are automatically expanded into
// spin-orbitals. We may print the Hamiltonian to see verify what it contains.
Console.WriteLine("----- Print Hamiltonian");
Console.Write(fermionHamiltonian);
Console.WriteLine("----- End Print Hamiltonian n");
// We also need to create an input quantum state to this Hamiltonian.
// Let us use the Hartree–Fock state.
var fermionWavefunction = fermionHamiltonian.CreateHartreeFockState(nElectrons);
#endregion
#region Jordan–Wigner representation
// The Jordan–Wigner encoding converts the fermion Hamiltonian,
// expressed in terms of Fermionic operators, to a qubit Hamiltonian,
// expressed in terms of Pauli matrices. This is an essential step
// for simulating our constructed Hamiltonians on a qubit quantum
// computer.
Console.WriteLine("----- Creating Jordan–Wigner encoding");
var jordanWignerEncoding =
fermionHamiltonian.ToPauliHamiltonian(Paulis.QubitEncoding.JordanWigner);
Console.WriteLine("----- End Creating Jordan–Wigner encoding n");
// Print the Jordan–Wigner encoded Hamiltonian to see verify what it contains.
Console.WriteLine("----- Print Hamiltonian");
Console.Write(jordanWignerEncoding);
Console.WriteLine("----- End Print Hamiltonian n");
#endregion