How does orbital ordering in Qiskit Nature work?

35 Views Asked by At

When I define a molecule with qiskit's PyscfDriver, it has a certain number of (spatial) orbitals. In this example, I define a NaH molecule and get an object with 10 spatial orbitals. I would like to reduce this number by reducing some orbitals from the active space. I intend to use the FreezeCoreTransformer as in FreezeCoreTransformer(freeze_core=False, remove_orbitals=[0,1,2,3,4,5]). But how do I know which physical orbital corresponds to which orbital number in this example? I know that all 12 electrons are within the first 6 spatial orbitals, as the num.particles becomes (0,0) after removing orbitals 0-5.

Here is the minimal code example:

from qiskit_nature.second_q.drivers import PySCFDriver
from qiskit_nature.second_q.transformers import FreezeCoreTransformer

driver = PySCFDriver(
    atom=f"H 0 0 0; Na 0 0 {1.5}",
    basis="sto3g",
    charge=0,
    spin=0,
)

problem = driver.run()

print(f'{problem.num_particles = }')
print(f'{problem.num_spatial_orbitals = }')

as_transformer = FreezeCoreTransformer(freeze_core=False, remove_orbitals=[0,1,2,3,4,5])
as_transformer.prepare_active_space(problem.molecule, problem.num_spatial_orbitals)
as_problem = as_transformer.transform(problem)

print(f'{as_problem.num_particles = }')
print(f'{as_problem.num_spatial_orbitals = }')

The printed outcome is:

problem.num_particles = (6, 6)
problem.num_spatial_orbitals = 10
as_problem.num_particles = (0, 0)
as_problem.num_spatial_orbitals = 4
1

There are 1 best solutions below

0
Steve Wood On

The spatial orbitals are in the order that the driver produces. Which is lowest energy orbitals to highest energy. The electrons will populate the lowest energy orbitals, so they are occupied orbitals, the rest being unoccupied.

Note: The PySCF driver module also has information written via the standard Python logging functionality. If you configure the logging for this module to DEBUG level then it should print infomation it has around the orbitals https://github.com/qiskit-community/qiskit-nature/blob/main/qiskit_nature/second_q/drivers/pyscfd/pyscfdriver.py#L522-L533 in case that's of further help.