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/e_util.h
DELETED
@@ -1,61 +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 __UTIL_H__
|
11
|
-
#define __UTIL_H__
|
12
|
-
|
13
|
-
/* BILLY 8/6/04 */
|
14
|
-
#ifndef INCHI_ALL_CPP
|
15
|
-
#ifdef __cplusplus
|
16
|
-
extern "C" {
|
17
|
-
#endif
|
18
|
-
#endif
|
19
|
-
|
20
|
-
int e_extract_ChargeRadical( char *elname, int *pnRadical, int *pnCharge );
|
21
|
-
int e_normalize_name( char* name );
|
22
|
-
|
23
|
-
int e_mystrncpy(char *target,const char *source,unsigned maxlen);
|
24
|
-
char *e_LtrimRtrim( char *p, int* nLen );
|
25
|
-
void e_remove_trailing_spaces( char* p );
|
26
|
-
void e_remove_one_lf( char* p);
|
27
|
-
int e_is_element_a_metal( char szEl[] );
|
28
|
-
|
29
|
-
AT_NUMB *e_is_in_the_list( AT_NUMB *pathAtom, AT_NUMB nNextAtom, int nPathLen );
|
30
|
-
S_SHORT *e_is_in_the_slist( S_SHORT *pathAtom, S_SHORT nNextAtom, int nPathLen );
|
31
|
-
void e_SplitTime( unsigned long ulTotalTime, int *hours, int *minutes, int *seconds, int *mseconds );
|
32
|
-
|
33
|
-
/* allocator */
|
34
|
-
#ifndef e_inchi_malloc
|
35
|
-
void *e_inchi_malloc(size_t c);
|
36
|
-
#endif
|
37
|
-
#ifndef e_inchi_calloc
|
38
|
-
void *e_inchi_calloc(size_t c, size_t n);
|
39
|
-
#endif
|
40
|
-
#ifndef e_inchi_free
|
41
|
-
void e_inchi_free(void *p);
|
42
|
-
#endif
|
43
|
-
|
44
|
-
|
45
|
-
extern char e_gsMissing[];
|
46
|
-
extern char e_gsEmpty[];
|
47
|
-
extern char e_gsSpace[];
|
48
|
-
extern char e_gsEqual[];
|
49
|
-
/* format string for SDF_LBL_VAL(L,V): %s%s%s%s (four strings) */
|
50
|
-
#define SDF_LBL_VAL(L,V) ((L)&&(L)[0])?e_gsSpace:e_gsEmpty, ((L)&&(L)[0])?L:e_gsEmpty, ((L)&&(L)[0])? (((V)&&(V)[0])?e_gsEqual:e_gsSpace):e_gsEmpty, ((V)&&(V)[0])?V:((L)&&(L)[0])?e_gsMissing:e_gsEmpty
|
51
|
-
|
52
|
-
|
53
|
-
/* BILLY 8/6/04 */
|
54
|
-
#ifndef INCHI_ALL_CPP
|
55
|
-
#ifdef __cplusplus
|
56
|
-
}
|
57
|
-
#endif
|
58
|
-
#endif
|
59
|
-
|
60
|
-
#endif /* __UTIL_H__*/
|
61
|
-
|
data/ext/src/ichilnct.c
DELETED
@@ -1,286 +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 <stdlib.h>
|
12
|
-
#include <limits.h>
|
13
|
-
#include <math.h>
|
14
|
-
#include <float.h>
|
15
|
-
#include <string.h>
|
16
|
-
#include <ctype.h>
|
17
|
-
|
18
|
-
/* for use in the InChI library */
|
19
|
-
|
20
|
-
#include "mode.h"
|
21
|
-
#include "inchi_api.h"
|
22
|
-
#include "util.h"
|
23
|
-
#include "ichierr.h"
|
24
|
-
#include "ichicomp.h"
|
25
|
-
|
26
|
-
#define my_fgetsTab l_my_fgetsTab
|
27
|
-
#define my_fgetsTab1 l_my_fgetsTab1
|
28
|
-
#define my_fgets l_my_fgets
|
29
|
-
#define str_fgetc l_str_fgetc
|
30
|
-
#define str_fgets l_str_fgets
|
31
|
-
#define str_fgetsTab l_str_fgetsTab
|
32
|
-
|
33
|
-
#define INChIToInchi_Atom l_INChIToInchi_Atom
|
34
|
-
|
35
|
-
int INChIToInchi_Input( INCHI_FILE *inp_molfile, inchi_Input *orig_at_data, int bMergeAllInputStructures,
|
36
|
-
int bDoNotAddH, INPUT_TYPE nInputType,
|
37
|
-
char *pSdfLabel, char *pSdfValue, long *lSdfId, INCHI_MODE *pInpAtomFlags,
|
38
|
-
int *err, char *pStrErr );
|
39
|
-
|
40
|
-
/* This contains executable code. Included in lReadAux.c, e_ReadINCH.c, ReadINCH.c, */
|
41
|
-
#include "aux2atom.h"
|
42
|
-
|
43
|
-
extern int bLibInchiSemaphore;
|
44
|
-
/*****************************************************************************************************/
|
45
|
-
EXPIMP_TEMPLATE INCHI_API int INCHI_DECL Get_inchi_Input_FromAuxInfo(
|
46
|
-
char *szInchiAuxInfo, int bDoNotAddH, InchiInpData *pInchiInp )
|
47
|
-
{
|
48
|
-
INCHI_FILE inp;
|
49
|
-
int num_at, nRet = inchi_Ret_OKAY, err = 0;
|
50
|
-
INCHI_MODE bChiral = 0;
|
51
|
-
/* the input string may contain the following line: "Structure NNN. HHH=VVV" */
|
52
|
-
long lNumber; /* structure number NNN from the input */
|
53
|
-
char szHeader[MAX_SDF_HEADER]; /* stucture label header HHH from the input */
|
54
|
-
char szLabel[MAX_SDF_VALUE]; /* stucture label VVV from the input */
|
55
|
-
if ( bLibInchiSemaphore ) { /* does not work properly under sufficient stress */
|
56
|
-
return inchi_Ret_BUSY;
|
57
|
-
}
|
58
|
-
bLibInchiSemaphore = 1;
|
59
|
-
|
60
|
-
if ( pInchiInp && pInchiInp->pInp ) {
|
61
|
-
/* clear output fields */
|
62
|
-
inchi_Input *pInp = pInchiInp->pInp;
|
63
|
-
char *szOptions = pInp->szOptions;
|
64
|
-
memset( pInchiInp, 0, sizeof(*pInchiInp) );
|
65
|
-
memset( pInp, 0, sizeof(*pInp) );
|
66
|
-
pInp->szOptions = szOptions;
|
67
|
-
pInchiInp->pInp = pInp;
|
68
|
-
} else {
|
69
|
-
bLibInchiSemaphore = 0;
|
70
|
-
return inchi_Ret_ERROR;
|
71
|
-
}
|
72
|
-
szHeader[0] = '\0';
|
73
|
-
szLabel[0] = '\0';
|
74
|
-
lNumber = 0;
|
75
|
-
/* prepare input string pointers */
|
76
|
-
inp.pStr = szInchiAuxInfo;
|
77
|
-
inp.nUsedLength = strlen(szInchiAuxInfo);
|
78
|
-
inp.nAllocatedLength = inp.nUsedLength+1;
|
79
|
-
inp.nPtr = 0;
|
80
|
-
|
81
|
-
num_at = INChIToInchi_Input( &inp, pInchiInp->pInp, 1, bDoNotAddH, INPUT_INCHI_PLAIN,
|
82
|
-
szHeader, szLabel, &lNumber, &bChiral,
|
83
|
-
&err, pInchiInp->szErrMsg );
|
84
|
-
pInchiInp->bChiral = bChiral;
|
85
|
-
if ( num_at <= 0 ) {
|
86
|
-
if ( 10 < err && err < 20 ) {
|
87
|
-
nRet = inchi_Ret_EOF;
|
88
|
-
} else
|
89
|
-
if ( err == 9 ) {
|
90
|
-
nRet = inchi_Ret_ERROR; /* sdfile bypassed to $$$$ */
|
91
|
-
} else
|
92
|
-
if ( err && err < 30 ) {
|
93
|
-
nRet = inchi_Ret_FATAL;
|
94
|
-
} else
|
95
|
-
if ( 98 == err ) {
|
96
|
-
nRet = inchi_Ret_WARNING; /* empty AuxInfo */
|
97
|
-
} else
|
98
|
-
if ( err ) {
|
99
|
-
nRet = inchi_Ret_ERROR;
|
100
|
-
} else
|
101
|
-
if ( pInchiInp->szErrMsg[0] ) {
|
102
|
-
nRet = inchi_Ret_WARNING;
|
103
|
-
}
|
104
|
-
}
|
105
|
-
if ( nRet != inchi_Ret_OKAY && nRet != inchi_Ret_WARNING ) {
|
106
|
-
Free_inchi_Input( pInchiInp->pInp );
|
107
|
-
pInchiInp->bChiral = 0;
|
108
|
-
}
|
109
|
-
bLibInchiSemaphore = 0;
|
110
|
-
return nRet;
|
111
|
-
}
|
112
|
-
/*****************************************************************************************************/
|
113
|
-
EXPIMP_TEMPLATE INCHI_API void INCHI_DECL Free_inchi_Input( inchi_Input *pInp )
|
114
|
-
{
|
115
|
-
FreeInchi_Atom( &pInp->atom );
|
116
|
-
FreeInchi_Stereo0D ( &pInp->stereo0D );
|
117
|
-
pInp->num_atoms = 0;
|
118
|
-
pInp->num_stereo0D = 0;
|
119
|
-
}
|
120
|
-
|
121
|
-
|
122
|
-
/*#endif*/ /* INCHI_MAIN */
|
123
|
-
|
124
|
-
#ifndef INCHI_LIBRARY
|
125
|
-
#error "INCHI_LIBRARY MUST be defined here"
|
126
|
-
#endif
|
127
|
-
|
128
|
-
|
129
|
-
/**********************************************************************************/
|
130
|
-
int INChIToInchi_Input( INCHI_FILE *inp_molfile, inchi_Input *orig_at_data, int bMergeAllInputStructures,
|
131
|
-
int bDoNotAddH, INPUT_TYPE nInputType,
|
132
|
-
char *pSdfLabel, char *pSdfValue, long *lSdfId, INCHI_MODE *pInpAtomFlags,
|
133
|
-
int *err, char *pStrErr )
|
134
|
-
{
|
135
|
-
/* inp_ATOM *at = NULL; */
|
136
|
-
int num_dimensions_new;
|
137
|
-
int num_inp_bonds_new;
|
138
|
-
int num_inp_atoms_new;
|
139
|
-
int num_inp_0D_new;
|
140
|
-
inchi_Atom *at_new = NULL;
|
141
|
-
inchi_Atom *at_old = NULL;
|
142
|
-
inchi_Stereo0D *stereo0D_new = NULL;
|
143
|
-
inchi_Stereo0D *stereo0D_old = NULL;
|
144
|
-
int nNumAtoms = 0, nNumStereo0D = 0;
|
145
|
-
MOL_COORD *szCoordNew = NULL;
|
146
|
-
MOL_COORD *szCoordOld = NULL;
|
147
|
-
int i, j;
|
148
|
-
|
149
|
-
if ( pStrErr ) {
|
150
|
-
pStrErr[0] = '\0';
|
151
|
-
}
|
152
|
-
|
153
|
-
/*FreeOrigAtData( orig_at_data );*/
|
154
|
-
if ( lSdfId )
|
155
|
-
*lSdfId = 0;
|
156
|
-
do {
|
157
|
-
|
158
|
-
at_old = orig_at_data? orig_at_data->atom : NULL; /* save pointer to the previous allocation */
|
159
|
-
stereo0D_old = orig_at_data? orig_at_data->stereo0D : NULL;
|
160
|
-
szCoordOld = NULL;
|
161
|
-
num_inp_atoms_new =
|
162
|
-
INChIToInchi_Atom( inp_molfile, orig_at_data? &stereo0D_new:NULL, &num_inp_0D_new,
|
163
|
-
bDoNotAddH, nInputType, orig_at_data? &at_new:NULL, MAX_ATOMS,
|
164
|
-
&num_dimensions_new, &num_inp_bonds_new,
|
165
|
-
pSdfLabel, pSdfValue, lSdfId, pInpAtomFlags, err, pStrErr );
|
166
|
-
if ( num_inp_atoms_new <= 0 && !*err ) {
|
167
|
-
MOLFILE_ERR_SET (*err, 0, "Empty structure");
|
168
|
-
*err = 98;
|
169
|
-
} else
|
170
|
-
if ( orig_at_data && !num_inp_atoms_new && 10 < *err && *err < 20 && orig_at_data->num_atoms > 0 && bMergeAllInputStructures ) {
|
171
|
-
*err = 0; /* end of file */
|
172
|
-
break;
|
173
|
-
} else
|
174
|
-
if ( num_inp_atoms_new > 0 && orig_at_data ) {
|
175
|
-
/* merge pOrigDataTmp + orig_at_data => pOrigDataTmp; */
|
176
|
-
nNumAtoms = num_inp_atoms_new + orig_at_data->num_atoms;
|
177
|
-
nNumStereo0D = num_inp_0D_new + orig_at_data->num_stereo0D;
|
178
|
-
if ( nNumAtoms >= MAX_ATOMS ) {
|
179
|
-
MOLFILE_ERR_SET (*err, 0, "Too many atoms");
|
180
|
-
*err = 70;
|
181
|
-
orig_at_data->num_atoms = -1;
|
182
|
-
} else
|
183
|
-
if ( !at_old ) {
|
184
|
-
/* the first structure */
|
185
|
-
orig_at_data->atom = at_new; at_new = NULL;
|
186
|
-
orig_at_data->num_atoms = num_inp_atoms_new; num_inp_atoms_new = 0;
|
187
|
-
orig_at_data->stereo0D = stereo0D_new; stereo0D_new = NULL;
|
188
|
-
orig_at_data->num_stereo0D = num_inp_0D_new; num_inp_0D_new = 0;
|
189
|
-
} else
|
190
|
-
if ( orig_at_data->atom = CreateInchi_Atom( nNumAtoms ) ) {
|
191
|
-
/* switch at_new <--> orig_at_data->at; */
|
192
|
-
if ( orig_at_data->num_atoms ) {
|
193
|
-
memcpy( orig_at_data->atom, at_old, orig_at_data->num_atoms * sizeof(orig_at_data->atom[0]) );
|
194
|
-
/* adjust numbering in the newly read structure */
|
195
|
-
for ( i = 0; i < num_inp_atoms_new; i ++ ) {
|
196
|
-
for ( j = 0; j < at_new[i].num_bonds; j ++ ) {
|
197
|
-
at_new[i].neighbor[j] += orig_at_data->num_atoms;
|
198
|
-
}
|
199
|
-
}
|
200
|
-
}
|
201
|
-
FreeInchi_Atom( &at_old );
|
202
|
-
/* copy newly read structure */
|
203
|
-
memcpy( orig_at_data->atom + orig_at_data->num_atoms,
|
204
|
-
at_new,
|
205
|
-
num_inp_atoms_new * sizeof(orig_at_data->atom[0]) );
|
206
|
-
/* copy newly read 0D stereo */
|
207
|
-
if ( num_inp_0D_new > 0 && stereo0D_new ) {
|
208
|
-
if ( orig_at_data->stereo0D = CreateInchi_Stereo0D( nNumStereo0D ) ) {
|
209
|
-
memcpy( orig_at_data->stereo0D, stereo0D_old, orig_at_data->num_stereo0D * sizeof(orig_at_data->stereo0D[0]) );
|
210
|
-
/* adjust numbering in the newly read structure */
|
211
|
-
for ( i = 0; i < num_inp_0D_new; i ++ ) {
|
212
|
-
if ( stereo0D_new[i].central_atom >= 0 ) {
|
213
|
-
stereo0D_new[i].central_atom += orig_at_data->num_atoms;
|
214
|
-
}
|
215
|
-
for ( j = 0; j < 4; j ++ ) {
|
216
|
-
stereo0D_new[i].neighbor[j] += orig_at_data->num_atoms;
|
217
|
-
}
|
218
|
-
}
|
219
|
-
FreeInchi_Stereo0D( &stereo0D_old );
|
220
|
-
memcpy( orig_at_data->stereo0D+orig_at_data->num_stereo0D,
|
221
|
-
stereo0D_new,
|
222
|
-
num_inp_0D_new * sizeof(orig_at_data->stereo0D[0]) );
|
223
|
-
} else {
|
224
|
-
num_inp_0D_new = 0;
|
225
|
-
MOLFILE_ERR_SET (*err, 0, "Out of RAM");
|
226
|
-
*err = -1;
|
227
|
-
}
|
228
|
-
} else {
|
229
|
-
num_inp_0D_new = 0;
|
230
|
-
}
|
231
|
-
/* update lengths */
|
232
|
-
orig_at_data->num_atoms += num_inp_atoms_new;
|
233
|
-
orig_at_data->num_stereo0D += num_inp_0D_new;
|
234
|
-
} else {
|
235
|
-
MOLFILE_ERR_SET (*err, 0, "Out of RAM");
|
236
|
-
*err = -1;
|
237
|
-
}
|
238
|
-
} else
|
239
|
-
if ( num_inp_atoms_new > 0 ) {
|
240
|
-
nNumAtoms += num_inp_atoms_new;
|
241
|
-
}
|
242
|
-
FreeInchi_Atom( &at_new );
|
243
|
-
num_inp_atoms_new = 0;
|
244
|
-
FreeInchi_Stereo0D( &stereo0D_new );
|
245
|
-
num_inp_0D_new = 0;
|
246
|
-
|
247
|
-
} while ( !*err && bMergeAllInputStructures );
|
248
|
-
/*
|
249
|
-
if ( !*err ) {
|
250
|
-
orig_at_data->num_components =
|
251
|
-
MarkDisconnectedComponents( orig_at_data );
|
252
|
-
if ( orig_at_data->num_components == 0 ) {
|
253
|
-
MOLFILE_ERR_SET (*err, 0, "No components found");
|
254
|
-
*err = 99;
|
255
|
-
}
|
256
|
-
if ( orig_at_data->num_components < 0 ) {
|
257
|
-
MOLFILE_ERR_SET (*err, 0, "Too many components");
|
258
|
-
*err = 99;
|
259
|
-
}
|
260
|
-
}
|
261
|
-
*/
|
262
|
-
if ( szCoordNew ) {
|
263
|
-
inchi_free( szCoordNew );
|
264
|
-
}
|
265
|
-
if ( at_new ) {
|
266
|
-
inchi_free( at_new );
|
267
|
-
}
|
268
|
-
/*
|
269
|
-
if ( !*err ) {
|
270
|
-
if ( ReconcileAllCmlBondParities( orig_at_data->atom, orig_at_data->num_atoms ) ) {
|
271
|
-
MOLFILE_ERR_SET (*err, 0, "Cannot reconcile stereobond parities");
|
272
|
-
if (!orig_at_data->num_atoms) {
|
273
|
-
*err = 1;
|
274
|
-
}
|
275
|
-
}
|
276
|
-
}
|
277
|
-
*/
|
278
|
-
if ( *err ) {
|
279
|
-
FreeInchi_Input( orig_at_data );
|
280
|
-
}
|
281
|
-
if ( *err && !(10 < *err && *err < 20) && pStrErr && !pStrErr[0] ) {
|
282
|
-
MOLFILE_ERR_SET (*err, 0, "Unknown error"); /* <BRKPT> */
|
283
|
-
}
|
284
|
-
return orig_at_data? orig_at_data->num_atoms : nNumAtoms;
|
285
|
-
}
|
286
|
-
|
data/ext/src/inchi_api.h
DELETED
@@ -1,670 +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 __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__ */
|