Setting the active orbitals or electrons in a reaction

Suppose I have the reaction X + Y → XY and would like to simulate its hamiltonian. I can do

H, qubits = qchem.molecular_hamiltonian(["X", "Y"], coordinates)

and ends up with a Hamiltonian with a lot of terms, many of them are not needed because not a lot of electrons are active.

I want to do something like

H, qubits = qchem.molecular_hamiltonian(["X", "Y"], coordinates, active_electrons=electrons, active_orbitals=orbitals

but cannot find a way to do it for a reaction, because the ordinals numbers of electrons and orbits would overlaps.

I guess a way to do that is to calculate the H separately for X and Y, then bump up the wires. Suppose H_X uses wires 1-10, H_Y uses wires 1-7. Now I would modify H_Y to use the same gates, but on wire 11-17 instead. Not sure if if makes sense though because I think the number of terms of H_{X+Y} is larger than numbers of terms of H_X+H_Y.

Is there a better way to do it. If there is none, is it supported somewhere in the API?

An example: Suppose H_x = 0.1 (X0+Y1) + 0.2 (Y1+Z2) and H_y = 0.1 (Y0+Z1) + 0.2 (X1+Z2) . So H_x and H_y both work on the 0,1,2 wires. If we are to combine them, we should move H_y to different wires (3,4,5 for example), to not overlaps with H_x. We want 1 Hamiltonian, but then it is not straigh forward to me to chunk them into the active_electrons=electrons, active_orbitals=orbitals parameters

Hi @mchau,

Thank you for your question.

Maybe this demo on qubit tapering can help you. Here we use qml.symmetry_generators to then find an optimal_sector and so reduce the number of qubits needed. You could then maybe combine it with this demo on chemical reactions to solve your problem. Does this solve your issue? Or were you looking for something different?

If this isn’t what you were looking for then maybe you can look into qchem.active_space. In the example there in the documentation and in the demo on building molecular Hamiltonians you can learn how to use it.

I hope this helps!

1 Like

Hi @CatalinaAlbornoz, thank you for the links. The Qubit tapering | PennyLane Demos tutorial is a great way to attack the problem and mine is just another. I would definitely out the tapering technique. As for the active orbitals approach, all the links you mentioned are only about one molecule and not a reaction.

Just to reiterate, I can do molecular_hamiltonian(all_the_reactants, all_coords) but that would be an enormous Hamiltonian while only a small active orbitals is there.

Im case it is not supported yet, I am still very happy with pointers to papers :slight_smile:

There seems to be another related question too Setting the active orbitals or electrons in a reaction

Hi @mchau,

Our demo on chemical reactions is indeed about a reaction.

The last link you shared is to your first question here. Was that your intention? Did I miss something in your question?

I’ll ask a colleague to add some clarification which might help you!

1 Like

Hi @mchau. You can define an active space when you simulate a chemical reaction. Suppose, for example, that you want to compute the reaction energy for A + B -> C + D. Then you can compute the energy of the products and the reactants separately, with or without defining an active space, and take difference. But if you would like to compute the reaction barrier, then you need to compute the energy of the transition stat. You can still define an active space for the transition state. Please let me know if this answers your question.

1 Like

@CatalinaAlbornoz thank you.

I think the part I miscommunicated is that suppose there are 4 activate orbitals in the lhs of A + B -> C + D. How can Pennylane know how many orbitals belong to A and B since active_orbitals is an int. But after @sjahangiri’s answer I think I need to internalize the active space doucmentation :smiley:

My end goal is to draw this PES, about which I asked the first question here.

Red line is

A + B ------------> C + D

Blue line is A + B ----> C + D

Ah I see, thanks for clarifying @mchau ! In that case let us know if you still have any questions after taking a look at the documentation.

1 Like

Thank you @CatalinaAlbornoz. Here is my next question

My reaction is 3H_2+N_2 \rightarrow 2NH_3 and my end goal is to draw this PES, . Right now even with STO-3G and setting the active numbers, my Hamiltonian has 30k terms. I don’t think it is feasible to do a LCU.

I see two options to move forward.

  1. Simpler
    Here is how I visualize part of the coordinates of the reactants

The distance between two Fe atom in its lattice is 2.865 A. I plan to sample 1000 positions of H and N, then simulate the energy according to Modelling chemical reactions on a quantum computer | PennyLane Demos

  1. More complex
  • Find all intermediaries between 3H_2+N_2 \rightarrow 2NH_3 with Fe catalyst. Figure 2 of this paper seems to cover that, but it is unclear to me how the right most product is not NH_3.
  • Simulate the reaction to create each intermediary, and draw the PES.

Which approach should I choose, or is there another way?

Hi @mchau,

Let me check with our quantum chemistry experts and get back to you.

1 Like

Hi @mchau,

Skimming the paper you linked, it seems like NH3 is being repeatedly produced throughout the diagram. In Fig 2 the red lines there represent ammonia desorption from the surface (at least the first 2 do I’m not sure what’s going on with the third). Figure 3 makes it more clear
Screenshot 2024-05-09 at 9.06.02 AM

However, I’m not yet sure how they’re calculating the barrier energies between the states.
Screenshot 2024-05-09 at 9.10.29 AM


hi @Danial_Motlagh

Or we can avoid breaking into phases by modeling the whole adsorption in-silico Quantum computation of reactions on surfaces using local embedding | npj Quantum Information?

Hi @mchau, I’m not sure that it will work but you can always give it a try! Implementing a paper is a good project that can help you develop and demonstrate your skills. The paper says “The code used for generating data during the current study will be made available from the corresponding author upon reasonable request.” So you can try asking the authors for their code and then replicating it in PennyLane.

1 Like

Hey @mchau,

In the new paper you shared, they also seem to look at the energies of the reactant vs the product and just like the other one, they don’t calculate the activation energy themself but rather say the energy was calculated to be x in another paper: ( last paragraph of subsection “Chemical reaction” under “Results”)

Determining the kinetics of Eq. (2) involves calculating the activation energy (i.e., the difference between the transition state and reactant energy). Williams et al.15 found that the activation energy for H2O dissociation on Mg is 1.31 eV for a single H2O molecule and 1.06 eV for a concerted reaction involving multiple H2O molecules. Although we did not calculate activation energies in this study, we plan to explore transition states in future research.