rino 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/mol2atom.h
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
/*
|
2
|
+
* International Union of Pure and Applied Chemistry (IUPAC)
|
3
|
+
* International Chemical Identifier (InChI)
|
4
|
+
* Version 1
|
5
|
+
* Software version 1.01
|
6
|
+
* July 21, 2006
|
7
|
+
* Developed at NIST
|
8
|
+
*/
|
9
|
+
|
10
|
+
#ifndef __MOL2ATOM_H__
|
11
|
+
#define __MOL2ATOM_H__
|
12
|
+
|
13
|
+
#include "readmol.h"
|
14
|
+
|
15
|
+
#ifndef INCHI_ALL_CPP
|
16
|
+
#ifdef __cplusplus
|
17
|
+
extern "C" {
|
18
|
+
#endif
|
19
|
+
#endif
|
20
|
+
|
21
|
+
void calculate_valences (MOL_DATA* mol_data, inp_ATOM* at, int *num_atoms, int bDoNotAddH, int *err, char *pStrErr);
|
22
|
+
/* void WriteCoord( char *str, double x );*/
|
23
|
+
|
24
|
+
#ifndef INCHI_ALL_CPP
|
25
|
+
#ifdef __cplusplus
|
26
|
+
}
|
27
|
+
#endif
|
28
|
+
#endif
|
29
|
+
|
30
|
+
|
31
|
+
#endif /* __MOL2ATOM_H__ */
|
data/ext/src/readinch.c
ADDED
@@ -0,0 +1,239 @@
|
|
1
|
+
/*
|
2
|
+
* International Union of Pure and Applied Chemistry (IUPAC)
|
3
|
+
* International Chemical Identifier (InChI)
|
4
|
+
* Version 1
|
5
|
+
* Software version 1.01
|
6
|
+
* July 21, 2006
|
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
|
+
#include "mode.h"
|
19
|
+
|
20
|
+
#include "inpdef.h"
|
21
|
+
#include "util.h"
|
22
|
+
#include "readmol.h"
|
23
|
+
|
24
|
+
#include "ichicomp.h"
|
25
|
+
#include "ichierr.h"
|
26
|
+
#include "extr_ct.h"
|
27
|
+
|
28
|
+
#define NO_ATOM (-1) /* non-existent (central) atom */
|
29
|
+
|
30
|
+
#define SB_PARITY_FLAG 0x38 /* disconnected structure has undef. parity */
|
31
|
+
#define SB_PARITY_SHFT 3
|
32
|
+
#define SB_PARITY_MASK 0x07
|
33
|
+
#define SB_PARITY_1(X) (X & SB_PARITY_MASK) /* refers to connected structure */
|
34
|
+
#define SB_PARITY_2(X) (((X) >> SB_PARITY_SHFT) & SB_PARITY_MASK) /* refers to connected structure */
|
35
|
+
|
36
|
+
/* 0D parity types */
|
37
|
+
typedef enum tagINCHIStereoType0D {
|
38
|
+
INCHI_StereoType_None = 0,
|
39
|
+
INCHI_StereoType_DoubleBond = 1,
|
40
|
+
INCHI_StereoType_Tetrahedral = 2,
|
41
|
+
INCHI_StereoType_Allene = 3
|
42
|
+
} inchi_StereoType0D;
|
43
|
+
|
44
|
+
/* 0D parities */
|
45
|
+
typedef enum tagINCHIStereoParity0D {
|
46
|
+
INCHI_PARITY_NONE = AB_PARITY_NONE,
|
47
|
+
INCHI_PARITY_ODD = AB_PARITY_ODD , /* 'o' */
|
48
|
+
INCHI_PARITY_EVEN = AB_PARITY_EVEN, /* 'e' */
|
49
|
+
INCHI_PARITY_UNKNOWN = AB_PARITY_UNKN, /* 'u' */
|
50
|
+
INCHI_PARITY_UNDEFINED = AB_PARITY_UNDF /* '?' -- should not be used; however, see Note above */
|
51
|
+
} inchi_StereoParity0D;
|
52
|
+
|
53
|
+
/* bond type definitions */
|
54
|
+
typedef enum tagINCHIBondType {
|
55
|
+
INCHI_BOND_TYPE_NONE = 0,
|
56
|
+
INCHI_BOND_TYPE_SINGLE = BOND_TYPE_SINGLE,
|
57
|
+
INCHI_BOND_TYPE_DOUBLE = BOND_TYPE_DOUBLE,
|
58
|
+
INCHI_BOND_TYPE_TRIPLE = BOND_TYPE_TRIPLE,
|
59
|
+
INCHI_BOND_TYPE_ALTERN = BOND_TYPE_ALTERN
|
60
|
+
} inchi_BondType;
|
61
|
+
|
62
|
+
/* 2D stereo definitions */
|
63
|
+
typedef enum tagINCHIBondStereo2D {
|
64
|
+
/* stereocenter-related; positive: the sharp end points to this atom */
|
65
|
+
INCHI_BOND_STEREO_NONE = 0,
|
66
|
+
INCHI_BOND_STEREO_SINGLE_1UP = STEREO_SNGL_UP,
|
67
|
+
INCHI_BOND_STEREO_SINGLE_1EITHER = STEREO_SNGL_EITHER,
|
68
|
+
INCHI_BOND_STEREO_SINGLE_1DOWN = STEREO_SNGL_DOWN,
|
69
|
+
/* stereocenter-related; negative: the sharp end points to the opposite atom */
|
70
|
+
INCHI_BOND_STEREO_SINGLE_2UP = -STEREO_SNGL_UP,
|
71
|
+
INCHI_BOND_STEREO_SINGLE_2EITHER = -STEREO_SNGL_EITHER,
|
72
|
+
INCHI_BOND_STEREO_SINGLE_2DOWN = -STEREO_SNGL_DOWN,
|
73
|
+
/* stereobond-related */
|
74
|
+
INCHI_BOND_STEREO_DOUBLE_EITHER = STEREO_DBLE_EITHER
|
75
|
+
} inchi_BondStereo2D;
|
76
|
+
|
77
|
+
/****************************************************************************/
|
78
|
+
typedef struct tagINCHIStereo0D {
|
79
|
+
S_SHORT neighbor[4]; /* 4 atoms always */
|
80
|
+
S_SHORT central_atom; /* central tetrahedral atom or a central */
|
81
|
+
/* atom of allene; otherwise NO_ATOM */
|
82
|
+
S_CHAR type; /* inchi_StereoType0D */
|
83
|
+
S_CHAR parity; /* inchi_StereoParity0D: may be a combination of two parities: */
|
84
|
+
/* ParityOfConnected | (ParityOfDisconnected << 3), see Note above */
|
85
|
+
}inchi_Stereo0D;
|
86
|
+
/****************************************************************************/
|
87
|
+
|
88
|
+
/* This contains executable code. Included in lReadAux.c, e_ReadINCH.c, ReadINCH.c, */
|
89
|
+
#include "aux2atom.h"
|
90
|
+
|
91
|
+
|
92
|
+
int INChIToOrigAtom( FILE *inp_molfile, ORIG_ATOM_DATA *orig_at_data, int bMergeAllInputStructures,
|
93
|
+
int bGetOrigCoord, int bDoNotAddH, INPUT_TYPE nInputType,
|
94
|
+
char *pSdfLabel, char *pSdfValue, long *lSdfId,
|
95
|
+
INCHI_MODE *pInpAtomFlags, int *err, char *pStrErr )
|
96
|
+
{
|
97
|
+
/* inp_ATOM *at = NULL; */
|
98
|
+
int num_dimensions_new;
|
99
|
+
int num_inp_bonds_new;
|
100
|
+
int num_inp_atoms_new;
|
101
|
+
inp_ATOM *at_new = NULL;
|
102
|
+
inp_ATOM *at_old = NULL;
|
103
|
+
int nNumAtoms = 0;
|
104
|
+
MOL_COORD *szCoordNew = NULL;
|
105
|
+
MOL_COORD *szCoordOld = NULL;
|
106
|
+
int i, j;
|
107
|
+
|
108
|
+
if ( pStrErr ) {
|
109
|
+
pStrErr[0] = '\0';
|
110
|
+
}
|
111
|
+
|
112
|
+
/*FreeOrigAtData( orig_at_data );*/
|
113
|
+
if ( lSdfId )
|
114
|
+
*lSdfId = 0;
|
115
|
+
do {
|
116
|
+
|
117
|
+
at_old = orig_at_data? orig_at_data->at : NULL; /* save pointer to the previous allocation */
|
118
|
+
szCoordOld = orig_at_data? orig_at_data->szCoord : NULL;
|
119
|
+
num_inp_atoms_new =
|
120
|
+
INChIToInpAtom( inp_molfile, (bGetOrigCoord && orig_at_data)? &szCoordNew : NULL,
|
121
|
+
bDoNotAddH, nInputType, orig_at_data? &at_new:NULL,
|
122
|
+
MAX_ATOMS,
|
123
|
+
&num_dimensions_new, &num_inp_bonds_new,
|
124
|
+
pSdfLabel, pSdfValue, lSdfId, pInpAtomFlags, err, pStrErr );
|
125
|
+
if ( num_inp_atoms_new <= 0 && !*err ) {
|
126
|
+
MOLFILE_ERR_SET (*err, 0, "Empty structure");
|
127
|
+
*err = 98;
|
128
|
+
} else
|
129
|
+
if ( orig_at_data && !num_inp_atoms_new && 10 < *err && *err < 20 && orig_at_data->num_inp_atoms > 0 && bMergeAllInputStructures ) {
|
130
|
+
*err = 0; /* end of file */
|
131
|
+
break;
|
132
|
+
} else
|
133
|
+
if ( num_inp_atoms_new > 0 && orig_at_data ) {
|
134
|
+
/* merge pOrigDataTmp + orig_at_data => pOrigDataTmp; */
|
135
|
+
nNumAtoms = num_inp_atoms_new + orig_at_data->num_inp_atoms;
|
136
|
+
if ( nNumAtoms >= MAX_ATOMS ) {
|
137
|
+
MOLFILE_ERR_SET (*err, 0, "Too many atoms");
|
138
|
+
*err = 70;
|
139
|
+
orig_at_data->num_inp_atoms = -1;
|
140
|
+
} else
|
141
|
+
if ( !at_old ) {
|
142
|
+
/* the first structure */
|
143
|
+
orig_at_data->at = at_new;
|
144
|
+
orig_at_data->szCoord = szCoordNew;
|
145
|
+
at_new = NULL;
|
146
|
+
szCoordNew = NULL;
|
147
|
+
orig_at_data->num_inp_atoms = num_inp_atoms_new;
|
148
|
+
orig_at_data->num_inp_bonds = num_inp_bonds_new;
|
149
|
+
orig_at_data->num_dimensions = num_dimensions_new;
|
150
|
+
} else
|
151
|
+
if ( (orig_at_data->at = ( inp_ATOM* ) inchi_calloc( nNumAtoms, sizeof(inp_ATOM) )) &&
|
152
|
+
(!szCoordNew || (orig_at_data->szCoord = (MOL_COORD *) inchi_calloc( nNumAtoms, sizeof(MOL_COORD) ))) ) {
|
153
|
+
/* switch at_new <--> orig_at_data->at; */
|
154
|
+
if ( orig_at_data->num_inp_atoms ) {
|
155
|
+
memcpy( orig_at_data->at, at_old, orig_at_data->num_inp_atoms * sizeof(orig_at_data->at[0]) );
|
156
|
+
/* adjust numbering in the newly read structure */
|
157
|
+
for ( i = 0; i < num_inp_atoms_new; i ++ ) {
|
158
|
+
for ( j = 0; j < at_new[i].valence; j ++ ) {
|
159
|
+
at_new[i].neighbor[j] += orig_at_data->num_inp_atoms;
|
160
|
+
}
|
161
|
+
at_new[i].orig_at_number += orig_at_data->num_inp_atoms; /* 12-19-2003 */
|
162
|
+
}
|
163
|
+
if ( orig_at_data->szCoord && szCoordOld ) {
|
164
|
+
memcpy( orig_at_data->szCoord, szCoordOld, orig_at_data->num_inp_atoms * sizeof(MOL_COORD) );
|
165
|
+
}
|
166
|
+
}
|
167
|
+
if ( at_old ) {
|
168
|
+
inchi_free( at_old );
|
169
|
+
at_old = NULL;
|
170
|
+
}
|
171
|
+
if ( szCoordOld ) {
|
172
|
+
inchi_free( szCoordOld );
|
173
|
+
szCoordOld = NULL;
|
174
|
+
}
|
175
|
+
/* copy newly read structure */
|
176
|
+
memcpy( orig_at_data->at + orig_at_data->num_inp_atoms,
|
177
|
+
at_new,
|
178
|
+
num_inp_atoms_new * sizeof(orig_at_data->at[0]) );
|
179
|
+
if ( orig_at_data->szCoord && szCoordNew ) {
|
180
|
+
memcpy( orig_at_data->szCoord + orig_at_data->num_inp_atoms,
|
181
|
+
szCoordNew,
|
182
|
+
num_inp_atoms_new * sizeof(MOL_COORD) );
|
183
|
+
}
|
184
|
+
/* add other things */
|
185
|
+
orig_at_data->num_inp_atoms += num_inp_atoms_new;
|
186
|
+
orig_at_data->num_inp_bonds += num_inp_bonds_new;
|
187
|
+
orig_at_data->num_dimensions = inchi_max(num_dimensions_new, orig_at_data->num_dimensions);
|
188
|
+
} else {
|
189
|
+
MOLFILE_ERR_SET (*err, 0, "Out of RAM");
|
190
|
+
*err = -1;
|
191
|
+
}
|
192
|
+
} else
|
193
|
+
if ( num_inp_atoms_new > 0 ) {
|
194
|
+
nNumAtoms += num_inp_atoms_new;
|
195
|
+
}
|
196
|
+
if ( at_new ) {
|
197
|
+
inchi_free( at_new );
|
198
|
+
at_new = NULL;
|
199
|
+
}
|
200
|
+
|
201
|
+
} while ( !*err && bMergeAllInputStructures );
|
202
|
+
/*
|
203
|
+
if ( !*err ) {
|
204
|
+
orig_at_data->num_components =
|
205
|
+
MarkDisconnectedComponents( orig_at_data );
|
206
|
+
if ( orig_at_data->num_components == 0 ) {
|
207
|
+
MOLFILE_ERR_SET (*err, 0, "No components found");
|
208
|
+
*err = 99;
|
209
|
+
}
|
210
|
+
if ( orig_at_data->num_components < 0 ) {
|
211
|
+
MOLFILE_ERR_SET (*err, 0, "Too many components");
|
212
|
+
*err = 99;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
*/
|
216
|
+
if ( szCoordNew ) {
|
217
|
+
inchi_free( szCoordNew );
|
218
|
+
}
|
219
|
+
if ( at_new ) {
|
220
|
+
inchi_free( at_new );
|
221
|
+
}
|
222
|
+
if ( !*err && orig_at_data ) { /* added testing (orig_at_data != NULL) */
|
223
|
+
if ( ReconcileAllCmlBondParities( orig_at_data->at, orig_at_data->num_inp_atoms, 0 ) ) {
|
224
|
+
MOLFILE_ERR_SET (*err, 0, "Cannot reconcile stereobond parities"); /* <BRKPT> */
|
225
|
+
if (!orig_at_data->num_dimensions) {
|
226
|
+
*err = 1;
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
230
|
+
if ( *err ) {
|
231
|
+
FreeOrigAtData( orig_at_data );
|
232
|
+
}
|
233
|
+
if ( *err && !(10 < *err && *err < 20) && pStrErr && !pStrErr[0] ) {
|
234
|
+
MOLFILE_ERR_SET (*err, 0, "Unknown error"); /* <BRKPT> */
|
235
|
+
}
|
236
|
+
return orig_at_data? orig_at_data->num_inp_atoms : nNumAtoms;
|
237
|
+
}
|
238
|
+
|
239
|
+
|
data/ext/src/readmol.c
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
/*
|
2
|
+
* International Union of Pure and Applied Chemistry (IUPAC)
|
3
|
+
* International Chemical Identifier (InChI)
|
4
|
+
* Version 1
|
5
|
+
* Software version 1.01
|
6
|
+
* July 21, 2006
|
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
|
+
#include "mode.h"
|
19
|
+
|
20
|
+
#include "comdef.h"
|
21
|
+
#include "util.h"
|
22
|
+
#include "readmol.h"
|
23
|
+
|
24
|
+
#include "ichicomp.h"
|
25
|
+
#include "inpdef.h"
|
26
|
+
|
27
|
+
|
28
|
+
#include "lreadmol.h"
|
@@ -2,8 +2,8 @@
|
|
2
2
|
* International Union of Pure and Applied Chemistry (IUPAC)
|
3
3
|
* International Chemical Identifier (InChI)
|
4
4
|
* Version 1
|
5
|
-
* Software version 1.
|
6
|
-
*
|
5
|
+
* Software version 1.01
|
6
|
+
* July 21, 2006
|
7
7
|
* Developed at NIST
|
8
8
|
*/
|
9
9
|
|
@@ -77,7 +77,7 @@ typedef struct tagMOL_ATOM {
|
|
77
77
|
double fY; /* F10.5; Generic */
|
78
78
|
double fZ; /* F10.5; Generic */
|
79
79
|
char szAtomSymbol[6]; /* aaa; Generic */ /* changed from 4 to 6 to match STDATA */
|
80
|
-
|
80
|
+
S_CHAR cMassDifference; /* dd; (M_ISO) Generic: -3..+4 otherwise 0 or 127=most abund. isotope */
|
81
81
|
S_CHAR cCharge; /* ccc; (M CHG), Generic: 1=+3,2=+2,3=+1,4=doublet,5=-1,6=-2,7=-3 */
|
82
82
|
char cRadical; /* (M RAD) */
|
83
83
|
char cStereoParity; /* sss; Generic */
|
@@ -128,8 +128,8 @@ typedef struct tagMOL_BONDS {
|
|
128
128
|
/****************************************************************************/
|
129
129
|
typedef struct tagMOL_CTAB {
|
130
130
|
/* Line #1: Counts line */
|
131
|
-
short nNumberOfAtoms; /* aaa; <=
|
132
|
-
short nNumberOfBonds; /* bbb; <=
|
131
|
+
short nNumberOfAtoms; /* aaa; <= 255; Generic */
|
132
|
+
short nNumberOfBonds; /* bbb; <= 255; Generic */
|
133
133
|
#if ( MOL_QUERY == MOL_PRESENT )
|
134
134
|
short nNumberOfAtomsLists; /* lll; <= 30; Query */
|
135
135
|
#endif
|
@@ -162,15 +162,13 @@ extern "C" {
|
|
162
162
|
#endif
|
163
163
|
|
164
164
|
|
165
|
-
MOL_DATA*
|
166
|
-
|
167
|
-
MOL_DATA* e_read_sdfile_segment(FILE* inp, MOL_HEADER_BLOCK *OnlyHeaderBlock, MOL_CTAB *OnlyCtab,
|
165
|
+
MOL_DATA* delete_mol_data( MOL_DATA* mol_data );
|
166
|
+
MOL_DATA* read_sdfile_segment(FILE* inp, MOL_HEADER_BLOCK *OnlyHeaderBlock, MOL_CTAB *OnlyCtab,
|
168
167
|
int bGetOrigCoord,
|
169
168
|
char *pname, int lname,
|
170
169
|
long *Id, const char *pSdfLabel, char *pSdfValue,
|
171
170
|
int *err, char *pStrErr );
|
172
171
|
|
173
|
-
|
174
172
|
#ifndef INCHI_ALL_CPP
|
175
173
|
#ifdef __cplusplus
|
176
174
|
}
|
data/ext/src/runichi.c
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
* International Union of Pure and Applied Chemistry (IUPAC)
|
3
3
|
* International Chemical Identifier (InChI)
|
4
4
|
* Version 1
|
5
|
-
* Software version 1.
|
6
|
-
*
|
5
|
+
* Software version 1.01
|
6
|
+
* July 21, 2006
|
7
7
|
* Developed at NIST
|
8
8
|
*/
|
9
9
|
|
@@ -58,7 +58,7 @@
|
|
58
58
|
int GetProcessingWarningsOneINChI(INChI *pINChI, INP_ATOM_DATA *inp_norm_data, char *pStrErrStruct);
|
59
59
|
int GetProcessingWarnings(INChI *cur_INChI[], INP_ATOM_DATA **inp_norm_data, STRUCT_DATA *sd);
|
60
60
|
int DisplayTheWholeStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, FILE *inp_file, INCHI_FILE *log_file,
|
61
|
-
ORIG_ATOM_DATA *orig_inp_data,
|
61
|
+
ORIG_ATOM_DATA *orig_inp_data, long num_inp, int iINChI, int bShowStruct, int bINCHI_LIB_Flag );
|
62
62
|
int DuplicateOrigAtom( ORIG_ATOM_DATA *new_orig_atom, ORIG_ATOM_DATA *orig_atom );
|
63
63
|
int bCheckUnusualValences( ORIG_ATOM_DATA *orig_at_data, int bAddIsoH, char *pStrErrStruct );
|
64
64
|
int CreateCompositeNormAtom( COMP_ATOM_DATA *composite_norm_data, INP_ATOM_DATA2 *all_inp_norm_data,
|
@@ -86,7 +86,7 @@ typedef struct tagRenumbData {
|
|
86
86
|
PINChI_Aux2 ren_INChI_Aux[1];
|
87
87
|
INP_ATOM_DATA orig_inp_cur_data;
|
88
88
|
INP_ATOM_DATA saved_inp_cur_data;
|
89
|
-
#if( TEST_RENUMB_ATOMS_SAVE_LONGEST == 1 )
|
89
|
+
#if( TEST_RENUMB_ATOMS_SAVE_LONGEST == 1 || TEST_RENUMB_SWITCH == 1 )
|
90
90
|
INP_ATOM_DATA longest_inp_cur_data;
|
91
91
|
#endif
|
92
92
|
INP_ATOM_DATA ren_inp_norm_data1, ren_inp_norm_data2;
|
@@ -108,11 +108,11 @@ int RenumberingTestUninit( RENUMB_DATA *pRenumbData );
|
|
108
108
|
int RenumberingTest( PINChI2 *pICh, PINChI_Aux2 *pINChI_Aux, ORIG_ATOM_DATA *orig_inp_data, int iINChI,
|
109
109
|
RENUMB_DATA *pRenumbData, INP_ATOM_DATA *inp_cur_data, INP_ATOM_DATA **inp_norm_data,
|
110
110
|
STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, INCHI_FILE *log_file, INCHI_FILE *prb_file,
|
111
|
-
int i,
|
111
|
+
int i, long num_inp, NORM_CANON_FLAGS *pncFlags);
|
112
112
|
/*
|
113
113
|
int RenumberingTest( INChI *pINChI[][TAUT_NUM], INChI_Aux *pINChI_Aux[][TAUT_NUM], int iINChI,
|
114
114
|
RENUMB_DATA *pRenumbData, INP_ATOM_DATA *inp_cur_data, INP_ATOM_DATA **inp_norm_data,
|
115
|
-
STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, INCHI_FILE *log_file, int i,
|
115
|
+
STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, INCHI_FILE *log_file, int i, long num_inp);
|
116
116
|
*/
|
117
117
|
#endif /* } TEST_RENUMB_ATOMS */
|
118
118
|
|
@@ -416,7 +416,7 @@ int inchi_print( INCHI_FILE* f, const char* lpszFormat, ... )
|
|
416
416
|
} else {
|
417
417
|
/* printf( "\r" ); */
|
418
418
|
my_va_start( argList, lpszFormat );
|
419
|
-
|
419
|
+
ret2 = vfprintf( stdout, lpszFormat, argList );
|
420
420
|
/* ret2 = vprintf( lpszFormat, argList ); */
|
421
421
|
va_end( argList );
|
422
422
|
}
|
@@ -508,8 +508,10 @@ int inchi_print_nodisplay( INCHI_FILE* f, const char* lpszFormat, ... )
|
|
508
508
|
int my_fprintf( INCHI_FILE* f, const char* lpszFormat, ... )
|
509
509
|
{
|
510
510
|
if ( f ) {
|
511
|
-
int ret=0, max_len;
|
511
|
+
int ret=0, max_len, nAddLength = 0;
|
512
|
+
char *new_str = NULL;
|
512
513
|
va_list argList;
|
514
|
+
|
513
515
|
my_va_start( argList, lpszFormat );
|
514
516
|
max_len = GetMaxPrintfLength( lpszFormat, argList);
|
515
517
|
va_end( argList );
|
@@ -517,8 +519,8 @@ int my_fprintf( INCHI_FILE* f, const char* lpszFormat, ... )
|
|
517
519
|
if ( max_len >= 0 ) {
|
518
520
|
if ( f->nAllocatedLength - f->nUsedLength <= max_len ) {
|
519
521
|
/* enlarge output string */
|
520
|
-
|
521
|
-
|
522
|
+
nAddLength = inchi_max( INCHI_ADD_STR_LEN, max_len );
|
523
|
+
new_str = (char *)inchi_calloc( f->nAllocatedLength + nAddLength, sizeof(new_str[0]) );
|
522
524
|
if ( new_str ) {
|
523
525
|
if ( f->pStr ) {
|
524
526
|
if ( f->nUsedLength > 0 ) {
|
@@ -577,9 +579,9 @@ int my_fprintf( INCHI_FILE* f, const char* lpszFormat, ... )
|
|
577
579
|
va_end( argList );
|
578
580
|
}
|
579
581
|
}
|
580
|
-
if ( f != stderr ) {
|
582
|
+
if ( f && f != stderr ) { /* disabled stderr output in case f == NULL. 11-23-2005 */
|
581
583
|
my_va_start( argList, lpszFormat );
|
582
|
-
|
584
|
+
ret2 = vfprintf( stderr, lpszFormat, argList );
|
583
585
|
va_end( argList );
|
584
586
|
}
|
585
587
|
#else
|
@@ -603,8 +605,9 @@ void FillTableParms( SET_DRAW_PARMS *sdp, INChI **cur_INChI, INChI_Aux **cur_INC
|
|
603
605
|
int i, j;
|
604
606
|
INChI_Stereo *Stereo;
|
605
607
|
int bShowTaut = (cur_INChI && cur_INChI[indx]->lenTautomer > 0)? 1 : 0;
|
608
|
+
#if( REL_RAC_STEREO_IGN_1_SC == 1 )
|
606
609
|
int bRelRac = 0 != (nMode & (REQ_MODE_RELATIVE_STEREO | REQ_MODE_RACEMIC_STEREO ));
|
607
|
-
|
610
|
+
#endif
|
608
611
|
if ( !cur_INChI || !cur_INChI_Aux ) {
|
609
612
|
sdp->tdp->bDrawTbl = 0;
|
610
613
|
sdp->bOrigAtom = 1;
|
@@ -743,7 +746,7 @@ void FillCompositeTableParms( SET_DRAW_PARMS *sdp, AT_NUMB StereoFlags,
|
|
743
746
|
#ifndef INCHI_ANSI_ONLY
|
744
747
|
#ifndef INCHI_LIB
|
745
748
|
/*******************************************************************/
|
746
|
-
int DisplayStructure( inp_ATOM *at, int num_at, int num_removed_H,
|
749
|
+
int DisplayStructure( inp_ATOM *at, int num_at, int num_removed_H, int bAdd_DT_to_num_H,
|
747
750
|
int nNumRemovedProtons, NUM_H *nNumRemovedProtonsIsotopic,
|
748
751
|
int bIsotopic, int j /*bTautomeric*/,
|
749
752
|
INChI **cur_INChI, INChI_Aux **cur_INChI_Aux,
|
@@ -753,8 +756,8 @@ int DisplayStructure( inp_ATOM *at, int num_at, int num_removed_H,
|
|
753
756
|
int err = -1;
|
754
757
|
if ( CreateInfoAtomData( &inf_data, num_at, 1 ) ) {
|
755
758
|
err = 0;
|
756
|
-
FillOutInfAtom( at, &inf_data, num_at, num_removed_H,
|
757
|
-
nNumRemovedProtonsIsotopic, bIsotopic,
|
759
|
+
FillOutInfAtom( at, &inf_data, num_at, num_removed_H, bAdd_DT_to_num_H,
|
760
|
+
nNumRemovedProtons, nNumRemovedProtonsIsotopic, bIsotopic,
|
758
761
|
cur_INChI?cur_INChI[j]:NULL,
|
759
762
|
cur_INChI_Aux?cur_INChI_Aux[j]:NULL, bAbcNumbers, nMode);
|
760
763
|
FillTableParms( &dp->sdp, cur_INChI, cur_INChI_Aux, nMode, bIsotopic, j );
|
@@ -783,7 +786,7 @@ int DisplayCompositeStructure( COMP_ATOM_DATA *composite_norm_data, int bIsotopi
|
|
783
786
|
if ( bTautomeric == TAUT_INI ) {
|
784
787
|
/*
|
785
788
|
FillOutInfAtom( (composite_norm_data+bTautomeric)->at, &inf_data, (composite_norm_data+bTautomeric)->num_at,
|
786
|
-
(composite_norm_data+bTautomeric)->num_removed_H,
|
789
|
+
(composite_norm_data+bTautomeric)->num_removed_H, bAdd_DT_to_num_H,
|
787
790
|
(composite_norm_data+bTautomeric)->nNumRemovedProtons,
|
788
791
|
(composite_norm_data+bTautomeric)->nNumRemovedProtonsIsotopic, bIsotopic,
|
789
792
|
NULL, NULL, bAbcNumbers, nMode);
|
@@ -835,9 +838,11 @@ const char *ErrMsg( int nErrorCode )
|
|
835
838
|
case CT_CALC_STEREO_ERR: p = "CALC_STEREO_ERR"; break;
|
836
839
|
case CT_STEREO_CANON_ERR: p = "STEREO_CANON_ERR"; break;
|
837
840
|
case CT_CANON_ERR: p = "CANON_ERR"; break;
|
841
|
+
case CT_WRONG_FORMULA: p = "Wrong or missing chemical formula"; break;
|
838
842
|
/*case CT_CANON_ERR2: p = "CT_CANON_ERR2"; break;*/
|
839
843
|
case CT_UNKNOWN_ERR: p = "UNKNOWN_ERR"; break;
|
840
|
-
case BNS_RADICAL_ERR: p = "Cannot process free radical center";
|
844
|
+
case BNS_RADICAL_ERR: p = "Cannot process free radical center"; break;
|
845
|
+
case BNS_ALTBOND_ERR: p = "Cannot process aromatic bonds"; break;
|
841
846
|
|
842
847
|
default:
|
843
848
|
if ( nErrorCode > CT_UNKNOWN_ERR ) {
|
@@ -970,7 +975,7 @@ int SaveEquComponentsInfoAndSortOrder ( int iINChI, INCHI_SORT *pINChISort[TAUT_
|
|
970
975
|
}
|
971
976
|
|
972
977
|
/************************************************************************************************/
|
973
|
-
int DisplayTheWholeCompositeStructure( INPUT_PARMS *ip, STRUCT_DATA *sd,
|
978
|
+
int DisplayTheWholeCompositeStructure( INPUT_PARMS *ip, STRUCT_DATA *sd, long num_inp, int iINChI,
|
974
979
|
PINChI2 *pINChI2, PINChI_Aux2 *pINChI_Aux2,
|
975
980
|
ORIG_ATOM_DATA *orig_inp_data, ORIG_ATOM_DATA *prep_inp_data,
|
976
981
|
COMP_ATOM_DATA composite_norm_data[TAUT_NUM+1] )
|
@@ -1021,7 +1026,7 @@ int DisplayTheWholeCompositeStructure( INPUT_PARMS *ip, STRUCT_DATA *sd, int num
|
|
1021
1026
|
for ( k = 0; k <= composite_norm_data[j].bHasIsotopicLayer && !sd->bUserQuitComponentDisplay; k ++ ) {
|
1022
1027
|
/* added number of components, added another format for a single component case - DCh */
|
1023
1028
|
int bMobileH = (bDisplayTaut>0 && nNumTautComponents);
|
1024
|
-
sprintf( szTitle, "%s Structure #%
|
1029
|
+
sprintf( szTitle, "%s Structure #%ld%s%s.%s%s%s%s%s",
|
1025
1030
|
j == TAUT_INI? "Preprocessed":"Result for", num_inp,
|
1026
1031
|
bMobileH? ", mobile H":
|
1027
1032
|
bDisplayTaut==0?", fixed H":"",
|
@@ -1050,7 +1055,7 @@ int DisplayTheWholeCompositeStructure( INPUT_PARMS *ip, STRUCT_DATA *sd, int num
|
|
1050
1055
|
int bDisplaySaved = ip->bDisplay;
|
1051
1056
|
/****** Display Equ Sets of composite Result structure **************/
|
1052
1057
|
for ( nEquSet = 1; nEquSet <= inp_data->nNumEquSets; nEquSet ++ ) {
|
1053
|
-
sprintf( szTitle, "Equ set %d of %d, %s Structure #%
|
1058
|
+
sprintf( szTitle, "Equ set %d of %d, %s Structure #%ld%s%s.%s%s%s%s%s",
|
1054
1059
|
nEquSet, inp_data->nNumEquSets,
|
1055
1060
|
j == TAUT_INI? "Preprocessed":"Result for",
|
1056
1061
|
num_inp,
|
@@ -1178,7 +1183,7 @@ int DisplayTheWholeCompositeStructure( INPUT_PARMS *ip, STRUCT_DATA *sd, int num
|
|
1178
1183
|
/* num_components[INCHI_BAS] > 0 if there was input structure */
|
1179
1184
|
/***********************************************************************************/
|
1180
1185
|
/* pINChI[INCHI_REC] refers to the reconnected structure, */
|
1181
|
-
/* and only if the
|
1186
|
+
/* and only if the input structure has been disconnected, that is,*/
|
1182
1187
|
/* num_components[INCHI_REC] > 0 */
|
1183
1188
|
/***********************************************************************************/
|
1184
1189
|
int SortAndPrintINChI( INCHI_FILE *output_file, char *pStr, int nStrLen, INCHI_FILE *log_file,
|
@@ -1187,7 +1192,7 @@ int SortAndPrintINChI( INCHI_FILE *output_file, char *pStr, int nStrLen, INCHI_F
|
|
1187
1192
|
ORIG_STRUCT *pOrigStruct, int num_components[INCHI_NUM],
|
1188
1193
|
int num_non_taut[INCHI_NUM], int num_taut[INCHI_NUM],
|
1189
1194
|
INCHI_MODE bTautFlags[INCHI_NUM], INCHI_MODE bTautFlagsDone[INCHI_NUM],
|
1190
|
-
NORM_CANON_FLAGS *pncFlags,
|
1195
|
+
NORM_CANON_FLAGS *pncFlags, long num_inp,
|
1191
1196
|
PINChI2 *pINChI[INCHI_NUM], PINChI_Aux2 *pINChI_Aux[INCHI_NUM], int *pSortPrintINChIFlags )
|
1192
1197
|
{
|
1193
1198
|
INCHI_SORT *pINChISort[INCHI_NUM][TAUT_NUM];
|
@@ -1195,7 +1200,11 @@ int SortAndPrintINChI( INCHI_FILE *output_file, char *pStr, int nStrLen, INCHI_F
|
|
1195
1200
|
INCHI_MODE nMode;
|
1196
1201
|
int bDisconnectedCoord = (0 != (bTautFlagsDone[0] & TG_FLAG_DISCONNECT_COORD_DONE));
|
1197
1202
|
int bINChIOutputOptions0, bCurOption, bINChIOutputOptionsCur, bEmbedReconnected, bAnnInXmlBrackets;
|
1198
|
-
|
1203
|
+
#if( SPECIAL_BUILD == 1 )
|
1204
|
+
static const char szAnnHdr[] = "MoChI ANNOTATED CONTENTS";
|
1205
|
+
#else
|
1206
|
+
static const char szAnnHdr[] = "InChI ANNOTATED CONTENTS";
|
1207
|
+
#endif
|
1199
1208
|
|
1200
1209
|
ret = 1;
|
1201
1210
|
for ( i = 0; i < INCHI_NUM; i ++ ) {
|
@@ -1225,7 +1234,7 @@ int SortAndPrintINChI( INCHI_FILE *output_file, char *pStr, int nStrLen, INCHI_F
|
|
1225
1234
|
}
|
1226
1235
|
} else {
|
1227
1236
|
for ( k1 = 0; k1 < TAUT_NUM; k1 ++ ) {
|
1228
|
-
pINChISort[j][k1] = NULL;
|
1237
|
+
pINChISort[j][k1] = NULL; /* keep BC happy */
|
1229
1238
|
}
|
1230
1239
|
}
|
1231
1240
|
}
|
@@ -1284,83 +1293,115 @@ int SortAndPrintINChI( INCHI_FILE *output_file, char *pStr, int nStrLen, INCHI_F
|
|
1284
1293
|
}
|
1285
1294
|
#endif
|
1286
1295
|
}
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
INCHI_OUT_XML_TEXT_COMMENTS);
|
1294
|
-
bEmbedReconnected = ip->bINChIOutputOptions & INCHI_OUT_EMBED_REC;
|
1295
|
-
|
1296
|
-
for ( i = 0; i < 4; i ++ ) {
|
1297
|
-
switch( i ) {
|
1298
|
-
case 0:
|
1299
|
-
bCurOption = INCHI_OUT_XML;
|
1300
|
-
break;
|
1301
|
-
case 1:
|
1302
|
-
bCurOption = INCHI_OUT_PLAIN_TEXT;
|
1303
|
-
break;
|
1304
|
-
case 2:
|
1305
|
-
bCurOption = INCHI_OUT_PLAIN_TEXT_COMMENTS;
|
1306
|
-
break;
|
1307
|
-
case 3:
|
1308
|
-
bCurOption = INCHI_OUT_XML_TEXT_COMMENTS;
|
1309
|
-
break;
|
1310
|
-
default:
|
1311
|
-
continue;
|
1312
|
-
}
|
1313
|
-
if ( ip->bINChIOutputOptions & bCurOption ) {
|
1314
|
-
bAnnInXmlBrackets = 0;
|
1315
|
-
if ( i == 1 ) {
|
1316
|
-
;/*bEmbedReconnected = 0;*/
|
1296
|
+
|
1297
|
+
if ( !( ip->bINChIOutputOptions & INCHI_OUT_PRINT_OPTIONS ) ) {
|
1298
|
+
/* prepare InChI from the structures obtained by reversing InChI for returning to the caller */
|
1299
|
+
for ( j = 0; j < INCHI_NUM; j ++ ) {
|
1300
|
+
if ( !num_components[j] ) {
|
1301
|
+
continue;
|
1317
1302
|
}
|
1318
|
-
|
1319
|
-
|
1303
|
+
/* pINChI[iINCHI][iComponent][bTaut] */
|
1304
|
+
/* j = disconnected/connected */
|
1305
|
+
/* k1 = sort order for Mobile or Fixed H */
|
1306
|
+
k1 = TAUT_YES; /* in Mobile H order */
|
1307
|
+
/* store components in Mobile H order */
|
1308
|
+
|
1309
|
+
for ( i = 0; i < num_components[j]; i ++ ) {
|
1310
|
+
|
1311
|
+
if ( pINChISort[j][k1][i].pINChI[TAUT_NON] &&
|
1312
|
+
!pINChISort[j][k1][i].pINChI[TAUT_YES] ) {
|
1313
|
+
/* make sure Mobile-H is always present */
|
1314
|
+
for ( k = 0; k < TAUT_NUM; k ++ ) {
|
1315
|
+
pINChI[j][i][k] = pINChISort[j][k1][i].pINChI[ALT_TAUT(k)];
|
1316
|
+
pINChI_Aux[j][i][k] = pINChISort[j][k1][i].pINChI_Aux[ALT_TAUT(k)];
|
1317
|
+
}
|
1318
|
+
} else {
|
1319
|
+
|
1320
|
+
for ( k = 0; k < TAUT_NUM; k ++ ) {
|
1321
|
+
pINChI[j][i][k] = pINChISort[j][k1][i].pINChI[k];
|
1322
|
+
pINChI_Aux[j][i][k] = pINChISort[j][k1][i].pINChI_Aux[k];
|
1323
|
+
}
|
1324
|
+
}
|
1320
1325
|
}
|
1321
|
-
|
1322
|
-
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
} else {
|
1329
|
+
|
1330
|
+
/* print inchi string(s) */
|
1331
|
+
|
1332
|
+
bINChIOutputOptions0 = ip->bINChIOutputOptions & ~INCHI_OUT_PRINT_OPTIONS;
|
1333
|
+
|
1334
|
+
bEmbedReconnected = ip->bINChIOutputOptions & INCHI_OUT_EMBED_REC;
|
1335
|
+
|
1336
|
+
for ( i = 0; i < 4; i ++ ) {
|
1337
|
+
switch( i ) {
|
1323
1338
|
case 0:
|
1339
|
+
bCurOption = INCHI_OUT_XML;
|
1340
|
+
break;
|
1324
1341
|
case 1:
|
1325
|
-
|
1326
|
-
bINChIOutputOptionsCur |= bEmbedReconnected;
|
1342
|
+
bCurOption = INCHI_OUT_PLAIN_TEXT;
|
1327
1343
|
break;
|
1328
1344
|
case 2:
|
1345
|
+
bCurOption = INCHI_OUT_PLAIN_TEXT_COMMENTS;
|
1346
|
+
break;
|
1329
1347
|
case 3:
|
1330
|
-
|
1331
|
-
bAnnInXmlBrackets = (i == 2 && (ip->bINChIOutputOptions & INCHI_OUT_XML ));
|
1332
|
-
if ( bAnnInXmlBrackets ) {
|
1333
|
-
inchi_print( output_file, "\n<%s>\n", szAnnHdr );
|
1334
|
-
} else {
|
1335
|
-
inchi_print( output_file, "\n==== %s ====\n", szAnnHdr );
|
1336
|
-
}
|
1337
|
-
bINChIOutputOptionsCur |= bEmbedReconnected;
|
1338
|
-
bINChIOutputOptionsCur &= ~INCHI_OUT_TABBED_OUTPUT;
|
1348
|
+
bCurOption = INCHI_OUT_XML_TEXT_COMMENTS;
|
1339
1349
|
break;
|
1340
1350
|
default:
|
1341
1351
|
continue;
|
1342
1352
|
}
|
1353
|
+
if ( ip->bINChIOutputOptions & bCurOption ) {
|
1354
|
+
bAnnInXmlBrackets = 0;
|
1355
|
+
if ( i == 1 ) {
|
1356
|
+
;/*bEmbedReconnected = 0;*/
|
1357
|
+
}
|
1358
|
+
if ( i == 3 ) {
|
1359
|
+
bCurOption = INCHI_OUT_XML; /* xml output as annotation */
|
1360
|
+
}
|
1361
|
+
bINChIOutputOptionsCur = bINChIOutputOptions0 | bCurOption;
|
1362
|
+
switch ( i ) {
|
1363
|
+
case 0:
|
1364
|
+
case 1:
|
1365
|
+
/* output INChI */
|
1366
|
+
bINChIOutputOptionsCur |= bEmbedReconnected;
|
1367
|
+
break;
|
1368
|
+
case 2:
|
1369
|
+
case 3:
|
1370
|
+
/* output annotation */
|
1371
|
+
bAnnInXmlBrackets = (i == 2 && (ip->bINChIOutputOptions & INCHI_OUT_XML ));
|
1372
|
+
if ( bAnnInXmlBrackets ) {
|
1373
|
+
inchi_print( output_file, "\n<%s>\n", szAnnHdr );
|
1374
|
+
} else {
|
1375
|
+
inchi_print( output_file, "\n==== %s ====\n", szAnnHdr );
|
1376
|
+
}
|
1377
|
+
bINChIOutputOptionsCur |= bEmbedReconnected;
|
1378
|
+
bINChIOutputOptionsCur &= ~INCHI_OUT_TABBED_OUTPUT;
|
1379
|
+
break;
|
1380
|
+
default:
|
1381
|
+
continue;
|
1382
|
+
}
|
1343
1383
|
|
1344
|
-
|
1345
|
-
bDisconnectedCoord, OUT_TN, bINChIOutputOptionsCur, 0 != (bINChIOutputOptionsCur & INCHI_OUT_XML),
|
1346
|
-
ip->bAbcNumbers, ip->bCtPredecessors, ip->bNoStructLabels,
|
1347
|
-
num_components, num_non_taut, num_taut,
|
1348
|
-
output_file, log_file, num_inp,
|
1349
|
-
ip->pSdfLabel,ip->pSdfValue, ip->lSdfId, pSortPrintINChIFlags );
|
1350
|
-
|
1351
|
-
if ( ret && !(bINChIOutputOptionsCur & INCHI_OUT_EMBED_REC) ) {
|
1352
|
-
ret &= OutputINChI2( pStr, nStrLen, pINChISort, INCHI_REC /*iINChI*/, pOrigStruct,
|
1384
|
+
ret &= OutputINChI2( pStr, nStrLen, pINChISort, INCHI_BAS /*iINChI*/, pOrigStruct,
|
1353
1385
|
bDisconnectedCoord, OUT_TN, bINChIOutputOptionsCur, 0 != (bINChIOutputOptionsCur & INCHI_OUT_XML),
|
1354
1386
|
ip->bAbcNumbers, ip->bCtPredecessors, ip->bNoStructLabels,
|
1355
1387
|
num_components, num_non_taut, num_taut,
|
1356
1388
|
output_file, log_file, num_inp,
|
1357
1389
|
ip->pSdfLabel,ip->pSdfValue, ip->lSdfId, pSortPrintINChIFlags );
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1390
|
+
|
1391
|
+
if ( ret && !(bINChIOutputOptionsCur & INCHI_OUT_EMBED_REC) ) {
|
1392
|
+
ret &= OutputINChI2( pStr, nStrLen, pINChISort, INCHI_REC /*iINChI*/, pOrigStruct,
|
1393
|
+
bDisconnectedCoord, OUT_TN, bINChIOutputOptionsCur, 0 != (bINChIOutputOptionsCur & INCHI_OUT_XML),
|
1394
|
+
ip->bAbcNumbers, ip->bCtPredecessors, ip->bNoStructLabels,
|
1395
|
+
num_components, num_non_taut, num_taut,
|
1396
|
+
output_file, log_file, num_inp,
|
1397
|
+
ip->pSdfLabel,ip->pSdfValue, ip->lSdfId, pSortPrintINChIFlags );
|
1398
|
+
}
|
1399
|
+
if ( bAnnInXmlBrackets ) {
|
1400
|
+
inchi_print( output_file, "</%s>\n\n", szAnnHdr );
|
1401
|
+
}
|
1402
|
+
if ( !ret ) {
|
1403
|
+
break;
|
1404
|
+
}
|
1364
1405
|
}
|
1365
1406
|
}
|
1366
1407
|
}
|
@@ -1428,10 +1469,11 @@ void FreeINChIArrays( PINChI2 *pINChI, PINChI_Aux2 *pINChI_Aux, int num_componen
|
|
1428
1469
|
* output " L=V" or " L missing" or ""
|
1429
1470
|
* The fprintf format string must contain %s%s%s%s
|
1430
1471
|
*/
|
1431
|
-
|
1432
|
-
char
|
1433
|
-
char
|
1434
|
-
char
|
1472
|
+
|
1473
|
+
const char gsMissing[] = "is missing";
|
1474
|
+
const char gsEmpty[] = "";
|
1475
|
+
const char gsSpace[] = " ";
|
1476
|
+
const char gsEqual[] = "=";
|
1435
1477
|
|
1436
1478
|
#ifndef INCHI_LIBRARY
|
1437
1479
|
/*********************************************************************************************************/
|
@@ -1650,15 +1692,15 @@ int ReadTheStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, FILE *inp_file, ORIG_ATO
|
|
1650
1692
|
/*****************************************************************************************************/
|
1651
1693
|
int TreatReadTheStructureErrors( STRUCT_DATA *sd, INPUT_PARMS *ip, int nLogMask,
|
1652
1694
|
FILE *inp_file, INCHI_FILE *log_file, INCHI_FILE *output_file, INCHI_FILE *prb_file,
|
1653
|
-
ORIG_ATOM_DATA *orig_inp_data,
|
1695
|
+
ORIG_ATOM_DATA *orig_inp_data, long *num_inp, char *pStr, int nStrLen )
|
1654
1696
|
{
|
1655
1697
|
int nRet = _IS_OKAY;
|
1656
1698
|
/* End of file */
|
1657
1699
|
if ( 10 < sd->nStructReadError && sd->nStructReadError < 20 ) {
|
1658
1700
|
if ( sd->pStrErrStruct[0] ) {
|
1659
|
-
my_fprintf( log_file, "%s inp structure #%
|
1701
|
+
my_fprintf( log_file, "%s inp structure #%ld: End of file.%s%s%s%s \n", sd->pStrErrStruct, *num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
1660
1702
|
}
|
1661
|
-
my_fprintf( log_file, "End of file detected after structure #%
|
1703
|
+
//my_fprintf( log_file, "End of file detected after structure #%ld. \n", *num_inp-1 );
|
1662
1704
|
nRet = _IS_EOF;
|
1663
1705
|
goto exit_function; /* end of file */
|
1664
1706
|
}
|
@@ -1669,7 +1711,7 @@ int TreatReadTheStructureErrors( STRUCT_DATA *sd, INPUT_PARMS *ip, int nLogMask
|
|
1669
1711
|
if ( *num_inp < ip->first_struct_number ) {
|
1670
1712
|
#ifndef INCHI_LIBRARY
|
1671
1713
|
if ( log_file != stderr ) {
|
1672
|
-
my_fprintf( stderr, "\rSkipping structure #%
|
1714
|
+
//my_fprintf( stderr, "\rSkipping structure #%ld.%s%s%s%s...", *num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue));
|
1673
1715
|
}
|
1674
1716
|
#endif
|
1675
1717
|
nRet = sd->nErrorType = _IS_SKIP;
|
@@ -1687,7 +1729,7 @@ int TreatReadTheStructureErrors( STRUCT_DATA *sd, INPUT_PARMS *ip, int nLogMask
|
|
1687
1729
|
if ( (ip->bINChIOutputOptions & INCHI_OUT_XML) && !sd->bXmlStructStarted ) {
|
1688
1730
|
if ( !OutputINChIXmlStructStartTag( output_file, pStr, 1, nStrLen, ip->bNoStructLabels,
|
1689
1731
|
*num_inp, ip->pSdfLabel, ip->pSdfValue ) ) {
|
1690
|
-
my_fprintf( log_file, "Cannot create start xml tag for structure #%
|
1732
|
+
my_fprintf( log_file, "Cannot create start xml tag for structure #%ld.%s%s%s%s Terminating.\n", *num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
1691
1733
|
sd->bXmlStructStarted = -1;
|
1692
1734
|
nRet = _IS_FATAL;
|
1693
1735
|
goto exit_function;
|
@@ -1698,7 +1740,7 @@ int TreatReadTheStructureErrors( STRUCT_DATA *sd, INPUT_PARMS *ip, int nLogMask
|
|
1698
1740
|
/* Fatal error */
|
1699
1741
|
if ( sd->nErrorType == _IS_FATAL ) {
|
1700
1742
|
if ( nLogMask & LOG_MASK_FATAL )
|
1701
|
-
my_fprintf( log_file, "Fatal Error %d (aborted; %s) inp structure #%
|
1743
|
+
my_fprintf( log_file, "Fatal Error %d (aborted; %s) inp structure #%ld.%s%s%s%s\n",
|
1702
1744
|
sd->nStructReadError, sd->pStrErrStruct, *num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
1703
1745
|
#if( bRELEASE_VERSION == 1 || EXTR_FLAGS == 0 )
|
1704
1746
|
if ( prb_file && 0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd && !ip->bSaveAllGoodStructsAsProblem ) {
|
@@ -1710,7 +1752,7 @@ int TreatReadTheStructureErrors( STRUCT_DATA *sd, INPUT_PARMS *ip, int nLogMask
|
|
1710
1752
|
/* Non-fatal errors: do not produce INChI */
|
1711
1753
|
if ( sd->nErrorType == _IS_ERROR ) { /* 70 => too many atoms */
|
1712
1754
|
if ( nLogMask & LOG_MASK_ERR )
|
1713
|
-
my_fprintf( log_file, "Error %d (no %s; %s) inp structure #%
|
1755
|
+
my_fprintf( log_file, "Error %d (no %s; %s) inp structure #%ld.%s%s%s%s\n",
|
1714
1756
|
sd->nStructReadError, INCHI_NAME, sd->pStrErrStruct, *num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
1715
1757
|
#if( bRELEASE_VERSION == 1 || EXTR_FLAGS == 0 )
|
1716
1758
|
if ( prb_file && 0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd && !ip->bSaveAllGoodStructsAsProblem) {
|
@@ -1722,7 +1764,7 @@ int TreatReadTheStructureErrors( STRUCT_DATA *sd, INPUT_PARMS *ip, int nLogMask
|
|
1722
1764
|
/* Warnings: try to produce INChI */
|
1723
1765
|
if ( sd->nErrorType == _IS_WARNING ) {
|
1724
1766
|
if ( nLogMask & LOG_MASK_WARN )
|
1725
|
-
my_fprintf( log_file, "Warning: (%s) inp structure #%
|
1767
|
+
my_fprintf( log_file, "Warning: (%s) inp structure #%ld.%s%s%s%s\n",
|
1726
1768
|
sd->pStrErrStruct, *num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
1727
1769
|
}
|
1728
1770
|
|
@@ -1747,7 +1789,7 @@ exit_function:
|
|
1747
1789
|
/******************************************************************************************************/
|
1748
1790
|
int GetOneComponent( STRUCT_DATA *sd, INPUT_PARMS *ip, INCHI_FILE *log_file, INCHI_FILE *output_file,
|
1749
1791
|
INP_ATOM_DATA *inp_cur_data,
|
1750
|
-
ORIG_ATOM_DATA *orig_inp_data, int i,
|
1792
|
+
ORIG_ATOM_DATA *orig_inp_data, int i, long num_inp, char *pStr, int nStrLen )
|
1751
1793
|
{
|
1752
1794
|
inchiTime ulTStart;
|
1753
1795
|
InchiTimeGet( &ulTStart );
|
@@ -1759,7 +1801,7 @@ int GetOneComponent( STRUCT_DATA *sd, INPUT_PARMS *ip, INCHI_FILE *log_file, INC
|
|
1759
1801
|
if ( inp_cur_data->num_at <= 0 || orig_inp_data->nCurAtLen[i] != inp_cur_data->num_at ) {
|
1760
1802
|
/* log error message */
|
1761
1803
|
AddMOLfileError(sd->pStrErrStruct, "Cannot extract Component");
|
1762
|
-
my_fprintf( log_file, "%s #%d structure #%
|
1804
|
+
my_fprintf( log_file, "%s #%d structure #%ld.%s%s%s%s\n", sd->pStrErrStruct, i+1, num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue));
|
1763
1805
|
sd->nErrorCode = inp_cur_data->num_at < 0? inp_cur_data->num_at : (orig_inp_data->nCurAtLen[i] != inp_cur_data->num_at)? CT_ATOMCOUNT_ERR : CT_UNKNOWN_ERR;
|
1764
1806
|
/* num_err ++; */
|
1765
1807
|
sd->nErrorType = _IS_ERROR;
|
@@ -1778,14 +1820,12 @@ int GetOneComponent( STRUCT_DATA *sd, INPUT_PARMS *ip, INCHI_FILE *log_file, INC
|
|
1778
1820
|
/*******************************************************************************************/
|
1779
1821
|
int GetProcessingWarningsOneINChI(INChI *pINChI, INP_ATOM_DATA *inp_norm_data, char *pStrErrStruct)
|
1780
1822
|
{
|
1781
|
-
int
|
1823
|
+
int j;
|
1782
1824
|
int nAmbiguousStereoAtoms, nAmbiguousStereoBonds;
|
1783
1825
|
nAmbiguousStereoAtoms = 0;
|
1784
1826
|
nAmbiguousStereoBonds = 0;
|
1785
1827
|
|
1786
|
-
|
1787
|
-
if ( !inp_norm_data->at )
|
1788
|
-
continue;
|
1828
|
+
if ( inp_norm_data->at ) {
|
1789
1829
|
for ( j = 0; j < pINChI->nNumberOfAtoms; j ++ ) {
|
1790
1830
|
if ( inp_norm_data->at[j].bAmbiguousStereo & (AMBIGUOUS_STEREO_ATOM | AMBIGUOUS_STEREO_ATOM_ISO) ) {
|
1791
1831
|
nAmbiguousStereoAtoms ++;
|
@@ -1794,14 +1834,14 @@ int GetProcessingWarningsOneINChI(INChI *pINChI, INP_ATOM_DATA *inp_norm_data, c
|
|
1794
1834
|
nAmbiguousStereoBonds ++;
|
1795
1835
|
}
|
1796
1836
|
}
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1837
|
+
if ( nAmbiguousStereoAtoms ) {
|
1838
|
+
AddMOLfileError(pStrErrStruct, "Ambiguous stereo:");
|
1839
|
+
AddMOLfileError(pStrErrStruct, "center(s)");
|
1840
|
+
}
|
1841
|
+
if ( nAmbiguousStereoBonds ) {
|
1842
|
+
AddMOLfileError(pStrErrStruct, "Ambiguous stereo:");
|
1843
|
+
AddMOLfileError(pStrErrStruct, "bond(s)");
|
1844
|
+
}
|
1805
1845
|
}
|
1806
1846
|
return (nAmbiguousStereoAtoms || nAmbiguousStereoBonds);
|
1807
1847
|
}
|
@@ -1820,7 +1860,7 @@ int GetProcessingWarnings(INChI *cur_INChI[], INP_ATOM_DATA **inp_norm_data, ST
|
|
1820
1860
|
/*******************************************************************************************/
|
1821
1861
|
int CreateOneComponentINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, INP_ATOM_DATA *inp_cur_data, ORIG_ATOM_DATA *orig_inp_data,
|
1822
1862
|
PINChI2 *pINChI, PINChI_Aux2 *pINChI_Aux, int iINChI,
|
1823
|
-
int i,
|
1863
|
+
int i, long num_inp, INP_ATOM_DATA **inp_norm_data, NORM_CANON_FLAGS *pncFlags, INCHI_FILE *log_file )
|
1824
1864
|
{
|
1825
1865
|
inchiTime ulTStart, ulTEnd, *pulTEnd = NULL;
|
1826
1866
|
int k, num_at, ret = 0;
|
@@ -1874,11 +1914,11 @@ int CreateOneComponentINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, INP_ATOM_DATA *in
|
|
1874
1914
|
#if( !defined( INCHI_LIB ) && !defined( INCHI_LIBRARY ) )
|
1875
1915
|
#if( TEST_RENUMB_ATOMS != 1 )
|
1876
1916
|
/* log file / console output */
|
1877
|
-
if ( log_file != stderr ) {
|
1917
|
+
if ( log_file && log_file != stderr ) { /* NULL log_file now ignored. 11-23-2005 */
|
1878
1918
|
if ( ip->bDisplay )
|
1879
|
-
my_fprintf( log_file, "Component #%d structure #%
|
1880
|
-
else
|
1881
|
-
//my_fprintf( stderr, "Component #%d structure #%
|
1919
|
+
my_fprintf( log_file, "Component #%d structure #%ld.%s%s%s%s...\n", i+1, num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
1920
|
+
//else
|
1921
|
+
//my_fprintf( stderr, "Component #%d structure #%ld.%s%s%s%s...\r", i+1, num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
1882
1922
|
}
|
1883
1923
|
#endif
|
1884
1924
|
#endif
|
@@ -1902,10 +1942,10 @@ int CreateOneComponentINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, INP_ATOM_DATA *in
|
|
1902
1942
|
InchiTimeAddMsec( pulTEnd, ip->msec_LeftTime );
|
1903
1943
|
}
|
1904
1944
|
}
|
1905
|
-
num_at = Create_INChI( cur_INChI, cur_INChI_Aux, orig_inp_data
|
1945
|
+
num_at = Create_INChI( cur_INChI, cur_INChI_Aux, orig_inp_data/* not used */, inp_cur_data->at,
|
1906
1946
|
inp_norm_data,
|
1907
1947
|
inp_cur_data->num_at,
|
1908
|
-
ip->nMode, &bTautFlags, &bTautFlagsDone, pulTEnd, sd->pStrErrStruct);
|
1948
|
+
ip->nMode, &bTautFlags, &bTautFlagsDone, pulTEnd, NULL, sd->pStrErrStruct);
|
1909
1949
|
SetConnectedComponentNumber( inp_cur_data->at, inp_cur_data->num_at, i+1 ); /* normalization alters structure component number */
|
1910
1950
|
for ( k = 0; k < TAUT_NUM; k ++ ) {
|
1911
1951
|
if ( cur_INChI_Aux[k] && cur_INChI_Aux[k]->nNumberOfAtoms > 0 ) {
|
@@ -2021,13 +2061,13 @@ int CreateOneComponentINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, INP_ATOM_DATA *in
|
|
2021
2061
|
}
|
2022
2062
|
/****************************************************************************************************/
|
2023
2063
|
int TreatCreateOneComponentINChIError(STRUCT_DATA *sd, INPUT_PARMS *ip, ORIG_ATOM_DATA *orig_inp_data,
|
2024
|
-
int i,
|
2064
|
+
int i, long num_inp,
|
2025
2065
|
FILE *inp_file, INCHI_FILE *log_file, INCHI_FILE *output_file, INCHI_FILE *prb_file,
|
2026
2066
|
char *pStr, int nStrLen )
|
2027
2067
|
{
|
2028
2068
|
if ( sd->nErrorCode ) {
|
2029
2069
|
AddMOLfileError(sd->pStrErrStruct, ErrMsg(sd->nErrorCode) );
|
2030
|
-
my_fprintf( log_file, "Error %d (%s) structure #%
|
2070
|
+
my_fprintf( log_file, "Error %d (%s) structure #%ld component %d.%s%s%s%s\n",
|
2031
2071
|
sd->nErrorCode, sd->pStrErrStruct, num_inp, i+1, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
2032
2072
|
sd->nErrorType = (sd->nErrorCode==CT_OUT_OF_RAM || sd->nErrorCode==CT_USER_QUIT_ERR)? _IS_FATAL : _IS_ERROR;
|
2033
2073
|
if ( (ip->bINChIOutputOptions & INCHI_OUT_XML)
|
@@ -2051,7 +2091,7 @@ int TreatCreateOneComponentINChIError(STRUCT_DATA *sd, INPUT_PARMS *ip, ORIG_ATO
|
|
2051
2091
|
#ifndef INCHI_LIBRARY
|
2052
2092
|
/* print the logfile record */
|
2053
2093
|
if ( log_file && log_file != stderr && (sd->ulStructTime >= 1000 || sd->nErrorCode) ) {
|
2054
|
-
fprintf( log_file, "%10lu msec structure #%
|
2094
|
+
fprintf( log_file, "%10lu msec structure #%ld.%s%s%s%s (%d component%s, %d atom%s, error=%d).\n",
|
2055
2095
|
sd->ulStructTime, num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue),
|
2056
2096
|
orig_inp_data->num_components, orig_inp_data->num_components==1?"":"s",
|
2057
2097
|
orig_inp_data->num_inp_atoms, orig_inp_data->num_inp_atoms==1?"":"s", sd->nErrorCode );
|
@@ -2060,7 +2100,7 @@ int TreatCreateOneComponentINChIError(STRUCT_DATA *sd, INPUT_PARMS *ip, ORIG_ATO
|
|
2060
2100
|
return sd->nErrorType;
|
2061
2101
|
}
|
2062
2102
|
/****************************************************************************************************/
|
2063
|
-
int TreatCreateINChIWarning(STRUCT_DATA *sd, INPUT_PARMS *ip, ORIG_ATOM_DATA *orig_inp_data,
|
2103
|
+
int TreatCreateINChIWarning(STRUCT_DATA *sd, INPUT_PARMS *ip, ORIG_ATOM_DATA *orig_inp_data, long num_inp,
|
2064
2104
|
FILE *inp_file, INCHI_FILE *log_file, INCHI_FILE *output_file, INCHI_FILE *prb_file,
|
2065
2105
|
char *pStr, int nStrLen )
|
2066
2106
|
{
|
@@ -2072,7 +2112,7 @@ int TreatCreateINChIWarning(STRUCT_DATA *sd, INPUT_PARMS *ip, ORIG_ATOM_DATA *or
|
|
2072
2112
|
}
|
2073
2113
|
#endif
|
2074
2114
|
if ( !sd->nErrorCode && sd->pStrErrStruct[0] ) {
|
2075
|
-
my_fprintf( log_file, "Warning (%s) structure #%
|
2115
|
+
my_fprintf( log_file, "Warning (%s) structure #%ld.%s%s%s%s\n",
|
2076
2116
|
sd->pStrErrStruct, num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
2077
2117
|
sd->nErrorType = _IS_WARNING;
|
2078
2118
|
if ( (ip->bINChIOutputOptions & INCHI_OUT_XML)
|
@@ -2100,14 +2140,14 @@ int TreatCreateINChIWarning(STRUCT_DATA *sd, INPUT_PARMS *ip, ORIG_ATOM_DATA *or
|
|
2100
2140
|
#if( bRELEASE_VERSION != 1 && bOUTPUT_ONE_STRUCT_TIME == 1 )
|
2101
2141
|
#ifndef INCHI_LIBRARY
|
2102
2142
|
if ( log_file && log_file != stderr ) {
|
2103
|
-
fprintf( log_file, "%10lu msec structure %1dD #%
|
2143
|
+
fprintf( log_file, "%10lu msec structure %1dD #%ld.%s%s%s%s (%d component%s, %d atom%s, error=%d).\n",
|
2104
2144
|
sd->ulStructTime, orig_inp_data->num_dimensions, num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue),
|
2105
2145
|
orig_inp_data->num_components, orig_inp_data->num_components==1?"":"s",
|
2106
2146
|
orig_inp_data->num_inp_atoms, orig_inp_data->num_inp_atoms==1?"":"s", sd->nErrorCode );
|
2107
2147
|
}
|
2108
2148
|
#else
|
2109
2149
|
if ( log_file ) {
|
2110
|
-
my_fprintf( log_file, "%10lu msec structure %1dD #%
|
2150
|
+
my_fprintf( log_file, "%10lu msec structure %1dD #%ld.%s%s%s%s (%d component%s, %d atom%s, error=%d).\n",
|
2111
2151
|
sd->ulStructTime, orig_inp_data->num_dimensions, num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue),
|
2112
2152
|
orig_inp_data->num_components, orig_inp_data->num_components==1?"":"s",
|
2113
2153
|
orig_inp_data->num_inp_atoms, orig_inp_data->num_inp_atoms==1?"":"s", sd->nErrorCode );
|
@@ -2184,7 +2224,7 @@ int DuplicateOrigAtom( ORIG_ATOM_DATA *new_orig_atom, ORIG_ATOM_DATA *orig_atom
|
|
2184
2224
|
/*******************************************************************************************/
|
2185
2225
|
int GetOneStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
2186
2226
|
FILE *inp_file, INCHI_FILE *log_file, INCHI_FILE *output_file, INCHI_FILE *prb_file,
|
2187
|
-
ORIG_ATOM_DATA *orig_inp_data,
|
2227
|
+
ORIG_ATOM_DATA *orig_inp_data, long *num_inp, char *pStr, int nStrLen, STRUCT_FPTRS *struct_fptrs )
|
2188
2228
|
{
|
2189
2229
|
int nRet, inp_index, out_index, bUseFptr = (NULL != struct_fptrs);
|
2190
2230
|
|
@@ -2380,7 +2420,7 @@ int RenumberingTestUninit( RENUMB_DATA *pRenumbData )
|
|
2380
2420
|
int RenumberingTest( PINChI2 *pINChI, PINChI_Aux2 *pINChI_Aux, ORIG_ATOM_DATA *orig_inp_data, int iINChI,
|
2381
2421
|
RENUMB_DATA *pRenumbData, INP_ATOM_DATA *inp_cur_data, INP_ATOM_DATA **inp_norm_data,
|
2382
2422
|
STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, INCHI_FILE *log_file, INCHI_FILE *prb_file,
|
2383
|
-
int i,
|
2423
|
+
int i, long num_inp, NORM_CANON_FLAGS *pncFlags)
|
2384
2424
|
{
|
2385
2425
|
int k, bLongerTime;
|
2386
2426
|
CopyInpAtomData( &pRenumbData->saved_inp_cur_data, inp_cur_data );
|
@@ -2391,7 +2431,7 @@ int RenumberingTest( PINChI2 *pINChI, PINChI_Aux2 *pINChI_Aux, ORIG_ATOM_DATA *o
|
|
2391
2431
|
while ( -- pRenumbData->ren_counter >= 0 && !pRenumbData->nRet2 ) {
|
2392
2432
|
pRenumbData->nComp ++;
|
2393
2433
|
MakeNewOrd( pRenumbData->orig_inp_cur_data.num_at, pRenumbData->new_ord );
|
2394
|
-
RenumbInpAtomData( inp_cur_data
|
2434
|
+
RenumbInpAtomData( inp_cur_data /* output*/, &pRenumbData->orig_inp_cur_data/* input*/, pRenumbData->new_ord/* input*/ );
|
2395
2435
|
#if( TEST_RENUMB_ATOMS_SAVE_LONGEST == 1 )
|
2396
2436
|
CopyInpAtomData( &pRenumbData->longest_inp_cur_data, inp_cur_data );
|
2397
2437
|
#endif
|
@@ -2425,13 +2465,21 @@ int RenumberingTest( PINChI2 *pINChI, PINChI_Aux2 *pINChI_Aux, ORIG_ATOM_DATA *o
|
|
2425
2465
|
my_fprintf( log_file, "\n" );
|
2426
2466
|
pRenumbData->ren_counter = 0; /* force exit */
|
2427
2467
|
pRenumbData->bRenumbErr = 1000*pRenumbData->c2 + pRenumbData->c1;
|
2468
|
+
#if( TEST_RENUMB_SWITCH == 1 )
|
2469
|
+
CopyInpAtomData( &pRenumbData->longest_inp_cur_data, inp_cur_data );
|
2470
|
+
if ( pRenumbData->longest_inp_cur_data.at ) {
|
2471
|
+
for ( k = 0; k < pRenumbData->longest_inp_cur_data.num_at; k ++ ) {
|
2472
|
+
pRenumbData->longest_inp_cur_data.at[k].orig_at_number = k+1; /* display new atom numbers */
|
2473
|
+
}
|
2474
|
+
}
|
2475
|
+
#endif
|
2428
2476
|
}
|
2429
2477
|
#if( TEST_RENUMB_ATOMS_SAVE_LONGEST == 1 )
|
2430
2478
|
/* output time per this component */
|
2431
|
-
my_fprintf( stderr, "\rComp#%d str#%
|
2432
|
-
|
2433
|
-
|
2434
|
-
|
2479
|
+
//my_fprintf( stderr, "\rComp#%d str#%ld/%d%s%s%s%s Ren %d/%d n(%lu:%lu)c(%lu:%lu)...\r",
|
2480
|
+
// i+1, num_inp, iINChI, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue), pRenumbData->nComp, pRenumbData->ren_counter+pRenumbData->nComp,
|
2481
|
+
// pRenumbData->ren_INChI_Aux[0][TAUT_NON]->ulNormTime, pRenumbData->ren_INChI_Aux[0][TAUT_NON]->ulCanonTime,
|
2482
|
+
// pRenumbData->ren_INChI_Aux[0][TAUT_YES]->ulNormTime, pRenumbData->ren_INChI_Aux[0][TAUT_YES]->ulCanonTime);
|
2435
2483
|
#endif
|
2436
2484
|
/* make sure the max. time is not overwritten */
|
2437
2485
|
pRenumbData->ulCurTime0 = pRenumbData->ren_INChI_Aux[0][TAUT_NON]?
|
@@ -2464,20 +2512,24 @@ int RenumberingTest( PINChI2 *pINChI, PINChI_Aux2 *pINChI_Aux, ORIG_ATOM_DATA *o
|
|
2464
2512
|
pRenumbData->ulMaxTimeCanon = pRenumbData->ulCurTimeCanon;
|
2465
2513
|
bLongerTime = 1;
|
2466
2514
|
}
|
2467
|
-
#if( TEST_RENUMB_ATOMS_SAVE_LONGEST == 1 )
|
2468
|
-
if ( bLongerTime ) {
|
2515
|
+
#if( TEST_RENUMB_ATOMS_SAVE_LONGEST == 1 || TEST_RENUMB_SWITCH == 1 )
|
2516
|
+
if ( bLongerTime || TEST_RENUMB_SWITCH == 1 && (pRenumbData->c1 || pRenumbData->c2 || pRenumbData->nRet2) ) {
|
2469
2517
|
char szLine[512];
|
2470
2518
|
char szValue[512];
|
2471
2519
|
//my_fprintf( stderr, "\n" );
|
2472
|
-
sprintf( szLine, "Comp#%d str#%
|
2520
|
+
sprintf( szLine, "Comp#%d str#%ld/%d%s%s%s%s Ren %d/%d n=%lu:%lu c=%lu:%lu",
|
2473
2521
|
i+1, num_inp, iINChI, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue), pRenumbData->nComp, pRenumbData->ren_counter+pRenumbData->nComp,
|
2474
|
-
pRenumbData->ren_INChI_Aux[0][TAUT_NON]
|
2475
|
-
pRenumbData->ren_INChI_Aux[0][
|
2476
|
-
|
2522
|
+
pRenumbData->ren_INChI_Aux[0][TAUT_NON]? pRenumbData->ren_INChI_Aux[0][TAUT_NON]->ulNormTime:0,
|
2523
|
+
pRenumbData->ren_INChI_Aux[0][TAUT_NON]? pRenumbData->ren_INChI_Aux[0][TAUT_NON]->ulCanonTime:0,
|
2524
|
+
pRenumbData->ren_INChI_Aux[0][TAUT_YES]? pRenumbData->ren_INChI_Aux[0][TAUT_YES]->ulNormTime:0,
|
2525
|
+
pRenumbData->ren_INChI_Aux[0][TAUT_YES]? pRenumbData->ren_INChI_Aux[0][TAUT_YES]->ulCanonTime:0);
|
2526
|
+
sprintf( szValue, "%s (c%d/s%ld/i%d, r%d/%d n=%lu:%lu c=%lu:%lu)",
|
2477
2527
|
(ip->pSdfValue && ip->pSdfValue[0])? ip->pSdfValue:"unk",
|
2478
2528
|
i+1, num_inp, iINChI, pRenumbData->nComp, pRenumbData->ren_counter+pRenumbData->nComp,
|
2479
|
-
pRenumbData->ren_INChI_Aux[0][TAUT_NON]
|
2480
|
-
pRenumbData->ren_INChI_Aux[0][
|
2529
|
+
pRenumbData->ren_INChI_Aux[0][TAUT_NON]? pRenumbData->ren_INChI_Aux[0][TAUT_NON]->ulNormTime:0,
|
2530
|
+
pRenumbData->ren_INChI_Aux[0][TAUT_NON]? pRenumbData->ren_INChI_Aux[0][TAUT_NON]->ulCanonTime:0,
|
2531
|
+
pRenumbData->ren_INChI_Aux[0][TAUT_YES]? pRenumbData->ren_INChI_Aux[0][TAUT_YES]->ulNormTime:0,
|
2532
|
+
pRenumbData->ren_INChI_Aux[0][TAUT_YES]? pRenumbData->ren_INChI_Aux[0][TAUT_YES]->ulCanonTime:0);
|
2481
2533
|
|
2482
2534
|
WriteToSDfile( &pRenumbData->longest_inp_cur_data, prb_file, szLine, NULL, ip->pSdfLabel, szValue );
|
2483
2535
|
}
|
@@ -2516,7 +2568,7 @@ int RenumberingTest( PINChI2 *pINChI, PINChI_Aux2 *pINChI_Aux, ORIG_ATOM_DATA *o
|
|
2516
2568
|
sd->num_taut[iINChI] = pRenumbData->num_taut0;
|
2517
2569
|
sd->num_non_taut[iINChI] = pRenumbData->num_non_taut0;
|
2518
2570
|
if ( pRenumbData->num_taut % pRenumbData->nComp || pRenumbData->num_non_taut % pRenumbData->nComp ) {
|
2519
|
-
my_fprintf( log_file, "Compare (%d,%d) %d (err=%d) %s structure #%
|
2571
|
+
my_fprintf( log_file, "Compare (%d,%d) %d (err=%d) %s structure #%ld component %d.%s%s%s%s\n",
|
2520
2572
|
pRenumbData->num_non_taut % pRenumbData->nComp, pRenumbData->num_taut % pRenumbData->nComp,
|
2521
2573
|
pRenumbData->nComp, 333, INCHI_NAME, num_inp, i+1, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
2522
2574
|
}
|
@@ -2526,9 +2578,20 @@ int RenumberingTest( PINChI2 *pINChI, PINChI_Aux2 *pINChI_Aux, ORIG_ATOM_DATA *o
|
|
2526
2578
|
/* renumbered input structure */
|
2527
2579
|
#ifndef INCHI_ANSI_ONLY /* { */
|
2528
2580
|
if ( /*ip->bDisplayEachComponentINChI &&*/ !pRenumbData->nRet2 ) {
|
2529
|
-
int err;
|
2530
|
-
|
2581
|
+
int err, len;
|
2582
|
+
/*
|
2583
|
+
err = DisplayStructure( inp_cur_data->at, inp_cur_data->num_at, 0, 1, 0, NULL. 1, 0, NULL, NULL,
|
2531
2584
|
ip->bAbcNumbers, &ip->dp, ip->nMode, szTitle );
|
2585
|
+
*/
|
2586
|
+
err = DisplayStructure( inp_cur_data->at, inp_cur_data->num_at, 0, 1, 0, NULL, 1/*isotopic*/, 0/*taut*/, NULL, NULL,
|
2587
|
+
ip->bAbcNumbers, &ip->dp, ip->nMode, szTitle );
|
2588
|
+
if ( pRenumbData->c1 || pRenumbData->c2 ) {
|
2589
|
+
len = strlen(szTitle);
|
2590
|
+
strcat( szTitle, " (Renumbered)" );
|
2591
|
+
err = DisplayStructure( pRenumbData->longest_inp_cur_data.at, pRenumbData->longest_inp_cur_data.num_at,
|
2592
|
+
0, 1, 0, NULL, 1, 0, NULL, NULL, ip->bAbcNumbers, &ip->dp, ip->nMode, szTitle );
|
2593
|
+
szTitle[len] = '\0';
|
2594
|
+
}
|
2532
2595
|
sd->bUserQuitComponentDisplay = (err==ESC_KEY);
|
2533
2596
|
if ( !err ) {
|
2534
2597
|
my_fprintf( stderr, "Cannot display the structure\n");
|
@@ -2541,7 +2604,9 @@ int RenumberingTest( PINChI2 *pINChI, PINChI_Aux2 *pINChI_Aux, ORIG_ATOM_DATA *o
|
|
2541
2604
|
FreeInpAtomData( &pRenumbData->saved_inp_cur_data );
|
2542
2605
|
FreeInpAtomData( pRenumbData->ren_inp_norm_data[TAUT_NON] );
|
2543
2606
|
FreeInpAtomData( pRenumbData->ren_inp_norm_data[TAUT_YES] );
|
2544
|
-
|
2607
|
+
#if( TEST_RENUMB_ATOMS_SAVE_LONGEST == 1 || TEST_RENUMB_SWITCH == 1 )
|
2608
|
+
FreeInpAtomData( &pRenumbData->longest_inp_cur_data );
|
2609
|
+
#endif
|
2545
2610
|
return pRenumbData->nRet2;
|
2546
2611
|
}
|
2547
2612
|
#endif /* } TEST_RENUMB_ATOMS */
|
@@ -2604,13 +2669,20 @@ int PreprocessOneStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, ORIG_ATOM_DATA *or
|
|
2604
2669
|
/* 2. fix odd things in prep_inp_data */
|
2605
2670
|
/*************************************************/
|
2606
2671
|
|
2607
|
-
if ( 0 < fix_odd_things( prep_inp_data->num_inp_atoms, prep_inp_data->at ) ) {
|
2672
|
+
if ( 0 < fix_odd_things( prep_inp_data->num_inp_atoms, prep_inp_data->at, 0 ) ) {
|
2608
2673
|
AddMOLfileError(sd->pStrErrStruct, "Charges were rearranged");
|
2609
2674
|
if ( sd->nErrorType < _IS_WARNING ) {
|
2610
2675
|
sd->nErrorType = _IS_WARNING;
|
2611
2676
|
}
|
2612
2677
|
sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ODD_THINGS_DONE;
|
2613
2678
|
}
|
2679
|
+
#if( FIX_ADJ_RAD == 1 )
|
2680
|
+
if ( ip->bTautFlags & TG_FLAG_FIX_ADJ_RADICALS ) {
|
2681
|
+
if ( 0 < FixAdjacentRadicals( prep_inp_data->num_inp_atoms, prep_inp_data->at ) ) {
|
2682
|
+
sd->bTautFlagsDone[INCHI_BAS] |= TG_FLAG_FIX_ADJ_RADICALS_DONE;
|
2683
|
+
}
|
2684
|
+
}
|
2685
|
+
#endif
|
2614
2686
|
#if( bRELEASE_VERSION == 0 && (EXTR_FLAGS & EXTR_HAS_FEATURE) )
|
2615
2687
|
if ( bFoundFeature( prep_inp_data->at, prep_inp_data->num_inp_atoms ) ) {
|
2616
2688
|
sd->bExtract |= EXTR_HAS_FEATURE;
|
@@ -2855,7 +2927,7 @@ exit_function:
|
|
2855
2927
|
#ifndef INCHI_ANSI_ONLY /* { */
|
2856
2928
|
/************************************************************************************************/
|
2857
2929
|
int DisplayTheWholeStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, FILE *inp_file, INCHI_FILE *log_file,
|
2858
|
-
ORIG_ATOM_DATA *orig_inp_data,
|
2930
|
+
ORIG_ATOM_DATA *orig_inp_data, long num_inp, int iINChI, int bShowStruct, int bINCHI_LIB_Flag )
|
2859
2931
|
{
|
2860
2932
|
|
2861
2933
|
int bDisplayEqu = 0;
|
@@ -2894,13 +2966,13 @@ int DisplayTheWholeStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, F
|
|
2894
2966
|
#ifndef INCHI_LIB
|
2895
2967
|
if ( bShowStruct && ip->bDisplay ) {
|
2896
2968
|
if ( bDisplayEqu ) {
|
2897
|
-
sprintf( szTitle, " Equ Set %d of %d, Input Structure #%
|
2969
|
+
sprintf( szTitle, " Equ Set %d of %d, Input Structure #%ld.%s%s%s%s%s",
|
2898
2970
|
ip->dp.nCurEquLabel, ip->dp.nNumEquSets,
|
2899
2971
|
num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue), lpszType);
|
2900
2972
|
} else {
|
2901
|
-
sprintf( szTitle, "Input Structure #%
|
2973
|
+
sprintf( szTitle, "Input Structure #%ld.%s%s%s%s%s", num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue), lpszType);
|
2902
2974
|
}
|
2903
|
-
err = DisplayStructure( orig_inp_data->at, orig_inp_data->num_inp_atoms, 0, 0, NULL, 1/*isotopic*/, 0/*taut*/, NULL, NULL,
|
2975
|
+
err = DisplayStructure( orig_inp_data->at, orig_inp_data->num_inp_atoms, 0, 1, 0, NULL, 1/*isotopic*/, 0/*taut*/, NULL, NULL,
|
2904
2976
|
ip->bAbcNumbers, &ip->dp, ip->nMode, szTitle );
|
2905
2977
|
sd->bUserQuitComponent = (err==ESC_KEY);
|
2906
2978
|
if ( !err ) {
|
@@ -2912,14 +2984,14 @@ int DisplayTheWholeStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, F
|
|
2912
2984
|
if ( ip->bDisplay && !sd->bUserQuitComponent ) {
|
2913
2985
|
if ( iINChI == 1 ) {
|
2914
2986
|
if ( ip->bDisplay )
|
2915
|
-
my_fprintf( log_file, "Processing (rec) structure #%
|
2987
|
+
my_fprintf( log_file, "Processing (rec) structure #%ld.%s%s%s%s...\n", num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
2916
2988
|
else
|
2917
|
-
my_fprintf( stderr, "Processing (rec) structure #%
|
2989
|
+
my_fprintf( stderr, "Processing (rec) structure #%ld.%s%s%s%s...\r", num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
2918
2990
|
} else {
|
2919
2991
|
if ( ip->bDisplay )
|
2920
|
-
my_fprintf( log_file, "Processing structure #%
|
2992
|
+
my_fprintf( log_file, "Processing structure #%ld.%s%s%s%s...\n", num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
2921
2993
|
else
|
2922
|
-
my_fprintf( stderr, "Processing structure #%
|
2994
|
+
my_fprintf( stderr, "Processing structure #%ld.%s%s%s%s...\r", num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
2923
2995
|
}
|
2924
2996
|
}
|
2925
2997
|
}
|
@@ -2949,7 +3021,7 @@ int DisplayTheWholeStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, F
|
|
2949
3021
|
nComponent = k/4;
|
2950
3022
|
bPreprocessed = ((k/2)%2);
|
2951
3023
|
|
2952
|
-
sprintf( szTitle, "%s Structure #%
|
3024
|
+
sprintf( szTitle, "%s Structure #%ld.%s%s%s%s",
|
2953
3025
|
bPreprocessed? "Preprocessed" : bReconnected? "Reconnected" : "Input",
|
2954
3026
|
num_inp,
|
2955
3027
|
SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue));
|
@@ -2965,7 +3037,7 @@ int DisplayTheWholeStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, F
|
|
2965
3037
|
return -1;
|
2966
3038
|
}
|
2967
3039
|
vDrawData.pWindowData = CreateWinData_( orig_inp_data->at, orig_inp_data->num_inp_atoms,
|
2968
|
-
0, 0, NULL, 1, 0, NULL, NULL,
|
3040
|
+
0, 1 /* bAdd_DT_to_num_H */, 0, NULL, 1, 0, NULL, NULL,
|
2969
3041
|
ip->bAbcNumbers, &ip->dp, ip->nMode );
|
2970
3042
|
if( vDrawData.pWindowData != NULL )
|
2971
3043
|
{
|
@@ -3002,7 +3074,7 @@ int ProcessOneStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3002
3074
|
PINChI2 *pINChI[INCHI_NUM], PINChI_Aux2 *pINChI_Aux[INCHI_NUM],
|
3003
3075
|
FILE *inp_file, INCHI_FILE *log_file, INCHI_FILE *output_file, INCHI_FILE *prb_file,
|
3004
3076
|
ORIG_ATOM_DATA *orig_inp_data, ORIG_ATOM_DATA *prep_inp_data,
|
3005
|
-
|
3077
|
+
long num_inp, char *pStr, int nStrLen )
|
3006
3078
|
{
|
3007
3079
|
int nRet = 0, nRet1, i, k, maxINChI=0;
|
3008
3080
|
COMP_ATOM_DATA composite_norm_data[INCHI_NUM][TAUT_NUM+1]; /* [0]:non-taut, [1]:taut, [2]:intermediate taut struct */
|
@@ -3020,7 +3092,7 @@ int ProcessOneStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3020
3092
|
|
3021
3093
|
/* for testing only */
|
3022
3094
|
#if( REMOVE_ION_PAIRS_ORIG_STRU == 1 )
|
3023
|
-
fix_odd_things( orig_inp_data->num_inp_atoms, orig_inp_data->at );
|
3095
|
+
fix_odd_things( orig_inp_data->num_inp_atoms, orig_inp_data->at, 0 );
|
3024
3096
|
#endif
|
3025
3097
|
|
3026
3098
|
/***** output MOLfile ***************/
|
@@ -3031,15 +3103,16 @@ int ProcessOneStructure( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3031
3103
|
/* log file / console output */
|
3032
3104
|
if ( log_file != stderr ) {
|
3033
3105
|
if ( ip->bDisplay )
|
3034
|
-
my_fprintf( log_file, "Writing structure #%
|
3035
|
-
else
|
3036
|
-
my_fprintf( stderr, "Writing structure #%
|
3106
|
+
my_fprintf( log_file, "Writing structure #%ld.%s%s%s%s...\n", num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
3107
|
+
//else
|
3108
|
+
//my_fprintf( stderr, "Writing structure #%ld.%s%s%s%s...\r", num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
3037
3109
|
}
|
3038
3110
|
#endif
|
3039
3111
|
#endif
|
3040
|
-
sprintf( szNumber, "Structure #%
|
3112
|
+
sprintf( szNumber, "Structure #%ld", num_inp );
|
3041
3113
|
WriteOrigAtomDataToSDfile( orig_inp_data, output_file, szNumber, NULL,
|
3042
|
-
(sd->bChiralFlag & FLAG_INP_AT_CHIRAL)? 1:0,
|
3114
|
+
(sd->bChiralFlag & FLAG_INP_AT_CHIRAL)? 1:0,
|
3115
|
+
(ip->bINChIOutputOptions & INCHI_OUT_SDFILE_ATOMS_DT)? 1:0, ip->pSdfLabel, ip->pSdfValue );
|
3043
3116
|
goto exit_function;
|
3044
3117
|
}
|
3045
3118
|
|
@@ -3198,7 +3271,7 @@ exit_loop:;
|
|
3198
3271
|
/* XML struct end tag */
|
3199
3272
|
if ( (ip->bINChIOutputOptions & INCHI_OUT_XML) && sd->bXmlStructStarted > 0 ) {
|
3200
3273
|
if ( !OutputINChIXmlStructEndTag( output_file, pStr, nStrLen, 1 ) ) {
|
3201
|
-
my_fprintf( log_file, "Cannot create end xml tag for structure #%
|
3274
|
+
my_fprintf( log_file, "Cannot create end xml tag for structure #%ld.%s%s%s%s Terminating.\n", num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
3202
3275
|
sd->bXmlStructStarted = -1; /* do not repeat same message */
|
3203
3276
|
nRet = _IS_FATAL;
|
3204
3277
|
} else {
|
@@ -3278,7 +3351,7 @@ int CreateOneStructureINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3278
3351
|
FILE *inp_file, INCHI_FILE *log_file, INCHI_FILE *output_file, INCHI_FILE *prb_file,
|
3279
3352
|
ORIG_ATOM_DATA *orig_inp_data, ORIG_ATOM_DATA *prep_inp_data,
|
3280
3353
|
COMP_ATOM_DATA composite_norm_data2[][TAUT_NUM+1],
|
3281
|
-
|
3354
|
+
long num_inp, char *pStr, int nStrLen, NORM_CANON_FLAGS *pncFlags )
|
3282
3355
|
{
|
3283
3356
|
int i, j, k, /*m,*/ nRet = 0;
|
3284
3357
|
#ifndef INCHI_LIB
|
@@ -3596,9 +3669,9 @@ int CreateOneStructureINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3596
3669
|
}
|
3597
3670
|
#ifndef INCHI_LIB /* { */
|
3598
3671
|
#if( bREUSE_INCHI == 1 )
|
3599
|
-
if ( iINChI == INCHI_REC && (!ip->bDisplay && !(ip->bCompareComponents & CMP_COMPONENTS) ||
|
3672
|
+
if ( iINChI == INCHI_REC && (!ip->bDisplay && !ip->bDisplayCompositeResults && !(ip->bCompareComponents & CMP_COMPONENTS) ||
|
3600
3673
|
sd->bUserQuitComponentDisplay) ) {
|
3601
|
-
/* reconnected structure */
|
3674
|
+
/* reconnected structure (06-20-2005: added "&& !ip->bDisplayCompositeResults" to display composite structure) */
|
3602
3675
|
int m = iINChI-1;
|
3603
3676
|
/* find whether we have already calculated this INChI in basic (disconnected) layer */
|
3604
3677
|
for ( j = n = 0; j < prep_inp_data[m].num_components; j ++ ) {
|
@@ -3672,17 +3745,17 @@ int CreateOneStructureINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3672
3745
|
/* b) Display the extracted original component structure */
|
3673
3746
|
if ( inp_cur_data->at && ip->bDisplay && !sd->bUserQuitComponentDisplay ) {
|
3674
3747
|
if ( cur_prep_inp_data->num_components == 1 ) {
|
3675
|
-
sprintf( szTitle, "%sInput Structure #%
|
3748
|
+
sprintf( szTitle, "%sInput Structure #%ld.%s%s%s%s%s",
|
3676
3749
|
bStructurePreprocessed? "Preprocessed ":"",
|
3677
3750
|
num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue), iINChI? " (Reconnected)":"");
|
3678
3751
|
} else {
|
3679
|
-
sprintf( szTitle, "Component #%d of %d, Input Structure #%
|
3752
|
+
sprintf( szTitle, "Component #%d of %d, Input Structure #%ld.%s%s%s%s%s",
|
3680
3753
|
i+1, cur_prep_inp_data->num_components,
|
3681
3754
|
num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue), iINChI? " (Reconnected)":"");
|
3682
3755
|
}
|
3683
3756
|
#ifndef INCHI_LIB
|
3684
3757
|
err = DisplayStructure( inp_cur_data->at, inp_cur_data->num_at,
|
3685
|
-
0, 0, NULL, 1/*isotopic*/, 0/*taut*/, NULL, NULL,
|
3758
|
+
0, 1, 0, NULL, 1/*isotopic*/, 0/*taut*/, NULL, NULL,
|
3686
3759
|
ip->bAbcNumbers, &ip->dp, ip->nMode, szTitle );
|
3687
3760
|
sd->bUserQuitComponentDisplay = (err==ESC_KEY);
|
3688
3761
|
if ( !err ) {
|
@@ -3694,7 +3767,7 @@ int CreateOneStructureINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3694
3767
|
struct DrawData vDrawData;
|
3695
3768
|
int nType = COMPONENT_ORIGINAL;
|
3696
3769
|
vDrawData.pWindowData = CreateWinData_( inp_cur_data->at, inp_cur_data->num_at,
|
3697
|
-
0, 0, NULL,
|
3770
|
+
0, 1 /* bAdd_DT_to_num_H */, 0, NULL,
|
3698
3771
|
1 /* display isotopic if present */, 0, NULL, NULL,
|
3699
3772
|
ip->bAbcNumbers, &ip->dp, ip->nMode );
|
3700
3773
|
if( vDrawData.pWindowData != NULL )
|
@@ -3721,9 +3794,9 @@ int CreateOneStructureINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3721
3794
|
RenumberingTestInit( pRenumbData, inp_cur_data );
|
3722
3795
|
if ( log_file != stderr ) {
|
3723
3796
|
if ( ip->bDisplay )
|
3724
|
-
my_fprintf( log_file, "Component #%d structure #%
|
3797
|
+
my_fprintf( log_file, "Component #%d structure #%ld.%s%s%s%s...\n", i+1, num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
3725
3798
|
else
|
3726
|
-
my_fprintf( stderr, "Component #%d structure #%
|
3799
|
+
my_fprintf( stderr, "Component #%d structure #%ld.%s%s%s%s...\r", i+1, num_inp, SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue) );
|
3727
3800
|
}
|
3728
3801
|
/****************************************************************************/
|
3729
3802
|
/* R E N U M B E R I N G (testing only) Part I ENDS here */
|
@@ -3797,14 +3870,14 @@ int CreateOneStructureINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3797
3870
|
nNumDisplayedFixedBondTaut += bFixedBondsTaut; /* display only one time */
|
3798
3871
|
/* added number of components, added another format for a single component case - DCh */
|
3799
3872
|
if ( cur_prep_inp_data->num_components > 1 ) {
|
3800
|
-
sprintf( szTitle, "%s Component #%d of %d, Structure #%
|
3873
|
+
sprintf( szTitle, "%s Component #%d of %d, Structure #%ld%s%s.%s%s%s%s%s",
|
3801
3874
|
bFixedBondsTaut? "Preprocessed":"Result for",
|
3802
3875
|
i+1, cur_prep_inp_data->num_components, num_inp,
|
3803
3876
|
bDisplayTaut==1? ", mobile H": bDisplayTaut==0?", fixed H":"",
|
3804
3877
|
bIsotopic? ", isotopic":"",
|
3805
3878
|
SDF_LBL_VAL(ip->pSdfLabel,ip->pSdfValue), iINChI? " (Reconnected)":"");
|
3806
3879
|
} else {
|
3807
|
-
sprintf( szTitle, "%s Structure #%
|
3880
|
+
sprintf( szTitle, "%s Structure #%ld%s%s.%s%s%s%s%s",
|
3808
3881
|
bFixedBondsTaut? "Preprocessed":"Result for",
|
3809
3882
|
num_inp,
|
3810
3883
|
bDisplayTaut==1? ", mobile H": bDisplayTaut==0?", fixed H":"",
|
@@ -3816,14 +3889,14 @@ int CreateOneStructureINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3816
3889
|
continue;
|
3817
3890
|
if ( bFixedBondsTaut ) {
|
3818
3891
|
err = DisplayStructure( inp_norm_data[j]->at_fixed_bonds, inp_norm_data[j]->num_at,
|
3819
|
-
inp_norm_data[j]->num_removed_H,
|
3892
|
+
inp_norm_data[j]->num_removed_H, 0 /*bAdd_DT_to_num_H*/,
|
3820
3893
|
inp_norm_data[j]->nNumRemovedProtons,
|
3821
3894
|
inp_norm_data[j]->nNumRemovedProtonsIsotopic,
|
3822
3895
|
bHasIsotopicLayer, j, NULL, NULL,
|
3823
3896
|
ip->bAbcNumbers, &ip->dp, ip->nMode, szTitle );
|
3824
3897
|
} else {
|
3825
3898
|
err = DisplayStructure( inp_norm_data[j]->at, inp_norm_data[j]->num_at,
|
3826
|
-
0, 0, NULL,
|
3899
|
+
0, 0 /*bAdd_DT_to_num_H*/, 0, NULL,
|
3827
3900
|
k, j, pINChI[i], pINChI_Aux[i],
|
3828
3901
|
ip->bAbcNumbers, &ip->dp, ip->nMode, szTitle );
|
3829
3902
|
}
|
@@ -3835,7 +3908,7 @@ int CreateOneStructureINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3835
3908
|
{
|
3836
3909
|
struct DrawData vDrawData;
|
3837
3910
|
vDrawData.pWindowData = CreateWinData_( inp_norm_data[j]->at, inp_norm_data[j]->num_at,
|
3838
|
-
0, 0, NULL,
|
3911
|
+
0, 0 /* bAdd_DT_to_num_H */, 0, NULL,
|
3839
3912
|
k, j, pINChI[i], pINChI_Aux[i],
|
3840
3913
|
ip->bAbcNumbers, &ip->dp, ip->nMode );
|
3841
3914
|
if( vDrawData.pWindowData != NULL )
|
@@ -3863,6 +3936,7 @@ int CreateOneStructureINChI( STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle,
|
|
3863
3936
|
vDrawData.pWindowData =
|
3864
3937
|
CreateWinData_( inp_norm_data[j]->at_fixed_bonds, inp_norm_data[j]->num_at,
|
3865
3938
|
inp_norm_data[j]->num_removed_H,
|
3939
|
+
0 /* bAdd_DT_to_num_H */,
|
3866
3940
|
inp_norm_data[j]->nNumRemovedProtons,
|
3867
3941
|
inp_norm_data[j]->nNumRemovedProtonsIsotopic,
|
3868
3942
|
k, j, NULL, NULL,
|