Three options at hand: i) Avogadro2 and openbabel installed with
sudo apt, ii) Avogadro2 as AppImage for Linux, iii) plain command line with openbabel.
i) On a spare partition of Xubuntu 22.04.1 LTS, I run the installation of Avogadro
synaptic lists as
Avogadro2 - just to ascertain to be in the path leading to a contemporary version. This currently offers Avogadro 1.95-1, though not the most recent version (vide infra), it emerges from the branch to Avogadro2. The export of the molecules (the molecule with arrow button, top rim of the frame) is considerably constrained, .xyz format is possible bu reads e.g. as
XYZ file generated by Avogadro.
C 0.09854 -2.66053 -0.00000
H 0.89853 -2.90891 0.66574
C 0.42114 -1.89620 -0.67574
H -0.18675 -3.52988 -0.55475
H -0.73877 -2.30715 0.56475
H 1.25844 -2.24959 -1.24049
H -0.37886 -1.64783 -1.34149
H 0.70643 -1.02686 -0.12099
(a not optimized model of ethane). The export to other file formats, including .mol2, is available only after installing
openbabel7 (again with the package manager’s frontend synaptic) and restart of Avogadro. For the Python-based plugins to work, maybe you did not yet indicate the Python3 interpreter (Extensions → Set Python Path) - if not in
/usr/bin/python3, a call
which python3 provides you a prompt.
ii) I removed Avogadro and openbabel as installed via synaptic completely. The project’s landing page on GitHub has an AppImage for Linux. Download the archive, decompress the .zip; from the command line, you enter the new folder. By
$ chmod u+x ./Avogadro2-x86_64.AppImage
you provide the application the executable bit. Still in this folder, you can now launch the program from the CLI by
./Avogadro2-x86_64.AppImage &. File I/O to many formats (including writing to .mol2) was working then. Because the Linux AppImage doesn’t “nest” into the operation system, it is invisible to
apt - hence, the watch for updates of the program is then your responsibility.
iii) Only use
openbabel. This starts again with a clean slate - without installation, nor appimage of avogadro, nor openbabel. Installation with
sudo apt-get install openbabel. Staying on the command line, an individual .pdb file would be given hydrogens reasonable for pH = 7.4 on idealized positions and exported as .mol2 by
obabel -ipdb input.pdb -h -omol2 -O output.mol2 # the verbose form of the command
obabel input.pdb -h -O output.mol2 # the shortened command
The shortened form of the command can be used because the file extensions .pdb and .mol2 are unique among formats openbabel reads & writes. (
obabel -ipdb input.pdb -h -omol2 -O output.txt would describe the same molecule in mol2 syntax, the output file only has a different file extension.)
sudo apt-get install openbabel-gui you can install an optional GUI for openbabel (call sign on the command line