# Unable to construct Hamiltonian

**URL:** <https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564>\
**Category:** PennyLane Help\
**Created:** [December 17, 2021, 4:05pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564 "2021-12-17T16:05:58Z")\
**Posts on this page:** 17\
**Page:** 2

<div class="post-metadata">

**Author:** ![raghavv](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@raghavv](https://discuss.pennylane.ai/u/raghavv)\
**Post date:** [February 12, 2022, 5:17am UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/22 "2022-02-12T05:17:08Z")

</div>

Dear Sir @Alain_Delgado_Gran. Thank you for sharing the information regarding significance of ‘3’ in coordinates and helping to convert into from Bohr to Angstrom as well. Also, thanks for sharing the information on how to get the molecular orbitals.

Sometime ago, I had also tried to get molecular orbital energies using OpenFermion. I have written some lines to get the frontier molecular orbital energies and their positions. I am just sharing the lines below.

“”"  
import pennylane as qml  
from pennylane import numpy as np  
from openfermion import MolecularData

symb = [“Li”, “H”]  
x = np.array([0.0, 0.0, 0.0, 0.0, 0.0, 2.969280527], requires\_grad=True)

lih = qml.qchem.meanfield(symb, x)  
mol\_LiH = MolecularData(filename=lih)

print("Number of orbitals: ", mol\_LiH.n\_orbitals)  
print("Orbital energies: ", mol\_LiH.orbital\_energies)  
print("Expansion coefficients: ", mol\_LiH.canonical\_orbitals)

molecule = mol\_LiH  
basis = ‘STO3G’

total\_MOs = (molecule.canonical\_orbitals.shape[0])  
print(“No. of orbitals generated for basis set”,basis, molecule.canonical\_orbitals.shape[0])

num\_electrons = molecule.n\_electrons  
occupied\_orbitals = round(num\_electrons/2)  
print(“No. of Occupied MOs for basis set”,basis, occupied\_orbitals)  
unoccupied\_orbitals = total\_MOs - occupied\_orbitals  
print(“No. of Unoccupied MOs for basis set”,basis, unoccupied\_orbitals)

HOMO\_position = round((num\_electrons/2)-1)  
LUMO\_position = round((num\_electrons/2)+0)

print(“The HOMO and LUMO positions are”,HOMO\_position,LUMO\_position)

HOMO\_energy = molecule.orbital\_energies[HOMO\_position]  
LUMO\_energy = molecule.orbital\_energies[LUMO\_position]  
H\_L\_Gap = LUMO\_energy - HOMO\_energy

print(“The HOMO and LUMO energies are”,round(HOMO\_energy,5),round(LUMO\_energy,5),“respectively in Hartrees”)  
print(“The HOMO-LUMO gap is”, round(H\_L\_Gap,5),“in Hartrees”)  
print(“The HOMO-LUMO gap is”, round(H\_L\_Gap\*27.2114,3),“in eV”)

“”"

Also, regarding constructing the Hamiltonian, can you kindly help me understand the reason for ’ **[0]** ’ in the following line.

“def H(x):  
return qml.qchem.molecular\_hamiltonian(symbols, x, active\_electrons=2, active\_orbitals=3))[0]”

I am also working on obtaining ground state energies of a few small molecules. I will share the information with you after consolidating the results.

Thank you very much for your kind help.

---

<div class="post-metadata">

**Author:** ![Alain\_Delgado\_Gran](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/alain_delgado_gran/32/78_2.png) [@Alain\_Delgado\_Gran](https://discuss.pennylane.ai/u/Alain_Delgado_Gran)\
**Post date:** [February 14, 2022, 10:34pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/23 "2022-02-14T22:34:48Z")

</div>

Hi @raghavv,

Thank you for the update.

Regarding your question below:

> Also, regarding constructing the Hamiltonian, can you kindly help me understand the reason for ’ **[0]** ’ in the following line.

Please, note that the [molecular\_hamiltonian](https://pennylane.readthedocs.io/en/stable/code/api/pennylane_qchem.qchem.molecular_hamiltonian.html) function returns a **tuple** containing the built Hamiltonian and the number of qubits needed to represent it. Since you only need the Hamiltonian (for the example we have been discussing) the `H(x)` function returns the first element of the tuple.

Thank you!

---

<div class="post-metadata">

**Author:** ![raghavv](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@raghavv](https://discuss.pennylane.ai/u/raghavv)\
**Post date:** [February 15, 2022, 10:00am UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/24 "2022-02-15T10:00:17Z")

</div>

Dear Sir @Alain_Delgado_Gran, thank you for your kind response, I understand the importance of [0] now.

I am also learning the the chemical reaction tutorial of Pennylane ([https://pennylane.ai/qml/demos/tutorial\_chemical\_reactions.html](https://pennylane.ai/qml/demos/tutorial_chemical_reactions.html)) and I am just curious to know if we can calculate the zero point vibrational energy in Pennylane while calculating dissociation energy of the molecule.

Thank you.

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [February 15, 2022, 11:41pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/25 "2022-02-15T23:41:37Z")

</div>

Hi @raghavv,

In principle you can calculate the zero point vibrational energy in PennyLane while calculating the dissociation energy of the molecule.

@Alain_Delgado_Gran is looking into what functionalities are available for this.

---

<div class="post-metadata">

**Author:** ![Alain\_Delgado\_Gran](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/alain_delgado_gran/32/78_2.png) [@Alain\_Delgado\_Gran](https://discuss.pennylane.ai/u/Alain_Delgado_Gran)\
**Post date:** [February 17, 2022, 5:18pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/26 "2022-02-17T17:18:05Z")

</div>

Hi @raghavv,

Thank you for your question.

Yes, you can compute the zero-point energy correction from the vibrational frequencies of the molecule. In the harmonic approximation, they are given by the non-zero eigenvalues of the energy Hessian matrix defined as \frac{\partial^2E({\bf R})}{\partial R\_i \partial R\_j}. Here,E({\bf R}) is the total electronic energy of the ground or excited states of the molecule and {\bf R} denotes the optimized nuclear coordinates for a given electronic state (e.g. the ground state).

At present, we don’t have a tutorial showing how to compute the Hessian matrix elements \frac{\partial^2E({\bf R})}{\partial R\_i \partial R\_j} but I try to outline here how this can be done by combining different functionalities available in PennyLane. To that aim, I encourage you to check [this paper](https://journals.aps.org/prresearch/abstract/10.1103/PhysRevResearch.2.013129) by Mitarai _et al._ about computing analytical energy derivatives for the VQE algorithm. This contribution reports the expression to compute the second-order derivative of the energy with respect to the nuclear coordinates (See Eqs. (8) and (10) ). Evaluating this expression requires the following:

- The equilibrium geometry of the molecule and the optimized circuit parameters to prepare its (electronic) ground-state.
- Compute expectation values of the first- and second-order derivatives  
of the electronic Hamiltonian (defined for the optimized geometry) with respect to the nuclear coordinates. The Hamiltonian derivatives can be computed using [finite-difference approximations](https://pennylane.readthedocs.io/en/stable/code/api/pennylane.finite_diff.html) or more accurate [automatic differentiation tools](https://arxiv.org/abs/2111.09967) available in PennyLane.
- Compute the second-order derivative of the circuit (expectation value  
of the Hamiltonian) with respect to the gate parameters (Hessian of the circuit). See example [here](https://pennylane.readthedocs.io/en/stable/code/api/pennylane.gradients.param_shift_hessian.html)

Please, see the attached notebook with a working example to compute the second-order energy derivative for the trihydrogen cation.

Hope this helps!

Thank you ![second_derivative.ipynb|attachment](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/1X/f6f43439534d52a818ab82239d95a2f918a49f49.ipynb) (3.7 KB)

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [February 18, 2022, 1:18am UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/27 "2022-02-18T01:18:37Z")

</div>

Hi @raghavv, here’s the file @Alain_Delgado_Gran had shared but in .py format. You should be able to paste it into a Jupyter notebook and run it.

[second\_derivative.py](https://discuss.pennylane.ai/uploads/short-url/3FiQoaziwnZs3qEiXF40cPNWCha.py) (2.2 KB)

---

<div class="post-metadata">

**Author:** ![raghavv](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@raghavv](https://discuss.pennylane.ai/u/raghavv)\
**Post date:** [February 18, 2022, 3:55pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/28 "2022-02-18T15:55:15Z")

</div>

Thank you sir @Alain_Delgado_Gran for such a beautiful explanation with appropriate references. I will go thorugh them.

Thank you @CatalinaAlbornoz for sharing the code.

I tried to run the code, upon running the line " hessian = qml.jacobian(qml.grad(energy, argnum=0))(opt\_param) ", it gave me the following error.

## “”"

AttributeError Traceback (most recent call last)  
/tmp/ipykernel\_1076/1091415110.py in   
1 # compute the Hessian of the quantum circuit  
2 energy = expval(H(coord), opt\_param)  
----\> 3 hessian = qml.jacobian(qml.grad(energy, argnum=0))(opt\_param)

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/pennylane/\_grad.py in \_jacobian\_function(\*args, \*\*kwargs)  
179  
180 if len(argnum) == 1:  
–\> 181 return \_jacobian(func, argnum[0])(\*args, \*\*kwargs)  
182  
183 return np.stack([\_jacobian(func, arg)(\*args, \*\*kwargs) for arg in argnum]).T

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/autograd/wrap\_util.py in nary\_f(\*args, \*\*kwargs)  
18 else:  
19 x = tuple(args[i] for i in argnum)  
—\> 20 return unary\_operator(unary\_f, x, \*nary\_op\_args, \*\*nary\_op\_kwargs)  
21 return nary\_f  
22 return nary\_operator

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/autograd/differential\_operators.py in jacobian(fun, x)  
55 (out1, out2, …) then the Jacobian has shape (out1, out2, …, in1, in2, …).  
56 “”"  
—\> 57 vjp, ans = \_make\_vjp(fun, x)  
58 ans\_vspace = vspace(ans)  
59 jacobian\_shape = ans\_vspace.shape + vspace(x).shape

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/autograd/core.py in make\_vjp(fun, x)  
8 def make\_vjp(fun, x):  
9 start\_node = VJPNode.new\_root()  
—\> 10 end\_value, end\_node = trace(start\_node, fun, x)  
11 if end\_node is None:  
12 def vjp(g): return vspace(x).zeros()

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/autograd/tracer.py in trace(start\_node, fun, x)  
8 with trace\_stack.new\_trace() as t:  
9 start\_box = new\_box(x, t, start\_node)  
—\> 10 end\_box = fun(start\_box)  
11 if isbox(end\_box) and end\_box.\_trace == start\_box.\_trace:  
12 return end\_box.\_value, end\_box.\_node

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/autograd/wrap\_util.py in unary\_f(x)  
13 else:  
14 subargs = subvals(args, zip(argnum, x))  
—\> 15 return fun(\*subargs, \*\*kwargs)  
16 if isinstance(argnum, int):  
17 x = args[argnum]

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/pennylane/\_grad.py in **call** (self, \*args, \*\*kwargs)  
99 “”“Evaluates the gradient function, and saves the function value  
100 calculated during the forward pass in :attr:`.forward`.”""  
–\> 101 grad\_value, ans = self.\_get\_grad\_fn(args)(\*args, \*\*kwargs)  
102 self.\_forward = ans  
103 return grad\_value

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/autograd/wrap\_util.py in nary\_f(\*args, \*\*kwargs)  
18 else:  
19 x = tuple(args[i] for i in argnum)  
—\> 20 return unary\_operator(unary\_f, x, \*nary\_op\_args, \*\*nary\_op\_kwargs)  
21 return nary\_f  
22 return nary\_operator

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/pennylane/\_grad.py in \_grad\_with\_forward(fun, x)  
116 difference being that it returns both the gradient _and_ the forward pass  
117 value."""  
–\> 118 vjp, ans = \_make\_vjp(fun, x)  
119  
120 if not vspace(ans).size == 1:

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/autograd/core.py in make\_vjp(fun, x)  
8 def make\_vjp(fun, x):  
9 start\_node = VJPNode.new\_root()  
—\> 10 end\_value, end\_node = trace(start\_node, fun, x)  
11 if end\_node is None:  
12 def vjp(g): return vspace(x).zeros()

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/autograd/tracer.py in trace(start\_node, fun, x)  
8 with trace\_stack.new\_trace() as t:  
9 start\_box = new\_box(x, t, start\_node)  
—\> 10 end\_box = fun(start\_box)  
11 if isbox(end\_box) and end\_box.\_trace == start\_box.\_trace:  
12 return end\_box.\_value, end\_box.\_node

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/autograd/wrap\_util.py in unary\_f(x)  
13 else:  
14 subargs = subvals(args, zip(argnum, x))  
—\> 15 return fun(\*subargs, \*\*kwargs)  
16 if isinstance(argnum, int):  
17 x = args[argnum]

/tmp/ipykernel\_1076/3145879875.py in funct(params)  
2 def expval(obs, params):  
3 def funct(params):  
----\> 4 return circuit(params, obs, wires=range(qubits))  
5 return funct

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/pennylane/qnode.py in **call** (self, \*args, \*\*kwargs)  
604 if self.mutable or self.qtape is None:  
605 # construct the tape  
–\> 606 self.construct(args, kwargs)  
607  
608 # Execute the tape.

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/pennylane/qnode.py in construct(self, args, kwargs)  
523  
524 with self.qtape:  
–\> 525 self.qfunc\_output = self.func(\*args, \*\*kwargs)  
526  
527 if not isinstance(self.qfunc\_output, Sequence):

/tmp/ipykernel\_1076/3280061623.py in circuit(params, obs, wires)  
6 qml.DoubleExcitation(params[0], wires=[0, 1, 2, 3])  
7 qml.DoubleExcitation(params[1], wires=[0, 1, 4, 5])  
----\> 8 return qml.expval(obs)

~/psi4conda/envs/pennylane/lib/python3.9/site-packages/pennylane/measure.py in expval(op)  
233 if not isinstance(op, (Observable, qml.Hamiltonian)):  
234 raise qml.QuantumFunctionError(  
–\> 235 “{} is not an observable or Hamiltonian: cannot be used with expval”.format(op.name)  
236 )  
237

AttributeError: ‘tensor’ object has no attribute ‘name’

“”".  
I am not sure why this error pops up. Can you help me troubleshoot this.

Thankyou.

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [February 18, 2022, 4:02pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/29 "2022-02-18T16:02:57Z")

</div>

Hi @raghavv, what version of Python and PennyLane are you using?

---

<div class="post-metadata">

**Author:** ![raghavv](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@raghavv](https://discuss.pennylane.ai/u/raghavv)\
**Post date:** [February 18, 2022, 4:53pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/30 "2022-02-18T16:53:55Z")

</div>

Hi @CatalinaAlbornoz, Pennylane is 0.19.1 and Python is 3.8.12. Do you think I should upgrade.

Thank you.

---

<div class="post-metadata">

**Author:** ![Alain\_Delgado\_Gran](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/alain_delgado_gran/32/78_2.png) [@Alain\_Delgado\_Gran](https://discuss.pennylane.ai/u/Alain_Delgado_Gran)\
**Post date:** [February 19, 2022, 3:06am UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/31 "2022-02-19T03:06:56Z")

</div>

Hi @raghavv,

Yes, installing the latest release of PennyLane should fix the problem.

Let us know.

Thank you.

---

<div class="post-metadata">

**Author:** ![raghavv](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@raghavv](https://discuss.pennylane.ai/u/raghavv)\
**Post date:** [February 19, 2022, 3:13am UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/32 "2022-02-19T03:13:17Z")

</div>

Thank you sir @Alain_Delgado_Gran. Will try upgrading and update the progress.  
Thank you

---

<div class="post-metadata">

**Author:** ![raghavv](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@raghavv](https://discuss.pennylane.ai/u/raghavv)\
**Post date:** [February 22, 2022, 4:03am UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/33 "2022-02-22T04:03:53Z")

</div>

Thank you sir @Alain_Delgado_Gran and @CatalinaAlbornoz. Will install latest Pennylane and try the Vibrational calculation and update.

---

<div class="post-metadata">

**Author:** ![sjahangiri](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/sjahangiri/32/1443_2.png) [@sjahangiri](https://discuss.pennylane.ai/u/sjahangiri)\
**Post date:** [February 23, 2022, 4:44pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/34 "2022-02-23T16:44:58Z")

</div>

Hi @raghavv.

Regarding this:

> I carried out the calculation for LiH and it worked. I was unable to construct Hamiltonian for the bigger molecule such as PSPCz which I had mentioned in the first comment. That is why @sjahangiri had suggested me a work around. However, as you mentioned when the Hamiltonian is borrowed from Openfermion, I guess the nuclear gradient did not run.

You can run the geometry optimisation [tutorial](https://pennylane.ai/qml/demos/tutorial_mol_geo_opt.html) by building your Hamiltonian directly with OpenFermion. You just need to replace the `H(x)` function in the tutorial with the following, or something similar:

```
def H(x):
    geometry = [[s, tuple(x[3 * i : 3 * i + 3])] for i, s in enumerate(symbols)] # convert geometry to OF format
    molecule = openfermion.MolecularData(geometry, basis, multiplicity, charge) # create molecule object
    hamiltonian = run_pyscf(molecule).get_molecular_hamiltonian() # construct Hamiltonian
    hamiltonian = jordan_wigner(get_fermion_operator(hamiltonian)) # transform to qubit basis
    return qml.qchem.convert_observable(hamiltonian) # convert to PL Hamiltonian

```

However, please note that the black-box `finite_diff` function used in this tutorial will be deprecated soon. You can also have a look at the differentiable Hartree-Fock [implementation](https://pennylane.readthedocs.io/en/stable/code/qml_hf.html) which allows computing the gradients with `qml.grad`.

Finally, since your questions are important and other users might benefit from seeing them, I highly recommend creating new topics for different problems.

Hope this info is helpful.

---

<div class="post-metadata">

**Author:** ![raghavv](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@raghavv](https://discuss.pennylane.ai/u/raghavv)\
**Post date:** [March 17, 2022, 10:19am UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/35 "2022-03-17T10:19:25Z")

</div>

Hi Sir @sjahangiri. I am very sorry for the delayed response. Thank you for your detailed explanations.

Thank you sharing the code to optimize geometry as well and sharing the status of finite\_diff.

Also, regarding the questions and answers, thank you for the remark. I thought it will be easier to go through from the same thread. But I will compile the questions and answers given by @sjahangiri, @CatalinaAlbornoz and @Alain_Delgado_Gran @maliasadi and create seperate threads and post them so that it will be visible to all of us.

I am working on optimizing the molecules. I will keep things updated.

Really thankful you for the immense support.

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [March 17, 2022, 11:50pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/36 "2022-03-17T23:50:16Z")

</div>

Thank you for the update @raghavv! Let us know how it goes when optimizing the molecules.

---

<div class="post-metadata">

**Author:** ![raghavv](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@raghavv](https://discuss.pennylane.ai/u/raghavv)\
**Post date:** [April 25, 2022, 6:35pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/37 "2022-04-25T18:35:46Z")

</div>

Dear @sjahangiri @Alain_Delgado_Gran @CatalinaAlbornoz. Thank you for your most valuable inputs. With an objective to optimize molecules using quantum computers, I have tried to integrate geom\_opt and adaptive-circuit codes, with the help discussions carried out here. I am attaching the status of work here.

I will be grateful if you could kindly provide me a your esteemed feedback on it.

The attached file has extension .txt, kindly request you change it to .pdf for reading.

Please let me know if you need any further information.

Thank you

[VariationalandGeometryOptimization.txt](https://discuss.pennylane.ai/uploads/short-url/sNZekrBOyFhqfLRT4C5mmSxA2GB.txt) (2.1 MB)

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [April 26, 2022, 4:10pm UTC](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564/38 "2022-04-26T16:10:59Z")

</div>

Hi @raghavv, thanks for sharing this with us. Here are a few notes:

- We usually write PennyLane with a capital P and a capital L (no spaces in the word)
- You can add a citation for PennyLane (the software itself, not the demos) like this:  
Ville Bergholm, Josh Izaac, Maria Schuld, Christian Gogolin, M. Sohaib Alam, Shahnawaz Ahmed, Juan Miguel Arrazola, Carsten Blank, Alain Delgado, Soran Jahangiri, Keri McKiernan, Johannes Jakob Meyer, Zeyue Niu, Antal Száva, and Nathan Killoran. _PennyLane: Automatic differentiation of hybrid quantum-classical computations._ 2018. [arXiv:1811.04968](https://arxiv.org/abs/1811.04968)
- You write “The quantum computer by Xanadu uses the paltofrom called Pennylane”. However PennyLane is a software that is not tied to any particular hardware so you might want to remove this phrase.

I can’t really comment on the contents but feel free to post this on our [Slack](https://u.strawberryfields.ai/slack/) and ask other members of the community to give you feedback.

Great initiative to write this!

[Previous page](https://discuss.pennylane.ai/t/unable-to-construct-hamiltonian/1564.md?page=1)
