From 5fef42b4adc288126b81b8a0bd275f0abc989e50 Mon Sep 17 00:00:00 2001 From: "Kevin J. Sung" Date: Thu, 5 Oct 2023 11:04:52 -0500 Subject: [PATCH] simplify FCI calculation in LUCJ tutorial --- docs/tutorials/04-lucj.ipynb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/tutorials/04-lucj.ipynb b/docs/tutorials/04-lucj.ipynb index 484b89b0e..6c7e12113 100644 --- a/docs/tutorials/04-lucj.ipynb +++ b/docs/tutorials/04-lucj.ipynb @@ -37,21 +37,21 @@ "hartree_fock = pyscf.scf.RHF(mol)\n", "hartree_fock.kernel()\n", "\n", - "# Get molecular data and molecular Hamiltonian (one- and two-body tensors)\n", + "# Define active space\n", "active_space = range(mol.nelectron // 2 - 2, mol.nelectron // 2 + 2)\n", + "\n", + "# Compute FCI energy\n", + "cas = pyscf.mcscf.CASCI(hartree_fock, ncas=4, nelecas=(2, 2))\n", + "mo = cas.sort_mo(active_space, base=0)\n", + "energy_fci = cas.kernel(mo)[0]\n", + "\n", + "# Get molecular data and molecular Hamiltonian (one- and two-body tensors)\n", "mol_data = ffsim.MolecularData.from_hartree_fock(\n", " hartree_fock, active_space=active_space\n", ")\n", "norb = mol_data.norb\n", "nelec = mol_data.nelec\n", - "mol_hamiltonian = mol_data.hamiltonian\n", - "\n", - "# Compute FCI energy\n", - "energy_fci, _ = pyscf.fci.direct_spin1.FCI().kernel(\n", - " mol_data.one_body_tensor, mol_data.two_body_tensor, norb, nelec\n", - ")\n", - "energy_fci += mol_data.core_energy\n", - "print(f\"FCI energy: {energy_fci}\")" + "mol_hamiltonian = mol_data.hamiltonian" ] }, {