Avogadro 2: xtb calculated orbitals (molden format) get wrong numbers upon display

Hello,

with the newest Avogadro 2, OpenBabel and xtb plugin on my Windows11 notebook I compute orbitals, but they do not show up in the “Molecular Orbitals” window. The MO window is empty - see the printscreen. Please help.

PS: I get the message about xtb calculated oribtals; likewise in the log.log file I see :

"main_:75: The following dictionary was passed back to Avogadro: {‘readProperties’: True, ‘moleculeFormat’: ‘molden’, ‘molden’: '[Molden Format]\n[Title]\n[Atoms] AU\nC 1 "

I’ll reply more thoroughly to you shortly, but to begin with you can look in the calculation directory (in the plugin’s submenu) and open the molden.input file manually with Avogadro. That should give you the results, at least.

I see the molden.input file in the deep xtb calculation subdirectory. But Avogadro 1.100 can not open this file (I am under Windows, and have no molden program )…

If you rename it to something like file.molden it will be fine.

Not entirely sure I want to enable .input as a recognized extension…

1 Like

Thanks ! After renaming molden.input to file.molden and opening it I got the orbitals.

Only minor issue remains now: how to tell Avogadro to display orbitals around HOMO+/-10 ?

You can just click on other lines in the table. It will pre-compute +/- 5 around the HOMO/LUMO gap, but it doesn’t take long to click on another one and have it render.

Well, I can not get more lines with so desired orbitals upon mere clicking. Got only 100% status of each orbital, but no extra lines…

The “Molecular Orbitals” window has constant number of lines…

I looked carefully into file.molden. Is has 36 orbitals , roughly half of them is occupied.

Avogadro2 assigns wrong ordering.

The issue there is that xtb doesn’t print the full set of MOs, and Avogadro currently doesn’t really expect that the set of MOs will be incomplete.

I need to change the plugin slightly so that the MO indices are passed back to Avogadro, but I’m not sure whether that will entirely fix the issue.

Besides which, the interface between Avogadro and the plugin is clearly not working at the moment anyway, since the orbitals weren’t being loaded for you. Can you please reproduce the original issue (no MOs being displayed after running an orbital calc with the plugin) and send the log file, input file, and the various output files from the calculation folder? (As an archive e.g. .zip). Then I can take a look. Thanks!

I think the main thing is that parts of Avogadro assume electrons / 2 → HOMO, and there needs to be more code that sets the HOMO or orbital occupations. The latter is probably the better option to also handle other kinds of calculations.

1 Like

Hello,

you can reproduce this issue with any small molecule.

For instance CH3Cl, optimize it using FF, and then calculate orbitals using xtB-as-plugin. Open the calculation files, rename molden.input to file.molden and open this file in Avogadro2.

In molden.input file there are all xtb calculated orbitals. But Avogadro2 does not properly counts the MOs, it wrongly assignes HOMO-x numbering…

This is the CH3Cl set of MOs.

This is content of file.molden:

[Molden Format]
[Title]
[Atoms] AU
C      1     6 -0.32225284938446E+01  0.10954114935358E+00 -0.19633106382764E+00
H      2     1 -0.49742369209648E+01  0.34268151953554E+00 -0.12626681597391E+01
Cl     3    17 -0.31584459800891E+01  0.23299476033206E+01  0.22965925517897E+01
H      4     1 -0.31310019661650E+01 -0.17949467532935E+01  0.59391560906370E+00
H      5     1 -0.16012695866399E+01  0.43486558373585E+00 -0.14314765127271E+01
[GTO]
           1 0
 s           4   1.00000000000000     
   51.0493630955799      -0.163120632101274     
   8.79112274068875      -0.199110245810007     
  0.706404222589298       0.318820477536558     
  0.269228134134116       0.127065041842404     
 p           4   1.00000000000000     
   5.82636561408000       0.737164515452096     
   1.51068960187200       0.682163716148503     
  0.532564832880000       0.357830539292537     
  0.212023236906000       5.398303027584788E-002
 
           2 0
 s           3   1.00000000000000     
   3.37022769753360       0.273591105889083     
  0.613891182214980       0.264605406538605     
  0.166142911484160       8.246594753408230E-002
 
           3 0
 s           4   1.00000000000000     
   9.34674866189868      -0.125552785052236     
   2.63274953955161      -0.254029831967196     
  0.472092932487140       0.305184566430756     
  0.232271649766237       8.559661830788402E-002
 p           4   1.00000000000000     
   8.96653868620652      -0.317209215069455     
  0.926601749794952       0.357031126383567     
  0.418792332287928       0.280771537007085     
  0.202453454537036       4.152131922185704E-002
 d           3   1.00000000000000     
   3.20597745654841        2.13231494102881     
   1.00523897559031       0.971375176087545     
  0.391565355448865       0.129419082352652     
 
           4 0
 s           3   1.00000000000000     
   3.37022769753360       0.273591105889083     
  0.613891182214980       0.264605406538605     
  0.166142911484160       8.246594753408230E-002
 
           5 0
 s           3   1.00000000000000     
   3.37022769753360       0.273591105889083     
  0.613891182214980       0.264605406538605     
  0.166142911484160       8.246594753408230E-002
 
[MO]
Sym=     1a
Ene=   -1.05282827011373     
Spin= Alpha
Occup=     2.00000000
           1  4.060378057440216E-002
           2  1.083137419866094E-003
           3  3.753179371156806E-002
           4  4.213816284108944E-002
           5 -6.561872048770307E-003
           6  0.981151079699653     
           7  1.737781213602045E-004
           8  6.023058061222195E-003
           9  6.762146809090162E-003
          10  1.700326422958499E-003
          11 -5.559954279960332E-004
          12 -1.144330994962465E-003
          13 -7.524048527787518E-005
          14 -8.449513511443549E-005
          15 -2.927600500969232E-003
          16 -6.561947641410705E-003
          17 -6.561906973934917E-003
Sym=     2a
Ene=  -0.621652236581656     
Spin= Alpha
Occup=     2.00000000
           1  0.576355003991025     
           2 -1.546781159781626E-003
           3 -5.345621451673015E-002
           4 -6.001999373856769E-002
           5  0.228643662959873     
           6 -0.107845827688730     
           7 -3.914198832848628E-003
           8 -0.135593938935599     
           9 -0.152236286230775     
          10 -5.404843958994873E-003
          11  1.767370885540072E-003
          12  3.637473073454801E-003
          13  2.391677445571995E-004
          14  2.685279621786108E-004
          15  9.305945728503391E-003
          16  0.228638173590808     
          17  0.228639723803956     
Sym=     3a
Ene=  -0.520809849667157     
Spin= Alpha
Occup=     2.00000000
           1 -1.632269756129727E-006
           2 -0.311602879121982     
           3 -0.356752451811833     
           4  0.325765565413470     
           5  4.457401411989895E-002
           6 -2.941122594719108E-007
           7 -0.147802330928474     
           8 -0.169219247889594     
           9  0.154519433665390     
          10 -2.992943759817717E-004
          11  1.413607186108324E-003
          12 -1.114312810126552E-003
          13  3.855726390160346E-004
          14  9.084741786782867E-004
          15 -4.070581216568523E-005
          16  0.351199301493097     
          17 -0.395770781047725     
Sym=     4a
Ene=  -0.520806917425547     
Spin= Alpha
Occup=     2.00000000
           1  1.169960426699672E-005
           2  0.482989302004463     
           3 -0.238885945815307     
           4  0.200381624197198     
           5 -0.431265746244052     
           6 -6.893174322232462E-006
           7  0.229102075356092     
           8 -0.113339799545076     
           9  9.502117074226349E-002
          10 -3.458828308435320E-004
          11  9.795433310342044E-004
          12 -6.336605001906724E-004
          13 -6.538652855790988E-004
          14 -1.334398299224526E-003
          15 -3.698146329677654E-005
          16  0.254227197646565     
          17  0.177024270583395     
Sym=     5a
Ene=  -0.505856737632911     
Spin= Alpha
Occup=     2.00000000
           1 -5.212692497792739E-002
           2 -9.887880651135333E-003
           3 -0.343306795898844     
           4 -0.385420430378048     
           5  0.129019115725025     
           6  0.140507997810290     
           7  1.300524057060689E-002
           8  0.450220256409048     
           9  0.505489458954859     
          10  1.018494717232968E-003
          11 -3.329006987212628E-004
          12 -6.855940185117048E-004
          13 -4.515205833103319E-005
          14 -5.076025178975560E-005
          15 -1.753673007931158E-003
          16  0.129047482450587     
          17  0.129044617587618     
Sym=     6a
Ene=  -0.415015817891013     
Spin= Alpha
Occup=     2.00000000
           1 -5.883164454056881E-007
           2 -9.527007326094829E-002
           3 -0.100975051542177     
           4  9.238606649941593E-002
           5  2.934561651725630E-002
           6 -1.176075848567695E-007
           7  0.549966539566645     
           8  0.582902911312226     
           9 -0.533318893776999     
          10 -3.537001616243145E-004
          11  8.014823841436581E-003
          12 -7.661123679812266E-003
          13  3.855618150479437E-003
          14  5.014011813926334E-003
          15  6.007609047908154E-004
          16  0.167968698821493     
          17 -0.197312271050848     
Sym=     7a
Ene=  -0.415015360521622     
Spin= Alpha
Occup=     2.00000000
           1  2.449502190555221E-006
           2  0.136831574868171     
           3 -7.290699983203944E-002
           4  6.141696056757012E-002
           5 -0.210900737601243     
           6  2.899725719242190E-008
           7 -0.789847634936926     
           8  0.420843783517991     
           9 -0.354532461128978     
          10 -8.458527044942189E-004
          11  5.845665383596215E-003
          12 -4.999812679101995E-003
          13 -5.430424782767317E-003
          14 -7.256339034576671E-003
          15  5.843623076717940E-004
          16  0.130864605946324     
          17  8.003656917811719E-002
Sym=     8a
Ene=  -0.153911372125390     
Spin= Alpha
Occup=     0.00000000
           1 -0.465727983721294     
           2 -1.192941683107127E-002
           3 -0.413368021266989     
           4 -0.464099672481515     
           5  7.285653081003481E-002
           6  0.229352749272059     
           7 -1.322894127233422E-002
           8 -0.458367234475612     
           9 -0.514624485899203     
          10  0.218850936656401     
          11 -7.156304406982017E-002
          12 -0.147287892586580     
          13 -9.686189006040584E-003
          14 -1.087530085523286E-002
          15 -0.376812887518600     
          16  7.285746850552403E-002
          17  7.285901217073378E-002
Sym=     9a
Ene=   1.874228132921546E-002
Spin= Alpha
Occup=     0.00000000
           1  1.092491883833390E-005
           2  0.142233945288470     
           3 -8.347499253919249E-002
           4  7.068340560490224E-002
           5  0.248181274995035     
           6  1.450287680726883E-006
           7 -5.705128556458195E-003
           8  3.346484154922579E-003
           9 -2.837047736652874E-003
          10  0.132101759961116     
          11  0.414947567120836     
          12 -0.547049327081952     
          13 -0.612451945694890     
          14 -0.448228554047548     
          15  0.169847262895024     
          16 -0.164400869707003     
          17 -8.380115391172749E-002
Sym=    10a
Ene=   1.874306538773398E-002
Spin= Alpha
Occup=     0.00000000
           1  3.091135732803551E-006
           2 -0.109314472569050     
           3 -0.104827237934174     
           4  9.617522596459792E-002
           5 -4.653288581309909E-002
           6  4.370877308278831E-007
           7  4.383661714545494E-003
           8  4.203138672995425E-003
           9 -3.857366608616293E-003
          10  0.166185954789200     
          11  0.542242499523146     
          12 -0.708428454312346     
          13  0.521123726838030     
          14  0.291716731426442     
          15  0.158484807786484     
          16 -0.191657288262603     
          17  0.238182777950788     
Sym=    11a
Ene=   2.597374522193683E-002
Spin= Alpha
Occup=     0.00000000
           1 -1.255975815339636E-006
           2 -5.228890929563994E-004
           3 -4.784349549238519E-004
           4  4.408057209068239E-004
           5  6.143037252122521E-003
           6 -1.794319913031395E-007
           7  2.454585885487585E-003
           8  2.249289812300419E-003
           9 -2.066120340784853E-003
          10  0.554939603312919     
          11 -0.492106179571796     
          12 -6.283342374112286E-002
          13  0.420074098408988     
          14 -0.603612223009732     
          15  0.300172652660927     
          16  2.223691362868259E-002
          17 -2.837746703538811E-002
Sym=    12a
Ene=   2.597376151458166E-002
Spin= Alpha
Occup=     0.00000000
           1 -2.353998902210399E-006
           2 -6.505983754305699E-004
           3  4.001460677156161E-004
           4 -3.372479728907400E-004
           5  2.922462068035250E-002
           6 -3.289621075088338E-007
           7  3.053147958983096E-003
           8 -1.872075448981004E-003
           9  1.589546226917444E-003
          10 -0.629092249175161     
          11  0.476180418374889     
          12  0.152911830800271     
          13  0.363124242888917     
          14 -0.569682915508623     
          15 -0.336611803486064     
          16 -1.992978490144780E-002
          17 -9.290767832593246E-003
Sym=    13a
Ene=   0.116454799203979     
Spin= Alpha
Occup=     0.00000000
           1  0.721739083939067     
           2 -1.508474674132272E-002
           3 -0.524288518779885     
           4 -0.588539805533957     
           5 -0.532884903550599     
           6  0.175389171153541     
           7 -5.843519230440831E-003
           8 -0.202304930915654     
           9 -0.227143946649888     
          10 -0.215997599933138     
          11  7.060783180280464E-002
          12  0.145389768130333     
          13  9.577333682413394E-003
          14  1.074458682628438E-002
          15  0.371882929205332     
          16 -0.533015156460101     
          17 -0.532966989842335     
Sym=    14a
Ene=   0.155000530481417     
Spin= Alpha
Occup=     0.00000000
           1  0.851012052241254     
           2  4.144724395769097E-003
           3  0.141678277799248     
           4  0.159153285131310     
           5 -0.306679763456326     
           6 -0.131576753861350     
           7  6.443529872055558E-003
           8  0.223448979358121     
           9  0.250865535330479     
          10  0.415742654983732     
          11 -0.135960886400790     
          12 -0.279781768582942     
          13 -1.838614198092237E-002
          14 -2.064818552998597E-002
          15 -0.715827154266990     
          16 -0.306807115319624     
          17 -0.306769623928906     
Sym=    15a
Ene=   0.190464472060312     
Spin= Alpha
Occup=     0.00000000
           1  1.295468417636367E-004
           2 -0.814668965979834     
           3  0.510049752722796     
           4 -0.433418052781700     
           5 -0.920897320970216     
           6  4.144554179308006E-006
           7  7.461827907174744E-002
           8 -4.671872736007503E-002
           9  3.969584568635467E-002
          10  2.587416935275271E-002
          11  0.138503438972377     
          12 -0.164377608325130     
          13 -0.167226838559814     
          14 -0.142287755756499     
          15  4.368591103583472E-002
          16  0.636637325552574     
          17  0.284049589296266     
Sym=    16a
Ene=   0.190481523724368     
Spin= Alpha
Occup=     0.00000000
           1  2.070849734516045E-005
           2  0.669035190552722     
           3  0.599921302388524     
           4 -0.551558030210488     
           5  0.203559397254443     
           6  2.371497530914950E-006
           7 -6.127757875596089E-002
           8 -5.494982979703820E-002
           9  5.051395979279643E-002
          10  3.505792806665642E-002
          11  0.167044747169808     
          12 -0.202102675236464     
          13  0.149571378902318     
          14  0.104257997954123     
          15  3.823654352356507E-002
          16  0.695669923830042     
          17 -0.899262561448701     

Having a look at it briefly, what happens for me is the same as you, that I run the orbitals calculation, and the MO dialog then opens but is empty, so I can confirm the bug.

However, if I then switch to another molecule in the Molecules Pane and back again, the dialog is then populated. So the information is being passed back correctly, there’s just something weird going on on the Avogadro side.

I know that’s a bit inconvenient, but at least that’s a bit of a work-around so you can see the orbitals without having to load the file manually. :slight_smile:

1 Like

I’ll also note @ghutchis that some MOs seem to render the same even when they ought to be different (and are verifiably different by checking the file).

ethylene.molden.txt (8.4 KB)

Here, for example, orbitals 6 to 12 (by Avogadro’s reckoning) are displayed uniquely, but 1 to 5 all display the same, with s-type symmetry.

acetone.molden.txt (23.0 KB)

Acetone also shows a similar issue, but here not only do the five lowest energy orbitals all render identically, so do 17-20.

ch3cl.molden.txt (13.2 KB)

For CH3Cl, orbitals 1-5 all render identically, 14-17 render identically, and actually 11-13 don’t render at all.

Changing the render quality has no impact.

1 Like

Yeah – looking at the files, the orbital numbering does actually match up with the scheme that xtb uses (i.e. even though it only looks at the valence orbitals, it just ignores the core orbitals for the purpose of the numbering).

So it’s the occupations that are needed really.

The occupancies are actually included in the .molden file, but unfortunately Avogadro doesn’t currently parse them.

Edit: I also just had a go at having the plugin pass the occupations back to Avogadro within the output JSON e.g.
example.json.txt (11.5 KB) and it doesn’t seem like the occupations are registered, as if I run an orbitals calculation and then save to CJSON the occupation data doesn’t appear. So it’s not a simple fix that can be done from the plugin.

Avogadro of course has to act appropriately for the given occupations, but getting the occupation data into Avogadro is a pre-requisite for that. The easiest way to get that to happen for now will be to add support for parsing occupation data from .molden files. I guess that’s not a huge undertaking and something that I can look at.

2 Likes

FYI: looking into the corresponding tutorial, Viewing Molecular Orbitals — Avogadro 1.100.0 documentation , I guess this is shown from the previous Avogadro version…

Yep, that’s one of the many parts of the manual that need updating before the 2.0 release.

1 Like

Yep. Help updating the manual is most welcome.

Coming back to this … is it a problem with the MO window? In other words, if you use “Create Surfaces” does it show the same issue?

While in principle, the occupations are tracked, in practice the code for handling basis sets does not do a great job with that - I noticed as I was working on the MO window itself. (e.g., it assumes it can get the HOMO number as electrons / 2 which is problematic).

Yes, parsing occupation from molden would be great.

1 Like