Skip to content

Commit

Permalink
Direct download the missing file (#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkDaoust authored Dec 4, 2021
1 parent 7532ad9 commit 0c5745d
Showing 1 changed file with 56 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,61 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"Print = True\n",
"from openfermion import FermionOperator, MolecularData\n",
"from openfermion.utils import hermitian_conjugated\n",
"import numpy\n",
"import fqe\n",
"from fqe.unittest_data import build_lih_data, build_hamiltonian\n",
"numpy.set_printoptions(floatmode='fixed', precision=6, linewidth=80, suppress=True)\n",
"numpy.random.seed(seed=409)\n",
"\n",
"h1e, h2e, wfn = build_lih_data.build_lih_data('energy')\n",
"lih_hamiltonian = fqe.get_restricted_hamiltonian(([h1e, h2e]))\n",
"lihwfn = fqe.Wavefunction([[4, 0, 6]])\n",
"lihwfn.set_wfn(strategy='from_data', raw_data={(4, 0): wfn})\n",
"if Print:\n",
" lihwfn.print_wfn()\n"
]
"cell_type": "code",
"metadata": {
"scrolled": true,
"id": "3i55Vs4SYsm5"
},
"source": [
"Print = True\n",
"from openfermion import FermionOperator, MolecularData\n",
"from openfermion.utils import hermitian_conjugated\n",
"import numpy\n",
"import fqe\n",
"\n",
"numpy.set_printoptions(floatmode='fixed', precision=6, linewidth=80, suppress=True)\n",
"numpy.random.seed(seed=409)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "obExleOZZSAq"
},
"source": [
"!curl -O https://raw.githubusercontent.com/quantumlib/OpenFermion-FQE/master/tests/unittest_data/build_lih_data.py"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "E3RaAyBkZuov"
},
"source": [
"import build_lih_data"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "g8XMRUw6Zb8W"
},
"source": [
"h1e, h2e, wfn = build_lih_data.build_lih_data('energy')\n",
"lih_hamiltonian = fqe.get_restricted_hamiltonian(([h1e, h2e]))\n",
"lihwfn = fqe.Wavefunction([[4, 0, 6]])\n",
"lihwfn.set_wfn(strategy='from_data', raw_data={(4, 0): wfn})\n",
"if Print:\n",
" lihwfn.print_wfn()"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -141,7 +173,7 @@
"if Print:\n",
" evolved2.print_wfn()\n",
"assert numpy.isclose(fqe.vdot(evolved1, evolved2), 1)\n",
"cirq_wf = fqe.to_cirq_ncr(lihwfn)\n",
"cirq_wf = fqe.to_cirq(lihwfn)\n",
"evolve_cirq = expm(-1j * time * ham_mat) @ cirq_wf\n",
"test_evolve = fqe.from_cirq(evolve_cirq, thresh=1.0E-12)\n",
"assert numpy.isclose(fqe.vdot(test_evolve, evolved1), 1)"
Expand Down

0 comments on commit 0c5745d

Please sign in to comment.