Skip to content

Commit

Permalink
simplify FCI calculation in LUCJ tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsung committed Oct 5, 2023
1 parent 1878c5b commit 5fef42b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/tutorials/04-lucj.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down

0 comments on commit 5fef42b

Please sign in to comment.