avcopan / scfexchange

1 stars 0 forks source link

Remove spin-orbital energies and coefficients from OrbitalsInterface #13

Closed avcopan closed 7 years ago

avcopan commented 7 years ago

All that should be required are the energies and coefficients themselves. The construction of spin-orbitals can then be made automatic by defining a function to get the spin-orbital sorting order in the base class. Something like the following:

class OrbitalsInterface(with_metaclass(abc.ABCMeta)):
    ...
    def get_spinorb_order(self):
        spinorb_mo_energies = np.concatenate(self.mo_energies)
        spinorb_order = np.argsort(spinorb_mo_energies)
        return spinorb_order

In this case, it also makes more sense to make mo_energies and mo_coefficients public attributes.

avcopan commented 7 years ago

Also, to avoid confusion about whether norb is the total number of orbitals or the number of non-frozen orbitals, replace the attributes nfrz, norb, naocc, etc. with a common function in the base class. The signature should look like this:

    def get_orbital_count(self, mo_type='alpha', mo_space='ov'):
        """Return the number of orbitals in a given space.

        Args:
            mo_type (str): Orbital type, 'alpha', 'beta', or 'spinorb'.
            mo_space (str): Any contiguous combination of 'c' (core),
                'o' (occupied), and 'v' (virtual).  Defaults to 'ov', 
                which denotes all unfrozen orbitals.

        Returns:
            np.ndarray: The orbital energies.
        """
avcopan commented 7 years ago

That will also simplify the get_mo_slice function.