rino 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/ext/extconf.rb +1 -24
- data/ext/libinchi.so +0 -0
- data/ext/src/aux2atom.h +120 -39
- data/ext/src/comdef.h +3 -3
- data/ext/src/dispstru.c +2547 -0
- data/ext/src/dispstru.h +73 -0
- data/ext/src/extr_ct.h +5 -2
- data/ext/src/ichi.h +27 -11
- data/ext/src/ichi_bns.c +1800 -254
- data/ext/src/ichi_bns.h +205 -4
- data/ext/src/ichican2.c +197 -86
- data/ext/src/ichicano.c +8 -13
- data/ext/src/ichicano.h +2 -2
- data/ext/src/ichicans.c +11 -6
- data/ext/src/ichicant.h +2 -2
- data/ext/src/ichicomn.h +2 -2
- data/ext/src/ichicomp.h +19 -4
- data/ext/src/ichidrp.h +9 -5
- data/ext/src/ichierr.h +5 -3
- data/ext/src/ichiisot.c +2 -2
- data/ext/src/ichimain.c +461 -0
- data/ext/src/ichimain.h +23 -15
- data/ext/src/ichimak2.c +6 -6
- data/ext/src/ichimake.c +843 -42
- data/ext/src/ichimake.h +4 -2
- data/ext/src/ichimap1.c +5 -5
- data/ext/src/ichimap2.c +2 -2
- data/ext/src/ichimap4.c +34 -21
- data/ext/src/ichinorm.c +11 -5
- data/ext/src/ichinorm.h +3 -2
- data/ext/src/ichiparm.c +2 -2
- data/ext/src/ichiparm.h +232 -30
- data/ext/src/ichiprt1.c +35 -11
- data/ext/src/ichiprt2.c +78 -7
- data/ext/src/ichiprt3.c +300 -120
- data/ext/src/ichiqueu.c +17 -2
- data/ext/src/ichiread.c +6932 -0
- data/ext/src/ichiring.c +3 -2
- data/ext/src/ichiring.h +2 -2
- data/ext/src/ichirvr1.c +4891 -0
- data/ext/src/ichirvr2.c +6344 -0
- data/ext/src/ichirvr3.c +5499 -0
- data/ext/src/ichirvr4.c +3177 -0
- data/ext/src/ichirvr5.c +1166 -0
- data/ext/src/ichirvr6.c +1287 -0
- data/ext/src/ichirvr7.c +2319 -0
- data/ext/src/ichirvrs.h +882 -0
- data/ext/src/ichisize.h +2 -2
- data/ext/src/ichisort.c +5 -5
- data/ext/src/ichister.c +281 -86
- data/ext/src/ichister.h +9 -3
- data/ext/src/ichitaut.c +208 -9
- data/ext/src/ichitaut.h +13 -11
- data/ext/src/ichitime.h +16 -2
- data/ext/src/inchicmp.h +107 -0
- data/ext/src/inpdef.h +6 -3
- data/ext/src/libinchi_wrap.c +912 -0
- data/ext/src/lreadmol.h +34 -31
- data/ext/src/mode.h +244 -7
- data/ext/src/mol2atom.c +1060 -0
- data/ext/src/mol2atom.h +31 -0
- data/ext/src/readinch.c +239 -0
- data/ext/src/readmol.c +28 -0
- data/ext/src/{e_readmol.h → readmol.h} +7 -9
- data/ext/src/runichi.c +251 -177
- data/ext/src/strutil.c +444 -238
- data/ext/src/strutil.h +150 -11
- data/ext/src/util.c +176 -118
- data/ext/src/util.h +15 -3
- data/lib/rino.rb +71 -3
- data/test/test.rb +33 -4
- metadata +22 -34
- data/ext/ruby_inchi_main.so +0 -0
- data/ext/src/e_0dstereo.c +0 -3014
- data/ext/src/e_0dstereo.h +0 -31
- data/ext/src/e_comdef.h +0 -57
- data/ext/src/e_ctl_data.h +0 -147
- data/ext/src/e_ichi_io.c +0 -498
- data/ext/src/e_ichi_io.h +0 -40
- data/ext/src/e_ichi_parms.c +0 -37
- data/ext/src/e_ichi_parms.h +0 -41
- data/ext/src/e_ichicomp.h +0 -50
- data/ext/src/e_ichierr.h +0 -40
- data/ext/src/e_ichimain.c +0 -593
- data/ext/src/e_ichisize.h +0 -43
- data/ext/src/e_inchi_atom.c +0 -75
- data/ext/src/e_inchi_atom.h +0 -33
- data/ext/src/e_inpdef.h +0 -41
- data/ext/src/e_mode.h +0 -706
- data/ext/src/e_mol2atom.c +0 -649
- data/ext/src/e_readinch.c +0 -58
- data/ext/src/e_readmol.c +0 -54
- data/ext/src/e_readstru.c +0 -251
- data/ext/src/e_readstru.h +0 -33
- data/ext/src/e_util.c +0 -284
- data/ext/src/e_util.h +0 -61
- data/ext/src/ichilnct.c +0 -286
- data/ext/src/inchi_api.h +0 -670
- data/ext/src/inchi_dll.c +0 -1480
- data/ext/src/inchi_dll.h +0 -34
- data/ext/src/inchi_dll_main.c +0 -23
- data/ext/src/inchi_dll_main.h +0 -31
- data/ext/src/ruby_inchi_main.c +0 -558
data/ext/src/lreadmol.h
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
* International Union of Pure and Applied Chemistry (IUPAC)
|
3
3
|
* International Chemical Identifier (InChI)
|
4
4
|
* Version 1
|
5
|
-
* Software version 1.
|
6
|
-
*
|
5
|
+
* Software version 1.01
|
6
|
+
* July 21, 2006
|
7
7
|
* Developed at NIST
|
8
8
|
*/
|
9
9
|
|
@@ -24,7 +24,10 @@ static int read_properties_block( MOL_CTAB* ctab, MOL_HEADER_BLOCK *pHdr, FILE *
|
|
24
24
|
|
25
25
|
static int identify_sdf_label( char* inp_line, const char *pSdfLabel );
|
26
26
|
static long extract_cas_rn( char *line );
|
27
|
-
int
|
27
|
+
static int mol_copy_check_empty( char* dest, char* source, int len, char **first_space );
|
28
|
+
static int mol_read_datum(void* data, int field_len, int data_type, char** line_ptr);
|
29
|
+
|
30
|
+
static int RemoveNonPrintable( char *line );
|
28
31
|
|
29
32
|
|
30
33
|
/******/
|
@@ -71,8 +74,8 @@ int AddMOLfileError( char *pStrErr, const char *szMsg )
|
|
71
74
|
}
|
72
75
|
return 0;
|
73
76
|
}
|
74
|
-
|
75
|
-
|
77
|
+
/*************** static **********************************************************/
|
78
|
+
int mol_copy_check_empty( char* dest, char* source, int len, char **first_space )
|
76
79
|
{
|
77
80
|
int i, c; /* required len >= 0; dest must have at least len+1 bytes */
|
78
81
|
if ( len > 0 )
|
@@ -84,8 +87,8 @@ static int mol_copy_check_empty( char* dest, char* source, int len, char **first
|
|
84
87
|
*first_space = dest + (i+1); /* first blank or zero terminating byte in dest */
|
85
88
|
return len; /* number of actually processed bytes; zero termination not included */
|
86
89
|
}
|
87
|
-
|
88
|
-
|
90
|
+
/************* static ************************************************************/
|
91
|
+
int mol_read_datum(void* data, int field_len, int data_type, char** line_ptr)
|
89
92
|
{
|
90
93
|
/* 1. 'field_len' for MOL_STRING_DATA does not include trailing zero,
|
91
94
|
* that is actual length of the string pointed by 'data'
|
@@ -228,8 +231,8 @@ static int mol_read_datum(void* data, int field_len, int data_type, char** line
|
|
228
231
|
}
|
229
232
|
return ret;
|
230
233
|
}
|
231
|
-
|
232
|
-
|
234
|
+
/************* static ************************************************************/
|
235
|
+
int mol_read_hdr(MOL_HEADER_BLOCK *hdr, FILE* inp, char *pStrErr)
|
233
236
|
{
|
234
237
|
/* All input lines can have are up 80 characters */
|
235
238
|
/* Header Block */
|
@@ -305,7 +308,7 @@ err_fin:
|
|
305
308
|
|
306
309
|
return err;
|
307
310
|
}
|
308
|
-
|
311
|
+
/********** static *****************************************************/
|
309
312
|
int RemoveNonPrintable( char *line )
|
310
313
|
{
|
311
314
|
int i, c, num = 0;
|
@@ -320,8 +323,8 @@ int RemoveNonPrintable( char *line )
|
|
320
323
|
}
|
321
324
|
return num;
|
322
325
|
}
|
323
|
-
|
324
|
-
|
326
|
+
/************** static *************************************************/
|
327
|
+
int mol_read_counts_line( MOL_CTAB* ctab, FILE *inp, char *pStrErr )
|
325
328
|
{
|
326
329
|
char *p;
|
327
330
|
char line[MOLFILEINPLINELEN];
|
@@ -369,8 +372,8 @@ err_fin:
|
|
369
372
|
return err;
|
370
373
|
}
|
371
374
|
|
372
|
-
|
373
|
-
|
375
|
+
/************ static *************************************************************/
|
376
|
+
int read_atom_block( MOL_CTAB* ctab, FILE *inp, int err, char *pStrErr )
|
374
377
|
{
|
375
378
|
char *p;
|
376
379
|
char line[MOLFILEINPLINELEN];
|
@@ -499,8 +502,8 @@ static int read_atom_block( MOL_CTAB* ctab, FILE *inp, int err, char *pStrErr )
|
|
499
502
|
/* err_fin: */
|
500
503
|
return err;
|
501
504
|
}
|
502
|
-
|
503
|
-
|
505
|
+
/************ static *************************************************************/
|
506
|
+
int read_bonds_block( MOL_CTAB* ctab, FILE *inp, int err, char *pStrErr )
|
504
507
|
{
|
505
508
|
char *p;
|
506
509
|
char line[MOLFILEINPLINELEN];
|
@@ -564,8 +567,8 @@ static int read_bonds_block( MOL_CTAB* ctab, FILE *inp, int err, char *pStrErr )
|
|
564
567
|
/* err_fin: */
|
565
568
|
return err;
|
566
569
|
}
|
567
|
-
|
568
|
-
|
570
|
+
/********** static ***************************************************************/
|
571
|
+
int read_stext_block( MOL_CTAB* ctab, FILE *inp, int err, char *pStrErr )
|
569
572
|
{
|
570
573
|
/* just pass by all stext enties without attemp to interpret */
|
571
574
|
char *p;
|
@@ -593,8 +596,8 @@ static int read_stext_block( MOL_CTAB* ctab, FILE *inp, int err, char *pStrErr )
|
|
593
596
|
err_fin:
|
594
597
|
return err;
|
595
598
|
}
|
596
|
-
|
597
|
-
|
599
|
+
/************ static *************************************************************/
|
600
|
+
int read_properties_block( MOL_CTAB* ctab, MOL_HEADER_BLOCK *pHdr, FILE *inp, int err, char *pStrErr )
|
598
601
|
{
|
599
602
|
enum { MULTI_LINE_MODE_NO_MODE, MULTI_LINE_MODE_ISIS_ALIAS };
|
600
603
|
char *p;
|
@@ -878,7 +881,7 @@ static int read_properties_block( MOL_CTAB* ctab, MOL_HEADER_BLOCK *pHdr, FILE *
|
|
878
881
|
err_fin:
|
879
882
|
return err;
|
880
883
|
}
|
881
|
-
|
884
|
+
/************ global *************************************************************/
|
882
885
|
MOL_DATA* delete_mol_data( MOL_DATA* mol_data )
|
883
886
|
{
|
884
887
|
if ( mol_data ) {
|
@@ -893,7 +896,7 @@ MOL_DATA* delete_mol_data( MOL_DATA* mol_data )
|
|
893
896
|
}
|
894
897
|
return mol_data;
|
895
898
|
}
|
896
|
-
|
899
|
+
/************* global ************************************************************/
|
897
900
|
/* Comletely ingnore STEXT block, queries, and 3D features
|
898
901
|
*/
|
899
902
|
MOL_DATA* read_mol_file( FILE* inp, MOL_HEADER_BLOCK *OnlyHeaderBlock, MOL_CTAB *OnlyCtab,
|
@@ -995,14 +998,14 @@ err_fin:
|
|
995
998
|
}
|
996
999
|
|
997
1000
|
/******************************************************************/
|
998
|
-
char sdf_data_hdr_name[] = "NAME";
|
999
|
-
char sdf_data_hdr_comm[] = "COMMENT";
|
1001
|
+
static const char sdf_data_hdr_name[] = "NAME";
|
1002
|
+
static const char sdf_data_hdr_comm[] = "COMMENT";
|
1000
1003
|
enum { SDF_START, SDF_DATA_HEADER, SDF_DATA_HEADER_NAME
|
1001
1004
|
, SDF_DATA_HEADER_COMMENT, SDF_DATA_HEADER_CAS
|
1002
1005
|
, SDF_DATA_HEADER_USER, SDF_DATA_LINE
|
1003
1006
|
, SDF_END_OF_DATA_ITEM, SDF_EMPTY_LINE, SDF_END_OF_DATA_BLOCK };
|
1004
|
-
|
1005
|
-
|
1007
|
+
/********** static ********************************************************/
|
1008
|
+
long extract_cas_rn( char *line )
|
1006
1009
|
{
|
1007
1010
|
int i, j;
|
1008
1011
|
i = line[0] == '-'? 1 : 0;
|
@@ -1017,8 +1020,8 @@ static long extract_cas_rn( char *line )
|
|
1017
1020
|
line[j] = '\0';
|
1018
1021
|
return strtol( line, NULL, 10 );
|
1019
1022
|
}
|
1020
|
-
|
1021
|
-
|
1023
|
+
/********** static ********************************************************/
|
1024
|
+
int identify_sdf_label( char* inp_line, const char *pSdfLabel )
|
1022
1025
|
{
|
1023
1026
|
char line[MOLFILEMAXLINELEN];
|
1024
1027
|
char *p, *q;
|
@@ -1045,7 +1048,7 @@ static int identify_sdf_label( char* inp_line, const char *pSdfLabel )
|
|
1045
1048
|
}
|
1046
1049
|
return SDF_DATA_HEADER;
|
1047
1050
|
}
|
1048
|
-
|
1051
|
+
/************* global *****************************************************/
|
1049
1052
|
int bypass_sdf_data_items( FILE* inp, long *cas_reg_no, char* comment,
|
1050
1053
|
int lcomment, char *name, int lname, int prev_err,
|
1051
1054
|
const char *pSdfLabel, char *pSdfValue, char *pStrErr )
|
@@ -1183,7 +1186,7 @@ got_data_line:
|
|
1183
1186
|
|
1184
1187
|
return err;
|
1185
1188
|
}
|
1186
|
-
|
1189
|
+
/**************** global **************************************************/
|
1187
1190
|
MOL_DATA* read_sdfile_segment(FILE* inp, MOL_HEADER_BLOCK *OnlyHeaderBlock, MOL_CTAB *OnlyCtab,
|
1188
1191
|
int bGetOrigCoord,
|
1189
1192
|
char *pname, int lname,
|
@@ -1211,7 +1214,7 @@ MOL_DATA* read_sdfile_segment(FILE* inp, MOL_HEADER_BLOCK *OnlyHeaderBlock, MOL_
|
|
1211
1214
|
/* } */
|
1212
1215
|
return mol_data;
|
1213
1216
|
}
|
1214
|
-
|
1217
|
+
/******************* global *********************************************************/
|
1215
1218
|
int CopyMOLfile(FILE *inp_file, long fPtrStart, long fPtrEnd, FILE *prb_file, long lNumb)
|
1216
1219
|
{
|
1217
1220
|
char line[MOLFILEINPLINELEN], *p;
|
data/ext/src/mode.h
CHANGED
@@ -2,19 +2,30 @@
|
|
2
2
|
* International Union of Pure and Applied Chemistry (IUPAC)
|
3
3
|
* International Chemical Identifier (InChI)
|
4
4
|
* Version 1
|
5
|
-
* Software version 1.
|
6
|
-
*
|
5
|
+
* Software version 1.01
|
6
|
+
* July 21, 2006
|
7
7
|
* Developed at NIST
|
8
8
|
*/
|
9
9
|
|
10
10
|
#ifndef __MODE_H__
|
11
11
|
#define __MODE_H__
|
12
12
|
|
13
|
+
#ifndef INCHI_ALL_CPP
|
14
|
+
#ifdef __cplusplus
|
15
|
+
extern "C" {
|
16
|
+
#endif
|
17
|
+
#endif
|
18
|
+
|
19
|
+
|
13
20
|
/* uncomment to unconditionally force ANSI-89 C, no Win32 specific code */
|
14
|
-
|
21
|
+
/*#define INCHI_ANSI_ONLY*/
|
22
|
+
|
23
|
+
#ifdef INCHI_ANSI_ONLY
|
24
|
+
/* #define ADD_NON_ANSI_FUNCTIONS */ /* uncomment to add stricmp(), etc., see util.c */
|
25
|
+
#endif
|
15
26
|
|
16
27
|
/* uncomment to create a library for using INChI API described in inchi_api.h */
|
17
|
-
#define INCHI_LIBRARY
|
28
|
+
/* #define INCHI_LIBRARY */
|
18
29
|
|
19
30
|
/* uncomment to use INChI library as a Win32 DLL or to eliminate stricmp duplication */
|
20
31
|
/* #define INCHI_LINK_AS_DLL */
|
@@ -40,9 +51,28 @@
|
|
40
51
|
C4514: unreferenced inline/local function has been removed (C++)
|
41
52
|
C4100: 'identifier' : unreferenced formal parameter
|
42
53
|
C4786: 'identifier' : identifier was truncated to 'number' characters in the debug information
|
54
|
+
C4996: 'identifier' was declared deprecated
|
43
55
|
========================================================================
|
44
56
|
*/
|
45
|
-
#pragma warning( disable : 4706 4127 4514 4100 4786 )
|
57
|
+
#pragma warning( disable : 4706 4127 4514 4100 4786 4996 )
|
58
|
+
#endif
|
59
|
+
|
60
|
+
#ifndef SPECIAL_BUILD
|
61
|
+
#define SPECIAL_BUILD 0
|
62
|
+
#endif
|
63
|
+
|
64
|
+
#if( SPECIAL_BUILD == 1 )
|
65
|
+
#define SPECIAL_BUILD_STR " (Modified Chemical Identifier - For Testing Only.)"
|
66
|
+
#endif
|
67
|
+
|
68
|
+
#ifdef SPECIAL_BUILD_STR
|
69
|
+
|
70
|
+
#define SPECIAL_BUILD_STRING SPECIAL_BUILD_STR
|
71
|
+
|
72
|
+
#else
|
73
|
+
|
74
|
+
#define SPECIAL_BUILD_STRING ", Software version 1.01 release 07/21/2006"
|
75
|
+
|
46
76
|
#endif
|
47
77
|
|
48
78
|
/* Release */
|
@@ -81,6 +111,118 @@
|
|
81
111
|
#define DISPLAY_DEBUG_DATA DISPLAY_DEBUG_DATA_C_POINT
|
82
112
|
#endif
|
83
113
|
|
114
|
+
#define INCLUDE_V1_FIXES 1 /*SPECIAL_BUILD*/ /* prohibit all fixes to get v1 exact behavior */
|
115
|
+
|
116
|
+
#if( INCLUDE_V1_FIXES == 1 || SPECIAL_BUILD == 1 )
|
117
|
+
|
118
|
+
/**************************/
|
119
|
+
/* bug fixes in v1.00 */
|
120
|
+
/**************************/
|
121
|
+
#define FIX_ChCh_STEREO_CANON_BUG 1 /* 1=> (NEEDED) */
|
122
|
+
#define ADD_ChCh_STEREO_CANON_CHK 0 /* 1 is NOT needed; let it always be 0 */
|
123
|
+
#define FIX_ChCh_CONSTIT_CANON_BUG 1 /* 1=> (NEEDED) */
|
124
|
+
#define FIX_EITHER_STEREO_IN_AUX_INFO 1 /* 1=> fix bug: Either stereobond direction in Aux_Info; 0=> do not fix */
|
125
|
+
#define FIX_NORM_BUG_ADD_ION_PAIR 1 /* 1=> (NEEDED) fix bug: Miscount number of charges when creating an ion pair */
|
126
|
+
#define FIX_REM_PROTON_COUNT_BUG 1 /* 1=> (NEEDED) check for number of actually removed protons and issue an error if mismatch */
|
127
|
+
#define FIX_READ_AUX_MEM_LEAK 1
|
128
|
+
#define FIX_READ_LONG_LINE_BUG 1 /* 1=> (NEEDED) prevent failure when reading AuxInfo and InChI is too long */
|
129
|
+
#define FIX_N_V_METAL_BONDS_GPF 1 /* 1=> (NEEDED) InChI v1 GPF bug fix */
|
130
|
+
#define BNS_RAD_SEARCH 1 /* 1=> prevent normalization failures due to radical centers */
|
131
|
+
|
132
|
+
#else
|
133
|
+
|
134
|
+
#define FIX_ChCh_STEREO_CANON_BUG 0
|
135
|
+
#define ADD_ChCh_STEREO_CANON_CHK 0
|
136
|
+
#define FIX_ChCh_CONSTIT_CANON_BUG 0
|
137
|
+
#define FIX_EITHER_STEREO_IN_AUX_INFO 0
|
138
|
+
#define FIX_NORM_BUG_ADD_ION_PAIR 0
|
139
|
+
#define FIX_REM_PROTON_COUNT_BUG 0
|
140
|
+
#define FIX_READ_AUX_MEM_LEAK 0
|
141
|
+
#define FIX_READ_LONG_LINE_BUG 0
|
142
|
+
#define FIX_N_V_METAL_BONDS_GPF 0
|
143
|
+
#define BNS_RAD_SEARCH 0
|
144
|
+
|
145
|
+
#endif
|
146
|
+
|
147
|
+
/*******************************/
|
148
|
+
/* bug fixes in post-v1.00 */
|
149
|
+
/*******************************/
|
150
|
+
#if ( SPECIAL_BUILD == 1 )
|
151
|
+
|
152
|
+
#define FIX_ODD_THINGS_REM_Plus_BUG 1 /* 1 => fix bug: remove (1+) or (2+) charge from the central atom; */
|
153
|
+
/* see Table 1, types 4 & 5 in InChI Tech Manual */
|
154
|
+
#define FIX_N_MINUS_NORN_BUG 1 /* to avoid numbering dependence of the normalization in case of */
|
155
|
+
/* >N(+)=-=-NH(-) added neutralization before removing positive charge */
|
156
|
+
#define FIX_CANCEL_CHARGE_COUNT_BUG 1 /* 1 => fix bug in counting neutralization: only the last result is */
|
157
|
+
/* remembered; 0 => keep as it was in version 1 */
|
158
|
+
#define FIX_2D_STEREO_BORDER_CASE 1 /* 1=> fix bug: 2D sp3 Stereo uncertainty in case of overlapping neighbors */
|
159
|
+
#define FIX_REM_ION_PAIRS_Si_BUG 1 /* 1 => detect Si same way as C in replacing ions with higher bond */
|
160
|
+
/* oreders and in fixing bonds. see Tables 2 and 5 in the InChI Tech */
|
161
|
+
/* Manual 0=> keep as it was in version 1. */
|
162
|
+
#define FIX_STEREO_SCALING_BUG 1 /* 1=> fix bug that makes sp3 stereo undefined in case of bonds length > 20 */
|
163
|
+
#define FIX_EMPTY_LAYER_BUG 0 /* output "e" if the component has no stereo in the current layer */
|
164
|
+
/* AND has stereo in the preceding layer */
|
165
|
+
#define FIX_EITHER_DB_AS_NONSTEREO 0 /* 1=> do not count ALT bond wuth Unknown stereo as stereogenic to close ALT-circuit */
|
166
|
+
/* new behavior as compared to v1 */
|
167
|
+
#define FIX_BOND23_IN_TAUT 0 /* 1=> when normalization results in bond order 2-3 try to interpret the bond as double */
|
168
|
+
/* not finished/tested */
|
169
|
+
#define FIX_TACN_POSSIBLE_BUG 0 /* fix (t-group)--(atom)--([-]c-group) behavior */
|
170
|
+
#define FIX_KEEP_H_ON_NH_ANION 0 /* in (de)protonation, disallow paths that convert -NH(-) into =N(-) */
|
171
|
+
#define FIX_AVOID_ADP 0 /* avoid aggressive deprotonation; may make the results depend on numbering */
|
172
|
+
/* may change InChI */
|
173
|
+
#define FIX_NUM_TG 1 /* in case of 7 or less atoms not enough BNS vertices allocated */
|
174
|
+
/* changes InChI for isothiocyanate */
|
175
|
+
#define FIX_CPOINT_BOND_CAP2 1 /* allow the leftmost bond in isothiocyanate N(-)=C=S become double */
|
176
|
+
|
177
|
+
#else
|
178
|
+
|
179
|
+
#define FIX_ODD_THINGS_REM_Plus_BUG 0
|
180
|
+
#define FIX_N_MINUS_NORN_BUG 0
|
181
|
+
#define FIX_CANCEL_CHARGE_COUNT_BUG 0
|
182
|
+
#define FIX_2D_STEREO_BORDER_CASE 0
|
183
|
+
#define FIX_REM_ION_PAIRS_Si_BUG 0
|
184
|
+
#define FIX_STEREO_SCALING_BUG 0
|
185
|
+
#define FIX_EMPTY_LAYER_BUG 0
|
186
|
+
#define FIX_EITHER_DB_AS_NONSTEREO 0
|
187
|
+
#define FIX_BOND23_IN_TAUT 0
|
188
|
+
#define FIX_TACN_POSSIBLE_BUG 0
|
189
|
+
#define FIX_KEEP_H_ON_NH_ANION 0
|
190
|
+
#define FIX_AVOID_ADP 0
|
191
|
+
/* may change InChI */
|
192
|
+
#define FIX_NUM_TG 0 /* increase number of t-groups for isothiocyanate */
|
193
|
+
/* changes InChI for isothiocyanate */
|
194
|
+
#define FIX_CPOINT_BOND_CAP2 0
|
195
|
+
|
196
|
+
#endif
|
197
|
+
|
198
|
+
/**************************/
|
199
|
+
/* additions to v1.00 */
|
200
|
+
/**************************/
|
201
|
+
#if ( SPECIAL_BUILD == 1 )
|
202
|
+
#define FIX_ADJ_RAD 1 /* remove radicals from adjacent atoms, fix valences: -FIXRAD */
|
203
|
+
#define ADD_PHOSPHINE_STEREO 1 /* make >P- stereogenic atoms: -SPXYZ */
|
204
|
+
#define ADD_ARSINE_STEREO 1 /* make >As- stereogenic atoms: -SPXYZ */
|
205
|
+
#else
|
206
|
+
#define FIX_ADJ_RAD 0
|
207
|
+
#define ADD_PHOSPHINE_STEREO 1
|
208
|
+
#define ADD_ARSINE_STEREO 1
|
209
|
+
#endif
|
210
|
+
|
211
|
+
#define SDF_OUTPUT_V2000 1 /* 1=>always output V2000 SDfile, 0=>only if needed */
|
212
|
+
#define SDF_OUTPUT_DT 1 /* 1=> all option -SdfAtomsDT to output D and T into SDfile */
|
213
|
+
#define CHECK_AROMBOND2ALT 1 /* 1=> check whether arom->alt bond conversion succeeded */
|
214
|
+
|
215
|
+
#ifdef INCHI_LIB
|
216
|
+
#define READ_INCHI_STRING 0 /* 1=> input InChI string and process it */
|
217
|
+
#else
|
218
|
+
#define READ_INCHI_STRING 1 /* 1=> input InChI string and process it */
|
219
|
+
#endif
|
220
|
+
|
221
|
+
/****************************************************/
|
222
|
+
/* disabled extra external calls to InChI algorithm */
|
223
|
+
/****************************************************/
|
224
|
+
#define INCLUDE_NORMALIZATION_ENTRY_POINT 0
|
225
|
+
|
84
226
|
/**************************/
|
85
227
|
/* Normalization settings */
|
86
228
|
/**************************/
|
@@ -166,8 +308,24 @@
|
|
166
308
|
/* 1.02: 01-26-2004 fixed new isotopic tgroup canon bug, molfile merge bug */
|
167
309
|
|
168
310
|
/*#define INCHI_VERSION "1.0RC"*/ /* 02-07-2005 v1.0 Release Candidate */
|
311
|
+
|
312
|
+
#if ( SPECIAL_BUILD == 1 )
|
313
|
+
|
314
|
+
#define INCHI_VERSION "1a"
|
315
|
+
#define INCHI_NAME "MoChI"
|
316
|
+
#define INCHI_REC_NAME "ReChI"
|
317
|
+
|
318
|
+
/* #define INCHI_VERSION "1" */
|
319
|
+
/* #define INCHI_NAME "InChI" */
|
320
|
+
|
321
|
+
#else
|
322
|
+
|
169
323
|
#define INCHI_VERSION "1"
|
170
324
|
#define INCHI_NAME "InChI"
|
325
|
+
#define INCHI_REC_NAME "ReChI"
|
326
|
+
|
327
|
+
#endif
|
328
|
+
|
171
329
|
#define INCHI_NAM_VER_DELIM "="
|
172
330
|
|
173
331
|
/* constants and array sizes */
|
@@ -196,15 +354,23 @@
|
|
196
354
|
|
197
355
|
#define TEST_RENUMB_ATOMS 0 /* 1 => heavy duty test by multiple renumbering of atoms */
|
198
356
|
#define TEST_RENUMB_NEIGH 1 /* 1 => randomly permutate neighbors */
|
199
|
-
#define TEST_RENUMB_SWITCH 0 /* 1 => output another (different) picture */
|
357
|
+
#define TEST_RENUMB_SWITCH 0 /* 1 => display & output another (different) picture */
|
200
358
|
#define TEST_RENUMB_ATOMS_SAVE_LONGEST 0 /* 1 => save the component with largest processing time into the problem file */
|
201
359
|
|
202
360
|
#if ( defined(_WIN32) && defined(_DEBUG) && defined(_MSC_VER) /*&& !defined(INCHI_ANSI_ONLY)*/ )
|
203
361
|
/* debug: memory leaks tracking */
|
204
362
|
#ifndef INCHI_LIB
|
363
|
+
|
364
|
+
#ifndef DO_NOT_TRACE_MEMORY_LEAKS
|
205
365
|
#define TRACE_MEMORY_LEAKS 1 /* 1=>trace, 0 => do not trace (Debug only) */
|
206
366
|
#else
|
367
|
+
#define TRACE_MEMORY_LEAKS 0
|
368
|
+
#endif
|
369
|
+
|
370
|
+
#else
|
371
|
+
|
207
372
|
#define TRACE_MEMORY_LEAKS 1 /* 1=>trace, **ALWAYS** =1 for INCHI_LIB */
|
373
|
+
|
208
374
|
#endif
|
209
375
|
|
210
376
|
#else /* not MSC and not Debug */
|
@@ -562,6 +728,13 @@
|
|
562
728
|
#define TG_FLAG_VARIABLE_PROTONS 0x00000800 /* add/remove protons to neutralize */
|
563
729
|
#define TG_FLAG_HARD_ADD_REM_PROTONS 0x00001000 /* add/remove protons to neutralize in hard way */
|
564
730
|
#define TG_FLAG_POINTED_EDGE_STEREO 0x00002000 /* only pointed edge of stereo bond defines stereo */
|
731
|
+
#if( FIX_ADJ_RAD == 1 )
|
732
|
+
#define TG_FLAG_FIX_ADJ_RADICALS 0x00004000 /* remove adjacent radical-doubletes, fix valence */
|
733
|
+
#endif
|
734
|
+
#define TG_FLAG_PHOSPHINE_STEREO 0x00008000 /* add phosphine sp3 stereo */
|
735
|
+
#define TG_FLAG_ARSINE_STEREO 0x00010000 /* add arsine sp3 stereo */
|
736
|
+
#define TG_FLAG_H_ALREADY_REMOVED 0x00020000 /* processing structure restored from InChI */
|
737
|
+
#define TG_FLAG_FIX_SP3_BUG 0x00040000 /* fix sp3 stereo bug: overlapping 2D stereo bond & coordinate scaling */
|
565
738
|
|
566
739
|
/* output bTautFlags flags */
|
567
740
|
|
@@ -586,6 +759,16 @@
|
|
586
759
|
#define TG_FLAG_FOUND_SALT_CHARGES_DONE 0x00002000 /* not assigned: preprocessing detected possibility of salt-type tautomerism */
|
587
760
|
#define TG_FLAG_FOUND_ISOTOPIC_H_DONE 0x00004000 /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
|
588
761
|
#define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000 /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
|
762
|
+
#if( FIX_ADJ_RAD == 1 )
|
763
|
+
#define TG_FLAG_FIX_ADJ_RADICALS_DONE 0x00010000
|
764
|
+
#endif
|
765
|
+
|
766
|
+
#if( READ_INCHI_STRING == 1 )
|
767
|
+
#define READ_INCHI_OUTPUT_INCHI 0x00000001
|
768
|
+
#define READ_INCHI_SPLIT_OUTPUT 0x00000002
|
769
|
+
#define READ_INCHI_KEEP_BALANCE_P 0x00000004
|
770
|
+
#define READ_INCHI_TO_STRUCTURE 0x00000008
|
771
|
+
#endif
|
589
772
|
|
590
773
|
|
591
774
|
#ifdef _WIN32
|
@@ -617,6 +800,7 @@ typedef struct tagOutputString {
|
|
617
800
|
|
618
801
|
|
619
802
|
/* memory leaks tracking */
|
803
|
+
#define INCHI_HEAPCHK /* default: no explicit heap checking during the execution */
|
620
804
|
|
621
805
|
#if( TRACE_MEMORY_LEAKS == 1 )
|
622
806
|
#ifdef _DEBUG
|
@@ -632,10 +816,34 @@ typedef struct tagOutputString {
|
|
632
816
|
#define e_inchi_free(a) inchi_free(a)
|
633
817
|
#endif
|
634
818
|
|
635
|
-
/*#define _CRTDBG_MAP_ALLOC*/
|
819
|
+
/*#define _CRTDBG_MAP_ALLOC*/ /* standard VC++ tool -- does not work with inchi_malloc(), etc */
|
636
820
|
|
637
821
|
#include <crtdbg.h>
|
638
822
|
|
823
|
+
/* to enable heap checking: #define CHECK_WIN32_VC_HEAP above #include "mode.h" in each source file or here */
|
824
|
+
#ifdef CHECK_WIN32_VC_HEAP
|
825
|
+
/* -- Confirms the integrity of the memory blocks allocated in the debug heap -- */
|
826
|
+
#undef INCHI_HEAPCHK
|
827
|
+
#define INCHI_HEAPCHK \
|
828
|
+
do { \
|
829
|
+
int tmp = _crtDbgFlag; \
|
830
|
+
_crtDbgFlag |= _CRTDBG_ALLOC_MEM_DF; \
|
831
|
+
_ASSERT( _CrtCheckMemory( ) ); \
|
832
|
+
_crtDbgFlag = tmp; \
|
833
|
+
} while(0);
|
834
|
+
|
835
|
+
/* -- less thorough than _CrtCheckMemory() check: check minimal consistency of the heap -- */
|
836
|
+
/*
|
837
|
+
#include <malloc.h>
|
838
|
+
#define INCHI_HEAPCHK \
|
839
|
+
do {\
|
840
|
+
int heapstatus = _heapchk(); \
|
841
|
+
_ASSERT( heapstatus != _HEAPBADBEGIN && heapstatus != _HEAPBADNODE && heapstatus != _HEAPBADPTR); \
|
842
|
+
} while(0);
|
843
|
+
*/
|
844
|
+
#endif
|
845
|
+
|
846
|
+
|
639
847
|
#else
|
640
848
|
#undef TRACE_MEMORY_LEAKS
|
641
849
|
#define TRACE_MEMORY_LEAKS 0
|
@@ -653,6 +861,29 @@ typedef struct tagOutputString {
|
|
653
861
|
#ifndef inchi_free
|
654
862
|
#define inchi_free e_inchi_free
|
655
863
|
#endif
|
864
|
+
|
865
|
+
#ifndef e_inchi_malloc
|
866
|
+
#define e_inchi_malloc malloc
|
867
|
+
#endif
|
868
|
+
#ifndef e_inchi_calloc
|
869
|
+
#define e_inchi_calloc calloc
|
870
|
+
#endif
|
871
|
+
#ifndef e_inchi_free
|
872
|
+
#define e_inchi_free(X) do{ if(X) free(X); }while(0)
|
873
|
+
#endif
|
874
|
+
|
875
|
+
#else /* not INCHI_MAIN */
|
876
|
+
|
877
|
+
#ifndef inchi_malloc
|
878
|
+
#define inchi_malloc malloc
|
879
|
+
#endif
|
880
|
+
#ifndef inchi_calloc
|
881
|
+
#define inchi_calloc calloc
|
882
|
+
#endif
|
883
|
+
#ifndef inchi_free
|
884
|
+
#define inchi_free(X) do{ if(X) free(X); }while(0)
|
885
|
+
#endif
|
886
|
+
|
656
887
|
#endif /* INCHI_MAIN */
|
657
888
|
|
658
889
|
/* allocation/deallocation */
|
@@ -702,5 +933,11 @@ typedef struct tagOutputString {
|
|
702
933
|
} else { (ERR) = 0; } \
|
703
934
|
} while(0)
|
704
935
|
|
936
|
+
#ifndef INCHI_ALL_CPP
|
937
|
+
#ifdef __cplusplus
|
938
|
+
}
|
939
|
+
#endif
|
940
|
+
#endif
|
941
|
+
|
705
942
|
|
706
943
|
#endif /* __MODE_H__ */
|