How do I calculate orbitals and electrons so I can find the electronic hamiltonian (Quantum Chemistry)

Visualization of a transparent conductor

Here’s a visualization of a transparent circuit made with plotly dash. I got .xyz files from the Kaggle challenge for transparent conductors, however, I need to calculate the electrons and orbitals so I can calculate the electronic hamiltonian.

This transparent circuit has about 11 In, 15 Ga, 6 Al, and 48 O atoms with a total of 80 atoms.

How do I calculate the orbitals and electrons of this molecule so I can find the electronic hamiltonian?

80

In 1.7089214588200001 7.6848373406700006 6.6842861752599996
In 6.9778435088199995 7.6640093506700007 6.6569519702599997
In 3.6401549557799990 1.3345275526100000 1.8753704028000002
In 8.9090770057800004 1.3136995626100001 1.8480361978000002
In 1.0128447146199999 3.1657712464300003 1.8834757766800001
In 6.2817667646199995 3.1449432564299999 1.8561415716800003
Ga 4.3362316999799990 5.8535936468500003 6.6761808013800001
Al 9.6051537499800013 5.8327656568500004 6.6488465963800003
Ga 0.9664301943099999 5.9274893235700006 -0.0230097406750000
In 6.2353522443100005 5.9066613335700007 -0.0503439456750000
Ga 4.3629222256899993 3.0803356564300000 4.7861087206750001
Ga 9.6318442756899980 3.0595076664300001 4.7587745156750003
Ga 1.7219476154100000 1.4321721039900002 4.8048419522149999
Al 6.9908696654099991 1.4113441139900000 4.7775077472150000
Al 3.6574657045899999 7.6049419960100000 9.5941900177850012
In 8.9263877545900012 7.5841140060100001 9.5668558127850005
In 0.9362517411000001 0.2961809808600000 9.6208789112700011
Ga 6.2051737910999982 0.2753529908600000 9.5935447062700003
Ga 4.4430614570999989 8.7408745409000002 4.7588811927500005
Ga 9.7119835070999994 8.7200465508999994 4.7315469877500007
Al 1.7930244673000000 4.7851248355000005 4.7846629516500006
Al 7.0619465172999991 4.7642968455000005 4.7573287466500007
Al 3.5862887308999998 4.2519306862600006 9.5950971523700002
Ga 8.8552107809000002 4.2311026962600007 9.5677629473700012
Ga 3.6541673199900000 1.4239826846600003 7.5604326030350011
Ga 8.9230893699900005 1.4031546946600002 7.5330983980350004
In 1.7039200566099999 7.6006542502199999 2.7336919132249999
Ga 6.9728421066099981 7.5798262602199999 2.7063577082250001
In 4.3317966964899988 5.9136346909600004 2.7251460063850002
Ga 9.6007187464899992 5.8928067009600005 2.6978118013849999
Ga 1.0262906801100000 3.1110022439200007 7.5689785098750004
Ga 6.2952127301099994 3.0901742539200008 7.5416443048750006
O 4.4363233096299997 6.0392604067400013 8.5638083197350010
O 9.7052453596299983 6.0184324167400014 8.5364741147350003
O 0.9323769777700001 2.9915858215800002 3.7731339904050003
O 6.2012990277699993 2.9707578315800003 3.7457997854050005
O 3.5611032157300002 1.5209024641600002 3.7639272841250002
O 8.8300252657299989 1.5000744741600003 3.7365930791250004
O 1.8075970716700001 7.5099437641600000 8.5730150260150015
O 7.0765191216699987 7.4891157741600001 8.5456808210150008
O 2.7979909816299999 0.0886142374200000 6.0464035932950004
O 8.0669130316299995 0.0677862474200000 6.0190693882950006
O 2.5442771505699993 8.9267673355400010 1.2027660981250001
O 7.8131992005699997 8.9059393455400020 1.1754318931250001
O 5.1616754141299994 4.5716012869200009 1.2023700510450002
O 10.4305974641300008 4.5507732969200010 1.1750358460450001
O 0.1805927180700000 4.4437802860400000 6.0467996403750002
O 5.4495147680699993 4.4229522960400001 6.0194654353750003
O 0.1143669334900000 7.4578165187400005 1.1427678313450000
O 5.3832889834899982 7.4369885287400006 1.1154336263450000
O 5.2271002243099991 1.5570964282999999 5.9522269322350008
O 10.4960222743099987 1.5362684382999998 5.9248927272350000
O 2.5980907869899998 2.9556677184400000 5.9616539049949999
O 7.8670128369899990 2.9348397284400001 5.9343196999950001
O 2.7433763708100001 6.0592452286000009 1.1333408585850000
O 8.0122984208099997 6.0384172386000010 1.1060066535849999
O 5.1828900199999994 7.5251386746300009 6.0981660865100009
O 10.4518120699999990 7.5043106846300009 6.0708318815100002
O 0.1602792084000000 1.4907701024900000 1.3244503987300003
O 5.4292012583999991 1.4699421124900001 1.2971161937300002
O 2.8007582197999996 3.0127375371900009 1.3061026335300001
O 8.0696802698000010 2.9919095471900006 1.2787684285300003
O 2.5424110085999994 6.0031712399300012 6.1165138517100006
O 7.8113330585999989 5.9823432499300004 6.0891796467100008
O 1.9514515858499999 1.5502269032300002 8.3301696586350005
O 7.2203736358499997 1.5293989132300001 8.3028354536349998
O 3.4145454129499995 7.4790377126099994 3.4864322700450003
O 8.6834674629500004 7.4582097226099995 3.4590980650450001
O 0.7744204007500001 6.0472103620100013 3.5045047021450002
O 6.0433424507500000 6.0263823720100014 3.4771704971449999
O 4.5915765980499996 2.9820542538300003 8.3120972265350002
O 9.8604986480499992 2.9612262638300000 8.2847630215350012
O 4.4499090437199991 0.0179620167700000 8.6494607623100013
O 9.7188310937199986 -0.0028659732300000 8.6221265573100005
O 0.9194920962799999 9.0132942592299994 3.8223846096900003
O 6.1884141462799986 8.9924662692299986 3.7950504046900004
O 3.5363239611199999 4.5139040760500011 3.8224290955700004
O 8.8052460111199995 4.4930760860500003 3.7950948905700006
O 1.8330771788800000 4.5173521999499995 8.6494162764300011
O 7.1019992288799996 4.4965242099499996 8.6220820714300004

Pennylane’s chemistry tutorial

Transparent conductors

Plotly’s dash speck

Hi Bayaniblues,

Thank you for your question and welcome to PennyLane’s forum.

I will clarify important aspects here but the tutorial Quantum Chemistry with PennyLane is the (almost perfect :slight_smile: ) guide to build the electronic Hamiltonian of molecules using PennyLane-QChem (PL-QChem).

The construction of the molecular Hamiltonian with PL-QChem involves four main steps:

1- First, you have to input the atomic structure of your system.
This is something you can easily do with the function read_structure:

from pennylane import qchem
geometry = qchem.read_structure(file_with_structure)

geometry is a list containing the symbol and the Cartesian coordinates of the 80 atoms.

2- Second, you have to compute the meanfield electronic structure of the molecule via the Hartree-Fock (HF) method to obtain the molecular orbitals. PL-QChem uses the quantum chemistry packages PySCF or Psi4 which requires to define several parameters (See the above mentioned tutorial for a detailed explanation):

name = name_of_the_molecule
charge = 0          # (neutral system)
multiplicity = 1    # (singlet HF state)
basis =' sto-3g'    # (minimum basis)
path_hf_data = qchem.meanfield_data(
    name,
    geometry,
    charge,
    multiplicity,
    basis,
    qc_package="pyscf"
)

The output variable path_hf_data stores the path to the directory containing an hdf5-formatted file with the Hartree-Fock electronic structure of your molecule.

VERY IMPORTANT: The system you are willing to simulate is extremely challenging even for large High Performance Computers (HPC). Your “molecule” has 80 atoms, including III-V compounds and metals, and a total number of electrons N_e=1466 which means the HF calculation will involve hundreds of molecular orbitals. I am inclined to believe that neither PySCF nor Psi4 can handle this calculation in a desktop but you can try and let me know.

3- Next step is to define an active space (please, see the tutorial for a comprehensive explanation of what an active space is). At present, we don’t have a quantum computer with hundreds of qubits to encode the full set of HF molecular orbitals. We can only encode few of them, in particular those orbitals (called active orbitals) around the highest-occupied molecular orbital (HOMO) that you think are the important ones for the property you want to simulate. For example, you can define a symmetric active space with 4 electrons populating 4 active orbitals. I stress that this is a very bad approximation for your system but it will certainly allow you to build an (equally bad) approximated Hamiltonian:

core, active = qchem.active_space(
    name,
    path_hf_data,
    n_active_electrons=4,
    n_active_orbitals=4)

The outputs core and active are lists containing the indices of the core (orbitals not included) and active orbitals, respectively.

4- The last step involve using the function decompose_hamiltonian to obtain the electronic Hamiltonian already represented in the basis of Pauli matrices using the Jordan-Wigner or Bravyi-Kitaev transformation:

qubit_hamiltonian = qchem.decompose_hamiltonian(
    name,
    path_hf_data,
    mapping="jordan_wigner",
    docc_mo_indices=core,
    active_mo_indices=active
)

Notice that PL-QChem provides also a driver function to perform all of the above with a single call statement:

qubit_hamiltonian, n_qubits = qchem.generate_hamiltonian(
    name_of_the_molecule,
    file_with_structure,
    charge,
    multiplicity,
    basis,
    qc_package="pyscf",
    n_active_electrons=4,
    n_active_orbitals=4,
    mapping="jordan_wigner"
)

Just to summarise:

  • Again, I strongly encourage you to take a look to the tutorial Quantum Chemistry with PennyLane.

  • The molecule you want to simulate is a challenging one and it requires huge computational resources if you want to perform relatively accurate calculations. At present, such systems can only be simulated in HPC systems using Density Functional approximations (DFT). That’s why we are trying to build quantum computers :slight_smile:.

  • Check out also the tutorial A brief overview of VQE explaining how to use the Variational Quantum Eigensolver (VQE) algorithm to find the ground state of molecular Hamiltonians.

I hope this helps and feel free to get back to us if you need further assistance.

1 Like

@Alain_Delgado_Gran Thanks for responding. I think I was just confused on the concept of active space. I found a small enough transparent conductor with 10 atoms that actually works well with pennylane.

I don’t know what I’m supposed to do next with the electronic Hamiltonian, but I think it’s a good exercise into quantum computing.

The total number of atoms is: 10

Molecule represented as a list
[['Al', (-0.06333698, -0.05494751, 5.96345083)], ['In', (0.0, 0.0, 0.0)], ['Al', (-0.1213922033980002, 1.797854057297, 2.996899394117)], ['Al', (1.441114033398, 0.9081707627029999, 8.969887315883)], ['O', (-0.03166849, -0.027473755, 2.981725415)], ['O', (-0.09500547, -0.082421265, 8.945176245)], ['O', (-0.1421540654420002, 1.779842263519, 4.951718576191)], ['O', (1.461875895442, 0.9261825564809999, 7.015068133809)], ['O', (1.420352171354, 0.8901589689249999, 10.924706497957)], ['O', (-0.1006303413540002, 1.815865851075, 1.042080212043)]]

Parsing the atoms with pennylane requires 8 qbits and returns a hamiltonian of (-6841.94042365577)

Number of qubits required to perform quantum simulations: 8
Electronic Hamiltonian of the conductor molecule represented in the Pauli basis


(-6841.94042365577) [I0]
+ (0.058506545704800426) [Z0]
+ (-0.0007151137486513083) [Y0 Z1 Y2]
+ (-0.0007151137486513083) [X0 Z1 X2]
+ (0.007787364962538158) [Y0 Z1 Z2 Z3 Y4]
+ (0.007787364962538158) [X0 Z1 Z2 Z3 X4]
+ (0.03196746521526802) [Y0 Z1 Z2 Z3 Z4 Z5 Y6]
+ (0.03196746521526802) [X0 Z1 Z2 Z3 Z4 Z5 X6]
+ (0.05850654570480046) [Z1]
+ (-0.0007151137486513044) [Y1 Z2 Y3]
+ (-0.0007151137486513044) [X1 Z2 X3]
+ (0.007787364962538158) [Y1 Z2 Z3 Z4 Y5]
+ (0.007787364962538158) [X1 Z2 Z3 Z4 X5]
+ (0.03196746521526802) [Y1 Z2 Z3 Z4 Z5 Z6 Y7]
+ (0.03196746521526802) [X1 Z2 Z3 Z4 Z5 Z6 X7]
+ (0.04943260264720637) [Z2]
+ (0.03614999387741753) [Y2 Z3 Y4]
+ (0.03614999387741753) [X2 Z3 X4]
+ (-0.001357723600163807) [Y2 Z3 Z4 Z5 Y6]
+ (-0.001357723600163807) [X2 Z3 Z4 Z5 X6]
+ (0.0494326026472064) [Z3]
+ (0.03614999387741753) [Y3 Z4 Y5]
+ (0.03614999387741753) [X3 Z4 X5]
+ (-0.0013577236001638066) [Y3 Z4 Z5 Z6 Y7]
+ (-0.0013577236001638066) [X3 Z4 Z5 Z6 X7]
+ (-0.04526937705039795) [Z4]
+ (-0.006334077260290271) [Y4 Z5 Y6]
+ (-0.006334077260290271) [X4 Z5 X6]
+ (-0.04526937705039794) [Z5]
+ (-0.006334077260290279) [Y5 Z6 Y7]
+ (-0.006334077260290279) [X5 Z6 X7]
+ (-0.04250531870397997) [Z6]
+ (-0.042505318703979965) [Z7]
+ (0.08918332920248896) [Z0 Z1]
+ (0.002209301907532986) [Y0 Y2]
+ (0.002209301907532986) [X0 X2]
+ (0.0013963881722326727) [Y0 Z2 Z3 Y4]
+ (0.0013963881722326727) [X0 Z2 Z3 X4]
+ (-0.00031459551873968964) [Y0 Z2 Z3 Z4 Z5 Y6]
+ (-0.00031459551873968964) [X0 Z2 Z3 Z4 Z5 X6]
+ (0.002209301907532986) [Z0 Y1 Z2 Y3]
+ (0.002209301907532986) [Z0 X1 Z2 X3]
+ (0.0013920099652893173) [Y0 X1 X2 Y3]
+ (-0.0013920099652893173) [Y0 Y1 X2 X3]
+ (-0.0013920099652893173) [X0 X1 Y2 Y3]
+ (0.0013920099652893173) [X0 Y1 Y2 X3]
+ (0.0004981158733384354) [Y0 X1 X3 Y4]
+ (0.0004981158733384354) [Y0 Y1 Y3 Y4]
+ (0.0004981158733384354) [X0 X1 X3 X4]
+ (0.0004981158733384354) [X0 Y1 Y3 X4]
+ (0.0027988131916009988) [Y0 X1 X3 Z4 Z5 Y6]
+ (0.0027988131916009988) [Y0 Y1 Y3 Z4 Z5 Y6]
+ (0.0027988131916009988) [X0 X1 X3 Z4 Z5 X6]
+ (0.0027988131916009988) [X0 Y1 Y3 Z4 Z5 X6]
+ (0.0013963881722326727) [Z0 Y1 Z2 Z3 Z4 Y5]
+ (0.0013963881722326727) [Z0 X1 Z2 Z3 Z4 X5]
+ (-0.0004981158733384354) [Y0 X1 X2 Z3 Z4 Y5]
+ (0.0004981158733384354) [Y0 Y1 X2 Z3 Z4 X5]
+ (0.0004981158733384354) [X0 X1 Y2 Z3 Z4 Y5]
+ (-0.0004981158733384354) [X0 Y1 Y2 Z3 Z4 X5]
+ (0.0011032509791649573) [Y0 X1 X4 Y5]
+ (-0.0011032509791649573) [Y0 Y1 X4 X5]
+ (-0.0011032509791649573) [X0 X1 Y4 Y5]
+ (0.0011032509791649573) [X0 Y1 Y4 X5]
+ (-0.004827200463297731) [Y0 X1 X5 Y6]
+ (-0.004827200463297731) [Y0 Y1 Y5 Y6]
+ (-0.004827200463297731) [X0 X1 X5 X6]
+ (-0.004827200463297731) [X0 Y1 Y5 X6]
+ (-0.00031459551873968964) [Z0 Y1 Z2 Z3 Z4 Z5 Z6 Y7]
+ (-0.00031459551873968964) [Z0 X1 Z2 Z3 Z4 Z5 Z6 X7]
+ (-0.0027988131916009988) [Y0 X1 X2 Z3 Z4 Z5 Z6 Y7]
+ (0.0027988131916009988) [Y0 Y1 X2 Z3 Z4 Z5 Z6 X7]
+ (0.0027988131916009988) [X0 X1 Y2 Z3 Z4 Z5 Z6 Y7]
+ (-0.0027988131916009988) [X0 Y1 Y2 Z3 Z4 Z5 Z6 X7]
+ (0.004827200463297731) [Y0 X1 X4 Z5 Z6 Y7]
+ (-0.004827200463297731) [Y0 Y1 X4 Z5 Z6 X7]
+ (-0.004827200463297731) [X0 X1 Y4 Z5 Z6 Y7]
+ (0.004827200463297731) [X0 Y1 Y4 Z5 Z6 X7]
+ (0.03528250639132569) [Y0 X1 X6 Y7]
+ (-0.03528250639132569) [Y0 Y1 X6 X7]
+ (-0.03528250639132569) [X0 X1 Y6 Y7]
+ (0.03528250639132569) [X0 Y1 Y6 X7]
+ (0.043565370088018196) [Z0 Z2]
+ (0.008986228940953444) [Z0 Y2 Z3 Y4]
+ (0.008986228940953444) [Z0 X2 Z3 X4]
+ (0.0014494209590322988) [Z0 Y2 Z3 Z4 Z5 Y6]
+ (0.0014494209590322988) [Z0 X2 Z3 Z4 Z5 X6]
+ (0.0008026140029488956) [Y0 Z1 Z3 Y4]
+ (0.0008026140029488956) [X0 Z1 Z3 X4]
+ (-0.00040702162346293474) [Y0 Z1 Z3 Z4 Z5 Y6]
+ (-0.00040702162346293474) [X0 Z1 Z3 Z4 Z5 X6]
+ (0.0003566305046007574) [Y0 Z1 X2 X4 Z5 Y6]
+ (-0.00017737211231355252) [Y0 Z1 Y2 Y4 Z5 Y6]
+ (-0.0005340026169143099) [Y0 Z1 Y2 X4 Z5 X6]
+ (-0.0005340026169143099) [X0 Z1 X2 Y4 Z5 Y6]
+ (-0.00017737211231355252) [X0 Z1 X2 X4 Z5 X6]
+ (0.0003566305046007574) [X0 Z1 Y2 Y4 Z5 X6]
+ (0.044957380053307516) [Z0 Z3]
+ (0.0003546763106247457) [Y0 Z1 Y2 Z3]
+ (0.0003546763106247457) [X0 Z1 X2 Z3]
+ (-0.000962391064745769) [Y0 Z1 Z2 Y4]
+ (-0.000962391064745769) [X0 Z1 Z2 X4]
+ (-0.0005142652400349607) [Y0 Z1 Z2 Z4 Z5 Y6]
+ (-0.0005142652400349607) [X0 Z1 Z2 Z4 Z5 X6]
+ (0.00948434481429188) [Z0 Y3 Z4 Y5]
+ (0.00948434481429188) [Z0 X3 Z4 X5]
+ (0.0017650050676946644) [Y0 Z1 Y2 Y3 Z4 Y5]
+ (0.0017650050676946644) [Y0 Z1 Y2 X3 Z4 X5]
+ (0.0017650050676946644) [X0 Z1 X2 Y3 Z4 Y5]
+ (0.0017650050676946644) [X0 Z1 X2 X3 Z4 X5]
+ (0.0017354285459326593) [Y0 Z1 Z2 X3 X4 Y5]
+ (-0.0017354285459326593) [Y0 Z1 Z2 Y3 X4 X5]
+ (-0.0017354285459326593) [X0 Z1 Z2 X3 Y4 Y5]
+ (0.0017354285459326593) [X0 Z1 Z2 Y3 Y4 X5]
+ (0.0005315556374718236) [Y0 Z1 Z2 X3 X5 Y6]
+ (0.0005315556374718236) [Y0 Z1 Z2 Y3 Y5 Y6]
+ (0.0005315556374718236) [X0 Z1 Z2 X3 X5 X6]
+ (0.0005315556374718236) [X0 Z1 Z2 Y3 Y5 X6]
+ (0.0042482341506332975) [Z0 Y3 Z4 Z5 Z6 Y7]
+ (0.0042482341506332975) [Z0 X3 Z4 Z5 Z6 X7]
+ (0.00010724361657202597) [Y0 Z1 Y2 Y3 Z4 Z5 Z6 Y7]
+ (0.00010724361657202597) [Y0 Z1 Y2 X3 Z4 Z5 Z6 X7]
+ (0.00010724361657202597) [X0 Z1 X2 Y3 Z4 Z5 Z6 Y7]
+ (0.00010724361657202597) [X0 Z1 X2 X3 Z4 Z5 Z6 X7]
+ (-0.00017492513287106618) [Y0 Z1 Z2 X3 X4 Z5 Z6 Y7]
+ (0.00017492513287106618) [Y0 Z1 Z2 Y3 X4 Z5 Z6 X7]
+ (0.00017492513287106618) [X0 Z1 Z2 X3 Y4 Z5 Z6 Y7]
+ (-0.00017492513287106618) [X0 Z1 Z2 Y3 Y4 Z5 Z6 X7]
+ (-0.0021717825911301792) [Y0 Z1 Z2 X3 X6 Y7]
+ (0.0021717825911301792) [Y0 Z1 Z2 Y3 X6 X7]
+ (0.0021717825911301792) [X0 Z1 Z2 X3 Y6 Y7]
+ (-0.0021717825911301792) [X0 Z1 Z2 Y3 Y6 X7]
+ (0.026778892555137213) [Z0 Z4]
+ (-0.004516406773792163) [Z0 Y4 Z5 Y6]
+ (-0.004516406773792163) [Z0 X4 Z5 X6]
+ (-0.0006136518531190689) [Y0 Z1 Y2 Z4]
+ (-0.0006136518531190689) [X0 Z1 X2 Z4]
+ (-0.0017260134063470565) [Y0 Z1 Z2 Z3 Z5 Y6]
+ (-0.0017260134063470565) [X0 Z1 Z2 Z3 Z5 X6]
+ (0.02788214353430217) [Z0 Z5]
+ (-0.0023490803990517286) [Y0 Z1 Y2 Z5]
+ (-0.0023490803990517286) [X0 Z1 X2 Z5]
+ (-0.004222486321373239) [Y0 Z1 Z2 Z3 Y4 Z5]
+ (-0.004222486321373239) [X0 Z1 Z2 Z3 X4 Z5]
+ (-0.0014495651209033623) [Y0 Z1 Z2 Z3 Z4 Y6]
+ (-0.0014495651209033623) [X0 Z1 Z2 Z3 Z4 X6]
+ (-0.009343607237089895) [Z0 Y5 Z6 Y7]
+ (-0.009343607237089895) [Z0 X5 Z6 X7]
+ (-0.0007089277497853761) [Y0 Z1 Y2 Y5 Z6 Y7]
+ (-0.0007089277497853761) [Y0 Z1 Y2 X5 Z6 X7]
+ (-0.0007089277497853761) [X0 Z1 X2 Y5 Z6 Y7]
+ (-0.0007089277497853761) [X0 Z1 X2 X5 Z6 X7]
+ (-0.0002764482854436942) [Y0 Z1 Z2 Z3 Y4 Y5 Z6 Y7]
+ (-0.0002764482854436942) [Y0 Z1 Z2 Z3 Y4 X5 Z6 X7]
+ (-0.0002764482854436942) [X0 Z1 Z2 Z3 X4 Y5 Z6 Y7]
+ (-0.0002764482854436942) [X0 Z1 Z2 Z3 X4 X5 Z6 X7]
+ (0.002942010996305029) [Y0 Z1 Z2 Z3 Z4 X5 X6 Y7]
+ (-0.002942010996305029) [Y0 Z1 Z2 Z3 Z4 Y5 X6 X7]
+ (-0.002942010996305029) [X0 Z1 Z2 Z3 Z4 X5 Y6 Y7]
+ (0.002942010996305029) [X0 Z1 Z2 Z3 Z4 Y5 Y6 X7]
+ (0.05491024958247053) [Z0 Z6]
+ (0.0020350475977870307) [Y0 Z1 Y2 Z6]
+ (0.0020350475977870307) [X0 Z1 X2 Z6]
+ (0.000306785367159358) [Y0 Z1 Z2 Z3 Y4 Z6]
+ (0.000306785367159358) [X0 Z1 Z2 Z3 X4 Z6]
+ (0.09019275597379624) [Z0 Z7]
+ (0.00420683018891721) [Y0 Z1 Y2 Z7]
+ (0.00420683018891721) [X0 Z1 X2 Z7]
+ (-0.0026352256291456706) [Y0 Z1 Z2 Z3 Y4 Z7]
+ (-0.0026352256291456706) [X0 Z1 Z2 Z3 X4 Z7]
+ (-0.030028153396116287) [Y0 Z1 Z2 Z3 Z4 Z5 Y6 Z7]
+ (-0.030028153396116287) [X0 Z1 Z2 Z3 Z4 Z5 X6 Z7]
+ (0.044957380053307516) [Z1 Z2]
+ (0.0003546763106247457) [Y1 Y3]
+ (0.0003546763106247457) [X1 X3]
+ (-0.000962391064745769) [Y1 Z3 Z4 Y5]
+ (-0.000962391064745769) [X1 Z3 Z4 X5]
+ (-0.0005142652400349607) [Y1 Z3 Z4 Z5 Z6 Y7]
+ (-0.0005142652400349607) [X1 Z3 Z4 Z5 Z6 X7]
+ (0.00948434481429188) [Z1 Y2 Z3 Y4]
+ (0.00948434481429188) [Z1 X2 Z3 X4]
+ (0.0017650050676946644) [Y1 X2 X3 Y4]
+ (-0.0017650050676946644) [Y1 Y2 X3 X4]
+ (-0.0017650050676946644) [X1 X2 Y3 Y4]
+ (0.0017650050676946644) [X1 Y2 Y3 X4]
+ (-0.0017354285459326593) [Y1 X2 X4 Y5]
+ (-0.0017354285459326593) [Y1 Y2 Y4 Y5]
+ (-0.0017354285459326593) [X1 X2 X4 X5]
+ (-0.0017354285459326593) [X1 Y2 Y4 X5]
+ (0.0005315556374718236) [Y1 X2 X4 Z5 Z6 Y7]
+ (0.0005315556374718236) [Y1 Y2 Y4 Z5 Z6 Y7]
+ (0.0005315556374718236) [X1 X2 X4 Z5 Z6 X7]
+ (0.0005315556374718236) [X1 Y2 Y4 Z5 Z6 X7]
+ (0.0042482341506332975) [Z1 Y2 Z3 Z4 Z5 Y6]
+ (0.0042482341506332975) [Z1 X2 Z3 Z4 Z5 X6]
+ (0.00010724361657202597) [Y1 X2 X3 Z4 Z5 Y6]
+ (-0.00010724361657202597) [Y1 Y2 X3 Z4 Z5 X6]
+ (-0.00010724361657202597) [X1 X2 Y3 Z4 Z5 Y6]
+ (0.00010724361657202597) [X1 Y2 Y3 Z4 Z5 X6]
+ (-0.00017492513287106618) [Y1 X2 X5 Y6]
+ (0.00017492513287106618) [Y1 Y2 X5 X6]
+ (0.00017492513287106618) [X1 X2 Y5 Y6]
+ (-0.00017492513287106618) [X1 Y2 Y5 X6]
+ (0.0021717825911301792) [Y1 X2 X6 Y7]
+ (0.0021717825911301792) [Y1 Y2 Y6 Y7]
+ (0.0021717825911301792) [X1 X2 X6 X7]
+ (0.0021717825911301792) [X1 Y2 Y6 X7]
+ (0.043565370088018196) [Z1 Z3]
+ (0.008986228940953444) [Z1 Y3 Z4 Y5]
+ (0.008986228940953444) [Z1 X3 Z4 X5]
+ (0.0014494209590322988) [Z1 Y3 Z4 Z5 Z6 Y7]
+ (0.0014494209590322988) [Z1 X3 Z4 Z5 Z6 X7]
+ (0.0008026140029488956) [Y1 Z2 Z4 Y5]
+ (0.0008026140029488956) [X1 Z2 Z4 X5]
+ (-0.00040702162346293474) [Y1 Z2 Z4 Z5 Z6 Y7]
+ (-0.00040702162346293474) [X1 Z2 Z4 Z5 Z6 X7]
+ (0.0003566305046007574) [Y1 Z2 X3 X5 Z6 Y7]
+ (-0.00017737211231355252) [Y1 Z2 Y3 Y5 Z6 Y7]
+ (-0.0005340026169143099) [Y1 Z2 Y3 X5 Z6 X7]
+ (-0.0005340026169143099) [X1 Z2 X3 Y5 Z6 Y7]
+ (-0.00017737211231355252) [X1 Z2 X3 X5 Z6 X7]
+ (0.0003566305046007574) [X1 Z2 Y3 Y5 Z6 X7]
+ (0.02788214353430217) [Z1 Z4]
+ (-0.0023490803990517286) [Y1 Z2 Y3 Z4]
+ (-0.0023490803990517286) [X1 Z2 X3 Z4]
+ (-0.004222486321373239) [Y1 Z2 Z3 Y5]
+ (-0.004222486321373239) [X1 Z2 Z3 X5]
+ (-0.0014495651209033623) [Y1 Z2 Z3 Z5 Z6 Y7]
+ (-0.0014495651209033623) [X1 Z2 Z3 Z5 Z6 X7]
+ (-0.009343607237089895) [Z1 Y4 Z5 Y6]
+ (-0.009343607237089895) [Z1 X4 Z5 X6]
+ (-0.0007089277497853761) [Y1 Z2 Y3 Y4 Z5 Y6]
+ (-0.0007089277497853761) [Y1 Z2 Y3 X4 Z5 X6]
+ (-0.0007089277497853761) [X1 Z2 X3 Y4 Z5 Y6]
+ (-0.0007089277497853761) [X1 Z2 X3 X4 Z5 X6]
+ (-0.0002764482854436942) [Y1 Z2 Z3 X4 X5 Y6]
+ (0.0002764482854436942) [Y1 Z2 Z3 Y4 X5 X6]
+ (0.0002764482854436942) [X1 Z2 Z3 X4 Y5 Y6]
+ (-0.0002764482854436942) [X1 Z2 Z3 Y4 Y5 X6]
+ (-0.002942010996305029) [Y1 Z2 Z3 X4 X6 Y7]
+ (-0.002942010996305029) [Y1 Z2 Z3 Y4 Y6 Y7]
+ (-0.002942010996305029) [X1 Z2 Z3 X4 X6 X7]
+ (-0.002942010996305029) [X1 Z2 Z3 Y4 Y6 X7]
+ (0.026778892555137213) [Z1 Z5]
+ (-0.004516406773792163) [Z1 Y5 Z6 Y7]
+ (-0.004516406773792163) [Z1 X5 Z6 X7]
+ (-0.0006136518531190689) [Y1 Z2 Y3 Z5]
+ (-0.0006136518531190689) [X1 Z2 X3 Z5]
+ (-0.0017260134063470565) [Y1 Z2 Z3 Z4 Z6 Y7]
+ (-0.0017260134063470565) [X1 Z2 Z3 Z4 Z6 X7]
+ (0.09019275597379624) [Z1 Z6]
+ (0.00420683018891721) [Y1 Z2 Y3 Z6]
+ (0.00420683018891721) [X1 Z2 X3 Z6]
+ (-0.0026352256291456706) [Y1 Z2 Z3 Z4 Y5 Z6]
+ (-0.0026352256291456706) [X1 Z2 Z3 Z4 X5 Z6]
+ (-0.030028153396116287) [Y1 Z2 Z3 Z4 Z5 Y7]
+ (-0.030028153396116287) [X1 Z2 Z3 Z4 Z5 X7]
+ (0.05491024958247053) [Z1 Z7]
+ (0.0020350475977870307) [Y1 Z2 Y3 Z7]
+ (0.0020350475977870307) [X1 Z2 X3 Z7]
+ (0.000306785367159358) [Y1 Z2 Z3 Z4 Y5 Z7]
+ (0.000306785367159358) [X1 Z2 Z3 Z4 X5 Z7]
+ (0.07943604074847484) [Z2 Z3]
+ (0.009647176266191758) [Y2 Y4]
+ (0.009647176266191758) [X2 X4]
+ (-0.005054221903055527) [Y2 Z4 Z5 Y6]
+ (-0.005054221903055527) [X2 Z4 Z5 X6]
+ (0.009647176266191758) [Z2 Y3 Z4 Y5]
+ (0.009647176266191758) [Z2 X3 Z4 X5]
+ (0.019533118445873496) [Y2 X3 X4 Y5]
+ (-0.019533118445873496) [Y2 Y3 X4 X5]
+ (-0.019533118445873496) [X2 X3 Y4 Y5]
+ (0.019533118445873496) [X2 Y3 Y4 X5]
+ (0.002339082359674755) [Y2 X3 X5 Y6]
+ (0.002339082359674755) [Y2 Y3 Y5 Y6]
+ (0.002339082359674755) [X2 X3 X5 X6]
+ (0.002339082359674755) [X2 Y3 Y5 X6]
+ (-0.005054221903055527) [Z2 Y3 Z4 Z5 Z6 Y7]
+ (-0.005054221903055527) [Z2 X3 Z4 Z5 Z6 X7]
+ (-0.0023390823596747554) [Y2 X3 X4 Z5 Z6 Y7]
+ (0.0023390823596747554) [Y2 Y3 X4 Z5 Z6 X7]
+ (0.0023390823596747554) [X2 X3 Y4 Z5 Z6 Y7]
+ (-0.0023390823596747554) [X2 Y3 Y4 Z5 Z6 X7]
+ (0.0021967637339330177) [Y2 X3 X6 Y7]
+ (-0.0021967637339330177) [Y2 Y3 X6 X7]
+ (-0.0021967637339330177) [X2 X3 Y6 Y7]
+ (0.0021967637339330177) [X2 Y3 Y6 X7]
+ (0.03895574666572883) [Z2 Z4]
+ (0.0004404866057861396) [Z2 Y4 Z5 Y6]
+ (0.0004404866057861396) [Z2 X4 Z5 X6]
+ (-0.0038996692256040933) [Y2 Z3 Z5 Y6]
+ (-0.0038996692256040933) [X2 Z3 Z5 X6]
+ (0.058488865111602326) [Z2 Z5]
+ (-0.023700051414500798) [Y2 Z3 Y4 Z5]
+ (-0.023700051414500798) [X2 Z3 X4 Z5]
+ (-0.0006993933651454514) [Y2 Z3 Z4 Y6]
+ (-0.0006993933651454514) [X2 Z3 Z4 X6]
+ (0.002779568965460895) [Z2 Y5 Z6 Y7]
+ (0.002779568965460895) [Z2 X5 Z6 X7]
+ (-0.003200275860458642) [Y2 Z3 Y4 Y5 Z6 Y7]
+ (-0.003200275860458642) [Y2 Z3 Y4 X5 Z6 X7]
+ (-0.003200275860458642) [X2 Z3 X4 Y5 Z6 Y7]
+ (-0.003200275860458642) [X2 Z3 X4 X5 Z6 X7]
+ (-0.0015046548685583201) [Y2 Z3 Z4 X5 X6 Y7]
+ (0.0015046548685583201) [Y2 Z3 Z4 Y5 X6 X7]
+ (0.0015046548685583201) [X2 Z3 Z4 X5 Y6 Y7]
+ (-0.0015046548685583201) [X2 Z3 Z4 Y5 Y6 X7]
+ (0.038481199265820755) [Z2 Z6]
+ (0.007081389617682757) [Y2 Z3 Y4 Z6]
+ (0.007081389617682757) [X2 Z3 X4 Z6]
+ (0.04067796299975377) [Z2 Z7]
+ (0.008586044486241076) [Y2 Z3 Y4 Z7]
+ (0.008586044486241076) [X2 Z3 X4 Z7]
+ (0.006600277478313517) [Y2 Z3 Z4 Z5 Y6 Z7]
+ (0.006600277478313517) [X2 Z3 Z4 Z5 X6 Z7]
+ (0.058488865111602326) [Z3 Z4]
+ (-0.023700051414500795) [Y3 Y5]
+ (-0.023700051414500795) [X3 X5]
+ (-0.0006993933651454514) [Y3 Z5 Z6 Y7]
+ (-0.0006993933651454514) [X3 Z5 Z6 X7]
+ (0.002779568965460895) [Z3 Y4 Z5 Y6]
+ (0.002779568965460895) [Z3 X4 Z5 X6]
+ (-0.003200275860458642) [Y3 X4 X5 Y6]
+ (0.003200275860458642) [Y3 Y4 X5 X6]
+ (0.003200275860458642) [X3 X4 Y5 Y6]
+ (-0.003200275860458642) [X3 Y4 Y5 X6]
+ (0.0015046548685583203) [Y3 X4 X6 Y7]
+ (0.0015046548685583203) [Y3 Y4 Y6 Y7]
+ (0.0015046548685583203) [X3 X4 X6 X7]
+ (0.0015046548685583203) [X3 Y4 Y6 X7]
+ (0.03895574666572883) [Z3 Z5]
+ (0.0004404866057861396) [Z3 Y5 Z6 Y7]
+ (0.0004404866057861396) [Z3 X5 Z6 X7]
+ (-0.0038996692256040933) [Y3 Z4 Z6 Y7]
+ (-0.0038996692256040933) [X3 Z4 Z6 X7]
+ (0.04067796299975377) [Z3 Z6]
+ (0.008586044486241076) [Y3 Z4 Y5 Z6]
+ (0.008586044486241076) [X3 Z4 X5 Z6]
+ (0.006600277478313517) [Y3 Z4 Z5 Y7]
+ (0.006600277478313517) [X3 Z4 Z5 X7]
+ (0.038481199265820755) [Z3 Z7]
+ (0.007081389617682757) [Y3 Z4 Y5 Z7]
+ (0.007081389617682757) [X3 Z4 X5 Z7]
+ (0.10005406561254904) [Z4 Z5]
+ (0.00827053076667791) [Y4 Y6]
+ (0.00827053076667791) [X4 X6]
+ (0.00827053076667791) [Z4 Y5 Z6 Y7]
+ (0.00827053076667791) [Z4 X5 Z6 X7]
+ (0.0029344492895979797) [Y4 X5 X6 Y7]
+ (-0.0029344492895979797) [Y4 Y5 X6 X7]
+ (-0.0029344492895979797) [X4 X5 Y6 Y7]
+ (0.0029344492895979797) [X4 Y5 Y6 X7]
+ (0.025483881058171377) [Z4 Z6]
+ (0.028418330347769357) [Z4 Z7]
+ (-0.012576407690316767) [Y4 Z5 Y6 Z7]
+ (-0.012576407690316767) [X4 Z5 X6 Z7]
+ (0.028418330347769357) [Z5 Z6]
+ (-0.012576407690316767) [Y5 Y7]
+ (-0.012576407690316767) [X5 X7]
+ (0.025483881058171377) [Z5 Z7]
+ (0.1215082681249633) [Z6 Z7]

Hi @Bayaniblues,

Thank you for the update.

I am glad that you managed to build an approximation to the electronic Hamiltonian. Please, keep in mind that polyatomic systems containing post-transition metals require large active spaces if you want to account for electronic correlations in a reliable way.

Having said that you can still experiment with the approximated Hamiltonian to get familiar with other PL-QChem functionalities.

I would suggest the following:

1- You can reduce the number of active orbitals in the active space by choosing n_active_electrons=2 and n_active_orbitals=2. This way you only need 4 qubits and quantum simulations should not be very involving. At this stage, you can follow the tutorial A brief overview of VQE to run a VQE simulation for your system to find the ground state of the Hamiltonian.

2- Another experiment you can try is to include different orbitals (while still having 2 active orbitals) in your active space to explore different approximations. The answer to the question “which orbitals do we need to include?” depends on the molecule and which chemical property you are looking at. In general, there is never a trivial answer to this question and quite often we are suppose to include all of them which is not possible at present. In order to define different active spaces you can swap indices in the core and active lists before calling the function decompose_hamiltonian to build the corresponding (approximated) Hamiltonians.

Next, you can use the function convert_hamiltonian to convert the QubitOperator to a PennyLane observable.

qubit_hamiltonian = qchem.decompose_hamiltonian(
name,
path_hf_data,
docc_mo_indices=swap_core,
active_mo_indices=swap_active
)

pl_hamiltonian = convert_observable(qubit_hamiltonian)

From this point on the VQE simulation proceeds as in 1. This experiment may help you to get a feeling of how sensitive is the optimized energy with respect to the chosen active space. I would expect the numbers to be significantly different :slight_smile:.

I hope you find this interesting and do not hesitate to come back to us if you have further questions.

Best,

Alain.