Xtb plugin installation

I believe this to be a problem with installing the xtb plugin for Avogadro

Environment Information

Avogadro version: 1.99.0
Operating system and version: Windows 10 Enterprise, version 22H2

Expected Behavior

According to the plugin manual, as one of the five ways of installation:

Manually download xtb and place it entirely within the Avogadro/commands/avo_xtb/ directory

Actual Behavior

There is no /commands directory in my Avogadro2 installation

Steps to Reproduce

Please upload files if appropriate here (or via file-sharing service like Dropbox or Pastebin)

Hi,

If you’ve installed the plugin from the dialog in Avogadro then it will have definitely been downloaded to that folder. But the plugins folder is not located at the path you’ve shown, it’s at %USERPROFILE%\AppData\Local\Avogadro or %USERPROFILE%\AppData\Roaming\Avogadro (I forget which of the two).

Sorry that that wasn’t clear, I’ve updated the README with a link to the docs that tell you where the folder is located.

Thanks a lot, Matt!
I did not realise that the standard plugin upload menu in Avogadro2 contains your plugin, now having used this standard dialog, I found the plugin in:
…\AppData\Local\OpenChemistry\Avogadro\commands\avo_xtb
However, the plugin existence is not yet seen in any of the Avogadro2 menus I try, such as Extensions. I imagine, now I need to download and install the xtb package itself from its own GitHub repository - is that correct?
Thank you very much!

Hmm, there should still be a menu entry under Extensions called Semi-empirical (xtb) as soon as you’ve installed the plugin, even if you don’t have xtb itself yet.

You do have to restart Avogadro after installing the plugin, first of all.

Secondly, have you got Python installed on your machine? It’s needed to run any of the plugins.

Yes, I am also a bit confused…


I restarted Avogadro, but still see no Semi-empirical entry - see screenshot. Also, I took a screenshot of the Python menu - I do have Python installed and Avogadro finds it, but maybe it’s a wrong version?

Thank you!

Strange. When you go on Extensions => Calculate => Configure…, what force fields are available to you? If MMFF and UFF are offered, Python is at least working correctly for some stuff, but if not, it’s more likely to be a general problem rather than one specific to the xtb plugin.

This might be a stupid question, but is that definitely the path to your Python interpreter? Seems odd to have it installed under .../Microsoft/WindowsApps/, as this StackOverflow question seems to indicate it should be under C:/Users/vaverbuk/AppData/Local/Programs/Python3xx/ (where xx is 9, 10, 11 etc. for the Python version).

Did you perhaps install it from the Microsoft Store? I know that when Python is installed from the store it often results in all sorts of limitations. If so, maybe try installing from python.org and see if anything changes.

@ghutchis Geoff, do you know for a fact whether the MS Store Python definitely does or definitely doesn’t work for Avogadro’s purposes?

Finally, if you’re able to start Avogadro from the command line (accessed from Terminal or cmd or PowerShell for you), Avogadro will report some information on the results of its search for plugins, and that info would be useful for me/us :slight_smile:

Extensions=>Calculate=>Configure gives MMFF94, UFF and a few other options, please see the screenshot

Python appears to be installed within Anaconda3, python.exe is in C:\Program Data\Anaconda3

If I run this executable, I get a python shell with the following message:

Python 3.9.13 (main, Aug 25 2022, 23:51:50) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see Managing environments — conda 24.9.3.dev45 documentation

Type “help”, “copyright”, “credits” or “license” for more information.

I can start avogadro2.exe from powershell, but I get no messages at all, it just starts the program normally.

Can it be that installation of python within Anaconda confuses Avogadro?

Thank you!

Yes, on Windows it sends error messages to a file in Documents called avogadro2.log

It shouldn’t - you should be able to set the Python environment. The other indication that Python is working for Avogadro2 is the list of input generators. If Orca is there, then it’s finding python.

Ok then, that should work fine, but from this image:

that doesn’t seem to be the interpreter that Avogadro is finding and using…

If you could upload this, that would be the most useful first thing. Then, as a second thing, maybe try clicking on “Other…” in the Python Settings dialog, select the Conda Python at C:\Program Data\Anaconda3, and see if that changes anything. But please upload the log file before you change the Python settings :slight_smile:

Thank you!

I did a full disc C:\ search and I do not have a file avogadro2.log on C. I also do not have any *.log file related to Avogadro in Documents…

Is avogadro2.log supposed to be generated after every Avogadro2 run?

I believe so.

I did some quick checking and it seems that C:/Users/<user>/AppData/Local/Microsoft/WindowsApps/ is indeed the location where Windows stores programs downloaded from the Microsoft Store. It also seems that the folder has very restricted permissions – read, you don’t have access or editing rights to the folder (despite it being within your personal AppData folder) – so I suspect that I might have been right and that is the root of the issue.

So just try doing this (indicate to Avogadro that it should use the Conda Python rather than the one it’s currently using) and see what happens. And assuming you have Python listed amongst the installed programs in the Microsoft Store app, since you now have Conda Python installed I would also recommend uninstalling the Store version, so that Avogadro and other things that use Python don’t get confused.

Thank you!

I have changed the pyhton location to Anaconda and now, after restarting Avogadro2, I could see the semi-empirical (xtb) in the Extensions menu - great!

However, after running “get xtb” and receiving the message that xtb was successfully installed, I still do not see the “location of the xtb binary” in the Config


ure menu - this field is empty:

The only xtb file I can see in my Programs folder is C:\Program Files\Avogadro2\lib\avogadro2\scripts\charges\xtb.py

1 Like

I believe you need to set that location manually, if you didn’t already move the file to the XTB directory in Avogadro2’s file path

Thank you, the field is indeed editable, but the binary - something like xtb.exe - is missing. As far as I understand, it was supposed to be generated or downloaded by the xtb installation process run from the plugin. This - again, as far as I can see, did not happen.

Actually, the xtb binary is almost certainly there and is being found. Unfortunately there’s a bug with Avogadro itself where the first field in any plugin’s dialog is emptied, see here. You’ll see that the same thing happens in the Configure, Run, and Conformers dialogs.

It’s tedious, but you can check what path is being used by looking at your config file at Avogadro/commands/avo_xtb/config.json.

Assuming that an xtb installation is being picked up, the pre-configured commands like xtb => Optimize etc. will work, so stick to those where possible for now.

If you need to use Run or Conformers, as a workaround for now you can copy the path from config.json and paste it into the empty box in the dialog. If the box is filled, everything will work fine, it’s just that the automatic population with the previously known value fails.

Let me know if this works for you.

Thank you, Matt, here is what I get trying to implement your suggestions.

I do not see “Optimise” in the Extensions–> xtb menu - please see how it looks at the moment:

I do see the config.json file, and here is what it contains:
{
“solvent”: null,
“energy_units”: “kJ/mol”,
“method”: 2,
“opt_lvl”: “normal”,
“calc_dir”: “C:\Users\vaverbuk\AppData\Local\OpenChemistry\Avogadro\commands\avo_xtb\last”,
“xtb_bin”: “C:\Users\vaverbuk\AppData\Local\OpenChemistry\Avogadro\commands\avo_xtb\xtb\bin\xtb”
}

Copying the location of the xtb_bin into the “location of xtb binary”, I get the same menu for xtb - without any clickable field which would start a calculation. The “go to calculation files” field is inactive - I can clock it but with no effect, probably because no calculation took place yet. Restarting Avogadro2 does not help, because the executable file field becomes empty…

It looks we still need one more step to actually make it work…

Ugh, I’m sorry this is taking so long to set up.

What happens if you create a folder at the path given by calc_dir, does the “go to” button work then? And does it change anything about the available options?

I’ll see if I can try it on a Windows PC and work out what’s going on.

Sorry, Matt, I am a bit confused. At the path given by calc_dir, I see a directory “last” with only one file inside it, called probe.txt and containing the following text:

This file is created only to check everything works.
It will be deleted when the first calculation is run.

I can create another folder at this location, but shouldn’t it have some pre-defined name? If yes, then which one?

Ah ok, in that case you have already answered my question!

It seems you already have the folder, and that the plugin can write files to it without an issue. So what I thought might be the issue is apparently not an issue.

In which case I’m running out of ideas as to what the problem could be, I’m afraid. Sorry :frowning: I’ll have a look myself on a Windows system in the next few days and see if I can work out what’s going on.

What you could do that might shed some more light: if you go to C:/Users/vaverbuk/AppData/Local/OpenChemistry/Avogadro/commands/avo_xtb, you will see all the Python script files of the plugin. Since you already have Python installed, if you are comfortable enough with the terminal/powershell/cmd you could try navigating to the folder and running some of the scripts with e.g. python energy.py --menu-path and python energy.py --print-options, and see what error messages get written to the output.

Thanks a lot, that would be great!

Here are the error messages I see in the powershell, they are the same no matter which one of the two commands I try to run:

Traceback (most recent call last):
File “C:\Users\vaverbuk\AppData\Local\OpenChemistry\Avogadro\commands\avo_xtb\energy.py”, line 13, in
import convert
File “C:\Users\vaverbuk\AppData\Local\OpenChemistry\Avogadro\commands\avo_xtb\convert.py”, line 35, in
) → list[str] | tuple[int, list[list[str]]]:
TypeError: unsupported operand type(s) for |: ‘types.GenericAlias’ and ‘types.GenericAlias’