I want to get a jordan_wigner_hamiltonians of a molecule-ion by using jordan_wignerget_fermion_operator(molecule.get_molecular_hamiltonian()). But I can only get the molecular Hamiltonians no matter how I set the charge and multiplicity.

How I can get a molecular Hamiltonians which have more (or less) electrons for example HeH+?


Qiskit allows you to build the customized geometry of the molecule. You can also adjust the charge and multiplicity. For example, to build the Hydrogen molecule with a given equilibrium distance ED, you can write:

molecule = Molecule(geometry=[['H', [0., 0., 0.]],
                              ['H', [0., 0., ed]]],
                             charge=0, multiplicity=1)

Next, you can do this to get the Pauli operators:

qubit_op, _ = fermionic_transformation.transform(driver)

Finally this code gives you a dictionary of the weights and the decompositions of the Hamiltonian:

    decompositions = {}
    for el in qubit_op.oplist:
        ceof, pauli = [x.strip() for x in str(el).split('*')]
        decompositions[pauli] = ceof

This tutorial explains every detail. Just make sure you have the latest version of Qiskit installed. https://qiskit.org/documentation/tutorials/chemistry/01_electronic_structure.html


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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