diff --git a/docs/fqe/tutorials/hamiltonian_time_evolution_and_expectation_estimation.ipynb b/docs/fqe/tutorials/hamiltonian_time_evolution_and_expectation_estimation.ipynb index fb81763ba..b8245d826 100644 --- a/docs/fqe/tutorials/hamiltonian_time_evolution_and_expectation_estimation.ipynb +++ b/docs/fqe/tutorials/hamiltonian_time_evolution_and_expectation_estimation.ipynb @@ -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", @@ -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)"