Hi, as the title of this post say, I have some questions about the use of basis set and how to use to construct molecular hamiltonians. The first one is related about to obtaining the element’s constants that are calculated using that basis set. The below code is an example of the call.
import pennylane as qml
from pennylane import numpy as np
basis = 'sto-6g'
element = 'Na'
basis = qml.qchem.load_basisset(basis, element)
The error that I got from the above code is KeyError: ‘Na’, the problem is that basis set have the Na element, so it’s weird that I got that error. I don’t know what I’m doing wrong or if pennylane have a restriction about what elements I can call.
The second thing about of how to use some inputs of the molecular hamiltonian constructor. The below code is a scheme of the idea that I have, load the constants from the load_basiset and pass those values to the molecular hamiltonian (I’m following the ideas from qml.qchem — PennyLane 0.32.0 documentation)
import pennylane as qml
from pennylane import numpy as np
symbols = ["H", "H"]
geometry = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 2.0]], requires_grad=True)
basis = 'sto-6g'
element = 'H'
basis = qml.qchem.load_basisset(basis, element)
coeff = np.array([basis["coefficients"][0],basis["coefficients"][0]], requires_grad = True)
alpha = np.array([basis["exponents"][0], basis["exponents"][0]], requires_grad = True)
args = [geometry, alpha, coeff]
hamiltonian, qubits = qml.qchem.molecular_hamiltonian(symbols, geometry, alpha=alpha, coeff=coeff, args=args)
The above code doesn’t give me errors, but I don’t understand how to change to other basis that have another structure, for example. Taking the hydrogen, the structure that I got from the below code is a list of exponents and coefficients, so there’s no problem, I just take that list and I used to construct the hamiltonian.
import pennylane as qml
from pennylane import numpy as np
basis = 'sto-6g'
element = 'H'
basis = qml.qchem.load_basisset(basis, element)
{'orbitals': ['S'],
'exponents': [[35.52322122,
6.513143725,
1.822142904,
0.6259552659,
0.2430767471,
0.100112428]],
'coefficients': [[0.009163596281,
0.04936149294,
0.1685383049,
0.3705627997,
0.4164915298,
0.1303340841]]}
If I change the basis to, for example, sapporo-dzp, I got a completely different structure, a list of lists of different sizes, so my question is how I should use it this data (the exponents and coefficients) to construct the molecular hamiltonian, because I feel that the procedure would be different from the exposed in qml.qchem — PennyLane 0.32.0 documentation.
import pennylane as qml
from pennylane import numpy as np
basis = 'sapporo-dzp'
element = 'H'
basis = qml.qchem.load_basisset(basis, element)
{'orbitals': ['S', 'S', 'P'],
'exponents': [[13.0107003, 1.9622571, 0.444538],
[0.1219496],
[2.860673, 0.88819, 0.303776]],
'coefficients': [[0.0334855, 0.2347219, 0.8137703],
[1.0],
[0.128856, 0.6197488, 0.3731129]]}
I’m not an expert working with basis set and quantum chemistry in general, so, I would thank a lot any kind of help, documentation and ideas that can give me to solve these problems.
Thanks in advance.