rino 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/README +44 -0
  2. data/Rakefile +123 -0
  3. data/ext/extconf.rb +26 -0
  4. data/ext/ruby_inchi_main.so +0 -0
  5. data/ext/src/aux2atom.h +2786 -0
  6. data/ext/src/comdef.h +148 -0
  7. data/ext/src/e_0dstereo.c +3014 -0
  8. data/ext/src/e_0dstereo.h +31 -0
  9. data/ext/src/e_comdef.h +57 -0
  10. data/ext/src/e_ctl_data.h +147 -0
  11. data/ext/src/e_ichi_io.c +498 -0
  12. data/ext/src/e_ichi_io.h +40 -0
  13. data/ext/src/e_ichi_parms.c +37 -0
  14. data/ext/src/e_ichi_parms.h +41 -0
  15. data/ext/src/e_ichicomp.h +50 -0
  16. data/ext/src/e_ichierr.h +40 -0
  17. data/ext/src/e_ichimain.c +593 -0
  18. data/ext/src/e_ichisize.h +43 -0
  19. data/ext/src/e_inchi_atom.c +75 -0
  20. data/ext/src/e_inchi_atom.h +33 -0
  21. data/ext/src/e_inpdef.h +41 -0
  22. data/ext/src/e_mode.h +706 -0
  23. data/ext/src/e_mol2atom.c +649 -0
  24. data/ext/src/e_readinch.c +58 -0
  25. data/ext/src/e_readmol.c +54 -0
  26. data/ext/src/e_readmol.h +180 -0
  27. data/ext/src/e_readstru.c +251 -0
  28. data/ext/src/e_readstru.h +33 -0
  29. data/ext/src/e_util.c +284 -0
  30. data/ext/src/e_util.h +61 -0
  31. data/ext/src/extr_ct.h +251 -0
  32. data/ext/src/ichi.h +206 -0
  33. data/ext/src/ichi_bns.c +7999 -0
  34. data/ext/src/ichi_bns.h +231 -0
  35. data/ext/src/ichican2.c +5000 -0
  36. data/ext/src/ichicano.c +2195 -0
  37. data/ext/src/ichicano.h +49 -0
  38. data/ext/src/ichicans.c +1625 -0
  39. data/ext/src/ichicant.h +379 -0
  40. data/ext/src/ichicomn.h +260 -0
  41. data/ext/src/ichicomp.h +50 -0
  42. data/ext/src/ichidrp.h +119 -0
  43. data/ext/src/ichierr.h +124 -0
  44. data/ext/src/ichiisot.c +101 -0
  45. data/ext/src/ichilnct.c +286 -0
  46. data/ext/src/ichimain.h +132 -0
  47. data/ext/src/ichimak2.c +1189 -0
  48. data/ext/src/ichimake.c +3812 -0
  49. data/ext/src/ichimake.h +205 -0
  50. data/ext/src/ichimap1.c +851 -0
  51. data/ext/src/ichimap2.c +2856 -0
  52. data/ext/src/ichimap4.c +1609 -0
  53. data/ext/src/ichinorm.c +741 -0
  54. data/ext/src/ichinorm.h +67 -0
  55. data/ext/src/ichiparm.c +45 -0
  56. data/ext/src/ichiparm.h +1441 -0
  57. data/ext/src/ichiprt1.c +3612 -0
  58. data/ext/src/ichiprt2.c +1511 -0
  59. data/ext/src/ichiprt3.c +3011 -0
  60. data/ext/src/ichiqueu.c +1003 -0
  61. data/ext/src/ichiring.c +326 -0
  62. data/ext/src/ichiring.h +49 -0
  63. data/ext/src/ichisize.h +35 -0
  64. data/ext/src/ichisort.c +539 -0
  65. data/ext/src/ichister.c +3538 -0
  66. data/ext/src/ichister.h +35 -0
  67. data/ext/src/ichitaut.c +3843 -0
  68. data/ext/src/ichitaut.h +387 -0
  69. data/ext/src/ichitime.h +74 -0
  70. data/ext/src/inchi_api.h +670 -0
  71. data/ext/src/inchi_dll.c +1480 -0
  72. data/ext/src/inchi_dll.h +34 -0
  73. data/ext/src/inchi_dll_main.c +23 -0
  74. data/ext/src/inchi_dll_main.h +31 -0
  75. data/ext/src/inpdef.h +328 -0
  76. data/ext/src/lreadmol.h +1246 -0
  77. data/ext/src/mode.h +706 -0
  78. data/ext/src/ruby_inchi_main.c +558 -0
  79. data/ext/src/runichi.c +4179 -0
  80. data/ext/src/strutil.c +3861 -0
  81. data/ext/src/strutil.h +182 -0
  82. data/ext/src/util.c +1130 -0
  83. data/ext/src/util.h +85 -0
  84. data/lib/clean_tempfile.rb +220 -0
  85. data/lib/rino.rb +111 -0
  86. data/test/test.rb +386 -0
  87. metadata +130 -0
@@ -0,0 +1,670 @@
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 __INHCH_API_H__
11
+ #define __INHCH_API_H__
12
+
13
+ /* radical definitions */
14
+ typedef enum tagINCHIRadical {
15
+ INCHI_RADICAL_NONE = 0,
16
+ INCHI_RADICAL_SINGLET = 1,
17
+ INCHI_RADICAL_DOUBLET = 2,
18
+ INCHI_RADICAL_TRIPLET = 3
19
+ } inchi_Radical;
20
+
21
+ /* bond type definitions */
22
+ typedef enum tagINCHIBondType {
23
+ INCHI_BOND_TYPE_NONE = 0,
24
+ INCHI_BOND_TYPE_SINGLE = 1,
25
+ INCHI_BOND_TYPE_DOUBLE = 2,
26
+ INCHI_BOND_TYPE_TRIPLE = 3,
27
+ INCHI_BOND_TYPE_ALTERN = 4
28
+ } inchi_BondType;
29
+ /* 2D stereo definitions */
30
+ typedef enum tagINCHIBondStereo2D {
31
+ /* stereocenter-related; positive: the sharp end points to this atom */
32
+ INCHI_BOND_STEREO_NONE = 0,
33
+ INCHI_BOND_STEREO_SINGLE_1UP = 1,
34
+ INCHI_BOND_STEREO_SINGLE_1EITHER = 4,
35
+ INCHI_BOND_STEREO_SINGLE_1DOWN = 6,
36
+ /* stereocenter-related; negative: the sharp end points to the opposite atom */
37
+ INCHI_BOND_STEREO_SINGLE_2UP = -1,
38
+ INCHI_BOND_STEREO_SINGLE_2EITHER = -4,
39
+ INCHI_BOND_STEREO_SINGLE_2DOWN = -6,
40
+ /* stereobond-related */
41
+ INCHI_BOND_STEREO_DOUBLE_EITHER = 3 /* unknown stereobond geometry */
42
+ } inchi_BondStereo2D;
43
+
44
+ /*************************************************************************
45
+ * Notes on using INCHI_BOND_STEREO_SINGLE_* from inchi_BondStereo2D *
46
+ * *
47
+ * These stereo markings are used by InChI to characterize a stereogenic *
48
+ * atom if and only if all neighbors of this atom have same z-coordinate *
49
+ * as this atom (that is, in case of 2D fragment). *
50
+ * The only exception is INCHI_BOND_STEREO_SINGLE_?EITHER marking which *
51
+ * always assigns to the atom an "unknown" parity (u). *
52
+ * *
53
+ * Note that the -NEWPS InChI option changes 2D stereo interpretation: *
54
+ * only bonds that have sharp end pointing to the stereogenic atom are *
55
+ * considered as being out of plane and only sharp ends of *
56
+ * INCHI_BOND_STEREO_SINGLE_?EITHER bonds are considered to determine *
57
+ * whether the stereochemistry is unknown. *
58
+ *************************************************************************/
59
+
60
+ /* sizes definitions */
61
+ #define MAXVAL 20 /* max number of bonds per atom */
62
+ #define ATOM_EL_LEN 6 /* length of ASCIIZ element symbol field */
63
+ #define NUM_H_ISOTOPES 3 /* number of hydrogen isotopes: protium, D, T */
64
+ #define ISOTOPIC_SHIFT_FLAG 10000 /* add to isotopic mass if isotopic_mass = */
65
+ /* (isotopic mass - average atomic mass) */
66
+ #define ISOTOPIC_SHIFT_MAX 100 /* max abs(isotopic mass - average atomic mass) */
67
+
68
+ #ifndef INCHI_US_CHAR_DEF
69
+ typedef signed char S_CHAR;
70
+ typedef unsigned char U_CHAR;
71
+ #define INCHI_US_CHAR_DEF
72
+ #endif
73
+
74
+ #ifndef INCHI_US_SHORT_DEF
75
+ typedef signed short S_SHORT;
76
+ typedef unsigned short U_SHORT;
77
+ #define INCHI_US_SHORT_DEF
78
+ #endif
79
+
80
+ typedef S_SHORT AT_NUM; /* atom number; starts from 0 */
81
+
82
+ /*************************************************
83
+ *
84
+ *
85
+ * A T O M S a n d C O N N E C T I V I T Y
86
+ *
87
+ *
88
+ *************************************************/
89
+
90
+ typedef struct tagInchiAtom {
91
+ /* atom coordinates */
92
+ double x;
93
+ double y;
94
+ double z;
95
+ /* connectivity */
96
+ AT_NUM neighbor[MAXVAL]; /* adjacency list: ordering numbers of */
97
+ /* the adjacent atoms, >= 0 */
98
+ S_CHAR bond_type[MAXVAL]; /* inchi_BondType */
99
+ /* 2D stereo */
100
+ S_CHAR bond_stereo[MAXVAL]; /* inchi_BondStereo2D; negative if the */
101
+ /* sharp end points to opposite atom */
102
+ /* other atom properties */
103
+ char elname[ATOM_EL_LEN]; /* zero-terminated chemical element name:*/
104
+ /* "H", "Si", etc. */
105
+ AT_NUM num_bonds; /* number of neighbors, bond types and bond*/
106
+ /* stereo in the adjacency list */
107
+ S_CHAR num_iso_H[NUM_H_ISOTOPES+1]; /* implicit hydrogen atoms */
108
+ /* [0]: number of implicit non-isotopic H
109
+ (exception: num_iso_H[0]=-1 means INCHI
110
+ adds implicit H automatically),
111
+ [1]: number of implicit isotopic 1H (protium),
112
+ [2]: number of implicit 2H (deuterium),
113
+ [3]: number of implicit 3H (tritium) */
114
+ AT_NUM isotopic_mass; /* 0 => non-isotopic; isotopic mass or */
115
+ /* ISOTOPIC_SHIFT_FLAG + mass - (average atomic mass) */
116
+ S_CHAR radical; /* inchi_Radical */
117
+ S_CHAR charge; /* positive or negative; 0 => no charge */
118
+ }inchi_Atom;
119
+
120
+ /*******************************************************************
121
+ * Notes: 1. Atom ordering numbers (i, k, and atom[i].neighbor[j] below)
122
+ * start from zero; max. ordering number is (num_atoms-1).
123
+ * 2. inchi_Atom atom[i] is connected to the atom[atom[i].neighbor[j]]
124
+ * by a bond that has type atom[i].bond_type[j] and 2D stereo type
125
+ * atom[i].bond_stereo[j] (in case of no stereo
126
+ * atom[i].bond_stereo[j] = INCHI_BOND_STEREO_NONE)
127
+ * Index j is in the range 0 <= j <= (atom[i].num_bonds-1)
128
+ * 3. Any connection (represented by atom[i].neighbor[j],
129
+ * atom[i].bond_type[j], and atom[i].bond_stereo[j])
130
+ * should be present in one or both adjacency list:
131
+ * if k = atom[i].neighbor[j] then i may or may not be present in
132
+ * atom[k].neighbor[] list. For example, the adjacency lists may be
133
+ * populated with only such neighbors that atom[i].neighbor[j] < i
134
+ * All elements of an adjacency list must be different, that is,
135
+ * a bond must be specified in an adjacency list only once.
136
+ * 4. in Molfiles usually
137
+ * (number of implicit H) = Valence - SUM(bond_type[])
138
+ * 5. Seemingly illogical order of the inchi_Atom members was
139
+ * chosen in an attempt to avoid alignment problems when
140
+ * accessing inchi_Atom from unrelated to C programming
141
+ * languages such as Visual Basic.
142
+ *******************************************************************/
143
+
144
+ /*******************************************************************
145
+ 0D Stereo Parity and Type definitions
146
+ *******************************************************************
147
+ Note:
148
+ =====
149
+ o Below #A is the ordering number of atom A, starting from 0
150
+ o See parity values corresponding to 'o', 'e', and 'u' in
151
+ inchi_StereoParity0D definition below)
152
+
153
+ =============================================
154
+ stereogenic bond >A=B< or cumulene >A=C=C=B<
155
+ =============================================
156
+
157
+ neighbor[4] : {#X,#A,#B,#Y} in this order
158
+ X central_atom : NO_ATOM
159
+ \ X Y type : INCHI_StereoType_DoubleBond
160
+ A==B \ /
161
+ \ A==B
162
+ Y
163
+
164
+ parity= 'e' parity= 'o' unknown parity = 'u'
165
+
166
+ Limitations:
167
+ ============
168
+ o Atoms A and B in cumulenes MUST be connected by a chain of double bonds;
169
+ atoms A and B in a stereogenic 'double bond' may be connected by a double,
170
+ single, or alternating bond.
171
+ o One atom may belong to up to 3 stereogenic bonds (i.g. in a fused
172
+ aromatic structure).
173
+ o Multiple stereogenic bonds incident to any given atom should
174
+ either all except possibly one have (possibly different) defined
175
+ parities ('o' or 'e') or should all have an unknown parity 'u'.
176
+
177
+ Note on parities of alternating stereobonds
178
+ ===========================================
179
+ D--E
180
+ In large rings (see Fig. 1, all // \\
181
+ atoms are C) all alternating bonds B--C F--G
182
+ are treated as stereogenic. // \\
183
+ To avoid "undefined" bond parities A H
184
+ for bonds BC, DE, FG, HI, JK, LM, AN \ /
185
+ it is recommended to mark them with N==M J==I
186
+ parities. \ /
187
+ L==K Fig. 1
188
+ Such a marking will make
189
+ the stereochemical layer unambiguous
190
+ and it will be different from the B--C F--G
191
+ stereochemical layer of the second // \\ // \\
192
+ structure (Fig. 2). A D--E H
193
+ \ /
194
+ N==M J==I
195
+ By default, double and alternating \ /
196
+ bonds in 8-member and greater rings L==K Fig. 2
197
+ are treated by InChI as stereogenic.
198
+
199
+
200
+ =============================================
201
+ tetrahedral atom
202
+ =============================================
203
+
204
+ 4 neighbors
205
+
206
+ X neighbor[4] : {#W, #X, #Y, #Z}
207
+ | central_atom: #A
208
+ W--A--Y type : INCHI_StereoType_Tetrahedral
209
+ |
210
+ Z
211
+ parity: if (X,Y,Z) are clockwize when seen from W then parity is 'e' otherwise 'o'
212
+ Example (see AXYZW above): if W is above the plane XYZ then parity = 'e'
213
+
214
+ 3 neighbors
215
+
216
+ Y Y neighbor[4] : {#A, #X, #Y, #Z}
217
+ / / central_atom: #A
218
+ X--A (e.g. O=S ) type : INCHI_StereoType_Tetrahedral
219
+ \ \
220
+ Z Z
221
+
222
+ parity: if (X,Y,Z) are clockwize when seen from A then parity is 'e',
223
+ otherwise 'o'
224
+ unknown parity = 'u'
225
+ Example (see AXYZ above): if A is above the plane XYZ then parity = 'e'
226
+ This approach may be used also in case of an implicit H attached to A.
227
+
228
+ =============================================
229
+ allene
230
+ =============================================
231
+
232
+ X Y neighbor[4] : {#X,#A,#B,#Y}
233
+ \ / central_atom : #C
234
+ A=C=B type : INCHI_StereoType_Allene
235
+
236
+ Y X
237
+ | |
238
+ when seen from A along A=C=B: X-A Y-A
239
+
240
+ parity: 'e' 'o'
241
+
242
+ parity: if A, B, Y are clockwise when seen from X then parity is 'e',
243
+ otherwise 'o'
244
+ unknown parity = 'u'
245
+ Example (see XACBY above): if X on the diagram is above the plane ABY
246
+ then parity is 'o'
247
+
248
+ Limitations
249
+ ===========
250
+ o Atoms A and B in allenes MUST be connected by a chain of double bonds;
251
+
252
+ ==============================================
253
+ Note. Correspondence to CML 0D stereo parities
254
+ ==============================================
255
+ a list of 4 atoms corresponds to CML atomRefs4
256
+
257
+ tetrahedral atom
258
+ ================
259
+ CML atomParity > 0 <=> INCHI_PARITY_EVEN
260
+ CML atomParity < 0 <=> INCHI_PARITY_ODD
261
+
262
+ | 1 1 1 1 | where xW is x-coordinate of
263
+ | xW xX xY xZ | atom W, etc. (xyz is a
264
+ CML atomParity = determinant | yW yX yY yZ | 'right-handed' Cartesian
265
+ | zW zX xY zZ | coordinate system)
266
+
267
+ allene (not yet defined in CML)
268
+ ===============================
269
+ the parity corresponds to the sign of the following determinant
270
+ in exactly same way as for tetrahedral atoms:
271
+
272
+ | 1 1 1 1 | where bonds and neighbor[4] array are
273
+ | xX xA xB xY | same as defined above for allenes
274
+ | yX yA yB yY | Obviously, the parity is same for
275
+ | zX zA xB zY | {#X,#A,#B,#Y} and {#Y,#B,#A,#X}
276
+ because of the even number of column permutations.
277
+
278
+ stereogenic double bond and (not yet defined in CML) cumulenes
279
+ ==============================================================
280
+ CML 'C' (cis) <=> INCHI_PARITY_ODD
281
+ CML 'T' (trans) <=> INCHI_PARITY_EVEN
282
+
283
+
284
+ How InChI uses 0D parities
285
+ ==========================
286
+
287
+ 1. 0D parities are used if all atom coordinates are zeroes.
288
+
289
+ In addition to that:
290
+
291
+ 2. 0D parities are used for Stereobonds, Allenes, or Cumulenes if:
292
+
293
+ 2a. A bond to the end-atom is shorter than MIN_BOND_LEN=0.000001
294
+ 2b. A ratio of two bond lengths to the end-atom is smaller than MIN_SINE=0.03
295
+ 2c. In case of a linear fragment X-A=B end-atom A is treated as satisfying 2a-b
296
+
297
+ 0D parities are used if 2a or 2b or 2c applies to one or both end-atoms.
298
+
299
+ 3. 0D parities are used for Tetrahedral Atoms if at least one of 3a-c is true:
300
+
301
+ 3a. One of bonds to the central atom is shorter than MIN_BOND_LEN=0.000001
302
+ 3b. A ratio of two bond lengths to the central atom is smaller than MIN_SINE=0.03
303
+ 3c. The four neighbors are almost in one plane or the central atom and
304
+ its only 3 explicit neighbors are almost in one plane
305
+
306
+ Notes on 0D parities and 'undefined' stereogenic elements
307
+ =========================================================
308
+
309
+ If 0D parity is to be used according to 1-3 but CH3 CH3
310
+ has not been provided then the corresponding \ /
311
+ stereogenic element is considered 'undefined'. C=CH
312
+ /
313
+ For example, if in the structure (Fig. 3) H
314
+ the explicit H has been moved so that it Fig. 3
315
+ has same coordinates as atom >C= (that is,
316
+ the length of the bond H-C became zero)
317
+ then the double bond is assigned 'undefined' CH3 CH3
318
+ parity which by default is omitted from the \ /
319
+ Identifier. CH=CH
320
+
321
+ However, the structure on Fig. 4 will have double Fig. 4
322
+ bond parity 'o' and its parity in the Identifier is (-).
323
+
324
+ Notes on 0D parities in structures containing metals
325
+ ====================================================
326
+ Since InChI disconnects bonds to metals the 0D parities upon the
327
+ disconnection may change in several different ways:
328
+
329
+ 1) previously non-stereogenic bond may become stereogenic:
330
+
331
+ \ / \ /
332
+ CH==CH disconnection CH==CH
333
+ \ / ======>
334
+ M M
335
+
336
+ before the disconnection: after the disconnection:
337
+ atoms C have valence=5 and the double bond may become
338
+ the double bond is not stereogenic
339
+ recognized as stereogenic
340
+
341
+ 2) previously stereogenic bond may become non-stereogenic:
342
+
343
+ M M(+)
344
+ \ / /
345
+ N==C disconnection (-)N==C
346
+ \ ======> \
347
+
348
+ 3) Oddball structures, usually resulting from projecting 3D
349
+ structures on the plane, may contain fragment like that
350
+ depicted on Fig. 5:
351
+
352
+ M A M A
353
+ |\ / B / B
354
+ | X / disconnection / /
355
+ |/ \ / ======> / /
356
+ C===C C===C
357
+ Fig. 5
358
+ (X stands for bond intersection)
359
+
360
+ A-C=C-B parity is A-C=C-B parity is
361
+ trans (e) cis (o) or undefined
362
+ because the bond because C valence = 3,
363
+ orientation is same not 4.
364
+ as on Fig, 6 below:
365
+
366
+ A M
367
+ \ / Removal of M from the structure
368
+ C===C on Fig. 5 changes the geometry from trans
369
+ / \ to cis.
370
+ M' B Removal of M and M' from the structure
371
+ Fig. 6 on Fig. 6 does not change the A-C=C-B
372
+ geometry: it is trans.
373
+
374
+ To resolve the problem InChI API accepts the second parity
375
+ corresponding to the metal-disconnected structure.
376
+ To store both bond parities use left shift by 3 bits:
377
+
378
+ inchi_Stereo0D::parity = ParityOfConnected | (ParityOfDisconnected<<3)
379
+
380
+ In case when only disconnected structure parity exists set
381
+ ParityOfConnected = INCHI_PARITY_UNDEFINED.
382
+ This is the only case when INCHI_PARITY_UNDEFINED parity
383
+ may be fed to the InChI.
384
+
385
+ In cases when the bond parity in a disconnected structure exists and
386
+ differs from the parity in the connected structure the atoms A and B
387
+ should be non-metals.
388
+
389
+ ****************************************************************************/
390
+
391
+ #define NO_ATOM (-1) /* non-existent (central) atom */
392
+
393
+ /* 0D parity types */
394
+ typedef enum tagINCHIStereoType0D {
395
+ INCHI_StereoType_None = 0,
396
+ INCHI_StereoType_DoubleBond = 1,
397
+ INCHI_StereoType_Tetrahedral = 2,
398
+ INCHI_StereoType_Allene = 3
399
+ } inchi_StereoType0D;
400
+
401
+ /* 0D parities */
402
+ typedef enum tagINCHIStereoParity0D {
403
+ INCHI_PARITY_NONE = 0,
404
+ INCHI_PARITY_ODD = 1, /* 'o' */
405
+ INCHI_PARITY_EVEN = 2, /* 'e' */
406
+ INCHI_PARITY_UNKNOWN = 3, /* 'u' */
407
+ INCHI_PARITY_UNDEFINED = 4 /* '?' -- should not be used; however, see Note above */
408
+ } inchi_StereoParity0D;
409
+
410
+
411
+ /*************************************************
412
+ *
413
+ *
414
+ * 0D - S T E R E O (if no coordinates given)
415
+ *
416
+ *
417
+ *************************************************/
418
+
419
+
420
+ typedef struct tagINCHIStereo0D {
421
+ AT_NUM neighbor[4]; /* 4 atoms always */
422
+ AT_NUM central_atom; /* central tetrahedral atom or a central */
423
+ /* atom of allene; otherwise NO_ATOM */
424
+ S_CHAR type; /* inchi_StereoType0D */
425
+ S_CHAR parity; /* inchi_StereoParity0D: may be a combination of two parities: */
426
+ /* ParityOfConnected | (ParityOfDisconnected << 3), see Note above */
427
+ }inchi_Stereo0D;
428
+
429
+ /*************************************************
430
+ *
431
+ *
432
+ * I N C h I D L L I n p u t
433
+ *
434
+ *
435
+ *************************************************/
436
+
437
+ typedef struct tagINCHI_Input {
438
+ /* the caller is responsible for the data allocation and deallocation */
439
+ inchi_Atom *atom; /* array of num_atoms elements */
440
+ inchi_Stereo0D *stereo0D; /* array of num_stereo0D 0D stereo elements or NULL */
441
+ char *szOptions; /* InChI options: space-delimited; each is preceded by */
442
+ /* '/' or '-' depending on OS and compiler */
443
+ AT_NUM num_atoms; /* number of atoms in the structure < 1024 */
444
+ AT_NUM num_stereo0D; /* number of 0D stereo elements */
445
+ }inchi_Input;
446
+
447
+ /*************************************************
448
+ *
449
+ *
450
+ * I N C h I D L L O u t p u t
451
+ *
452
+ *
453
+ *************************************************/
454
+
455
+ typedef struct tagINCHI_Output {
456
+ /* zero-terminated C-strings allocated by GetINCHI() */
457
+ /* to deallocate all of them call FreeINCHI() (see below) */
458
+ char *szInChI; /* InChI ASCIIZ string */
459
+ char *szAuxInfo; /* Aux info ASCIIZ string */
460
+ char *szMessage; /* Error/warning ASCIIZ message */
461
+ char *szLog; /* log-file ASCIIZ string, contains a human-readable list */
462
+ /* of recognized options and possibly an Error/warning message */
463
+ } inchi_Output;
464
+
465
+ /*************************************************
466
+ *
467
+ *
468
+ * I N C h I D L L I n t e r f a c e
469
+ *
470
+ *
471
+ *************************************************/
472
+
473
+ #if (defined( _WIN32 ) && defined( _MSC_VER ) && defined(INCHI_LINK_AS_DLL) )
474
+ /* Win32 & MS VC ++, compile and link as a DLL */
475
+ #ifdef _USRDLL
476
+ /* InChI library dll */
477
+ #define INCHI_API __declspec(dllexport)
478
+ #define EXPIMP_TEMPLATE
479
+ #define INCHI_DECL __stdcall
480
+ #else
481
+ /* calling the InChI dll program */
482
+ #define INCHI_API __declspec(dllimport)
483
+ #define EXPIMP_TEMPLATE extern
484
+ #define INCHI_DECL __stdcall
485
+ #endif
486
+ #else
487
+ /* create a statically linked InChI library or link to an executable */
488
+ #define INCHI_API
489
+ #define EXPIMP_TEMPLATE
490
+ #define INCHI_DECL
491
+ #endif
492
+
493
+ /* GetINCHI(...) and Get_inchi_Input_FromAuxInfo(...) return values: */
494
+
495
+ typedef enum tagRetValGetINCHI {
496
+
497
+ inchi_Ret_SKIP = -2, /* not used in InChI library */
498
+ inchi_Ret_EOF = -1, /* no structural data has been provided */
499
+ inchi_Ret_OKAY = 0, /* Success; no errors or warnings */
500
+ inchi_Ret_WARNING = 1, /* Success; warning(s) issued */
501
+ inchi_Ret_ERROR = 2, /* Error: no InChI has been created */
502
+ inchi_Ret_FATAL = 3, /* Severe error: no InChI has been created (typically, memory allocation failure) */
503
+ inchi_Ret_UNKNOWN = 4, /* Unknown program error */
504
+ inchi_Ret_BUSY = 5 /* Previuos call to InChI has not returned yet */
505
+
506
+ } RetValGetINCHI;
507
+
508
+ /* to compile all InChI code as a C++ code #define INCHI_ALL_CPP */
509
+ #ifndef INCHI_ALL_CPP
510
+ #ifdef __cplusplus
511
+ extern "C" {
512
+ #endif
513
+ #endif
514
+
515
+ /* inchi_Input is created by the user; strings in inchi_Output are allocated and deallocated by InChI */
516
+ /* inchi_Output does not need to be initilized out to zeroes; see FreeINCHI on how to deallocate it */
517
+ EXPIMP_TEMPLATE INCHI_API int INCHI_DECL GetINCHI( inchi_Input *inp, inchi_Output *out );
518
+
519
+ /* FreeINCHI() should be called to deallocate char* pointers obtained from each GetINCHI() call */
520
+ EXPIMP_TEMPLATE INCHI_API void INCHI_DECL FreeINCHI ( inchi_Output *out );
521
+
522
+ /* helper: get string length */
523
+ EXPIMP_TEMPLATE INCHI_API int INCHI_DECL GetStringLength( char *p );
524
+
525
+
526
+
527
+ #ifndef INCHI_ALL_CPP
528
+ #ifdef __cplusplus
529
+ }
530
+ #endif
531
+ #endif
532
+
533
+ /**********************************************************
534
+ Using inchi_Input::szOptions related to ChiralFlag
535
+ **********************************************************
536
+ Awailable options (use - instead of / for O.S. other than MS Windows):
537
+
538
+ /SUCF Use Chiral Flag
539
+ /ChiralFlagON Set Chiral Flag
540
+ /ChiralFlagOFF Set Not-Chiral Flag
541
+
542
+ The following table describes the effect of the options
543
+ ---------------------------------------------------------------
544
+ Options Equivalent to Chiral Flag Information
545
+ stored in AuxInfo
546
+ ---------------------------------------------------------------
547
+ /SUCF /ChiralFlagON /SABS Chiral Flag
548
+ /SUCF /ChiralFlagOFF /SREL Not-Chiral Flag
549
+ /SUCF /SREL none
550
+ /ChiralFlagON none Chiral Flag
551
+ /ChiralFlagOFF none Not-Chiral Flag
552
+
553
+ *************************************************************
554
+ Other options available in InChI Library (case insensitive)
555
+ *************************************************************
556
+ /SNon Exclude stereo (Default: Include Absolute stereo)
557
+ /SRel Relative stereo
558
+ /SRac Racemic stereo
559
+
560
+ /SUU Include omitted unknown/undefined stereo
561
+ /NEWPS Narrow end of wedge points to stereocenter (default: both)
562
+ /RecMet Include reconnected bond to metal results
563
+ /FixedH Mobile H Perception Off (Default: On)
564
+ /AuxNone Omit auxiliary information (default: Include)
565
+ /NoADP Disable Aggressive Deprotonation (for testing only)
566
+ /Compress Compressed output
567
+ /DoNotAddH Overrides inchi_Atom::num_iso_H[0] == -1
568
+ /Wnumber Set time-out per structure in seconds; W0 means unlimited
569
+ In InChI library the default value is unlimited
570
+ /OutputSDF Output SDfile instead of InChI
571
+ /WarnOnEmptyStructure Warn and produce empty InChI for empty structure
572
+
573
+ Empty InChI format: InChI=1//
574
+ AuxInfo=1//
575
+ */
576
+
577
+
578
+ /*****************************************************************
579
+ *
580
+ *
581
+ * C o n v e r s i o n: InChI AuxInfo string => inchi_Input
582
+ *
583
+ *
584
+ *****************************************************************/
585
+
586
+ #ifndef STR_ERR_LEN
587
+ #define STR_ERR_LEN 256
588
+ #endif
589
+
590
+ typedef struct tagInchiInpData {
591
+ inchi_Input *pInp; /* a pointer to pInp that has all items 0 or NULL */
592
+ int bChiral; /* 1 => the structure was marked as chiral, 2=> not chiral, 0=> not marked */
593
+ char szErrMsg[STR_ERR_LEN];
594
+ } InchiInpData;
595
+
596
+ /* to compile all InChI code as a C++ code #define INCHI_ALL_CPP */
597
+ #ifndef INCHI_ALL_CPP
598
+ #ifdef __cplusplus
599
+ extern "C" {
600
+ #endif
601
+ #endif
602
+
603
+ /* Input
604
+ -----
605
+ szInchiAuxInfo: contains ASCIIZ string of InChI output for a single
606
+ structure or only the AuxInfo line
607
+ bDoNotAddH: if 0 then InChI will be allowed to add implicit H
608
+ pInchiInp: should have a valid pointer pInchiInp->pInp to an empty
609
+ (all members = 0) inchi_Input structure
610
+
611
+ Output
612
+ ------
613
+ pInchiInp: The following members of pInp may be filled during the call:
614
+ atom, num_atoms, stereo0D, num_stereo0D
615
+ Return value: see RetValGetINCHI
616
+ */
617
+ EXPIMP_TEMPLATE INCHI_API int INCHI_DECL Get_inchi_Input_FromAuxInfo
618
+ ( char *szInchiAuxInfo, int bDoNotAddH, InchiInpData *pInchiInp );
619
+
620
+ /*
621
+ To deallocate and write zeroes into the changed members of pInchiInp->pInp call
622
+ Free_inchi_Input( inchi_Input *pInp )
623
+ */
624
+ EXPIMP_TEMPLATE INCHI_API void INCHI_DECL Free_inchi_Input( inchi_Input *pInp );
625
+
626
+ #ifndef INCHI_ALL_CPP
627
+ #ifdef __cplusplus
628
+ }
629
+ #endif
630
+ #endif
631
+
632
+
633
+ /* Annotated List of -Exports for libinchi.dll produced by dumpbin (Win32):
634
+
635
+ ordinal hint RVA name
636
+ --------------------------------- C calling conventions, compatible with gcc under Win32
637
+ (see inchi_dll.c and vc6_libinchi.def for details)
638
+ 1 0 0004D800 FreeINCHI
639
+ 2 1 0004D840 Free_inchi_Input
640
+ 3 2 0004D7F0 GetINCHI
641
+ 4 3 0004D810 GetStringLength
642
+ 5 4 0004D820 Get_inchi_Input_FromAuxInfo
643
+ --------------------------------- __stdcall calling conventions, compatible with MS VB 6
644
+ (as defined in this file and used in INCHI_MAIN.exe)
645
+ 6 5 0004BD30 _FreeINCHI@4
646
+ 7 6 0001D7C0 _Free_inchi_Input@4
647
+ 8 7 0004BD80 _GetINCHI@8
648
+ 9 8 0004D7D0 _GetStringLength@4
649
+ 10 9 0001D620 _Get_inchi_Input_FromAuxInfo@12
650
+
651
+ ------------------- end of the Annotated list-----------------------
652
+
653
+ =======================================================================
654
+ ============= prototypes for C calling conventions: ===================
655
+ =======================================================================
656
+ int GetINCHI( inchi_Input *inp, inchi_Output *out );
657
+ void FreeINCHI( inchi_Output *out );
658
+ int GetStringLength( char *p );
659
+ int Get_inchi_Input_FromAuxInfo
660
+ ( char *szInchiAuxInfo, int bDoNotAddH, InchiInpData *pInchiInp );
661
+ void Free_inchi_Input( inchi_Input *pInp );
662
+ =======================================================================
663
+
664
+
665
+
666
+ */
667
+
668
+ /* Currently there is no callback function for aborting, progress, etc. */
669
+
670
+ #endif /* __INHCH_API_H__ */