rino 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/Rakefile +1 -1
  2. data/ext/extconf.rb +1 -24
  3. data/ext/libinchi.so +0 -0
  4. data/ext/src/aux2atom.h +120 -39
  5. data/ext/src/comdef.h +3 -3
  6. data/ext/src/dispstru.c +2547 -0
  7. data/ext/src/dispstru.h +73 -0
  8. data/ext/src/extr_ct.h +5 -2
  9. data/ext/src/ichi.h +27 -11
  10. data/ext/src/ichi_bns.c +1800 -254
  11. data/ext/src/ichi_bns.h +205 -4
  12. data/ext/src/ichican2.c +197 -86
  13. data/ext/src/ichicano.c +8 -13
  14. data/ext/src/ichicano.h +2 -2
  15. data/ext/src/ichicans.c +11 -6
  16. data/ext/src/ichicant.h +2 -2
  17. data/ext/src/ichicomn.h +2 -2
  18. data/ext/src/ichicomp.h +19 -4
  19. data/ext/src/ichidrp.h +9 -5
  20. data/ext/src/ichierr.h +5 -3
  21. data/ext/src/ichiisot.c +2 -2
  22. data/ext/src/ichimain.c +461 -0
  23. data/ext/src/ichimain.h +23 -15
  24. data/ext/src/ichimak2.c +6 -6
  25. data/ext/src/ichimake.c +843 -42
  26. data/ext/src/ichimake.h +4 -2
  27. data/ext/src/ichimap1.c +5 -5
  28. data/ext/src/ichimap2.c +2 -2
  29. data/ext/src/ichimap4.c +34 -21
  30. data/ext/src/ichinorm.c +11 -5
  31. data/ext/src/ichinorm.h +3 -2
  32. data/ext/src/ichiparm.c +2 -2
  33. data/ext/src/ichiparm.h +232 -30
  34. data/ext/src/ichiprt1.c +35 -11
  35. data/ext/src/ichiprt2.c +78 -7
  36. data/ext/src/ichiprt3.c +300 -120
  37. data/ext/src/ichiqueu.c +17 -2
  38. data/ext/src/ichiread.c +6932 -0
  39. data/ext/src/ichiring.c +3 -2
  40. data/ext/src/ichiring.h +2 -2
  41. data/ext/src/ichirvr1.c +4891 -0
  42. data/ext/src/ichirvr2.c +6344 -0
  43. data/ext/src/ichirvr3.c +5499 -0
  44. data/ext/src/ichirvr4.c +3177 -0
  45. data/ext/src/ichirvr5.c +1166 -0
  46. data/ext/src/ichirvr6.c +1287 -0
  47. data/ext/src/ichirvr7.c +2319 -0
  48. data/ext/src/ichirvrs.h +882 -0
  49. data/ext/src/ichisize.h +2 -2
  50. data/ext/src/ichisort.c +5 -5
  51. data/ext/src/ichister.c +281 -86
  52. data/ext/src/ichister.h +9 -3
  53. data/ext/src/ichitaut.c +208 -9
  54. data/ext/src/ichitaut.h +13 -11
  55. data/ext/src/ichitime.h +16 -2
  56. data/ext/src/inchicmp.h +107 -0
  57. data/ext/src/inpdef.h +6 -3
  58. data/ext/src/libinchi_wrap.c +912 -0
  59. data/ext/src/lreadmol.h +34 -31
  60. data/ext/src/mode.h +244 -7
  61. data/ext/src/mol2atom.c +1060 -0
  62. data/ext/src/mol2atom.h +31 -0
  63. data/ext/src/readinch.c +239 -0
  64. data/ext/src/readmol.c +28 -0
  65. data/ext/src/{e_readmol.h → readmol.h} +7 -9
  66. data/ext/src/runichi.c +251 -177
  67. data/ext/src/strutil.c +444 -238
  68. data/ext/src/strutil.h +150 -11
  69. data/ext/src/util.c +176 -118
  70. data/ext/src/util.h +15 -3
  71. data/lib/rino.rb +71 -3
  72. data/test/test.rb +33 -4
  73. metadata +22 -34
  74. data/ext/ruby_inchi_main.so +0 -0
  75. data/ext/src/e_0dstereo.c +0 -3014
  76. data/ext/src/e_0dstereo.h +0 -31
  77. data/ext/src/e_comdef.h +0 -57
  78. data/ext/src/e_ctl_data.h +0 -147
  79. data/ext/src/e_ichi_io.c +0 -498
  80. data/ext/src/e_ichi_io.h +0 -40
  81. data/ext/src/e_ichi_parms.c +0 -37
  82. data/ext/src/e_ichi_parms.h +0 -41
  83. data/ext/src/e_ichicomp.h +0 -50
  84. data/ext/src/e_ichierr.h +0 -40
  85. data/ext/src/e_ichimain.c +0 -593
  86. data/ext/src/e_ichisize.h +0 -43
  87. data/ext/src/e_inchi_atom.c +0 -75
  88. data/ext/src/e_inchi_atom.h +0 -33
  89. data/ext/src/e_inpdef.h +0 -41
  90. data/ext/src/e_mode.h +0 -706
  91. data/ext/src/e_mol2atom.c +0 -649
  92. data/ext/src/e_readinch.c +0 -58
  93. data/ext/src/e_readmol.c +0 -54
  94. data/ext/src/e_readstru.c +0 -251
  95. data/ext/src/e_readstru.h +0 -33
  96. data/ext/src/e_util.c +0 -284
  97. data/ext/src/e_util.h +0 -61
  98. data/ext/src/ichilnct.c +0 -286
  99. data/ext/src/inchi_api.h +0 -670
  100. data/ext/src/inchi_dll.c +0 -1480
  101. data/ext/src/inchi_dll.h +0 -34
  102. data/ext/src/inchi_dll_main.c +0 -23
  103. data/ext/src/inchi_dll_main.h +0 -31
  104. data/ext/src/ruby_inchi_main.c +0 -558
@@ -1,43 +0,0 @@
1
- /*
2
- * International Union of Pure and Applied Chemistry (IUPAC)
3
- * International Chemical Identifier (InChI)
4
- * Version 1
5
- * Software version 1.00
6
- * April 13, 2005
7
- * Developed at NIST
8
- */
9
-
10
- #ifndef ___INCHISIZE_H__
11
- #define ___INCHISIZE_H__
12
-
13
-
14
- typedef unsigned short AT_NUMB;
15
- typedef unsigned short AT_RANK;
16
- #define AT_RANK_MASK ((AT_RANK)~0)
17
-
18
- typedef signed short NUM_H;
19
- #define MAX_ATOMS 1024
20
-
21
- #define CHAR_MASK 0xFF
22
-
23
- typedef unsigned long INCHI_MODE;
24
-
25
- #define LEN_COORD 10
26
- #define NUM_COORD 3
27
- typedef char MOL_COORD[LEN_COORD*NUM_COORD + NUM_COORD-1]; /*copied 30 bytes from MOLfile */
28
-
29
- typedef enum tagInputType { INPUT_NONE=0, INPUT_MOLFILE=1, INPUT_SDFILE=2, INPUT_INCHI_XML=3, INPUT_INCHI_PLAIN=4, INPUT_CMLFILE=5, INPUT_MAX } INPUT_TYPE;
30
-
31
- /* other types */
32
-
33
- #define UCINT (int)(unsigned char)
34
- #ifndef INCHI_US_CHAR_DEF
35
- typedef signed char S_CHAR;
36
- typedef unsigned char U_CHAR;
37
- #define INCHI_US_CHAR_DEF
38
- #endif
39
-
40
-
41
-
42
- #endif /* ___INCHISIZE_H__ */
43
-
@@ -1,75 +0,0 @@
1
- /*
2
- * International Union of Pure and Applied Chemistry (IUPAC)
3
- * International Chemical Identifier (InChI)
4
- * Version 1
5
- * Software version 1.00
6
- * April 13, 2005
7
- * Developed at NIST
8
- */
9
-
10
- #include <stdio.h>
11
- #include <string.h>
12
-
13
- #include "e_mode.h"
14
- #include "inchi_api.h"
15
- #include "e_inchi_atom.h"
16
- #include "e_ichisize.h"
17
- #include "e_util.h"
18
- /******************************************************************************************************/
19
- void e_FreeInchi_Atom( inchi_Atom **at )
20
- {
21
- if ( at && *at ) {
22
- e_inchi_free( *at );
23
- *at = NULL;
24
- }
25
- }
26
- /******************************************************************************************************/
27
- void e_FreeInchi_Stereo0D( inchi_Stereo0D **stereo0D )
28
- {
29
- if ( stereo0D && *stereo0D ) {
30
- e_inchi_free( *stereo0D );
31
- *stereo0D = NULL;
32
- }
33
- }
34
- /******************************************************************************************************/
35
- inchi_Atom *e_CreateInchi_Atom( int num_atoms )
36
- {
37
- inchi_Atom *p = (inchi_Atom* ) e_inchi_calloc(num_atoms, sizeof(inchi_Atom) );
38
- return p;
39
- }
40
- /******************************************************************************************************/
41
- inchi_Stereo0D *e_CreateInchi_Stereo0D( int num_stereo0D )
42
- {
43
- return (inchi_Stereo0D* ) e_inchi_calloc(num_stereo0D, sizeof(inchi_Stereo0D) );
44
- }
45
- /******************************************************************************************************/
46
- void e_FreeInchi_Input( inchi_Input *inp_at_data )
47
- {
48
- e_FreeInchi_Atom( &inp_at_data->atom );
49
- e_FreeInchi_Stereo0D( &inp_at_data->stereo0D );
50
- memset( inp_at_data, 0, sizeof(*inp_at_data) );
51
- }
52
- /*********************************************************/
53
- int e_RemoveRedundantNeighbors( inchi_Input *inp_at_data )
54
- {
55
- int i, j, k;
56
- inchi_Atom *at = inp_at_data->atom;
57
- int num_atoms = inp_at_data->num_atoms;
58
- for ( i = 0; i < num_atoms; i ++ ) {
59
- for ( j = k = 0; j < at[i].num_bonds; j ++ ) {
60
- if ( at[i].neighbor[j] < i ) {
61
- at[i].neighbor[k] = at[i].neighbor[j];
62
- at[i].bond_type[k] = at[i].bond_type[j];
63
- at[i].bond_stereo[k] = at[i].bond_stereo[j];
64
- k ++;
65
- }
66
- }
67
- for ( j = k; j < at[i].num_bonds; j ++ ) {
68
- at[i].neighbor[j] = 0;
69
- at[i].bond_type[j] = 0;
70
- at[i].bond_stereo[j] = 0;
71
- }
72
- at[i].num_bonds = k;
73
- }
74
- return 0;
75
- }
@@ -1,33 +0,0 @@
1
- /*
2
- * International Union of Pure and Applied Chemistry (IUPAC)
3
- * International Chemical Identifier (InChI)
4
- * Version 1
5
- * Software version 1.00
6
- * April 13, 2005
7
- * Developed at NIST
8
- */
9
-
10
- #ifndef __INCHI_ATOM_H__
11
- #define __INCHI_ATOM_H__
12
-
13
- #ifndef INCHI_ALL_CPP
14
- #ifdef __cplusplus
15
- extern "C" {
16
- #endif
17
- #endif
18
-
19
- void e_FreeInchi_Atom( inchi_Atom **at );
20
- void e_FreeInchi_Stereo0D( inchi_Stereo0D **stereo0D );
21
- inchi_Atom *e_CreateInchi_Atom( int num_atoms );
22
- inchi_Stereo0D *e_CreateInchi_Stereo0D( int num_stereo0D );
23
- void e_FreeInchi_Input( inchi_Input *inp_at_data );
24
- int e_RemoveRedundantNeighbors( inchi_Input *inp_at_data );
25
-
26
- #ifndef INCHI_ALL_CPP
27
- #ifdef __cplusplus
28
- }
29
- #endif
30
- #endif
31
-
32
-
33
- #endif /* __INCHI_ATOM_H__ */
@@ -1,41 +0,0 @@
1
- /*
2
- * International Union of Pure and Applied Chemistry (IUPAC)
3
- * International Chemical Identifier (InChI)
4
- * Version 1
5
- * Software version 1.00
6
- * April 13, 2005
7
- * Developed at NIST
8
- */
9
-
10
- /* input/output format */
11
- #ifndef __INPDEF_H__
12
- #define __INPDEF_H__
13
-
14
-
15
- /* BILLY 8/6/04 */
16
- #ifndef INCHI_ALL_CPP
17
- #ifdef __cplusplus
18
- extern "C" {
19
- #endif
20
- #endif
21
-
22
- int e_MolfileToInchi_Input( FILE *inp_molfile, inchi_Input *orig_at_data, int bMergeAllInputStructures,
23
- int bDoNotAddH, int bAllowEmptyStructure,
24
- const char *pSdfLabel, char *pSdfValue, long *lSdfId,
25
- long *lMolfileNumber, INCHI_MODE *pInpAtomFlags, int *err, char *pStrErr );
26
- int e_INChIToInchi_Input( FILE *inp_molfile, inchi_Input *orig_at_data, int bMergeAllInputStructures,
27
- int bDoNotAddH, INPUT_TYPE nInputType,
28
- char *pSdfLabel, char *pSdfValue, long *lSdfId, INCHI_MODE *pInpAtomFlags,
29
- int *err, char *pStrErr );
30
-
31
- int e_CopyMOLfile(FILE *inp_file, long fPtrStart, long fPtrEnd, FILE *prb_file, long nNumb);
32
-
33
-
34
- /* BILLY 8/6/04 */
35
- #ifndef INCHI_ALL_CPP
36
- #ifdef __cplusplus
37
- }
38
- #endif
39
- #endif
40
-
41
- #endif /* __INPDEF_H__ */
@@ -1,706 +0,0 @@
1
- /*
2
- * International Union of Pure and Applied Chemistry (IUPAC)
3
- * International Chemical Identifier (InChI)
4
- * Version 1
5
- * Software version 1.00
6
- * April 13, 2005
7
- * Developed at NIST
8
- */
9
-
10
- #ifndef __MODE_H__
11
- #define __MODE_H__
12
-
13
- /* uncomment to unconditionally force ANSI-89 C, no Win32 specific code */
14
- #define INCHI_ANSI_ONLY
15
-
16
- /* uncomment to create a library for using INChI API described in inchi_api.h */
17
- /* #define INCHI_LIBRARY */
18
-
19
- /* uncomment to use INChI library as a Win32 DLL or to eliminate stricmp duplication */
20
- /* #define INCHI_LINK_AS_DLL */
21
-
22
- /* Uncomment to compile INCHI_MAIN.exe that calls INCHI_DLL.dll */
23
- #define INCHI_MAIN
24
-
25
- #if(!defined(_MSC_VER) || defined(INCHI_LIBRARY)) /* non-Microsoft GNU C, BCC, etc. compilers */
26
- #ifndef INCHI_ANSI_ONLY
27
- #define INCHI_ANSI_ONLY
28
- #endif
29
- #endif
30
-
31
- /* #define INCHI_ALL_CPP */ /* uncomment to allow C++ compilation/linkage of functions prototyped in .h files */
32
-
33
- #ifdef _MSC_VER
34
- /*
35
- ========== disable MS VC++ 6.0 Level 4 compiler warnings: ==============
36
- C4706: assignment within conditional expression
37
- C4127: conditional expression is constant
38
- C4244: '=' : conversion from 'int ' to '???', possible loss of data
39
- C4701: local variable '???' may be used without having been initialized (removed)
40
- C4514: unreferenced inline/local function has been removed (C++)
41
- C4100: 'identifier' : unreferenced formal parameter
42
- C4786: 'identifier' : identifier was truncated to 'number' characters in the debug information
43
- ========================================================================
44
- */
45
- #pragma warning( disable : 4706 4127 4514 4100 4786 )
46
- #endif
47
-
48
- /* Release */
49
- #define bRELEASE_VERSION 1 /* 1=> release version; comment out to disable */
50
- /* Debug */
51
- #ifndef bRELEASE_VERSION
52
- #define bRELEASE_VERSION 0 /* 0=> debug version */
53
- #endif
54
-
55
- #define ACD_LABS_VERSION 0 /* always 0 */
56
-
57
- #ifndef ADD_CMLPP
58
- /* this allows ADD_CMLPP be #defined in a makefile */
59
- #define ADD_CMLPP 0 /* 1 => add CMLPP input */
60
- #endif
61
-
62
- #if ( ADD_CMLPP == 1 )
63
- #ifdef USE_CMLPPDLL
64
- /* 1200 is VC++ 6.0 version, 1300 is VC++ .NET; USE_CMLPPDLL may be #defined in a makefile*/
65
- #if ( defined(_WIN32) && defined(_MSC_VER) && _MSC_VER >= 1200 )
66
- #define MSC_DELAY_LOAD_CMLPPDLL
67
- #endif
68
- #endif
69
- #endif
70
-
71
- /* display (non-canonical) c-groups, display orig at numbers */
72
- #if( bRELEASE_VERSION == 1 )
73
- #define DISPLAY_DEBUG_DATA_C_POINT 0 /* disabled release version for now */
74
- #define DISPLAY_ORIG_AT_NUMBERS 1 /* 1 => in an uncanonicalized components display orig. atom numbers (default) */
75
- #else
76
- #define DISPLAY_DEBUG_DATA_C_POINT 1 /* debug: 1=>display (non-canonically numbered) c-groups, 0=>do not display */
77
- #define DISPLAY_ORIG_AT_NUMBERS 1 /* 0 => in an uncanonicalized components display ordering atom numbers (debug) */
78
- #endif
79
-
80
- #if ( DISPLAY_DEBUG_DATA_C_POINT > 0 )
81
- #define DISPLAY_DEBUG_DATA DISPLAY_DEBUG_DATA_C_POINT
82
- #endif
83
-
84
- /**************************/
85
- /* Normalization settings */
86
- /**************************/
87
-
88
- /* post-2004-04-27 features */
89
- #define HAL_ACID_H_XCHG 1 /* allow iso H exchange to HX (X=halogen) and H2Y (Y=halcogen) */
90
- #define CANON_FIXH_TRANS 1 /* produce canonical fixed-H transposition */
91
- #define STEREO_WEDGE_ONLY 0 /* 1=> only pointed ends stereo bonds define stereo; 0=> both ends */
92
-
93
- /* current new (with respect to v1.12 Beta) preprocessing */
94
- #define REMOVE_ION_PAIRS_EARLY 1 /* 1=> new preprocessing: step 1 before disconnecting metals in fix_odd_things() */
95
- #define REMOVE_ION_PAIRS_DISC_STRU 1 /* 1=> new post-preprocessing: remove charhes after metal disconnection */
96
- #define REMOVE_ION_PAIRS_FIX_BONDS 1 /* 1=> step2: set unchangeable bonds around removed ion pairs */
97
- #define S_VI_O_PLUS_METAL_FIX_BOND 1 /* 1=> count double bond M-O(+)=S as O=S in S(VI) ans S(VIII) fixing bonds */
98
- #define N_V_STEREOBONDS 1 /* 1=> detect stereobonds incident to N(V); 0 => don't */
99
- /* for testing */
100
- #define REMOVE_ION_PAIRS_ORIG_STRU 0 /* 0=> normal mode (default)
101
- * 1=> testing mode only: remove ion pairs from the original structure
102
- * to save the changes in the output Molfile (/OutputSDF) or AuxInfo
103
- * NIP=No Ion Pairs
104
- */
105
- /* salts treatment */
106
- #define DISCONNECT_SALTS 1 /* 1=>disconnect metal atoms from salts, 0=>dont */
107
- #define TEST_REMOVE_S_ATOMS 1 /* 1=>default: after merging into one group test &
108
- * remove unreachable,
109
- * 0=> old version: test only before merging into one t-group */
110
- #define CHARGED_SALTS_ONLY 1 /* 1=>(default)do not test far salts tautomerism if
111
- * no negative charge(s) present */
112
- #define BNS_PROTECT_FROM_TAUT 1 /* 1=> do not allow testing of bonds to acetyl or nitro */
113
- #define BNS_MARK_EDGE_2_DISCONNECT 1 /* 1=> mark edge as temp forbidden instead of disconnection */
114
-
115
- #define REPLACE_ALT_WITH_TAUT 1 /* 1 => replace alt bonds with tautomeric bonds in case of standard t-groups */
116
- #define MOVE_CHARGES 1 /* 1 => take moveable charges into account */
117
- #define NEUTRALIZE_ENDPOINTS 1 /* 1 => before checking whether an H is moveable make 2 endpoints neutral */
118
- /* implemented only if CHECK_TG_ALT_PATH = 0, defined in ichi_bns.c */
119
- #define FIX_H_CHECKING_TAUT 1 /* 1 => Fix moveable H or (-) before checking if taut. exchange is possible */
120
- #define ALWAYS_ADD_TG_ON_THE_FLY 1 /* 1 => disables radical calcellation by taut-charge movement */
121
- #define IGNORE_SINGLE_ENDPOINTS 1 /* 1 => see FindAccessibleEndPoints() in INChITaut.c */
122
-
123
- /* recently added -- begin */
124
- #define INCL_NON_SALT_CANDIDATATES 1 /* 1=> allow H and (-) migrate between "acidic" O and
125
- * other possible endpoints */
126
- #define SALT_WITH_PROTONS 1 /* 1=> (new new) include proton migrarion C-SH, =C-OH, NH+ */
127
- #define OPPOSITE_CHARGE_IN_CGROUP 1 /* 1=> allow N(-) in (+) c-group, 0=> disallow */
128
- #define MOVE_PPLUS_TO_REMOVE_PROTONS 0 /* 0=> default; 1=> (disabled) add P/P+ charge group during
129
- * 'hard' proton removal */
130
- #define ADD_MOVEABLE_O_PLUS 1 /* 1=> allow charges on O(+) to move */
131
- /* recently added -- end */
132
-
133
- #define DISCONNECT_METALS 1 /* make main layer disconnected */
134
- #define RECONNECT_METALS 0 /* 1=> by default add reconnected layer in case of coord.
135
- * compound disconnection */
136
- #define CHECK_METAL_VALENCE 0 /* 1=> disconnect only metals that have abnormal valence */
137
- #define bREUSE_INCHI 1 /* 1=> do not recalulate INChI for components in reconnected
138
- * structure that are same as in the connected one */
139
- #define OUTPUT_CONNECTED_METAL_ONLY 0 /* 0=> default; 1 => (debug) create only reconnected or
140
- * initial struct. output */
141
- #define EMBED_REC_METALS_INCHI 1 /* 1=> (default) output Reconnected embedded in Disconnected INChI;
142
- * 0=> separate output */
143
-
144
- #define bOUTPUT_ONE_STRUCT_TIME 1 /* 1 => output each structure time (non-release only) */
145
-
146
-
147
- /*#define INCHI_VERSION "0.9Beta" */
148
- /*#define INCHI_VERSION "0.91Beta" */ /* 10-10-2002: sent to Jonathan Goodman */
149
- /*#define INCHI_VERSION "0.92Beta" */ /* 11-15-2002: added Hill notation; sent to S.Heller & S.Stein */
150
- /*#define INCHI_VERSION "0.93Beta" */ /* 12-09-2002: Fixed isotopic canon. bug & chiralanes; sent to S.Heller & A. McNaught */
151
- /*#define INCHI_VERSION "0.931Beta" */ /* Non-BNS without salts released to PMR 01-2003 */
152
- /*#define INCHI_VERSION "0.932Beta" */ /* Released to CAS 04-01-2003:
153
- * - Improved taut. definitions as compared to 01-2003;
154
- * - fixed bug: non-isotopic components' stereo missing from isotopic stereo
155
- * - fixed bug: couldn't properly read Unix files (EOL = LF instead of CR/LF)
156
- * (effective only for MS VC++, Borland and MinGW/GCC compiles that accept "rb" mode of fopen)
157
- * DJGPP/GCC does not seem to need this fix.
158
- */
159
- /*==== Release version ===*/
160
- /*#define INCHI_VERSION "0.94Beta" */ /* 02-27-2003: Balanced network search to find alt paths and non-stereo bonds;
161
- Implemented salts disconnection; added (-) to taut groups */
162
- /*#define INCHI_VERSION "1.12Beta" */ /* 1.12: 07-06-2004: sort order: No H formula,..; Pointed end stereo ON, Aggressive (de)protonation OFF */
163
- /* 1.11: 05-19-2004: annotated plain text output, fixed bugs */
164
- /* 1.1: 04-08-2004: variable protonation version */
165
- /* 1.01: 12-23-2003 protected bonds, isotopic canonicalization in GetBaseCanonRanking() */
166
- /* 1.02: 01-26-2004 fixed new isotopic tgroup canon bug, molfile merge bug */
167
-
168
- /*#define INCHI_VERSION "1.0RC"*/ /* 02-07-2005 v1.0 Release Candidate */
169
- #define INCHI_VERSION "1"
170
- #define INCHI_NAME "InChI"
171
- #define INCHI_NAM_VER_DELIM "="
172
-
173
- /* constants and array sizes */
174
-
175
- #define INCHI_NUM 2 /* = array size; member indexes: */
176
- #define INCHI_BAS 0 /* 0 => disconnected or normal */
177
- #define INCHI_REC 1 /* 1 => reconnected */
178
-
179
- #define TAUT_NUM 2 /* = array size; member indexes: */
180
- #define TAUT_NON 0 /* 0 => normal structure */
181
- #define TAUT_YES 1 /* 1 => tautomeric */
182
- #define TAUT_INI 2 /* 2 => intermediate tautomeric structure */
183
- #define ALT_TAUT(X) ((X)>TAUT_YES? TAUT_YES : 1-(X)) /* was (1-(X)) */
184
-
185
- /* INChI output modes */
186
- #define OUT_N1 0 /* non-tautomeric only */
187
- #define OUT_T1 1 /* tautomeric if present otherwise non-tautomeric */
188
- #define OUT_NT 2 /* only non-taut representations of tautomeric */
189
- #define OUT_TN 3 /* tautomeric if present otherwise non-tautomeric;
190
- separately output non-taut representations of tautomeric if present */
191
- #define OUT_NN 4 /* only non-taut representations: non-taut else tautomeric */
192
-
193
- /* OUT_TN = OUT_T1 + OUT_NT */
194
-
195
- /* torture test */
196
-
197
- #define TEST_RENUMB_ATOMS 0 /* 1 => heavy duty test by multiple renumbering of atoms */
198
- #define TEST_RENUMB_NEIGH 1 /* 1 => randomly permutate neighbors */
199
- #define TEST_RENUMB_SWITCH 0 /* 1 => output another (different) picture */
200
- #define TEST_RENUMB_ATOMS_SAVE_LONGEST 0 /* 1 => save the component with largest processing time into the problem file */
201
-
202
- #if ( defined(_WIN32) && defined(_DEBUG) && defined(_MSC_VER) /*&& !defined(INCHI_ANSI_ONLY)*/ )
203
- /* debug: memory leaks tracking */
204
- #ifndef INCHI_LIB
205
- #define TRACE_MEMORY_LEAKS 1 /* 1=>trace, 0 => do not trace (Debug only) */
206
- #else
207
- #define TRACE_MEMORY_LEAKS 1 /* 1=>trace, **ALWAYS** =1 for INCHI_LIB */
208
- #endif
209
-
210
- #else /* not MSC and not Debug */
211
-
212
- #define TRACE_MEMORY_LEAKS 0 /* 0: do not change */
213
-
214
- #endif
215
-
216
- /* stereo */
217
-
218
- #define NEW_STEREOCENTER_CHECK 1 /* 1 => add new stereocenter categories (see bCanInpAtomBeAStereoCenter(...)) */
219
- #define MIN_SB_RING_SIZE 8 /* do not assume stereo bonds in rings containing 3..MIN_SB_RING_SIZE-1 atoms */
220
-
221
- #define REMOVE_KNOWN_NONSTEREO 1 /* 1=> check in advance known stereo to remove parities from non-stereogenic elements */
222
- #define REMOVE_CALC_NONSTEREO 1 /* 1=> check new stereo numberings to remove parities from non-stereogenic elements */
223
- #define PROPAGATE_ILL_DEF_STEREO 1 /* 1=> if at least one of the pair of constitutionally identical (far) neighbors */
224
- /* (of the tested atom) has ill-defined stereo parity and another has any */
225
- /* stereo parity then set the parity of the tested atom to ill-defined value. */
226
-
227
- #define ONLY_DOUBLE_BOND_STEREO 0 /* 1=> no alt bond stereo, no taut. bond attachment to stereo bond */
228
- /* 0=> allow other definitions (below) to be active */
229
- #define ONE_BAD_SB_NEIGHBOR 1 /* 1 => allow 1 "bad" bond type neighbor to a stereobond atom. 2004-06-02 */
230
-
231
- /* more stereo settings */
232
- #define BREAK_ONE_MORE_SC_TIE 1 /* break one more tie when comparing possible stereocenter neighbors */
233
- #define BREAK_ALSO_NEIGH_TIE 0 /* post 1.12Beta 2004-08-20: if fixed neighbor has equ neighbors, fix the one with smaller canon. rank */
234
- #define BREAK_ALSO_NEIGH_TIE_ROTATE 1 /* post 1.12Beta 2004-09-02: break the second in 2nd psition; 1 works, 0 does not (example:MFCD01085607) */
235
-
236
- #define STEREO_CENTER_BONDS_NORM 1 /* set length of the bonds around a stereocenter = 1 before getting the parity */
237
- #define STEREO_CENTER_BOND4_NORM 0 /* set length of the added bond around a stereocenter = 1 before getting the parity */
238
- #define NORMALIZE_INP_COORD 0 /* 0=>keep unchanged, 1 => make atom coordinates integer values, avg bond len=20 */
239
-
240
- /* recent stereo */
241
- #define STEREO_WEDGE_ONLY 0 /* 1=> only pointed ends stereo bonds define stereo; 0=> both ends 1.12Beta */
242
- #define CHECK_C2v_S4_SYMM 0 /* post-1.12Beta 1=> check if a stereocenter has C2v or S4 symmetry; 0=>old mode */
243
-
244
- #define EQL_H_NUM_TOGETHER 1 /* 1=> output 1-3,5H2 intead of 1-3H2,5H2 (CT_MODE_EQL_H_TOGETHER) */
245
- #define ABC_CT_NUM_CLOSURES 1 /* 1=> in coinnections compressed format output decimal number of closures instead of '-' */
246
-
247
- /* temporary fix */
248
- #define SINGLET_IS_TRIPLET 1 /* 'singlet' means two electrons make a lone pair instead of 2 bonds
249
- its effect on valence is same as the effect of a triplet */
250
-
251
- /* defug: find structures where canonical partition is different from equitable */
252
- #define FIND_CANON_NE_EQUITABLE 0 /* 0=>normal mode */
253
- /* 1=> extract (set EXTR_FLAGS = (EXTR_CANON_NE_EQUITABLE)*/
254
- /* set cmd line options: /onlynonTAUT /: /UNCHARGEDACIDS:1 /DISCONSALT:0 /MOVEPOS:0 /DISCONMETAL:0 */
255
-
256
- /* Debug: definitions for the extraction of the structures to the problem file */
257
-
258
- /* definition of the flags for structure extraction to the
259
- problem file (for debugging and non-standard searching) */
260
- #define EXTR_KNOWN_USED_TO_REMOVE_PARITY 0x000001
261
- #define EXTR_CALC_USED_TO_REMOVE_PARITY 0x000002
262
- #define EXTR_2EQL2CENTER_TO_REMOVE_PARITY 0x000004
263
- #define EXTR_HAS_ATOM_WITH_DEFINED_PARITY 0x000008
264
- #define EXTR_REMOVE_PARITY_WARNING 0x000010
265
- #define EXTR_SALT_WAS_DISCONNECTED 0x000020
266
- #define EXTR_SALT_PROTON_MOVED 0x000040
267
- #define EXTR_SALT_PROTON_MOVE_ERR_WARN 0x000080
268
- #define EXTR_METAL_WAS_DISCONNECTED 0x000100
269
- #define EXTR_METAL_WAS_NOT_DISCONNECTED 0x000200
270
- #define EXTR_NON_TRIVIAL_STEREO 0x000400 /* (Inv != Abs stereo) && (parities can't be obtained by inverting them) */
271
- #define EXTR_UNUSUAL_VALENCES 0x000800
272
- #define EXTR_HAS_METAL_ATOM 0x001000
273
- #define EXTR_TEST_TAUT3_SALTS_DONE 0x002000 /* non-oxygen t-points used to discover tautomerism of merged t-groups */
274
- #define EXTR_CANON_NE_EQUITABLE 0x004000 /* find structures where canonical partition is different from equitable */
275
- #define EXTR_HAS_PROTON_PN 0x008000 /* has movable H+ attached to N or P */
276
- #define EXTR_HAS_FEATURE 0x010000 /* found a feature */
277
- #define EXTR_TAUT_TREATMENT_CHARGES 0x020000 /* tautomeric treatment of charges */
278
- #define EXTR_TRANSPOSITION_EXAMPLES 0x040000 /* extract structures that have different mobile-H and fixed-H orders */
279
-
280
- /* define conditions of structure extraction to the problem file */
281
- #define EXTR_MASK 0 /*EXTR_TAUT_TREATMENT_CHARGES*/ /*(EXTR_HAS_FEATURE)*/ /*(EXTR_UNUSUAL_VALENCES | EXTR_HAS_METAL_ATOM)*/ /* 0 to disable */
282
- #define EXTR_FLAGS 0 /*EXTR_TAUT_TREATMENT_CHARGES*/ /*(EXTR_HAS_FEATURE)*/ /*(EXTR_HAS_PROTON_PN)*/ /*(EXTR_UNUSUAL_VALENCES)*/ /*(EXTR_CANON_NE_EQUITABLE)*/ /*(EXTR_TEST_TAUT3_SALTS_DONE)*/ /*(EXTR_HAS_METAL_ATOM)*/ /* (EXTR_NON_TRIVIAL_STEREO)*/ /*(EXTR_METAL_WAS_DISCONNECTED)*/ /* (EXTR_REMOVE_PARITY_WARNING)*/ /*(EXTR_HAS_ATOM_WITH_DEFINED_PARITY) */
283
-
284
-
285
- #define ENTITY_REFS_IN_XML_MESSAGES 1 /* 1=> replace ' " < > & in error/warning messages with xml entity references */
286
-
287
- /* added tautomeric structures */
288
-
289
- #define TAUT_TROPOLONE_7 1 /* 1=> tautomeric 7-member rings ON */
290
- #define TAUT_TROPOLONE_5 1 /* 1=> taut. similar to tropolone, 5-member ring */
291
- #define TAUT_4PYRIDINOL_RINGS 1 /* 1=> OH-C5H4N rings tautomerism */
292
- #define TAUT_PYRAZOLE_RINGS 1 /* 1=> tautomerizm in pyrazole rings */
293
- /* limitation on tautomerism detection: */
294
- #define TAUT_IGNORE_EQL_ENDPOINTS 0 /* 0=> even though 2 endpoints belong to same t-group check
295
- them to find more alt bonds (new)
296
- 1=> ignore and do not check (old mode) */
297
- #define TAUT_RINGS_ATTACH_CHAIN 1 /* 1=> allow only chain attachments to tautomeric endpoints */
298
- /* (except pyrazole, where is no tautomeric attachment) */
299
- /* 0=> allow taut. attachments from same ring system. Default=1 */
300
-
301
- #define FIND_RING_SYSTEMS 1 /* 1 => find and mark ring systems, blocks, cut-vertices */
302
- /* Needed for 5- and 6-member ring tautomers and in other places */
303
-
304
- #define FIND_RINS_SYSTEMS_DISTANCES 0 /* 1 => find ring system and atom distance from terminal */
305
- #define USE_DISTANCES_FOR_RANKING 0 /* 1 => rank ring systems according to distances from terminal */
306
-
307
- #define DISPLAY_RING_SYSTEMS 0 /* 1 => for debug only; displays: */
308
- /* "block no"/"ring system no"/"cut-vertex (num. intersecting blocks-1)" */
309
- /* instead of ranks */
310
- /* consistency */
311
-
312
- #if( bRELEASE_VERSION==1 && bOUTPUT_ONE_STRUCT_TIME==1)
313
- #undef bOUTPUT_ONE_STRUCT_TIME
314
- #define bOUTPUT_ONE_STRUCT_TIME 0
315
- #endif
316
-
317
- /* consistency: bRELEASE_VERSION==1 needs FIND_RING_SYSTEMS=1 */
318
- #if( bRELEASE_VERSION==1 && FIND_RING_SYSTEMS!=1 )
319
- #ifdef FIND_RING_SYSTEMS
320
- #undef FIND_RING_SYSTEMS
321
- #endif
322
- #define FIND_RING_SYSTEMS 1
323
- #endif
324
-
325
- /* consistency: FIND_RINS_SYSTEMS_DISTANCES needs FIND_RING_SYSTEMS */
326
- #if( FIND_RING_SYSTEMS != 1 )
327
-
328
- #if( FIND_RINS_SYSTEMS_DISTANCES == 1 )
329
- #undef FIND_RINS_SYSTEMS_DISTANCES
330
- #define FIND_RINS_SYSTEMS_DISTANCES 0
331
- #endif
332
-
333
- #endif
334
-
335
- /* consistency: USE_DISTANCES_FOR_RANKING and DISPLAY_RING_SYSTEMS need FIND_RINS_SYSTEMS_DISTANCES */
336
- #if( FIND_RINS_SYSTEMS_DISTANCES != 1 )
337
-
338
- #if( USE_DISTANCES_FOR_RANKING == 1 )
339
- #undef USE_DISTANCES_FOR_RANKING
340
- #define USE_DISTANCES_FOR_RANKING 0
341
- #endif
342
-
343
- #if( DISPLAY_RING_SYSTEMS == 1 )
344
- #undef DISPLAY_RING_SYSTEMS
345
- #define DISPLAY_RING_SYSTEMS 0
346
- #endif
347
-
348
- #endif
349
-
350
-
351
- #if( FIND_RING_SYSTEMS==1 && (TAUT_TROPOLONE_7==1 || TAUT_TROPOLONE_5==1 || TAUT_4PYRIDINOL_RINGS==1 || TAUT_PYRAZOLE_RINGS) )
352
- #define TAUT_OTHER 1
353
- #else
354
- #define TAUT_OTHER 0
355
- #endif
356
-
357
- #define APPLY_IMPLICIT_H_DOWN_RULE 0 /* 1=> if 3 non-H atoms around stereocenter are in same plane */
358
- /* then add "down" hydrogen to obtain sterecenter oparity */
359
- /* 0=> Implicit H stereo is unknown if all bonds to 3 non-H atoms */
360
- /* are in XY plane */
361
- #define ALLOW_TAUT_ATTACHMENTS_TO_STEREO_BONDS 1 /* 1=> consider bond in an alternating circuit stereogenic */
362
- /* even though it has adjacent tautomeric atom(s) */
363
-
364
- #define IGNORE_TGROUP_WITHOUT_H 1 /* ignore tautomeric groups containing charges only */
365
-
366
- #if ( DISCONNECT_SALTS == 1 )
367
- #define REMOVE_TGROUP_CHARGE 0 /* 0: do not remove charge information from tautomeric groups */
368
- #else
369
- #define REMOVE_TGROUP_CHARGE 1 /* 1: remove charge information from tautomeric groups */
370
- #endif
371
-
372
- #if ( REMOVE_TGROUP_CHARGE == 1 )
373
- #define INCHI_T_NUM_MOVABLE 1
374
- #else
375
- #define INCHI_T_NUM_MOVABLE 2
376
- #endif
377
-
378
- /******************************************/
379
- /* define canonicalization modes here */
380
- /******************************************/
381
-
382
- #define USE_AUX_RANKING 1 /* 1=> get auxiliary ranking to accelerate canonicalization of H layers */
383
- #define USE_AUX_RANKING_ALL 1 /* 1=> include all vertices in CellGetMinNode() selection 0=> only vertices with highest ranks */
384
-
385
- #define USE_ISO_SORT_KEY_HFIXED 0 /* 0=> normal mode: merge isotopic taut H to isotopic atom sorting key in
386
- taut H-fixed canonicalization;
387
- 1=> add one more "string" iso_sort_Hfixed to the canonicalization */
388
-
389
- /************************
390
- questionable behavior
391
- ************************/
392
- #define REL_RAC_STEREO_IGN_1_SC 0 /* 1=> drop from InChI sp3 stereo in components that have a single stereocenter */
393
- /* 0=> old-old mode (all such sp3 stereo is in the Identifier) */
394
- /* internal definitions; see also REQ_MODE_BASIC etc in ichi.h */
395
- #define CMODE_CT 0x000001
396
- #define CMODE_ISO 0x000002
397
- #define CMODE_ISO_OUT 0x000004 /* obsolete ? */
398
- #define CMODE_STEREO 0x000008
399
- #define CMODE_ISO_STEREO 0x000010
400
- #define CMODE_TAUT 0x000020
401
- #define CMODE_NOEQ_STEREO 0x000040 /* 5-24-2002: do not use stereo equivalence to accelerate */
402
- #define CMODE_REDNDNT_STEREO 0x000080 /* 6-11-2002: do not check for redundant stereo elements */
403
- #define CMODE_NO_ALT_SBONDS 0x000100 /* 6-14-2002: do not assign stereo to alternating bonds */
404
- /* new 10-10-2003 */
405
- #define CMODE_RELATIVE_STEREO 0x000200 /* REL All Relative Stereo */
406
- #define CMODE_RACEMIC_STEREO 0x000400 /* RAC All Racemic Stereo */
407
- #define CMODE_SC_IGN_ALL_UU 0x000800 /* IAUSC Ignore stereocenters if All Undef/Unknown */
408
- #define CMODE_SB_IGN_ALL_UU 0x001000 /* IAUSC Ignore stereobonds if All Undef/Unknown */
409
- /* end of 10-10-2003 */
410
-
411
- /* external definitions */
412
- #define CANON_MODE_CT (CMODE_CT)
413
- #define CANON_MODE_TAUT (CMODE_CT|CMODE_TAUT)
414
- #define CANON_MODE_ISO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT)
415
- #define CANON_MODE_STEREO (CMODE_CT|CMODE_STEREO)
416
- #define CANON_MODE_ISO_STEREO (CMODE_CT|CMODE_ISO|CMODE_ISO_OUT|CMODE_ISO_STEREO)
417
-
418
- #define CANON_MODE_MASK 0x00FF /* used to determine canonicalization mode */
419
-
420
- /*************************************************
421
- * from d_norm.c
422
- */
423
-
424
- /* implemented definitions for CT_ATOMID */
425
- #define CT_ATOMID_DONTINCLUDE 1
426
- #define CT_ATOMID_IS_INITRANK 2
427
- #define CT_ATOMID_IS_CURRANK 3
428
-
429
- /***************************************
430
- * canonicalization settings I
431
- ***************************************/
432
-
433
- #define CANON_TAUTOMERS 1 /* 1=> process tautomers */
434
- #define HYDROGENS_IN_INIT_RANKS 1 /* 1=> include num_H in initial ranking */
435
-
436
- #define DOUBLE_BOND_NEIGH_LIST 0 /* 1 => include double bond neighbor in NeighList 2 times */
437
- #define INCL_NON_6AROM 1 /* 1 => mark all arom. bonds; 0=>mark arom. bonds only in 6-member rings */
438
-
439
- #define CT_SMALLEST /* minimal CT */
440
-
441
- #define CT_NEIGH_SMALLER /* in CT, include neighbors with smaller ranks */
442
-
443
- #define CT_ATOMID CT_ATOMID_IS_CURRANK /*CT_ATOMID_DONTINCLUDE */
444
-
445
- #define CT_NEIGH_INCREASE /* in CT, neighbors ranks increase */
446
-
447
- #define USE_SYMMETRY_TO_ACCELERATE 1 /*1 => for fast CT canonicalization, to avoid full enumeration */
448
-
449
- /* dependent definitions due to settings */
450
-
451
- #ifdef CT_SMALLEST
452
- #define CT_GREATER_THAN >
453
- #define CT_INITVALUE ~0
454
- #define BEST_PARITY 1 /* odd */
455
- #define WORSE_PARITY 2
456
- #else
457
- #define CT_GREATER_THAN <
458
- #define CT_INITVALUE 0
459
- #define BEST_PARITY 2 /* even */
460
- #define WORSE_PARITY 1
461
- #endif
462
-
463
- #ifdef CT_NEIGH_SMALLER
464
- #define CT_NEIGH_SMALLER_THAN <
465
- #else
466
- #define CT_NEIGH_SMALLER_THAN >
467
- #endif
468
-
469
- /* verify corectness of dependent settings */
470
- #if !defined( CT_ATOMID )
471
- #error You have to #define CT_ATOMID
472
- #else
473
- #if( defined( CT_ATOMID ) && CT_ATOMID==CT_ATOMID_DONTINCLUDE )
474
- #error CT_DELIMITER should be #defined if CT_ATOMID is not included
475
- #endif
476
- #endif
477
-
478
- /***************************************
479
- * canonicalization settings II
480
- ***************************************/
481
- /* from extr_ct.h */
482
- #define ALL_ALT_AS_AROMATIC 1 /* 1 => all altrnate bonds (even in cyclooctateraene) treat as aromatic */
483
- /* and set DOUBLE_BOND_NEIGH_LIST = 0 */
484
- #define ANY_ATOM_IN_ALT_CYCLE 1 /* 1=> accept any atom in alternating bond circuit, 0=>only some */
485
-
486
- #define EXCL_ALL_AROM_BOND_PARITY 0 /* 1 => any arom atom cannot belong to stereo bond. */
487
- /* This has presedence over ADD_6MEMB_AROM_BOND_PARITY=1 */
488
- /* 0 => include arom bonds parities according to */
489
- /* ADD_6MEMB_AROM_BOND_PARITY definition */
490
-
491
- #if ( EXCL_ALL_AROM_BOND_PARITY == 0 )
492
- #define ADD_6MEMB_AROM_BOND_PARITY 1 /* 1 => all arom bonds are stereo bonds */
493
- /* 0 => only those arom bonds which do not belong to */
494
- /* 6-member arom rings are stereo bonds */
495
- #else
496
- #define ADD_6MEMB_AROM_BOND_PARITY 0 /* 0 => standard; 1 => meaningless: ignore parities of non-6-member ring alt. bonds */
497
- #endif
498
-
499
- #define CML_NUM_AT_IN_ATREF4 4
500
- #define MAX_NUM_STEREO_BONDS 3
501
- #define MAX_NUM_STEREO_BOND_NEIGH 3
502
- #define MIN_NUM_STEREO_BOND_NEIGH 2
503
-
504
- #define MAX_NUM_STEREO_ATOM_NEIGH 4
505
- #define STEREO_AT_MARK 8 /* > MAX_NUM_STEREO_BONDS */
506
-
507
- #if( ONLY_DOUBLE_BOND_STEREO == 1 ) /* { */
508
-
509
- #ifdef ALLOW_TAUT_ATTACHMENTS_TO_STEREO_BONDS
510
- #undef ALLOW_TAUT_ATTACHMENTS_TO_STEREO_BONDS
511
- #define ALLOW_TAUT_ATTACHMENTS_TO_STEREO_BONDS 0
512
- #endif
513
-
514
- #ifdef EXCL_ALL_AROM_BOND_PARITY
515
- #undef EXCL_ALL_AROM_BOND_PARITY
516
- #define EXCL_ALL_AROM_BOND_PARITY 1
517
- #endif
518
-
519
- #ifdef ADD_6MEMB_AROM_BOND_PARITY
520
- #undef ADD_6MEMB_AROM_BOND_PARITY
521
- #define ADD_6MEMB_AROM_BOND_PARITY 0
522
- #endif
523
-
524
- #endif /* } ONLY_DOUBLE_BOND_STEREO */
525
-
526
- /* dependent definitions due to settings */
527
- #if( ALL_ALT_AS_AROMATIC == 1 && DOUBLE_BOND_NEIGH_LIST != 0 )
528
- #undef DOUBLE_BOND_NEIGH_LIST
529
- #define DOUBLE_BOND_NEIGH_LIST 0
530
- #endif
531
-
532
-
533
- /*************************************
534
- * Drawing
535
- */
536
-
537
- #define DRAW_AROM_TAUT 1 /* 1=> draw distinct aromatic & tautomer bonds, 0=> don't */
538
-
539
- /******************************************************/
540
- /* C O M M O N D E F I N I T I O N S */
541
- /******************************************************/
542
-
543
-
544
- /* input bTautFlags flags */
545
- #define TG_FLAG_TEST_TAUT__ATOMS 0x00000001 /* find regular tautomerism */
546
- #define TG_FLAG_DISCONNECT_SALTS 0x00000002 /* DISCONNECT_SALTS disconnect */
547
- #define TG_FLAG_TEST_TAUT__SALTS 0x00000004 /* DISCONNECT_SALTS if possible find long-range H/(-) taut. on =C-OH, >C=O */
548
- #define TG_FLAG_MOVE_POS_CHARGES 0x00000008 /* MOVE_CHARGES allow long-range movement of N(+), P(+) charges */
549
- #define TG_FLAG_TEST_TAUT2_SALTS 0x00000010 /* TEST_REMOVE_S_ATOMS multi-attachement long-range H/(-) taut. on =C-OH, >C=O */
550
- #define TG_FLAG_ALLOW_NO_NEGTV_O 0x00000020 /* CHARGED_SALTS_ONLY=0 (debug) find long-range H-only tautomerism on =C-OH, >C=O */
551
- #define TG_FLAG_MERGE_TAUT_SALTS 0x00000040 /* DISCONNECT_SALTS merge all "salt"-t-groups and other =C-OH into one t-group */
552
-
553
- #define TG_FLAG_ALL_TAUTOMERIC (TG_FLAG_TEST_TAUT__ATOMS| \
554
- TG_FLAG_TEST_TAUT__SALTS| \
555
- TG_FLAG_TEST_TAUT2_SALTS| \
556
- TG_FLAG_MERGE_TAUT_SALTS)
557
-
558
- #define TG_FLAG_DISCONNECT_COORD 0x00000080 /* find "coord. centers" and disconnect them */
559
- #define TG_FLAG_RECONNECT_COORD 0x00000100 /* reconnect disconnected "coord. centers" */
560
- #define TG_FLAG_CHECK_VALENCE_COORD 0x00000200 /* do not disconnect "coord. centers" with usual valence */
561
- #define TG_FLAG_MOVE_HPLUS2NEUTR 0x00000400 /* move protons to neutralize */
562
- #define TG_FLAG_VARIABLE_PROTONS 0x00000800 /* add/remove protons to neutralize */
563
- #define TG_FLAG_HARD_ADD_REM_PROTONS 0x00001000 /* add/remove protons to neutralize in hard way */
564
- #define TG_FLAG_POINTED_EDGE_STEREO 0x00002000 /* only pointed edge of stereo bond defines stereo */
565
-
566
- /* output bTautFlags flags */
567
-
568
- #define TG_FLAG_MOVE_HPLUS2NEUTR_DONE 0x00000001 /* protons have been moved to neutralize */
569
- #define TG_FLAG_TEST_TAUT__ATOMS_DONE 0x00000002
570
- #define TG_FLAG_DISCONNECT_SALTS_DONE 0x00000004
571
- #define TG_FLAG_TEST_TAUT__SALTS_DONE 0x00000008 /* multiple H tautomerism */
572
- #define TG_FLAG_MOVE_POS_CHARGES_DONE 0x00000010
573
- #define TG_FLAG_TEST_TAUT2_SALTS_DONE 0x00000020 /* merged t-groups */
574
- #define TG_FLAG_ALLOW_NO_NEGTV_O_DONE 0x00000040
575
- #define TG_FLAG_MERGE_TAUT_SALTS_DONE 0x00000080 /* added non-taut O to taut groups */
576
-
577
- #define TG_FLAG_ALL_SALT_DONE (TG_FLAG_TEST_TAUT__SALTS_DONE | \
578
- TG_FLAG_TEST_TAUT2_SALTS_DONE | \
579
- TG_FLAG_MERGE_TAUT_SALTS_DONE )
580
-
581
- #define TG_FLAG_DISCONNECT_COORD_DONE 0x00000100 /* found and disconnected "coord. centers" */
582
- #define TG_FLAG_CHECK_VALENCE_COORD_DONE 0x00000200 /* did not disconnect "coord. centers" with usual valence */
583
- #define TG_FLAG_MOVE_CHARGE_COORD_DONE 0x00000400 /* changed charge of a disconnected ligand to fit its valence */
584
- #define TG_FLAG_FIX_ODD_THINGS_DONE 0x00000800 /* fixed drawing ambiguities in fix_odd_things */
585
- #define TG_FLAG_TEST_TAUT3_SALTS_DONE 0x00001000 /* merged t-groups + non-O taut atoms */
586
- #define TG_FLAG_FOUND_SALT_CHARGES_DONE 0x00002000 /* not assigned: preprocessing detected possibility of salt-type tautomerism */
587
- #define TG_FLAG_FOUND_ISOTOPIC_H_DONE 0x00004000 /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
588
- #define TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE 0x00008000 /* preprocessing detected isotopic H on "good" heteroatoms or isotopic H(+) */
589
-
590
-
591
- #ifdef _WIN32
592
-
593
- #define INCHI_OPTION_PREFX '/'
594
- #define INCHI_PATH_DELIM '\\'
595
-
596
- #else
597
-
598
- #define INCHI_OPTION_PREFX '-'
599
- #define INCHI_PATH_DELIM '/'
600
-
601
- #endif
602
-
603
- #define INCHI_ALT_OPT_PREFIX '-'
604
- #define INCHI_ACD_LABS_PREFIX '-'
605
-
606
- #ifdef INCHI_LIBRARY
607
- typedef struct tagOutputString {
608
- char *pStr;
609
- int nAllocatedLength;
610
- int nUsedLength;
611
- int nPtr;
612
- } INCHI_OUTPUT;
613
- #define INCHI_FILE INCHI_OUTPUT
614
- #else
615
- #define INCHI_FILE FILE
616
- #endif
617
-
618
-
619
- /* memory leaks tracking */
620
-
621
- #if( TRACE_MEMORY_LEAKS == 1 )
622
- #ifdef _DEBUG
623
-
624
- #define inchi_malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
625
- #define inchi_calloc(c, s) _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
626
- #define inchi_free(p) _free_dbg(p, _NORMAL_BLOCK)
627
-
628
- #ifdef INCHI_MAIN
629
- /* INChI_MAIN specific */
630
- #define e_inchi_malloc(a) inchi_malloc(a)
631
- #define e_inchi_calloc(a,b) inchi_calloc(a,b)
632
- #define e_inchi_free(a) inchi_free(a)
633
- #endif
634
-
635
- /*#define _CRTDBG_MAP_ALLOC*/
636
-
637
- #include <crtdbg.h>
638
-
639
- #else
640
- #undef TRACE_MEMORY_LEAKS
641
- #define TRACE_MEMORY_LEAKS 0
642
- #endif /* _DEBUG */
643
- #endif /* TRACE_MEMORY_LEAKS */
644
-
645
- #ifdef INCHI_MAIN
646
- /* INChI_MAIN specific */
647
- #ifndef inchi_malloc
648
- #define inchi_malloc e_inchi_malloc
649
- #endif
650
- #ifndef inchi_calloc
651
- #define inchi_calloc e_inchi_calloc
652
- #endif
653
- #ifndef inchi_free
654
- #define inchi_free e_inchi_free
655
- #endif
656
- #endif /* INCHI_MAIN */
657
-
658
- /* allocation/deallocation */
659
- #define USE_ALLOCA 0
660
-
661
- #if( USE_ALLOCA == 1 )
662
- #define qmalloc(X) _alloca(X)
663
- #define qfree(X) do{(X)=NULL;}while(0)
664
- #else
665
- #define qmalloc(X) inchi_malloc(X)
666
- #define qfree(X) do{if(X){inchi_free(X);(X)=NULL;}}while(0)
667
- #endif
668
-
669
- #if( defined(_MSC_VER) && _MSC_VER >= 800 )
670
- #define fast_alloc(X) _alloca(X)
671
- #define fast_free(X)
672
- #else
673
- #define fast_alloc(X) inchi_malloc(X)
674
- #define fast_free(X) inchi_free(X)
675
- #endif
676
-
677
- #define qzfree(X) do{if(X){inchi_free(X);(X)=NULL;}}while(0)
678
-
679
- /* rellocation */
680
-
681
- #define MYREALLOC2(PTRTYPE1, PTRTYPE2, PTR1, PTR2, LEN1, LEN2, ERR) \
682
- do { \
683
- if( (LEN1) <= (LEN2) ) {\
684
- PTRTYPE1 * newPTR1 = (PTRTYPE1 *)inchi_calloc( (LEN2)+1, sizeof(PTRTYPE1) );\
685
- PTRTYPE2 * newPTR2 = (PTRTYPE2 *)inchi_calloc( (LEN2)+1, sizeof(PTRTYPE2) );\
686
- if ( newPTR1 && newPTR2 ) { \
687
- if ( (PTR1) && (LEN1) > 0 ) \
688
- (memcpy) ( newPTR1, (PTR1), (LEN1) * sizeof(PTRTYPE1) ); \
689
- if ( (PTR2) && (LEN1) > 0 ) \
690
- (memcpy) ( newPTR2, (PTR2), (LEN1) * sizeof(PTRTYPE2) ); \
691
- if ( PTR1 ) \
692
- inchi_free(PTR1); \
693
- if ( PTR2 ) \
694
- inchi_free(PTR2); \
695
- (PTR1) = newPTR1; \
696
- (PTR2) = newPTR2; \
697
- (LEN1) = (LEN2); \
698
- (ERR) = 0; \
699
- } else { \
700
- (ERR) = 1; \
701
- } \
702
- } else { (ERR) = 0; } \
703
- } while(0)
704
-
705
-
706
- #endif /* __MODE_H__ */