IUPAC-InChI / InChI

Main InChI repository
MIT License
60 stars 7 forks source link

WarnOnEmptyStructure option broken since 1.06 #25

Closed wijnand1 closed 1 month ago

wijnand1 commented 2 months ago

The WarnOnEmptyStructure option is broken since 1.06.

InChI version 1, Software v. 1.06 (inchi-1 executable)
Linux 64-bit Build (gcc 4.8.5 20150623 (Red Hat 4.8.5-39)) of Dec 19 2020 21:02:16

Opened log file 'empty.mol.log'
Opened input file 'empty.mol'
Opened output file 'empty.mol.txt'
Opened problem file 'empty.mol.prb'
Warning: specified timeout value was ignored due to invalid number format, using the default;
The command line used:
"./inchi-1 empty.mol -AuxNone -Tabbed -WarnOnEmptyStructure"
Generating standard InChI
Input format: MOLfile
Output format: Plain text, tabbed
Aux. info suppressed
Timeout per structure: 60000 msec
Up to 1024 atoms per structure

Error 98 (no InChI; Empty structure) inp structure #1.
End of file detected after structure #1.

Looking at the logs, there is a message Warning: specified timeout value was ignored due to invalid number format, using the default; This indicates where the problem is: WarnOnEmptyStructure is being interpreted as -W option. Looking at the code, this is a bug caused by changing to code when adding the WM option in inichparm.c

Bug fix must be as simple as moving the WarnOnEmptyStructure check before the other options starting with W: image

https://github.com/IUPAC-InChI/InChI/blob/77e7acdf385f2b784a4667d54ea380c2278ca199/INCHI-1-SRC/INCHI_BASE/src/ichiparm.c#L1385

JanCBrammer commented 2 months ago

Thanks for the issue @wijnand1! We'll look into it.

djb-rwth commented 2 months ago

Hi @wijnand1 , Thanks for reporting this. Please be so kind as to send us a file called empty.mol which you used for this test as I am getting the following message after processing a totally empty file with the same CLI options mentioned in your post:

InChI version 1, Software v. 1.07 (inchi-1 executable)
Windows 64-bit Build (MS VS 2017 or later) of Jun 27 2024 15:38:47

Opened log file 'empty.mol.log'
Opened input file 'empty.mol'
Opened output file 'empty.mol.txt'
Opened problem file 'empty.mol.prb'
Warning: specified timeout value was ignored due to invalid number format, using the default;
The command line used:
"\<path_to>\INCHI_EXE\bin2\Windows\x64\Release\inchi-1.exe empty.mol /AuxNone /Tabbed /WarnOnEmptyStructure"
Generating standard InChI
Input format: MOLfile
Output format: Plain text, tabbed
Aux. info suppressed
Timeout per structure: 60000 msec
Up to 1024 atoms per structure

End of file detected after structure #0.
Finished processing 0 structures: 0 errors, processing time 0:00:00.00

Elapsed walltime: 32 msec.

The output is the same on MS Windows and Ubuntu Linux 22.04 using either MSVC, GCC or CLang. Thank you in advance, Djordje

wijnand1 commented 2 months ago

Well, it is just an empty molfile, but here you go (.txt so github accepts it)

empty.mol.txt

djb-rwth commented 2 months ago

Hi @wijnand1 , Thanks for sending the empty.mol file. I can confirm that Error 98 shows up for this empty.mol file, and that the proposed fix works. Obviously, similar fix could be also inserted into the section which manages all options starting with W, but for legacy reasons and easier readability, it will be applied in InChI v.1.07-RC5 in the above mentioned way for both CLI and API versions. Will keep you posted on InChI v.1.07-RC5 release which should be out very soon. Kind regards, Djordje

djb-rwth commented 1 month ago

Hi @wijnand1 , Just wished to let you know that InChI v.1.07-RC5 has been uploaded. Please be so kind as to test if this issue has now been fixed. Kind regards, Djordje

wijnand1 commented 1 month ago

Issue is fixed, WarnOnEmptyStructure works again: returns an InChI for an empty molecule, instead of an error and nothing in the output

djb-rwth commented 1 month ago

Thanks for the feedback @wijnand1.

JanCBrammer commented 1 month ago

Closed with c94cf24.