Molden occupancies issue



I faced with the problem in exporting the wavefunction with molden_write. With DFT methods it’s OK, but with MP2 or CCSD(T) the occupancies of the core and valence orbitals in .molden file are zeroes. The Multiwfn program is not able to generate topology paths from file like this. It is needed to set the occupancy numbers to 1 manually.

The quick example is coming:

molecule {
H 1 1.0
set basis DZ
E, wfn = energy('mp2', return_wfn=True)

and the output .molden file is not correct:

 Sym= Ag
 Ene=        -0.5236851885
 Spin= Alpha
 Occup=  0.0000
  1       0.273617115565
  2       0.341877709082
  3       0.273617115565
  4       0.341877709082
 Sym= B1u
 Ene=         0.1851190448
 Spin= Alpha
 Occup=  0.0000
  1       0.161697299698
  2       1.177136553097
  3      -0.161697299698
  4      -1.177136553097
 Sym= Ag
 Ene=         0.9925049243
 Spin= Alpha
 Occup=  0.0000
  1       0.907971691314
  2      -0.729682710190
  3       0.907971691314
  4      -0.729682710190
 Sym= B1u
 Ene=         1.2409694441
 Spin= Alpha
 Occup=  0.0000
  1       1.009221757032
  2      -1.227081532562
  3      -1.009221757032
  4       1.227081532562

All occupancies are zeroes.


Yes, we currently set to all zeros as the occupation numbers could either be SCF-style (unit vector) or NO occupations and we do not have a consensus to what should be there. It is worth reading through the notes here.


The documentation is not clear to me.

The only relevant-seeming section is: “Will write natural orbitals from density (MO basis) if supplied. Warning! Most post-SCF Wavefunctions do not build the density as this is often much more costly than the energy.” That explains that natural orbitals won’t be written in this case, but it does not specify that the reference orbital occupations won’t be written, even if the orbitals being written are the reference orbitals. …Which, now that I type that, is very strange behavior.


Ok, thank you!

I guess, question is closed.


This is something to make a pull request about, the relevant code is here. Most of it is rather straightforward Python, should be editable by anyone-- we can also advise on how obtain the desired behavior.