Problems with RHF::c1_deep_copy

Hi all,

I would like to be able to make a de-symmetrized (C1) deep copy of a RHF wavefunction. RHF::c1_deep_copy() seemed to be the obvious choice, however when I run:

wfn.c1_deep_copy(wfn.basisset())

I get

Fatal Error: Passed in functional was unpolarized for UV reference.

I looked up the source code and I suspect this might be related to the fact that c1_deep_copy returns a generic Wavefunction, not a RHF one.

Any help would be very appreciated.

All the best,

Tim

RHF.c1_deep_copy does not return a generic wavefunction but another RHF wavefunction, as shown by the following minimal example:

molecule = geometry("""
H
H 1 1.0 
""")

set basis sto-3g

wfn = energy('scf', return_wfn=True)[1]
assert isinstance(wfn, core.RHF)

c1_molecule = molecule.clone()
c1_molecule.reset_point_group('c1')
c1_molecule.fix_orientation(True)
c1_molecule.fix_com(True)
c1_molecule.update_geometry()
c1_basis = core.BasisSet.build(c1_molecule, "ORBITAL", core.get_global_option('BASIS'), quiet=True)

new_wfn = wfn.c1_deep_copy(c1_basis)
assert isinstance(new_wfn, core.RHF)

I’ve found the issue and will leave it for people more familiar with the DFT infrastructure than I to fix. As a workaround, explicitly supply set reference rks before calling c1_deep_copy on an RKS DFT wavefunction object.

You’re right. I was looking at wfn and not hf_wfn in the C++ code.

It looks like I may have misunderstood the purpose of c1_deep_copy(). I thought it would strip the symmetry from the basis but it seems it simply copies a few arrays. Anyway, setting the reference to ‘rks’ seems to fix the problem. Which is weird because the rest of the code worked fine with ‘rhf’.

        # Strip symmetries
        psi4.set_options({"reference":"rks"})
        c1_molecule = wfn.molecule().clone()
        c1_molecule.reset_point_group('c1')
        c1_molecule.update_geometry()
        c1_basis = psi4.core.BasisSet.build(c1_molecule, "ORBITAL",
                                            psi4.core.get_global_option('BASIS'),
                                            quiet=True)
        c1_wfn = wfn.c1_deep_copy(c1_basis)

Tim