I encountered a problem when learning from the qiskit tutorial about solving electronic structure problem with VQE. Under the "Running VQE on a Statevector Simulator" part, the code provided for leveraging active space of LiH to reduce the qubit requirement seems quite confusing. The freeze_list in the code is interpreted as the core space in my opinion. However, what confuse me is that why to choose the [-3, -2] orbitals as virtual space to be removed (remove_list). Or the problem can be stated as why to choose [-3, -2] as the virtual space of the LiH molecule? The corresponding code of the tutorial is provide as below:

def get_qubit_op(dist):
    driver = PySCFDriver(atom="Li .0 .0 .0; H .0 .0 " + str(dist), unit=UnitsType.ANGSTROM, 
                         charge=0, spin=0, basis='sto3g')
    molecule = driver.run()
    freeze_list = [0]
    remove_list = [-3, -2]
    repulsion_energy = molecule.nuclear_repulsion_energy
    num_particles = molecule.num_alpha + molecule.num_beta
    num_spin_orbitals = molecule.num_orbitals * 2
    remove_list = [x % molecule.num_orbitals for x in remove_list]
    freeze_list = [x % molecule.num_orbitals for x in freeze_list]
    remove_list = [x - len(freeze_list) for x in remove_list]
    remove_list += [x + molecule.num_orbitals - len(freeze_list)  for x in remove_list]
    freeze_list += [x + molecule.num_orbitals for x in freeze_list]
    ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)
    ferOp, energy_shift = ferOp.fermion_mode_freezing(freeze_list)
    num_spin_orbitals -= len(freeze_list)
    num_particles -= len(freeze_list)
    ferOp = ferOp.fermion_mode_elimination(remove_list)
    num_spin_orbitals -= len(remove_list)
    qubitOp = ferOp.mapping(map_type='parity', threshold=0.00000001)
    qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)
    shift = energy_shift + repulsion_energy
    return qubitOp, num_particles, num_spin_orbitals, shift

1 Answer 1


in general removing virtual orbitals needs careful consideration as it will often affect the final solution and lead to an answer outside what might be considered not chemically accurate. In this case the orbitals of LiH, from a chemistry perspective, were figured out to contribute very little to the solution and could be removed - there is a very slight change in energy but within chemical accuracy.

  • $\begingroup$ The code given just set the virtual orbitals as [-3, -2]. How does one know that it is the given remove_list contribute very little to the solution? In my opinion, the chosen of the active space is based on diagonalizing the 1-RDM, which gives the natural occuplied orbial number (NOON). Then, one can use NOON to set the active space. In the above code, it seems that the NOON is not explicitly computed. $\endgroup$ Commented Jul 19, 2021 at 13:19
  • $\begingroup$ The orbitals were figured out-of-band in the code you show by knowing the LiH molecule from a chemistry perspective. It was showing how to do things given you want to freeze and remove orbitals not how either of the orbital lists were arrived at. $\endgroup$
    – Steve Wood
    Commented Jul 19, 2021 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.