Skip to content

run_pyscf does not work on PyscfMolecularData #38

Description

@kevinsung

Input:

from openfermionpyscf import PyscfMolecularData, run_pyscf

geometry = [('Li', (0., 0., 0.)), ('H', (0., 0., 1.4))]
basis = 'sto-3g'
multiplicity = 1
charge = 0

molecule = run_pyscf(
        PyscfMolecularData(geometry, basis, multiplicity, charge)
)

Output:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-bf13348427ff> in <module>()
      7 
      8 molecule = run_pyscf(
----> 9         PyscfMolecularData(geometry, basis, multiplicity, charge)
     10 )

~/Projects/OpenFermion-PySCF/openfermionpyscf/_run_pyscf.py in run_pyscf(molecule, run_scf, run_mp2, run_cisd, run_ccsd, run_fci, verbose)
    143 
    144     # Populate fields.
--> 145     molecule.canonical_orbitals = pyscf_scf.mo_coeff.astype(float)
    146     molecule.orbital_energies = pyscf_scf.mo_energy.astype(float)
    147 

AttributeError: can't set attribute

The reason is that PyscfMolecularData has canonical_orbitals, etc., as properties rather than attributes. One could fix this by adding setters, but I don't know what the correct design or intended usage is. If we can calculate stuff on the fly, then perhaps we don't even need to perform run_pyscf on a PyscfMolecularData? @sunqm

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions