theochem / iodata

Python library for reading, writing, and converting computational chemistry file formats and generating input files.
https://iodata.readthedocs.io/
GNU Lesser General Public License v3.0
131 stars 46 forks source link

Intuitive representation of molecular orbitals #24

Closed matt-chan closed 5 years ago

matt-chan commented 5 years ago

It's too complicated to make an Orbital instance right now. You need to assign the attributes by hand, which is really clunky. ie

a = Orbitals(*mol.occ_alpha)
a.coeffs[:] = mol.occ_alpha_coeffs
a.energies[:] = mol.occ_alpha_energies
a.occupations[:] = mol.occ_alpha_occs

Instead we should introduce a new parameter, orb_alpha_params (or something along those lines) to be fed into Orbitals in the same way we do GBasis (this also requires an API change to Orbitals within meanfield). Then the API becomes something like

Orbitals(**mol.occ_alpha_params)
FarnazH commented 5 years ago

@matt-chan, there is no Orbital class in iodata at this point, is there? I think this is relevant to the other thread regarding Orbital package vs. class.

matt-chan commented 5 years ago

Sorry for the delay @FarnazH. No, there's no orbital class right now. But even to instantiate an Orbital instance from meanfield or from another orbital package, it's too clunky I think. We should instead give it all the parameters needed as a dictionary. Right now a developer would need to use the first code-block just to create an orbital instance.

tovrstra commented 5 years ago

Re-introducing an Orbital class is certainly an option, but it should remain focussed on facilitating IOData, not too many adding computational features. I would suggest to have one class, with possibly two instances, one for alpha and one for beta orbitals. I still need to figure out how to make it the most convenient for chemtools and denspart.

tovrstra commented 5 years ago

Here is a new proposal: one mo attribute in IOData that is flexible enough to handle different cases (restricted, unrestricted, generalized, open-/closed-shells)

mo is an instance of type namedtuple('MolecularOrbitals', ['type', 'norba', 'norbb' 'energies', 'occupations', 'irreps', 'coefficients'])

where

tovrstra commented 5 years ago

@FarnazH This is currently partially implemented. Do you have additional work on this in a local branch? If not, I could tackle this in the next few days.

FarnazH commented 5 years ago

@tovrstra I had a few small local commits and considering all the recent updates, there is nothing sitting there that isn't fully covered. Thanks for checking with me.

tovrstra commented 5 years ago

Fixed in #76.