Openbabel is not converting Gaussian Z-matrix I ran into an issue when OpenBabel (a great and extremely useful problem) could not convert my custom-generated Gaussian Z-matrix to XYZ format. The problem is that probably major flaw of OpenBabel are very terse error messages (mostly just "0 molecules converted", and even with ---errorlevel 25 option I got only:

==============================
*** Open Babel Audit Log  in ReadChemObjectImpl
  OpenBabel::Read molecule Gaussian Z-Matrix Input
==============================
*** Open Babel Audit Log  in Clear
  Ran OpenBabel::Clear Molecule
==============================
*** Open Babel Audit Log  in ReadChemObjectImpl
  OpenBabel::Read molecule Gaussian Z-Matrix Input
==============================
*** Open Babel Audit Log  in Clear
  Ran OpenBabel::Clear Molecule
0 molecules converted


). Some other file was converting just fine, with no obvious differences between their contents! I spent a long time trying to understand what is wrong with the second file, but to no avail.

The file which converts without any problem:

# This is a dummy route line, required for OpenBabel for the conversion

   This molecule contains 26 atoms.

0 1
C 
C   1    1.4141
C   2    1.3856  1    117.29
C   1    1.4077  2    121.06  3    -1.09
C   4    1.4088  1    121.27  2    2.37
C   3    1.4075  2    121.95  1    -0.93
C   3    1.5118  2    128.77  1    -176.79
C   7    1.4378  3    105.16  2    175.55
C   6    1.5156  3    108.80  2    -176.32
N   8    1.4317  7    122.53  3    -177.58
C   10   1.3629  8    120.12  7    -146.43
C   11   1.3942  10   120.44  8    -178.97
C   12   1.4024  11   119.82  10   -3.12
C   13   1.4110  12   118.94  11   1.63
C   10   1.3704  8    119.11  7    32.69
O   7    1.2445  3    125.27  2    -1.31
O   9    1.2448  6    124.96  3    -179.37
H   2    1.0882  3    121.72  6    -181.70
H   4    1.1010  1    119.57  2    -178.73
H   5    1.0951  6    121.12  3    179.30
H   11   1.0928  10   115.87  8    1.70
H   12   1.0908  11   118.95  10   178.60
H   13   1.0963  12   120.77  11   182.82
H   14   1.0959  13   121.94  12   -180.61
H   15   1.0855  10   115.78  11   178.99
H   1    1.0923  2    119.78  18   0.45


The file which fails to convert:

#T HF/3-21G Opt Integral(Grid=SG1)

  H2O2 H2O2 GeometryOptimization GeomOpt GeometryOptimization 1

0 1
O
H   1    1.0
O   1    1.4  2    105.0
H   3    1.0  1    105.0  2    176.0
O   1    5.0  2    90.0   3    90.0
H   5    1.0  1    105.0  2    52.5
H   5    1.0  6    105.0  1    178.0


This is OpenBabel version 2.4.1 on Debian 10.

P.S. I sincerely don't know whether this question belongs better to the Chemistry StackExchange or to other forum, but I presume the question might appear to be useful for someone someday.
Turns out that OpenBabel is sensitive to whether blank lines are really blank lines or lines with space characters only. In my case, this was the blank line between the route and the title line. One can see them by pressing the button with a paragraph sign (¶) on it in Your favourite text editor (Notepad++, or even MS Word or  LibreOffice Writer), or by entering :set list in vim or M-x whitespace-mode in Emacs.

What does OpenBabel require for conversion:


First line of the file must begin with a hash sign (#) – a substitute for the Route line
Next line must be absolutely empty
Next line can contain anything You want
Next line again must be absolutely empty
Then comes the charge and multiplicity
And then comes the Gaussian Z-matrix in either compact or full form.


What doesn't OpenBabel require for conversion:


the file to have the extension GZMAT, it can also be GJF
title line not to begin with the hash sign (#) or any other character
route line to contain actual keywords (if You are not trying to convert them to any other input file format, that is)