quantumlib / OpenFermion-PySCF

OpenFermion plugin to interface with the electronic structure package PySCF.
Apache License 2.0
105 stars 44 forks source link

run_pyscf is broken #40

Closed kevinsung closed 5 years ago

kevinsung commented 5 years ago

For instance, executing the example notebook gives the error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-3cf684407860> in <module>
     35                          run_cisd=run_cisd,
     36                          run_ccsd=run_ccsd,
---> 37                          run_fci=run_fci)
     38 
     39     # Print out some results of calculation.

~/Projects/OpenFermion-PySCF/openfermionpyscf/_run_pyscf.py in run_pyscf(molecule, run_scf, run_mp2, run_cisd, run_ccsd, run_fci, verbose)
    158             print("WARNING: RO-MP2 is not available in PySCF.")
    159         else:
--> 160             pyscf_mp2 = pyscf.mp.MP2(pyscf_scf)
    161             pyscf_mp2.verbose = 0
    162             pyscf_mp2.run()

AttributeError: module 'pyscf' has no attribute 'mp'

@sunqm Do you know what's up with this? Something strange that I found is that if I do

import pyscf
_ = pyscf.mp

I get the same error,

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'pyscf' has no attribute 'mp'

However,

from pyscf import mp

works fine.

sunqm commented 5 years ago

modules like mp, ci, cc are not exported at the package level. They need to explicitly imported from the pyscf package with "from pyscf import". I updated the import code in the PR.

babbush commented 5 years ago

closed by #41