How to access PubChem from python modules

I’m trying to retrieve coordinates for molecules from the PubChem database through a jupyter notebook.

The documentation uses the following syntax to access PubChem, but I’m not sure how to implement this as part of a python module.

molecule benzene {
pubchem:benzene
}

‘Psi4.geometry(“pubchem:benzene”)’

On a phone, sorry for the truncated answer.

This resulted in the following error message for me.

File “”, line 2
psi4.geometry(“pubchem:benzene”)
^
SyntaxError: invalid character in identifier

However, using three quotations, as used in the other psithon geometry examples was successful. Thanks!

psi4.geometry(“““pubchem:benzene”””)

There’s absolutely no reason why doing what Daniel said correctly should throw that error. My guess is that you used smart-quotes for Python rather than the raw " characters.

When your question is answered, remember to mark the post that solved it as the solution as a way to thank the answerer, guide others to the solution, and signal that no more help is needed.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.