InChI
 
Loading...
Searching...
No Matches
strutil.h
Go to the documentation of this file.
1/*
2 * International Chemical Identifier (InChI)
3 * Version 1
4 * Software version 1.07
5 * April 30, 2024
6 *
7 * MIT License
8 *
9 * Copyright (c) 2024 IUPAC and InChI Trust
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in all
19 * copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28 *
29 * The InChI library and programs are free software developed under the
30 * auspices of the International Union of Pure and Applied Chemistry (IUPAC).
31 * Originally developed at NIST.
32 * Modifications and additions by IUPAC and the InChI Trust.
33 * Some portions of code were developed/changed by external contributors
34 * (either contractor or volunteer) which are listed in the file
35 * 'External-contributors' included in this distribution.
36 *
37 * info@inchi-trust.org
38 *
39 */
40
41#ifndef _STRUTIL_H_
42#define _STRUTIL_H_
43
44/* Mol structure utlities */
45
46#include "inpdef.h"
47#include "ichi.h"
48
49#ifndef COMPILE_ALL_CPP
50#ifdef __cplusplus
51extern "C"
52{
53#endif
54#endif
55
56 /* forward declaration */
58 struct tagCANON_GLOBALS;
59
69 int ExtractConnectedComponent(inp_ATOM *at, int num_at,
70 int component_number,
71 inp_ATOM *component_at);
80 int SetConnectedComponentNumber(inp_ATOM *at, int num_at, int component_number);
81
92 INChI *Alloc_INChI(inp_ATOM *at, int num_at, int *found_num_bonds,
93 int *found_num_isotopic, int nAllocMode);
94
101 int Free_INChI(INChI **ppINChI);
102
109 int Free_INChI_Members(INChI *pINChI);
110
117 int Free_INChI_Stereo(INChI_Stereo *pINChI_Stereo);
118
128 INChI_Aux *Alloc_INChI_Aux(int num_at, int num_isotopic_atoms,
129 int nAllocMode, int bOrigData);
130
137 int Free_INChI_Aux(INChI_Aux **ppINChI_Aux);
138
159 int Create_INChI(struct tagCANON_GLOBALS *pCG,
160 struct tagINCHI_CLOCK *ic,
161 INPUT_PARMS *ip,
162 INChI **ppINChI,
163 INChI_Aux **ppINChI_Aux,
164 ORIG_ATOM_DATA *orig_inp_data,
165 inp_ATOM *inp_at,
166 INP_ATOM_DATA *inp_norm_data[2],
167 int num_inp_at,
168 INCHI_MODE nUserMode,
169 INCHI_MODE *pbTautFlags,
170 INCHI_MODE *pbTautFlagsDone,
171 struct tagInchiTime *ulMaxTime,
172 struct tagTautomerGroupsInfo *ti_out,
173 char *pStrErrStruct);
174
194 inp_ATOM *norm_at,
195 INF_ATOM_DATA *inf_norm_at_data,
196 int init_num_at,
197 int num_removed_H,
198 int bAdd_DT_to_num_H,
199 int nNumRemovedProtons,
200 NUM_H *nNumRemovedProtonsIsotopic,
201 int bIsotopic,
202 INChI *pINChI,
203 INChI_Aux *pINChI_Aux,
204 int bAbcNumbers,
205 INCHI_MODE nMode);
206
222 COMP_ATOM_DATA *composite_norm_data,
223 INF_ATOM_DATA *inf_norm_at_data,
224 int bIsotopic,
225 int bTautomeric,
226 PINChI2 *pINChI2,
227 PINChI_Aux2 *pINChI_Aux2,
228 int bAbcNumbers,
229 INCHI_MODE nMode);
230
231#if (FIX_DALKE_BUGS == 1)
238 char *AllocateAndFillHillFormula(INChI *pINChI);
239#endif
240
241 typedef enum tagInchiDiffBits
242 {
243 IDIF_PROBLEM = 0x00000001, /* severe: at least one InChI does not exist */
244 IDIF_NUM_AT = 0x00000001, /* severe: different number of atoms in the skeleton */
245 IDIF_ATOMS = 0x00000001, /* severe: diiferent types of skeleton atoms */
246 IDIF_NUM_EL = 0x00000001, /* severe: formulas differ in another element */
247 IDIF_CON_LEN = 0x00000001, /* severe: different connection table lengths */
248 IDIF_CON_TBL = 0x00000001, /* severe: different connection tables */
249 IDIF_POSITION_H = 0x00000002, /* difference in non-taut (Mobile-H) or all H (Fixed-H) location/number */
250 IDIF_MORE_FH = 0x00000004, /* extra fixed H */
251 IDIF_LESS_FH = 0x00000008, /* missing fixed H */
252 IDIF_MORE_H = 0x00000010, /* formulas differ in number of H */
253 IDIF_LESS_H = 0x00000020, /* formulas differ in number of H */
254 /*IDIF_TAUT_LEN = 0x00000008,*/ /* different lengths of tautomer lists */
255 IDIF_NO_TAUT = 0x00000040, /* restored structure has no taut groups while the original InChI has some */
256 IDIF_WRONG_TAUT = 0x00000080, /* restored has tautomerism while the original does not have it */
257 IDIF_SINGLE_TG = 0x00000100, /* restored has 1 taut. group while the original InChI has multiple tg */
258 IDIF_MULTIPLE_TG = 0x00000200, /* restored has multiple tg while the original InChI has only one tg */
259 IDIF_NUM_TG = 0x00000400, /* different number of tautomeric groups */
260 /*IDIF_LESS_TG_ENDP = 0x00000200,*/ /* restores structure has less taut. endpoints */
261 /*IDIF_MORE_TG_ENDP = 0x00000400,*/ /* restores structure has more taut. endpoints */
262 IDIF_EXTRA_TG_ENDP = 0x00000800, /* extra tautomeric endpoint(s) in restored structure */
263 IDIF_MISS_TG_ENDP = 0x00001000, /* one or more tg endpoint is not in the restored structure */
264 IDIF_DIFF_TG_ENDP = 0x00002000, /* lists of tg endpoints are different */
265 IDIF_TG = 0x00004000, /* different tautomeric groups */
266 IDIF_NUM_ISO_AT = 0x00008000, /* ?severe: restored struct. has different number of isotopic atoms */
267 IDIF_ISO_AT = 0x00010000, /* ?severe: restored struct. has different locations/isotopes of isotopic atoms */
268 IDIF_CHARGE = 0x00020000, /* restored structure has different charge */
269 IDIF_REM_PROT = 0x00040000, /* proton(s) removed/added from the restored structure */
270 IDIF_REM_ISO_H = 0x00080000, /* isotopic H removed */
271 IDIF_SC_INV = 0x00100000, /* restores structure has different inversion stereocenter mark */
272 IDIF_SC_PARITY = 0x00200000, /* restored structure has stereoatoms or allenes with different parity */
273 IDIF_SC_EXTRA_UNDF = 0x00400000, /* restored structure has extra undefined stereocenter(s) */
274 IDIF_SC_EXTRA = 0x00800000, /* restored structure has extra stereocenter(s) */
275 IDIF_SC_MISS_UNDF = 0x01000000, /* restored structure has not some undefined stereocenter(s) */
276 IDIF_SC_MISS = 0x02000000, /* restored structure has not some stereocenters that are not undefined */
277 IDIF_SB_PARITY = 0x04000000, /* restored structure has stereobonds or cumulenes with different parity */
278 IDIF_SB_EXTRA_UNDF = 0x08000000, /* restored structure has extra undefined stereobond(s) */
279 IDIF_SB_EXTRA = 0x10000000, /* restored structure has extra stereobond(s) */
280 IDIF_SB_MISS_UNDF = 0x20000000, /* restored structure has not some undefined stereocenters */
281 IDIF_SB_MISS = 0x40000000 /* restored structure has not some stereobonds that are not undefined */
283
284#define IDIFF_SB (IDIF_SB_PARITY | IDIF_SB_EXTRA_UNDF | IDIF_SB_EXTRA | IDIF_SB_MISS_UNDF | IDIF_SB_MISS)
285#define IDIFF_SC (IDIF_SC_PARITY | IDIF_SC_EXTRA_UNDF | IDIF_SC_EXTRA | IDIF_SC_MISS_UNDF | IDIF_SC_MISS)
286
287#define IDIFF_CONSTIT (IDIF_POSITION_H | IDIF_MORE_FH | IDIF_LESS_FH | IDIF_MORE_H | IDIF_LESS_H | \
288 IDIF_NO_TAUT | IDIF_WRONG_TAUT | IDIF_SINGLE_TG | IDIF_MULTIPLE_TG | \
289 IDIF_NUM_TG | IDIF_EXTRA_TG_ENDP | IDIF_MISS_TG_ENDP | IDIF_TG | \
290 IDIF_NUM_ISO_AT | IDIF_ISO_AT | IDIF_CHARGE | IDIF_REM_PROT | IDIF_REM_ISO_H | \
291 IDIF_DIFF_TG_ENDP)
292#define IDIFF_STEREO (IDIF_SC_INV | IDIF_SC_PARITY | IDIF_SC_EXTRA_UNDF | IDIF_SC_EXTRA | \
293 IDIF_SC_MISS_UNDF | IDIF_SC_MISS | IDIF_SB_PARITY | IDIF_SB_EXTRA_UNDF | \
294 IDIF_SB_EXTRA | IDIF_SB_MISS_UNDF | IDIF_SB_MISS)
295
296/*************************************************************************************/
297#define ICR_MAX_ENDP_IN1_ONLY 32
298#define ICR_MAX_ENDP_IN2_ONLY 32
299#define ICR_MAX_DIFF_FIXED_H 32
300#define ICR_MAX_SB_IN1_ONLY 32
301#define ICR_MAX_SB_IN2_ONLY 32
302#define ICR_MAX_SC_IN1_ONLY 32
303#define ICR_MAX_SC_IN2_ONLY 32
304#define ICR_MAX_SB_UNDF 32
305#define ICR_MAX_SC_UNDF 32
306
308 {
310
317
318 /* 1 => InChI from reversed struct. 2 => input InChI */
319
320 AT_NUMB endp_in1_only[ICR_MAX_ENDP_IN1_ONLY]; /* endpoint canonical number = index+1 */
322
323 AT_NUMB endp_in2_only[ICR_MAX_ENDP_IN2_ONLY]; /* endpoint canonical number = index+1 */
325
329
333
337
342
347
352
357 } ICR; /* tagInChICompareResults */
358
370 INCHI_MODE CompareReversedINChI2(INChI *i1 /* InChI from reversed struct */,
371 INChI *i2 /* input InChI */,
372 INChI_Aux *a1, INChI_Aux *a2,
373 ICR *picr, int *err);
374
385 int CompareIcr(ICR *picr1, ICR *picr2, INCHI_MODE *pin1, INCHI_MODE *pin2, INCHI_MODE mask);
386
396 int CompareReversedINChI(INChI *i1, INChI *i2, INChI_Aux *a1, INChI_Aux *a2);
397
398 // Where is this function?
399 const char *CompareReversedInchiMsg(int code);
400
401#define EQL_EXISTS 1
402#define EQL_SP3 2
403#define EQL_SP3_INV 4
404#define EQL_SP2 8
405
416 int Eql_INChI_Stereo(INChI_Stereo *s1, int eql1, INChI_Stereo *s2, int eql2, int bRelRac);
417
425 int Eql_INChI_Isotopic(INChI *i1, INChI *i2);
426
427#define EQL_EQU 0
428#define EQL_EQU_TG 1
429#define EQL_EQU_ISO 2
430
440 int Eql_INChI_Aux_Equ(INChI_Aux *a1, int eql1, INChI_Aux *a2, int eql2);
441
442#define EQL_NUM 0
443#define EQL_NUM_INV 1
444#define EQL_NUM_ISO 2
445
455 int Eql_INChI_Aux_Num(INChI_Aux *a1, int eql1, INChI_Aux *a2, int eql2);
456
464 int bHasEquString(AT_NUMB *LinearCT, int nLenCT);
465
473 int CompINChINonTaut2(const void *p1, const void *p2);
474
482 int CompINChITaut2(const void *p1, const void *p2);
483
493 int CompINChI2(const INCHI_SORT *p1, const INCHI_SORT *p2, int bTaut, int bCompareIsotopic);
494
503 int CompINChITautVsNonTaut(const INCHI_SORT *p1, const INCHI_SORT *p2, int bCompareIsotopic);
504
506 { /* r = repetitive, n = non-repetitive */
507 DIFS_f_FORMULA, /* 0 r; fixed-H <-> mobile-H */
508 DIFS_c_CONNECT, /* 1 n; connection table; mobile-H only */
509 DIFS_h_H_ATOMS, /* 2 n; hydrogen atoms: mobile-H and Fixed-H; have different meanings */
510 DIFS_q_CHARGE, /* 3 r; charge; fixed-H <-> mobile-H */
511 DIFS_p_PROTONS, /* 4 n; protons; mobile-H only */
512 DIFS_b_SBONDS, /* 5 r: stereobonds: fixed-H <-> mobile-H * isotopic <-> non-isotopic */
513 DIFS_t_SATOMS, /* 6 r: stereoatoms: fixed-H <-> mobile-H * isotopic <-> non-isotopic */
514 DIFS_m_SP3INV, /* 7 r: stereo-abs-inv: fixed-H <-> mobile-H * isotopic <-> non-isotopic */
515 DIFS_s_STYPE, /* 8 r: stereo-type: fixed-H <-> mobile-H * isotopic <-> non-isotopic */
516 DIFS_i_IATOMS, /* 9 r: isotopic atoms: fixed-H <-> mobile-H * isotopic <-> non-isotopic */
517 DIFS_o_TRANSP, /* 10 n: Fixed-H transposition */
518 DIFS_idf_LENGTH, /* 11 length of the array relevant to the INChI Identifier */
519 /* later elements referring to AuxInfo may be added */
520 DIFS_LENGTH = DIFS_idf_LENGTH /* length of the array */
522
524 {
525 DIFL_M, /* 0 main layer */
526 DIFL_MI, /* 1 main isotopic */
527 DIFL_F, /* 2 fixed-H */
528 DIFL_FI, /* 3 fixed-H isotopic */
529 DIFL_LENGTH /* number of layers */
531
532 /* Value meaning */
533 typedef enum tagMarkDiff
534 {
535 DIFV_BOTH_EMPTY = 0, /* both this and the component in the preceding namesake segment are empty */
536 DIFV_EQL2PRECED = 1, /* equal to the component in the preceding namesake segment */
537 DIFV_NEQ2PRECED = 2, /* different from the component in the preceding namesake segment */
538 DIFV_IS_EMPTY = 4, /* is empty while the preceding namesake segment is not empty */
539 DIFV_FI_EQ_MI = 8, /* FI stereo component is equal to the component in the MI namesake segment */
540 /* while M and F components are empty */
541 /* decision_F = bitmask: bits that should not be present */
542 /* decision_T = bitmask: at least one of the bits should be present */
543 /* decision = true if( !( BITS & decision_F ) && ( BITS & decision_F ) ) */
544 DIFV_OUTPUT_EMPTY_T = (DIFV_IS_EMPTY), /* bits present for empty segment output */
546
547 DIFV_OUTPUT_OMIT_F = (DIFV_NEQ2PRECED | DIFV_IS_EMPTY), /* bits NOT present for omitting */
548
551
553 {
555 INCHI_SEGM_FILL = 1, /* the value is used in str_LineEnd() */
556 INCHI_SEGM_EMPTY = 2 /* the value is used in str_LineEnd() */
558
568 int CompINChILayers(const INCHI_SORT *p1, const INCHI_SORT *p2,
569 char sDifSegs[][DIFS_LENGTH], int bFixTranspChargeBug);
570
577 int MarkUnusedAndEmptyLayers(char sDifSegs[][DIFS_LENGTH]);
578
585 int INChI_SegmentAction(char cDifSegs);
586
587#define FLAG_SORT_PRINT_TRANSPOS_BAS 1 /* transposition in the main InChI layer */
588#define FLAG_SORT_PRINT_TRANSPOS_REC 2 /* transposition in the reconnected InChI layer */
589#define FLAG_SORT_PRINT_NO_NFIX_H_BAS 4 /* no fixed H non-isotopic in the main InChI layer */
590#define FLAG_SORT_PRINT_NO_NFIX_H_REC 8 /* no fixed H non-isotopic in the reconnected InChI layer */
591#define FLAG_SORT_PRINT_NO_IFIX_H_BAS 16 /* no fixed H isotopic in the main InChI layer */
592#define FLAG_SORT_PRINT_NO_IFIX_H_REC 32 /* no fixed H isotopic in the the reconnected InChI layer */
593#define FLAG_SORT_PRINT_ReChI_PREFIX 64 /* Output ReChI instead of InChI */
594
595 struct tagCANON_GLOBALS;
596
620 int OutputINChI1(struct tagCANON_GLOBALS *pCG,
621 INCHI_IOS_STRING *strbuf,
622 INCHI_SORT *pINChISortTautAndNonTaut2[][TAUT_NUM],
623 int iINChI,
624 ORIG_ATOM_DATA *orig_inp_data,
625 ORIG_STRUCT *pOrigStruct,
626 INPUT_PARMS *ip,
627 int bDisconnectedCoord,
628 int bOutputType,
629 int bINChIOutputOptions,
630 int num_components2[],
631 int num_non_taut2[],
632 int num_taut2[],
633 INCHI_IOSTREAM *out_file,
634 INCHI_IOSTREAM *log_file,
635 int num_input_struct,
636 int *pSortPrintINChIFlags,
637 unsigned char save_opt_bits);
638
639 int OutputINChI2(struct tagCANON_GLOBALS *pCG,
640 INCHI_IOS_STRING *strbuf,
641 INCHI_SORT *pINChISortTautAndNonTaut2[][TAUT_NUM],
642 int INCHI_basic_or_INCHI_reconnected,
643 ORIG_ATOM_DATA *orig_inp_data,
644 ORIG_STRUCT *pOrigStruct,
645 INPUT_PARMS *ip,
646 int bDisconnectedCoord,
647 int bOutputType,
648 int bINChIOutputOptions,
649 int num_components2[],
650 int num_non_taut2[],
651 int num_taut2[],
652 INCHI_IOSTREAM *out_file,
653 INCHI_IOSTREAM *log_file,
654 int num_input_struct,
655 int *pSortPrintINChIFlags,
656 unsigned char save_opt_bits);
657
671 INCHI_SORT *pINChISort[TAUT_NUM],
672 int *num_components,
673 ORIG_ATOM_DATA *orig_inp_data,
674 ORIG_ATOM_DATA *prep_inp_data,
675 COMP_ATOM_DATA composite_norm_data[TAUT_NUM + 1],
676 int bCompareComponents); /* djb-rwth: matching composite_norm_data bounds */
677
687 char *pErrorText,
688 int bError);
689
699 int GetInpStructErrorType(INPUT_PARMS *ip, int err, char *pStrErrStruct, int num_inp_atoms);
700
713 INCHI_IOSTREAM *log_file,
714 char *pStrErrStruct,
715 int nErrorType,
716 long num_inp,
717 INPUT_PARMS *ip);
718
726 int bNumHeterAtomHasIsotopicH(inp_ATOM *atom, int num_atoms);
727
728 // does this function exist?
729 int WriteToSDfile(const INP_ATOM_DATA *inp_at_data, INCHI_IOSTREAM *fcb, const char *name, const char *comment,
730 const char *szLabel, const char *szValue);
731
739 int bIsMetalSalt(inp_ATOM *at, int i);
740
750 int bIsSameBond(int a1, int a2, int b1, int b2);
751
752 extern const char gsMissing[];
753 extern const char gsEmpty[];
754 extern const char gsSpace[];
755 extern const char gsEqual[];
756
757#define SDF_LBL_VAL(L, V) ((L) && (L)[0]) ? gsSpace : gsEmpty, ((L) && (L)[0]) ? L : gsEmpty, ((L) && (L)[0]) ? (((V) && (V)[0]) ? gsEqual : gsSpace) : gsEmpty, ((V) && (V)[0]) ? V : ((L) && (L)[0]) ? gsMissing \
758 : gsEmpty
759
760 /* Handle integer matrix [mxn] */
769 int imat_new(int m, int n, int ***a);
770
777 void imat_free(int m, int **a);
778
779 /* Light-weight {nodes, connections} subgraph of molecule, subgraf
780 refers to parent structure via orig atom numbers stored internally
781 nodes and edges: are living in 0-based node numbers domain
782 atoms and bonds: are living in 1-based orig atom numbers domain
783 */
784
785 /* subgraf_edge is node connections element */
786 typedef struct subgraf_edge
787 {
788 int nbr; /* node neighbor */
789 int etype; /* edge type echoing corresponding bond type */
791 /* subgraf is set of nodes and their connections */
792 typedef struct subgraf
793 {
794 int nnodes; /* number of nodes (atoms) */
795 int *nodes; /* nodes[i] is 1-based orig atom number of node #i */
796 /* (i = 0 to nnodes) */
797 int *degrees; /* degrees of nodes */
798 int *orig2node; /* orig2node[k] is 0-based node number for orig #k */
799 subgraf_edge **adj; /* node connections representing adjacency relation */
800 /* adj[i] is vector[0-degree] of edges at node #i */
802 /* helper structure for finding paths in subgraf*/
803 typedef struct subgraf_pathfinder
804 {
805 subgraf *sg; /* base subgraf */
806 int start; /* start node of path, 0-based */
807 int end; /* end node of path */
808 int maxbonds; /* max number of bonds in path */
809 int nbonds; /* actual number of bonds in path */
810 int nseen; /* number of nodes of found path(s) */
811 int *seen; /* nodes of found path(s) */
813
822 subgraf *subgraf_new(ORIG_ATOM_DATA *orig_inp_data,
823 int nnodes,
824 int *nodes);
825
832 void subgraf_free(subgraf *sg);
839
850 ORIG_ATOM_DATA *orig_inp_data,
851 int start,
852 int end);
853
861
874 int nforbidden,
875 int *forbidden_orig,
876 int *nbonds, int **bonds,
877 int *natoms, int *atoms);
878
889 int nforbidden,
890 int *forbidden,
891 int *atnums);
892
893 void CompAtomData_GetNumMapping(COMP_ATOM_DATA *adata, int *orig_num, int *curr_num);
894
895#ifndef COMPILE_ALL_CPP
896#ifdef __cplusplus
897}
898#endif
899#endif
900
901#endif /* _STRUTIL_H_ */
INChI * PINChI2[TAUT_NUM]
Definition ichi.h:259
INChI_Aux * PINChI_Aux2[TAUT_NUM]
Definition ichi.h:302
unsigned short AT_NUMB
Definition ichisize.h:45
signed short NUM_H
Definition ichisize.h:49
unsigned long INCHI_MODE
Definition ichisize.h:60
signed char S_CHAR
Definition inchi_api.h:113
#define TAUT_NUM
Definition mode.h:593
Definition strutil.h:787
int etype
Definition strutil.h:789
int nbr
Definition strutil.h:788
Definition strutil.h:804
int * seen
Definition strutil.h:811
int nseen
Definition strutil.h:810
int end
Definition strutil.h:807
subgraf * sg
Definition strutil.h:805
int start
Definition strutil.h:806
int nbonds
Definition strutil.h:809
int maxbonds
Definition strutil.h:808
Definition strutil.h:793
int * nodes
Definition strutil.h:795
int * degrees
Definition strutil.h:797
int * orig2node
Definition strutil.h:798
subgraf_edge ** adj
Definition strutil.h:799
int nnodes
Definition strutil.h:794
Definition ichicant.h:338
Structure describing composite atom data for InChI generation.
Definition inpdef.h:647
Definition ichitime.h:85
Definition ichi.h:267
Definition ichi.h:122
Definition ichi.h:209
Definition ichi.h:305
Definition strutil.h:308
int num_fixed_H2_more
Definition strutil.h:336
AT_NUMB sc_in2_only[ICR_MAX_SC_IN2_ONLY]
Definition strutil.h:340
int num_sb_in2_only
Definition strutil.h:346
AT_NUMB fixed_H_at1_more[ICR_MAX_DIFF_FIXED_H]
Definition strutil.h:330
int num_sc_in1_only
Definition strutil.h:339
int tot_num_H2
Definition strutil.h:312
AT_NUMB sc_undef_in2_only[ICR_MAX_SB_UNDF]
Definition strutil.h:355
AT_NUMB sb_undef_in1_only[ICR_MAX_SC_UNDF]
Definition strutil.h:348
int num_endp_in2_only
Definition strutil.h:324
int tot_num_H1
Definition strutil.h:311
S_CHAR fixed_H_nH2_more[ICR_MAX_DIFF_FIXED_H]
Definition strutil.h:335
int num_sc_in2_only
Definition strutil.h:341
int num_sb_undef_in2_only
Definition strutil.h:351
INCHI_MODE flags
Definition strutil.h:309
int num_sb_undef_in1_only
Definition strutil.h:349
int num_sb_in1_only
Definition strutil.h:344
AT_NUMB sb_undef_in2_only[ICR_MAX_SC_UNDF]
Definition strutil.h:350
AT_NUMB diff_pos_H_at[ICR_MAX_DIFF_FIXED_H]
Definition strutil.h:326
int num_diff_pos_H
Definition strutil.h:328
AT_NUMB sb_in2_only[ICR_MAX_SB_IN2_ONLY]
Definition strutil.h:345
int num_fixed_H1_more
Definition strutil.h:332
AT_NUMB sc_in1_only[ICR_MAX_SC_IN1_ONLY]
Definition strutil.h:338
int num_sc_undef_in2_only
Definition strutil.h:356
AT_NUMB fixed_H_at2_more[ICR_MAX_DIFF_FIXED_H]
Definition strutil.h:334
AT_NUMB endp_in1_only[ICR_MAX_ENDP_IN1_ONLY]
Definition strutil.h:320
AT_NUMB sb_in1_only[ICR_MAX_SB_IN1_ONLY]
Definition strutil.h:343
int num_taut_M2
Definition strutil.h:316
int num_endp_in1_only
Definition strutil.h:321
int num_taut_M1
Definition strutil.h:315
int num_sc_undef_in1_only
Definition strutil.h:354
AT_NUMB sc_undef_in1_only[ICR_MAX_SB_UNDF]
Definition strutil.h:353
AT_NUMB endp_in2_only[ICR_MAX_ENDP_IN2_ONLY]
Definition strutil.h:323
int num_taut_H1
Definition strutil.h:313
int num_taut_H2
Definition strutil.h:314
S_CHAR fixed_H_nH1_more[ICR_MAX_DIFF_FIXED_H]
Definition strutil.h:331
S_CHAR diff_pos_H_nH[ICR_MAX_DIFF_FIXED_H]
Definition strutil.h:327
Definition ichitime.h:69
Structure describing information about atoms for InChI generation.
Definition inpdef.h:553
Structure describing input atom data for InChI generation.
Definition inpdef.h:588
Structure describing an input atom.
Definition inpdef.h:142
Definition ichidrp.h:120
Structure describing original atom data.
Definition inpdef.h:433
Structure describing the original structure.
Definition inpdef.h:478
Definition mode.h:1030
Definition mode.h:1016
Definition ichitaut.h:222
int OutputINChI2(struct tagCANON_GLOBALS *pCG, INCHI_IOS_STRING *strbuf, INCHI_SORT *pINChISortTautAndNonTaut2[][TAUT_NUM], int INCHI_basic_or_INCHI_reconnected, ORIG_ATOM_DATA *orig_inp_data, ORIG_STRUCT *pOrigStruct, INPUT_PARMS *ip, int bDisconnectedCoord, int bOutputType, int bINChIOutputOptions, int num_components2[], int num_non_taut2[], int num_taut2[], INCHI_IOSTREAM *out_file, INCHI_IOSTREAM *log_file, int num_input_struct, int *pSortPrintINChIFlags, unsigned char save_opt_bits)
Definition ichiprt1.c:966
#define ICR_MAX_SC_IN2_ONLY
Definition strutil.h:303
int imat_new(int m, int n, int ***a)
Allocate integer matrix.
Definition strutil.c:5005
struct tagInChICompareResults ICR
int CompINChITaut2(const void *p1, const void *p2)
Compare function for qsort (tautomeric structures)
Definition ichimake.c:2064
int GetInpStructErrorType(INPUT_PARMS *ip, int err, char *pStrErrStruct, int num_inp_atoms)
Get the input struct error type.
Definition ichimake.c:2480
const char gsMissing[]
Definition runichi.c:207
enum tagMarkDiff DIF_VALUES
int Free_INChI_Stereo(INChI_Stereo *pINChI_Stereo)
Free INChI_Stereo data structure.
Definition strutil.c:4611
tagDiffINChISegments
Definition strutil.h:506
@ DIFS_t_SATOMS
Definition strutil.h:513
@ DIFS_idf_LENGTH
Definition strutil.h:518
@ DIFS_m_SP3INV
Definition strutil.h:514
@ DIFS_h_H_ATOMS
Definition strutil.h:509
@ DIFS_f_FORMULA
Definition strutil.h:507
@ DIFS_q_CHARGE
Definition strutil.h:510
@ DIFS_p_PROTONS
Definition strutil.h:511
@ DIFS_b_SBONDS
Definition strutil.h:512
@ DIFS_o_TRANSP
Definition strutil.h:517
@ DIFS_i_IATOMS
Definition strutil.h:516
@ DIFS_s_STYPE
Definition strutil.h:515
@ DIFS_LENGTH
Definition strutil.h:520
@ DIFS_c_CONNECT
Definition strutil.h:508
enum tagDiffINChISegments DIF_SEGMENTS
int Free_INChI_Aux(INChI_Aux **ppINChI_Aux)
Free INChI_Aux data structure.
Definition strutil.c:4843
void imat_free(int m, int **a)
Free integer matrix.
Definition strutil.c:5036
int Eql_INChI_Isotopic(INChI *i1, INChI *i2)
Compares isotopic information of two InChIs.
Definition ichiprt2.c:203
int subgraf_pathfinder_collect_all(subgraf_pathfinder *spf, int nforbidden, int *forbidden, int *atnums)
Collects atom numbers along path.
Definition strutil.c:5422
int FillOutInfAtom(struct tagCANON_GLOBALS *pCG, inp_ATOM *norm_at, INF_ATOM_DATA *inf_norm_at_data, int init_num_at, int num_removed_H, int bAdd_DT_to_num_H, int nNumRemovedProtons, NUM_H *nNumRemovedProtonsIsotopic, int bIsotopic, INChI *pINChI, INChI_Aux *pINChI_Aux, int bAbcNumbers, INCHI_MODE nMode)
Fill out.
subgraf * subgraf_new(ORIG_ATOM_DATA *orig_inp_data, int nnodes, int *nodes)
Create graph from atom data.
Definition strutil.c:5064
#define ICR_MAX_SC_IN1_ONLY
Definition strutil.h:302
const char * CompareReversedInchiMsg(int code)
int Free_INChI(INChI **ppINChI)
Free INChI data structure.
Definition strutil.c:4675
int CompINChI2(const INCHI_SORT *p1, const INCHI_SORT *p2, int bTaut, int bCompareIsotopic)
Compares two INChI data structures (qsort)
Definition ichimake.c:1712
enum tagINChISegmAction INCHI_SEGM_ACTION
#define ICR_MAX_SB_UNDF
Definition strutil.h:304
int ProcessStructError(INCHI_IOSTREAM *out_file, INCHI_IOSTREAM *log_file, char *pStrErrStruct, int nErrorType, long num_inp, INPUT_PARMS *ip)
Definition ichimake.c:2511
INCHI_MODE CompareReversedINChI2(INChI *i1, INChI *i2, INChI_Aux *a1, INChI_Aux *a2, ICR *picr, int *err)
Compares two InChIs (2)
Definition ichimake.c:3262
tagMarkDiff
Definition strutil.h:534
@ DIFV_OUTPUT_OMIT_F
Definition strutil.h:547
@ DIFV_OUTPUT_FILL_T
Definition strutil.h:549
@ DIFV_NEQ2PRECED
Definition strutil.h:537
@ DIFV_OUTPUT_EMPTY_T
Definition strutil.h:544
@ DIFV_BOTH_EMPTY
Definition strutil.h:535
@ DIFV_EQL2PRECED
Definition strutil.h:536
@ DIFV_OUTPUT_EMPTY_F
Definition strutil.h:545
@ DIFV_FI_EQ_MI
Definition strutil.h:539
@ DIFV_IS_EMPTY
Definition strutil.h:538
void subgraf_free(subgraf *sg)
Free graph data structure.
Definition strutil.c:5155
#define ICR_MAX_ENDP_IN1_ONLY
Definition strutil.h:297
#define ICR_MAX_SB_IN2_ONLY
Definition strutil.h:301
void subgraf_pathfinder_run(subgraf_pathfinder *spf, int nforbidden, int *forbidden_orig, int *nbonds, int **bonds, int *natoms, int *atoms)
Find path(s) from subgraf node spf->start to spf->end and fill bonds[nbonds] and atoms[natoms]....
Definition strutil.c:5273
const char gsEmpty[]
Definition runichi.c:208
int bHasEquString(AT_NUMB *LinearCT, int nLenCT)
Checks if a given array of equivalence numbers (LinearCT) contains any repetitions.
Definition ichiprt2.c:398
int CompareReversedINChI(INChI *i1, INChI *i2, INChI_Aux *a1, INChI_Aux *a2)
Compares two InChIs (1)
Definition ichimake.c:2936
int INChI_SegmentAction(char cDifSegs)
Action to take per segment (?)
Definition ichimake.c:1486
int bIsSameBond(int a1, int a2, int b1, int b2)
Check if two bonds are the same.
Definition runichi2.c:1293
int Eql_INChI_Aux_Num(INChI_Aux *a1, int eql1, INChI_Aux *a2, int eql2)
Compares two InChI AuxInfo objects in terms of numbering.
Definition ichiprt2.c:305
int Create_INChI(struct tagCANON_GLOBALS *pCG, struct tagINCHI_CLOCK *ic, INPUT_PARMS *ip, INChI **ppINChI, INChI_Aux **ppINChI_Aux, ORIG_ATOM_DATA *orig_inp_data, inp_ATOM *inp_at, INP_ATOM_DATA *inp_norm_data[2], int num_inp_at, INCHI_MODE nUserMode, INCHI_MODE *pbTautFlags, INCHI_MODE *pbTautFlagsDone, struct tagInchiTime *ulMaxTime, struct tagTautomerGroupsInfo *ti_out, char *pStrErrStruct)
Create INChI.
Definition ichimake.c:3707
subgraf_pathfinder * subgraf_pathfinder_new(subgraf *sg, ORIG_ATOM_DATA *orig_inp_data, int start, int end)
Allocate new graph pathfinder data structure.
Definition strutil.c:5221
void CompAtomData_GetNumMapping(COMP_ATOM_DATA *adata, int *orig_num, int *curr_num)
Definition strutil.c:4986
void subgraf_debug_trace(subgraf *sg)
Debug graph data structure.
Definition strutil.c:5192
#define ICR_MAX_DIFF_FIXED_H
Definition strutil.h:299
int CompINChITautVsNonTaut(const INCHI_SORT *p1, const INCHI_SORT *p2, int bCompareIsotopic)
Compare tautomeric vs non-tautomeric information.
Definition ichimake.c:341
int MarkUnusedAndEmptyLayers(char sDifSegs[][DIFS_LENGTH])
Mark unused and empty layers.
Definition ichimake.c:1525
int bIsMetalSalt(inp_ATOM *at, int i)
Check if atom is a metal salt.
Definition strutil.c:2511
int bNumHeterAtomHasIsotopicH(inp_ATOM *atom, int num_atoms)
Check if hetero atoms has isotopic hydrogens.
Definition strutil.c:4133
int CompINChILayers(const INCHI_SORT *p1, const INCHI_SORT *p2, char sDifSegs[][DIFS_LENGTH], int bFixTranspChargeBug)
Compare InChI layers.
Definition ichimake.c:645
const char gsEqual[]
Definition runichi.c:210
enum tagInchiDiffBits IDIF
INChI_Aux * Alloc_INChI_Aux(int num_at, int num_isotopic_atoms, int nAllocMode, int bOrigData)
Allocate AuxInfo data structure.
Definition strutil.c:4884
enum tagDiffINChILayers DIF_LAYERS
int ExtractConnectedComponent(inp_ATOM *at, int num_at, int component_number, inp_ATOM *component_at)
Extract one (connected) component.
Definition strutil.c:4558
int SaveEquComponentsInfoAndSortOrder(int iINChI, INCHI_SORT *pINChISort[TAUT_NUM], int *num_components, ORIG_ATOM_DATA *orig_inp_data, ORIG_ATOM_DATA *prep_inp_data, COMP_ATOM_DATA composite_norm_data[TAUT_NUM+1], int bCompareComponents)
Save equivalent components information and sort order (not used ?)
#define ICR_MAX_ENDP_IN2_ONLY
Definition strutil.h:298
tagDiffINChILayers
Definition strutil.h:524
@ DIFL_LENGTH
Definition strutil.h:529
@ DIFL_FI
Definition strutil.h:528
@ DIFL_M
Definition strutil.h:525
@ DIFL_MI
Definition strutil.h:526
@ DIFL_F
Definition strutil.h:527
INChI * Alloc_INChI(inp_ATOM *at, int num_at, int *found_num_bonds, int *found_num_isotopic, int nAllocMode)
Allocate INChI data structure.
Definition strutil.c:4722
tagINChISegmAction
Definition strutil.h:553
@ INCHI_SEGM_OMIT
Definition strutil.h:554
@ INCHI_SEGM_FILL
Definition strutil.h:555
@ INCHI_SEGM_EMPTY
Definition strutil.h:556
int SetConnectedComponentNumber(inp_ATOM *at, int num_at, int component_number)
Set the Connected Component Number object.
Definition strutil.c:4598
const char gsSpace[]
Definition runichi.c:209
int CompareIcr(ICR *picr1, ICR *picr2, INCHI_MODE *pin1, INCHI_MODE *pin2, INCHI_MODE mask)
Compares results from InChI comparison.
Definition ichimake.c:3189
int Eql_INChI_Aux_Equ(INChI_Aux *a1, int eql1, INChI_Aux *a2, int eql2)
Compares two InChI AuxInfo objects.
Definition ichiprt2.c:227
int FillOutCompositeCanonInfAtom(struct tagCANON_GLOBALS *pCG, COMP_ATOM_DATA *composite_norm_data, INF_ATOM_DATA *inf_norm_at_data, int bIsotopic, int bTautomeric, PINChI2 *pINChI2, PINChI_Aux2 *pINChI_Aux2, int bAbcNumbers, INCHI_MODE nMode)
Fill out composite canonical info atom data structure.
#define ICR_MAX_SC_UNDF
Definition strutil.h:305
int OutputINChIPlainError(INCHI_IOSTREAM *out_file, char *pErrorText, int bError)
Print error message (plain text)
Definition ichiprt1.c:514
void subgraf_pathfinder_free(subgraf_pathfinder *spf)
Frees subgraph pathfinder data structure.
Definition strutil.c:5252
tagInchiDiffBits
Definition strutil.h:242
@ IDIF_SC_EXTRA_UNDF
Definition strutil.h:273
@ IDIF_MULTIPLE_TG
Definition strutil.h:258
@ IDIF_CON_TBL
Definition strutil.h:248
@ IDIF_REM_ISO_H
Definition strutil.h:270
@ IDIF_SB_MISS_UNDF
Definition strutil.h:280
@ IDIF_NUM_ISO_AT
Definition strutil.h:266
@ IDIF_REM_PROT
Definition strutil.h:269
@ IDIF_POSITION_H
Definition strutil.h:249
@ IDIF_SB_MISS
Definition strutil.h:281
@ IDIF_MISS_TG_ENDP
Definition strutil.h:263
@ IDIF_TG
Definition strutil.h:265
@ IDIF_SC_INV
Definition strutil.h:271
@ IDIF_SC_PARITY
Definition strutil.h:272
@ IDIF_SINGLE_TG
Definition strutil.h:257
@ IDIF_SB_EXTRA
Definition strutil.h:279
@ IDIF_MORE_FH
Definition strutil.h:250
@ IDIF_NUM_EL
Definition strutil.h:246
@ IDIF_ISO_AT
Definition strutil.h:267
@ IDIF_NUM_AT
Definition strutil.h:244
@ IDIF_CON_LEN
Definition strutil.h:247
@ IDIF_EXTRA_TG_ENDP
Definition strutil.h:262
@ IDIF_SB_EXTRA_UNDF
Definition strutil.h:278
@ IDIF_LESS_H
Definition strutil.h:253
@ IDIF_ATOMS
Definition strutil.h:245
@ IDIF_DIFF_TG_ENDP
Definition strutil.h:264
@ IDIF_SC_MISS
Definition strutil.h:276
@ IDIF_CHARGE
Definition strutil.h:268
@ IDIF_SC_EXTRA
Definition strutil.h:274
@ IDIF_LESS_FH
Definition strutil.h:251
@ IDIF_PROBLEM
Definition strutil.h:243
@ IDIF_NO_TAUT
Definition strutil.h:255
@ IDIF_WRONG_TAUT
Definition strutil.h:256
@ IDIF_SB_PARITY
Definition strutil.h:277
@ IDIF_NUM_TG
Definition strutil.h:259
@ IDIF_MORE_H
Definition strutil.h:252
@ IDIF_SC_MISS_UNDF
Definition strutil.h:275
int WriteToSDfile(const INP_ATOM_DATA *inp_at_data, INCHI_IOSTREAM *fcb, const char *name, const char *comment, const char *szLabel, const char *szValue)
int OutputINChI1(struct tagCANON_GLOBALS *pCG, INCHI_IOS_STRING *strbuf, INCHI_SORT *pINChISortTautAndNonTaut2[][TAUT_NUM], int iINChI, ORIG_ATOM_DATA *orig_inp_data, ORIG_STRUCT *pOrigStruct, INPUT_PARMS *ip, int bDisconnectedCoord, int bOutputType, int bINChIOutputOptions, int num_components2[], int num_non_taut2[], int num_taut2[], INCHI_IOSTREAM *out_file, INCHI_IOSTREAM *log_file, int num_input_struct, int *pSortPrintINChIFlags, unsigned char save_opt_bits)
Main actual worker which serializes InChI to string (called from OutputINChI2( ......
Definition ichiprt1.c:1043
int CompINChINonTaut2(const void *p1, const void *p2)
Compare function for qsort (normal structure)
Definition ichimake.c:2042
int Free_INChI_Members(INChI *pINChI)
Free INChI members.
Definition strutil.c:4698
#define ICR_MAX_SB_IN1_ONLY
Definition strutil.h:300
char * AllocateAndFillHillFormula(INChI *pINChI)
Allocate and fill hill formula.
Definition ichimak2.c:402
int Eql_INChI_Stereo(INChI_Stereo *s1, int eql1, INChI_Stereo *s2, int eql2, int bRelRac)
Compares stereo information of two structures.
Definition ichiprt2.c:54