Reallocation of matrix object 'Ca' with new matrix of different dimension

Dear PSI4 community,

We have recently worked on an interface of PSI4 with a stand-alone orbital localization code(ROSE)| which takes the information from the original wavefunction(wfn) object of PSI4, localizes the orbitals and then writes them back to wfn. However, the output from ROSE has truncated number of orbitals(and orbital energies) which we re-write back to the original wfn. As a result there is a dimension mismatch between the original ‘Ca’ and ‘epsilon_a’ objects of wfn and the output( numpy array) from ROSE.

So my question is there any general python functionality/methods of deallocating and reallocating these objects with the new matrix dimensions ?

thanks and regards,

Have you tried the Matrix and Vector copy method?

OK. Thanks. I did see the ‘copy’ method for the Vector object but was a bit confused with the documentation for the Matrix object. But it works for now.

On that note, is it also possible to re-set the ‘nmo’ of the wfn object ?

I’ll update the Matrix.copy documentation to actually be correct.

No, it isn’t possible to reset nmo. I can make an issue about this. Ideally, nmo should be computed from nmopi_ rather than cached.