I am attempting to manually swap entries in the MO coefficient matrices of an HF-generated wfn object, then use psi4.molden() to view the swapped orbitals. However, both the indexing and the actual orbital shapes seem to be wrong for the neutral Scandium atom, despite the manually inspected Ca and Cb arrays being correct. I swapped orbital indices 14 and 27 in the numpy array, but which should mean orbitals 15 and 28 were swapped in molden’s notation. However, 14 and 28 were swapped in molden notation; see vim diff below:
Additionally, the orbitals molden generates after the rotation are asymmetric, e.g.
I’m using the following code to obtain this transformation:
cb = wfn.Cb().to_array()
ca = wfn.Ca().to_array()
self.molecule.n_orbitals = len(ca)
ca = psi4.core.Matrix.from_array(ca)
cb = psi4.core.Matrix.from_array(cb)
where self.active = [9,10,11,12,13,14] and self.reorder = [9,10,11,12,13,27]
I suspect this is an issue unique to very high symmetry systems, and I am running it in c1 if that matters. Any help is appreciated!
The fact that you are running this in c1 means that Psi shouldn’t be using symmetry at all, so I would be surprised if this issue is “unique to very high symmetry systems”.
Before anything else: are you trying to swap molecular orbitals or atomic orbitals?
They should be one and the same here, but in general I want to be swapping molecular orbitals.
Psi is just fine. The problem is your NumPy slices do not mean what you think they mean.
When Python sees
ca[:][self.active+self.reorder], it parses it piece by piece and forgets what the previous piece was. When it sees
ca, it knows to refer to the matrix, and then it sees
[:], which tells it to slice all rows. When it sees [self.active+self.reorder], it sees it has a matrix and you have a single slice and interprets that as a row slice. It has no memory of the fact that it just did a row slice. Consequently, you are flipping atomic orbitals in the current version, now molecular orbtials. The correct NumPy looks like
ca[:, self.active+self.reorder]. When I change your code accordingly, all works as expected.
As for why atomic orbital flips cause a problem, molden has its own atomic orbital ordering convention. I’m not surprised that Psi’s internal convention doesn’t match Molden’s. I’d need more detailed information about the basis set you used to work that out for sure, but that’s my guess.
Okay, thank you; that helps tremendously! As a bonus, it did fix the molden orderings. In general this sort of rotation has been consistent with molden’s rotations for me in the past, which is part of why I was so alarmed.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.