Hi, I have the following two functions:
def water(charge=0, multiplicity=1, basis_set='sto-3g', active_electrons=4, active_orbitals=4):
symbols, coordinates = qchem.read_structure('Water.xyz')
hamiltonian, qubits = qchem.molecular_hamiltonian(
symbols,
coordinates,
charge=charge,
mult=multiplicity,
basis=basis_set,
active_electrons=active_electrons,
active_orbitals=active_orbitals,
)
return hamiltonian, qubits
def hydrogen_fluoride(charge=0, multiplicity=1, basis_set='sto-3g', active_electrons=2, active_orbitals=2):
symbols = ["H", "F"]
coordinates = np.array([0.896, 0, 0, -0.896, 0, 0])
hamiltonian, qubits = qchem.molecular_hamiltonian(
symbols,
coordinates,
charge=charge,
mult=multiplicity,
basis=basis_set,
active_electrons=active_electrons,
active_orbitals=active_orbitals,
)
return hamiltonian, qubits
The molecules obviously have the same number of electrons. But when I run the following code:
ELECTRONS = 4
ORBITALS = 4
H, qubits = hydrogen_fluoride(active_electrons=ELECTRONS, active_orbitals=ORBITALS)
I get an error :
The number of core (3) + active orbitals (4) cannot be greater than the total number of orbitals (6)
However, the code
ELECTRONS = 4
ORBITALS = 4
H, qubits = water(active_electrons=ELECTRONS, active_orbitals=ORBITALS)
runs fine. I looked into it further, and it seems that within the qchem.molecular_hamiltonian function, it has the following code:
mol = qml.qchem.Molecule(
symbols,
geometry_dhf,
charge=charge,
mult=mult,
basis_name=basis,
load_data=load_data,
alpha=alpha,
coeff=coeff,
)
Which returns a mol
with n_orbitals = 7
for water and 6 for HF. Any idea how I can fix this?