rino 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/Rakefile +1 -1
  2. data/ext/extconf.rb +1 -24
  3. data/ext/libinchi.so +0 -0
  4. data/ext/src/aux2atom.h +120 -39
  5. data/ext/src/comdef.h +3 -3
  6. data/ext/src/dispstru.c +2547 -0
  7. data/ext/src/dispstru.h +73 -0
  8. data/ext/src/extr_ct.h +5 -2
  9. data/ext/src/ichi.h +27 -11
  10. data/ext/src/ichi_bns.c +1800 -254
  11. data/ext/src/ichi_bns.h +205 -4
  12. data/ext/src/ichican2.c +197 -86
  13. data/ext/src/ichicano.c +8 -13
  14. data/ext/src/ichicano.h +2 -2
  15. data/ext/src/ichicans.c +11 -6
  16. data/ext/src/ichicant.h +2 -2
  17. data/ext/src/ichicomn.h +2 -2
  18. data/ext/src/ichicomp.h +19 -4
  19. data/ext/src/ichidrp.h +9 -5
  20. data/ext/src/ichierr.h +5 -3
  21. data/ext/src/ichiisot.c +2 -2
  22. data/ext/src/ichimain.c +461 -0
  23. data/ext/src/ichimain.h +23 -15
  24. data/ext/src/ichimak2.c +6 -6
  25. data/ext/src/ichimake.c +843 -42
  26. data/ext/src/ichimake.h +4 -2
  27. data/ext/src/ichimap1.c +5 -5
  28. data/ext/src/ichimap2.c +2 -2
  29. data/ext/src/ichimap4.c +34 -21
  30. data/ext/src/ichinorm.c +11 -5
  31. data/ext/src/ichinorm.h +3 -2
  32. data/ext/src/ichiparm.c +2 -2
  33. data/ext/src/ichiparm.h +232 -30
  34. data/ext/src/ichiprt1.c +35 -11
  35. data/ext/src/ichiprt2.c +78 -7
  36. data/ext/src/ichiprt3.c +300 -120
  37. data/ext/src/ichiqueu.c +17 -2
  38. data/ext/src/ichiread.c +6932 -0
  39. data/ext/src/ichiring.c +3 -2
  40. data/ext/src/ichiring.h +2 -2
  41. data/ext/src/ichirvr1.c +4891 -0
  42. data/ext/src/ichirvr2.c +6344 -0
  43. data/ext/src/ichirvr3.c +5499 -0
  44. data/ext/src/ichirvr4.c +3177 -0
  45. data/ext/src/ichirvr5.c +1166 -0
  46. data/ext/src/ichirvr6.c +1287 -0
  47. data/ext/src/ichirvr7.c +2319 -0
  48. data/ext/src/ichirvrs.h +882 -0
  49. data/ext/src/ichisize.h +2 -2
  50. data/ext/src/ichisort.c +5 -5
  51. data/ext/src/ichister.c +281 -86
  52. data/ext/src/ichister.h +9 -3
  53. data/ext/src/ichitaut.c +208 -9
  54. data/ext/src/ichitaut.h +13 -11
  55. data/ext/src/ichitime.h +16 -2
  56. data/ext/src/inchicmp.h +107 -0
  57. data/ext/src/inpdef.h +6 -3
  58. data/ext/src/libinchi_wrap.c +912 -0
  59. data/ext/src/lreadmol.h +34 -31
  60. data/ext/src/mode.h +244 -7
  61. data/ext/src/mol2atom.c +1060 -0
  62. data/ext/src/mol2atom.h +31 -0
  63. data/ext/src/readinch.c +239 -0
  64. data/ext/src/readmol.c +28 -0
  65. data/ext/src/{e_readmol.h → readmol.h} +7 -9
  66. data/ext/src/runichi.c +251 -177
  67. data/ext/src/strutil.c +444 -238
  68. data/ext/src/strutil.h +150 -11
  69. data/ext/src/util.c +176 -118
  70. data/ext/src/util.h +15 -3
  71. data/lib/rino.rb +71 -3
  72. data/test/test.rb +33 -4
  73. metadata +22 -34
  74. data/ext/ruby_inchi_main.so +0 -0
  75. data/ext/src/e_0dstereo.c +0 -3014
  76. data/ext/src/e_0dstereo.h +0 -31
  77. data/ext/src/e_comdef.h +0 -57
  78. data/ext/src/e_ctl_data.h +0 -147
  79. data/ext/src/e_ichi_io.c +0 -498
  80. data/ext/src/e_ichi_io.h +0 -40
  81. data/ext/src/e_ichi_parms.c +0 -37
  82. data/ext/src/e_ichi_parms.h +0 -41
  83. data/ext/src/e_ichicomp.h +0 -50
  84. data/ext/src/e_ichierr.h +0 -40
  85. data/ext/src/e_ichimain.c +0 -593
  86. data/ext/src/e_ichisize.h +0 -43
  87. data/ext/src/e_inchi_atom.c +0 -75
  88. data/ext/src/e_inchi_atom.h +0 -33
  89. data/ext/src/e_inpdef.h +0 -41
  90. data/ext/src/e_mode.h +0 -706
  91. data/ext/src/e_mol2atom.c +0 -649
  92. data/ext/src/e_readinch.c +0 -58
  93. data/ext/src/e_readmol.c +0 -54
  94. data/ext/src/e_readstru.c +0 -251
  95. data/ext/src/e_readstru.h +0 -33
  96. data/ext/src/e_util.c +0 -284
  97. data/ext/src/e_util.h +0 -61
  98. data/ext/src/ichilnct.c +0 -286
  99. data/ext/src/inchi_api.h +0 -670
  100. data/ext/src/inchi_dll.c +0 -1480
  101. data/ext/src/inchi_dll.h +0 -34
  102. data/ext/src/inchi_dll_main.c +0 -23
  103. data/ext/src/inchi_dll_main.h +0 -31
  104. data/ext/src/ruby_inchi_main.c +0 -558
@@ -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.00
6
- * April 13, 2005
5
+ * Software version 1.01
6
+ * July 21, 2006
7
7
  * Developed at NIST
8
8
  */
9
9
 
@@ -16,9 +16,10 @@ extern "C" {
16
16
  #endif
17
17
  #endif
18
18
  int bCanAtomBeAStereoCenter( char *elname, S_CHAR charge, S_CHAR radical );
19
- int bCanInpAtomBeAStereoCenter( inp_ATOM *at, int cur_at );
19
+ int bCanInpAtomBeAStereoCenter( inp_ATOM *at, int cur_at, int bPointedEdgeStereo );
20
20
  int bCanAtomHaveAStereoBond( char *elname, S_CHAR charge, S_CHAR radical );
21
21
  int bCanAtomBeTerminalAllene( char *elname, S_CHAR charge, S_CHAR radical );
22
+ int bCanAtomBeMiddleAllene( char *elname, S_CHAR charge, S_CHAR radical );
22
23
  int bAtomHasValence3( char *elname, S_CHAR charge, S_CHAR radical );
23
24
  int set_stereo_parity( inp_ATOM* at, sp_ATOM* at_output, int num_at, int num_removed_H,
24
25
  int *nMaxNumStereoAtoms, int *nMaxNumStereoBonds, INCHI_MODE nMode,
@@ -26,6 +27,11 @@ int set_stereo_parity( inp_ATOM* at, sp_ATOM* at_output, int num_at, int num_rem
26
27
  int get_opposite_sb_atom( inp_ATOM *at, int cur_atom, int icur2nxt,
27
28
  int *pnxt_atom, int *pinxt2cur, int *pinxt_sb_parity_ord );
28
29
 
30
+ #define PES_BIT_POINT_EDGE_STEREO 1
31
+ #define PES_BIT_PHOSPHINE_STEREO 2
32
+ #define PES_BIT_ARSINE_STEREO 4
33
+ #define PES_BIT_FIX_SP3_BUG 8
34
+
29
35
  #ifndef INCHI_ALL_CPP
30
36
  #ifdef __cplusplus
31
37
  }
@@ -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.00
6
- * April 13, 2005
5
+ * Software version 1.01
6
+ * July 21, 2006
7
7
  * Developed at NIST
8
8
  */
9
9
 
@@ -724,6 +724,7 @@ int GetNeutralRepsIfNeeded( AT_NUMB *pri, AT_NUMB *prj, inp_ATOM *at, int num_at
724
724
  if ( (c_point = at[ri].c_point) && (c_point == at[rj].c_point) &&
725
725
  (at[ri].charge == 1 || at[rj].charge == 1) && cgi && cgi->num_c_groups > 0 ) {
726
726
  /* at[ri] and at[rj] belong to the same charge group, at least one is charged */
727
+ /* MS VC++ 2005 reports unreachable code here ??? */
727
728
  for ( k = 0; k < cgi->num_c_groups; k ++ ) {
728
729
  if ( cgi->c_group[k].nGroupNumber == c_point ) {
729
730
  /* cgi->c_group[k] is found to be this charge group */
@@ -2291,6 +2292,7 @@ int MarkSaltChargeGroups ( inp_ATOM *at, int num_atoms, S_GROUP_INFO *s_group_in
2291
2292
  }
2292
2293
  #endif
2293
2294
  nNumCandidates = 0; /* always recalculate 2004-03-22 */
2295
+ num_tested = 0;
2294
2296
 
2295
2297
  if ( nNumCandidates == 0 ) {
2296
2298
  for ( i = 0, nNumCandidates = nNumOtherCandidates = nNumPOnlyCandidates = 0; i < num_atoms; i ++ ) {
@@ -2353,7 +2355,6 @@ int MarkSaltChargeGroups ( inp_ATOM *at, int num_atoms, S_GROUP_INFO *s_group_in
2353
2355
  SALT_DONOR_Neg to SALT_ACCEPTOR : long distance migration of negative charges
2354
2356
  SALT_DONOR_H to SALT_ACCEPTOR : long distance migration of H-atoms
2355
2357
  */
2356
- num_tested = 0;
2357
2358
  do {
2358
2359
  nNumChanges = 0;
2359
2360
  for ( i1 = 0; i1 < nNumCandidates; i1 ++ ) {
@@ -2944,7 +2945,10 @@ int MarkTautomerGroups( inp_ATOM *at, int num_atoms, T_GROUP_INFO *t_group_info,
2944
2945
  int *pnum_t, max_num_t, bIgnoreIsotopic;
2945
2946
  ENDPOINT_INFO eif1, eif2;
2946
2947
  int nErr = 0;
2947
- #define ALLOWED_EDGE(PBNS, IAT,IBOND) ( !PBNS || !PBNS->edge || !PBNS->vert || !PBNS->edge[PBNS->vert[IAT].iedge[IBOND]].forbidden)
2948
+ #define ALLOWED_EDGE(PBNS, IAT,IBOND) ( !(PBNS) || !(PBNS)->edge || !(PBNS)->vert || !(PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].forbidden)
2949
+ #define ACTUAL_ORDER(PBNS, IAT,IBOND, BTYPE) ( ((PBNS) && (PBNS)->edge && (PBNS)->vert &&\
2950
+ ((BTYPE)==BOND_ALT_123 || (BTYPE)==BOND_ALT_13 || (BTYPE)==BOND_ALT_23))? (PBNS)->edge[(PBNS)->vert[IAT].iedge[IBOND]].flow+BOND_TYPE_SINGLE:(BTYPE))
2951
+
2948
2952
 
2949
2953
  if ( !t_group_info || !(t_group_info->bTautFlags & TG_FLAG_TEST_TAUT__ATOMS) )
2950
2954
  return 0;
@@ -2984,6 +2988,9 @@ int MarkTautomerGroups( inp_ATOM *at, int num_atoms, T_GROUP_INFO *t_group_info,
2984
2988
  /* 1st endpoint candidate found. Find centerpoint candidate */
2985
2989
  for ( j = 0; j < at[i].valence; j ++ ) {
2986
2990
  bond_type = (int)at[i].bond_type[j] & ~BOND_MARK_ALL;
2991
+ #if( FIX_BOND23_IN_TAUT == 1 )
2992
+ bond_type = ACTUAL_ORDER(pBNS,i,j,bond_type);
2993
+ #endif
2987
2994
  centerpoint = (int)at[i].neighbor[j]; /* a centerpoint candidate */
2988
2995
  if ( (bond_type == BOND_DOUBLE ||
2989
2996
  bond_type == BOND_ALTERN ||
@@ -3000,13 +3007,13 @@ int MarkTautomerGroups( inp_ATOM *at, int num_atoms, T_GROUP_INFO *t_group_info,
3000
3007
  for ( k = 0, nNumEndPoints = 0, nNumBondPos = 0; k < at[centerpoint].valence; k ++ ) {
3001
3008
  endpoint = at[centerpoint].neighbor[k]; /* endpoint candidate */
3002
3009
  bond_type = (int)at[centerpoint].bond_type[k] & ~BOND_MARK_ALL;
3010
+ #if( FIX_BOND23_IN_TAUT == 1 )
3011
+ bond_type = ACTUAL_ORDER(pBNS,centerpoint,k,bond_type);
3012
+ #endif
3003
3013
  bTautBond =
3004
3014
  bNonTautBond =
3005
3015
  bAltBond =
3006
3016
  bPossiblyEndpoint = 0;
3007
- if ( !( !pBNS || !pBNS->edge || !pBNS->vert || !pBNS->edge[pBNS->vert[centerpoint].iedge[k]].forbidden) ) {
3008
- continue;
3009
- }
3010
3017
  if ( !ALLOWED_EDGE(pBNS, centerpoint, k) ) {
3011
3018
  continue;
3012
3019
  } else
@@ -3597,9 +3604,9 @@ int set_tautomer_iso_sort_keys( T_GROUP_INFO *t_group_info )
3597
3604
  * No previous t_group_info adjustment due to throwing out disconnected parts of
3598
3605
  * the chemical structure is needed.
3599
3606
  *
3600
- * Note2: throw out t_groups containing negative charges only (IGNORE_TGROUP_WITHOUT_H==1)
3607
+ * Note2: throws out t_groups containing negative charges only (IGNORE_TGROUP_WITHOUT_H==1)
3601
3608
  * (leave their tautomeric bonds unchanged)
3602
- * Note3: remove negative charges from other tautomeric groups
3609
+ * Note3: removes negative charges from other tautomeric groups
3603
3610
  * and adjust counts of mobile atoms if permitted (REMOVE_TGROUP_CHARGE==1)
3604
3611
  */
3605
3612
  int CountTautomerGroups( sp_ATOM *at, int num_atoms, T_GROUP_INFO *t_group_info )
@@ -3789,6 +3796,198 @@ exit_function:
3789
3796
  }
3790
3797
  return ret;
3791
3798
  }
3799
+ #if( READ_INCHI_STRING == 1 )
3800
+ #if( INCLUDE_NORMALIZATION_ENTRY_POINT == 1 )
3801
+ /********************************************************************************/
3802
+ int CountTautomerGroupsInpAt( inp_ATOM *at, int num_atoms, T_GROUP_INFO *t_group_info )
3803
+ {
3804
+ int i, j, ret = 0, nNumEndpoints, max_t_group, num_groups_noH;
3805
+
3806
+ AT_NUMB nGroupNumber, nNewGroupNumber, *nCurrEndpointAtNoPos = NULL;
3807
+
3808
+ T_GROUP *t_group;
3809
+ int num_t;
3810
+ /* int bIgnoreIsotopic, max_num_t; */
3811
+ AT_NUMB *nTautomerGroupNumber = NULL;
3812
+ AT_NUMB *nEndpointAtomNumber = NULL;
3813
+ AT_NUMB *tGroupNumber = NULL;
3814
+
3815
+ if ( !t_group_info || !t_group_info->t_group || 0 >= t_group_info->max_num_t_groups ) {
3816
+ return 0; /* empty t-groups */
3817
+ }
3818
+ num_t = t_group_info->num_t_groups;
3819
+ t_group = t_group_info->t_group;
3820
+ /*
3821
+ max_num_t = t_group_info->max_num_t_groups;
3822
+ bIgnoreIsotopic = t_group_info->bIgnoreIsotopic;
3823
+ */
3824
+ num_groups_noH = 0;
3825
+
3826
+ /* the following 2 arrays are to be rebuilt here */
3827
+ if ( t_group_info->nEndpointAtomNumber ) {
3828
+ inchi_free ( t_group_info->nEndpointAtomNumber );
3829
+ t_group_info->nEndpointAtomNumber = NULL;
3830
+ }
3831
+ if ( t_group_info->tGroupNumber ) {
3832
+ inchi_free ( t_group_info->tGroupNumber );
3833
+ t_group_info->tGroupNumber = NULL;
3834
+ }
3835
+ /* find max_t_group */
3836
+ for ( i = 0, max_t_group = 0; i < t_group_info->num_t_groups; i ++ ) {
3837
+ if ( max_t_group < t_group[i].nGroupNumber )
3838
+ max_t_group = t_group[i].nGroupNumber;
3839
+ }
3840
+ /* allocate memory for temp storage of numbers of endpoints */
3841
+ if ( max_t_group &&
3842
+ !(nTautomerGroupNumber = (AT_NUMB*) inchi_calloc( max_t_group+1, sizeof(nTautomerGroupNumber[0]) ) /*temp*/ ) ) {
3843
+ goto err_exit_function; /* program error: out of RAM */ /* <BRKPT> */
3844
+ }
3845
+
3846
+ /* count endpoints for each tautomer group */
3847
+ for ( i = 0, nNumEndpoints = 0; i < num_atoms; i ++ ) {
3848
+ if ( (j = at[i].endpoint) == 0 )
3849
+ continue;
3850
+ if ( j > max_t_group ) /* debug only */
3851
+ goto err_exit_function; /* program error */ /* <BRKPT> */
3852
+ nTautomerGroupNumber[j] ++;
3853
+ nNumEndpoints ++;
3854
+ }
3855
+
3856
+ if ( !nNumEndpoints ) {
3857
+ goto exit_function; /* not a tautomer */
3858
+ }
3859
+
3860
+ /* allocate temporary array */
3861
+ if ( !(nEndpointAtomNumber = (AT_NUMB*) inchi_calloc( nNumEndpoints, sizeof(nEndpointAtomNumber[0]) ) ) ||
3862
+ !(nCurrEndpointAtNoPos = (AT_NUMB*) inchi_calloc( num_t, sizeof(nCurrEndpointAtNoPos[0]) ) /*temp*/ ) ) {
3863
+ goto err_exit_function; /* program error: out of RAM */ /* <BRKPT> */
3864
+ }
3865
+ /*
3866
+ * Remove missing endpoints from t_group. Since only one
3867
+ * disconnected part is processed, some endpoints groups may have disappeared.
3868
+ * Mark t_groups containing charges only for subsequent removal
3869
+ */
3870
+ for ( i = 0, nNewGroupNumber = 0; i < num_t; /*i ++*/ ) {
3871
+ int bNoH = 0, nNumH;
3872
+ nGroupNumber = t_group[i].nGroupNumber;
3873
+ for ( j = 1, nNumH = t_group[i].num[0]; j < T_NUM_NO_ISOTOPIC; j ++ ) {
3874
+ nNumH -= (int)t_group[i].num[j];
3875
+ }
3876
+ if ( t_group[i].nNumEndpoints != nTautomerGroupNumber[(int)nGroupNumber]
3877
+ #if( IGNORE_TGROUP_WITHOUT_H == 1 )
3878
+ || (bNoH = (t_group[i].num[0]==t_group[i].num[1])) /* only for (H,-) t-groups; (+) t-groups are not removed */
3879
+ #endif
3880
+ ) {
3881
+ if ( !nTautomerGroupNumber[(int)nGroupNumber] || bNoH ) {
3882
+ /* the group belongs to another disconnected part of the structure or has only charges */
3883
+ /* Remove the group */
3884
+ num_t --;
3885
+ if ( i < num_t )
3886
+ memmove( t_group+i, t_group+i+1, (num_t-i)*sizeof(t_group[0]) );
3887
+ if ( bNoH ) {
3888
+ /* group contains no mobile hydrogen atoms, only charges. Prepare to remove it. */
3889
+ nTautomerGroupNumber[(int)nGroupNumber] = 0;
3890
+ num_groups_noH ++;
3891
+ }
3892
+ /*i --;*/
3893
+ } else {
3894
+ /* different number of endpoints */
3895
+ goto err_exit_function; /* program error */ /* <BRKPT> */
3896
+ }
3897
+ } else {
3898
+ /* renumber t_group and prepare to renumber at[i].endpoint */
3899
+ nTautomerGroupNumber[(int)nGroupNumber] =
3900
+ t_group[i].nGroupNumber = ++nNewGroupNumber; /* = i+1 */
3901
+ /* get first group atom orig. number position in the nEndpointAtomNumber[] */
3902
+ /* and in the tautomer endpoint canon numbers part of the connection table */
3903
+ t_group[i].nFirstEndpointAtNoPos = nCurrEndpointAtNoPos[i] =
3904
+ i? (t_group[i-1].nFirstEndpointAtNoPos+t_group[i-1].nNumEndpoints) : 0;
3905
+ t_group[i].num[0] = nNumH;
3906
+ #if( REMOVE_TGROUP_CHARGE == 1 )
3907
+ t_group[i].num[1] = 0; /* remove only (-) charges */
3908
+ #endif
3909
+ /* -- wrong condition. Disabled.
3910
+ if ( t_group[i].nGroupNumber != i + 1 ) { // for debug only
3911
+ goto err_exit_function; // program error
3912
+ }
3913
+ */
3914
+ i ++;
3915
+ }
3916
+ }
3917
+ if ( num_t != nNewGroupNumber ) { /* for debug only */
3918
+ goto err_exit_function; /* program error */ /* <BRKPT> */
3919
+ }
3920
+
3921
+ /* check if any tautomer group was left */
3922
+ if ( !nNewGroupNumber ) {
3923
+ if ( !num_groups_noH )
3924
+ goto err_exit_function; /* program error: not a tautomer */ /* <BRKPT> */
3925
+ else
3926
+ goto exit_function;
3927
+ }
3928
+ /*
3929
+ * an array for tautomer group sorting later, at the time of storing Connection Table
3930
+ * Later the sorting consists out of 2 steps:
3931
+ * 1) Sort t_group[i].nNumEndpoints endpoint atom ranks within each endpoint group
3932
+ * starting from t_group[i].nFirstEndpointAtNoPos; i = 0..t_group_info->num_t_groups-1
3933
+ * 2) Sort the groups indexes t_group_info->tGroupNumber[]
3934
+ */
3935
+ if ( !(tGroupNumber=
3936
+ (AT_NUMB*)inchi_calloc(nNewGroupNumber*TGSO_TOTAL_LEN, sizeof(tGroupNumber[0])))) {
3937
+ goto err_exit_function; /* out of RAM */
3938
+ }
3939
+ for ( i = 0; i < nNewGroupNumber; i ++ ) {
3940
+ tGroupNumber[i] = (AT_NUMB)i; /* initialization: original t_group number = (at[i]->endpoint-1) */
3941
+ }
3942
+ /*
3943
+ * renumber endpoint atoms and save their orig. atom
3944
+ * numbers for filling out the tautomer part of the LinearCT.
3945
+ * nCurrEndpointAtNoPos[j] is an index of the atom number in the nEndpointAtomNumber[]
3946
+ */
3947
+ for ( i = 0; i < num_atoms; i ++ ) {
3948
+ if ( j = (int)at[i].endpoint ) {
3949
+ j = (int)(at[i].endpoint = nTautomerGroupNumber[j])-1; /* new t_group number */
3950
+ if ( j >= 0 ) { /* j=-1 in case of no mobile hydrogen atoms (charges only), group being removed */
3951
+ if ( nCurrEndpointAtNoPos[j] >= /* debug only */
3952
+ t_group[j].nFirstEndpointAtNoPos+t_group[j].nNumEndpoints ) {
3953
+ goto err_exit_function; /* program error */ /* <BRKPT> */
3954
+ }
3955
+ nEndpointAtomNumber[(int)nCurrEndpointAtNoPos[j] ++] = (AT_NUMB)i;
3956
+ } else {
3957
+ nNumEndpoints --; /* endpoint has been removed */
3958
+ }
3959
+ }
3960
+ }
3961
+ t_group_info->num_t_groups = nNewGroupNumber;
3962
+ t_group_info->nNumEndpoints = nNumEndpoints;
3963
+ t_group_info->nEndpointAtomNumber = nEndpointAtomNumber;
3964
+ t_group_info->tGroupNumber = tGroupNumber; /* only the 1st segment filled */
3965
+ inchi_free ( nTautomerGroupNumber );
3966
+ inchi_free ( nCurrEndpointAtNoPos );
3967
+ return nNumEndpoints + T_GROUP_HDR_LEN * nNewGroupNumber + 1; /* nLenLinearCTTautomer */
3968
+
3969
+ err_exit_function:
3970
+ ret = CT_TAUCOUNT_ERR;
3971
+ exit_function:
3972
+ /* release allocated memory; set "no tautomeric group" */
3973
+ if ( nEndpointAtomNumber )
3974
+ inchi_free ( nEndpointAtomNumber );
3975
+ if ( nTautomerGroupNumber )
3976
+ inchi_free ( nTautomerGroupNumber );
3977
+ if ( tGroupNumber )
3978
+ inchi_free ( tGroupNumber );
3979
+ if ( nCurrEndpointAtNoPos )
3980
+ inchi_free ( nCurrEndpointAtNoPos );
3981
+ t_group_info->nNumEndpoints = 0;
3982
+ t_group_info->num_t_groups = 0;
3983
+ if ( !ret && ((t_group_info->tni.bNormalizationFlags & FLAG_NORM_CONSIDER_TAUT) ||
3984
+ t_group_info->nNumIsotopicEndpoints>1 && (t_group_info->bTautFlagsDone & (TG_FLAG_FOUND_ISOTOPIC_H_DONE | TG_FLAG_FOUND_ISOTOPIC_ATOM_DONE))) ) {
3985
+ ret = 1; /* only protons have been (re)moved or neitralization happened */
3986
+ }
3987
+ return ret;
3988
+ }
3989
+ #endif
3990
+ #endif
3792
3991
  /**************************************************************
3793
3992
  * tautomers: Compare for sorting
3794
3993
  ******************************************************************/
@@ -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.00
6
- * April 13, 2005
5
+ * Software version 1.01
6
+ * July 21, 2006
7
7
  * Developed at NIST
8
8
  */
9
9
 
@@ -137,15 +137,10 @@ typedef struct tagTautomerGroup {
137
137
 
138
138
  /* offsets/num_t_groups within T_GROUP_INFO::tGroupNumber */
139
139
  #define TGSO_CURR_ORDER 0 /* tGroupNumber: current sorting order */
140
- #define TGSO_PREV_ORDER 1 /* tPrevGroupNumber: previous sorting order; symmetry rank sorting order */
141
- /* #define TGSO_CURR_IORDER 1 */ /* tiGroupNumber: isotopic sort order */
142
- #define TGSO_SYMM_RANK 2 /* tSymmRank: symmetry ranks (no isotopes) = min. ordering number > 0. */
143
- #define TGSO_SORT_RANK 3 /* tSortRank: current rank (positive ordering number) */
144
- #define TGSO_SYMM_IORDER 4 /* tiGroupNumber: isotopic symmetry rank sorting order */
145
- #define TGSO_SYMM_IRANK 5 /* tiSymmRank: isotopic symmetry ranks */
146
- #define TGSO_SORT_IRANK 6 /* tiSortRank: current isotopic rank (positive ordering number) */
147
- #define TGSO_MARK_IRANK 7 /* tiMarkGroup: the min. canonical number has been mapped on the endpoint */
148
- #define TGSO_TOTAL_LEN 8
140
+ #define TGSO_SYMM_RANK 1 /* tSymmRank: symmetry ranks (no isotopes) = min. ordering number > 0. */
141
+ #define TGSO_SYMM_IORDER 2 /* tiGroupNumber: isotopic symmetry rank sorting order */
142
+ #define TGSO_SYMM_IRANK 3 /* tiSymmRank: isotopic symmetry ranks */
143
+ #define TGSO_TOTAL_LEN 4
149
144
 
150
145
  /***************************************************/
151
146
  /* flags for t_group_info->tni.bNormalizationFlags */
@@ -169,10 +164,17 @@ typedef struct tagTautomerGroup {
169
164
  FLAG_PROTON_SINGLE_REMOVED | \
170
165
  FLAG_PROTON_CHARGE_CANCEL )
171
166
 
167
+ #if( FIX_N_MINUS_NORN_BUG == 1 )
168
+ #define FLAG_FORCE_SALT_TAUT ( FLAG_PROTON_NP_HARD_REMOVED | \
169
+ FLAG_PROTON_AC_HARD_REMOVED | \
170
+ FLAG_PROTON_AC_HARD_ADDED | \
171
+ FLAG_PROTON_CHARGE_CANCEL )
172
+ #else
172
173
  /* force salt tautomerism exploration */
173
174
  #define FLAG_FORCE_SALT_TAUT ( FLAG_PROTON_NP_HARD_REMOVED | \
174
175
  FLAG_PROTON_AC_HARD_REMOVED | \
175
176
  FLAG_PROTON_AC_HARD_ADDED )
177
+ #endif
176
178
 
177
179
  typedef struct tagTautomerNormInfo {
178
180
  NUM_H nNumRemovedExplicitH; /* keeps track of explicit 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.00
6
- * April 13, 2005
5
+ * Software version 1.01
6
+ * July 21, 2006
7
7
  * Developed at NIST
8
8
  */
9
9
 
@@ -64,11 +64,25 @@ typedef struct tagInchiTime {
64
64
 
65
65
  #endif
66
66
 
67
+ #ifndef INCHI_ALL_CPP
68
+ #ifdef __cplusplus
69
+ extern "C" {
70
+ #endif
71
+ #endif
72
+
73
+
67
74
  void InchiTimeGet( inchiTime *TickEnd );
68
75
  long InchiTimeMsecDiff( inchiTime *TickEnd, inchiTime *TickStart );
69
76
  void InchiTimeAddMsec( inchiTime *TickEnd, unsigned long nNumMsec );
70
77
  int bInchiTimeIsOver( inchiTime *TickEnd );
71
78
  long InchiTimeElapsed( inchiTime *TickStart );
72
79
 
80
+ #ifndef INCHI_ALL_CPP
81
+ #ifdef __cplusplus
82
+ }
83
+ #endif
84
+ #endif
85
+
86
+
73
87
  #endif /* __ICHITIME_H__ */
74
88
 
@@ -0,0 +1,107 @@
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 __INCHICMP_H__
11
+ #define __INCHICMP_H__
12
+
13
+ typedef enum tagInchiCompareDiffBits {
14
+ INCHIDIFF_ZERO = 0x00000000,
15
+ INCHIDIFF_PROBLEM = 0x00000001, /* severe: at least one InChI does not exist */
16
+ INCHIDIFF_NUM_AT = 0x00000001, /* severe: different number of atoms in the skeleton */
17
+ INCHIDIFF_ATOMS = 0x00000001, /* severe: diiferent types of skeleton atoms */
18
+ INCHIDIFF_NUM_EL = 0x00000001, /* severe: formulas differ in another element */
19
+ INCHIDIFF_CON_LEN = 0x00000001, /* severe: different connection table lengths */
20
+ INCHIDIFF_CON_TBL = 0x00000001, /* severe: different connection tables */
21
+ INCHIDIFF_POSITION_H = 0x00000002, /* difference in non-taut (Mobile-H) or all H (Fixed-H) location/number */
22
+ INCHIDIFF_MORE_FH = 0x00000004, /* extra fixed H */
23
+ INCHIDIFF_LESS_FH = 0x00000004, /* missing fixed H */
24
+ INCHIDIFF_MORE_H = 0x00000008, /* formulas differ in number of H */
25
+ INCHIDIFF_LESS_H = 0x00000008, /* formulas differ in number of H */
26
+ INCHIDIFF_NO_TAUT = 0x00000010, /* restored structure has no taut groups while the original InChI has some */
27
+ INCHIDIFF_WRONG_TAUT = 0x00000020, /* restored has tautomerism while the original does not have it */
28
+ INCHIDIFF_SINGLE_TG = 0x00000040, /* restored has 1 taut. group while the original InChI has multiple tg */
29
+ INCHIDIFF_MULTIPLE_TG = 0x00000080, /* restored has multiple tg while the original InChI has only one tg */
30
+ INCHIDIFF_EXTRA_TG_ENDP = 0x00000100, /* extra tautomeric endpoint(s) in restored structure */
31
+ INCHIDIFF_MISS_TG_ENDP = 0x00000100, /* one or more tg endpoint is not in the restored structure */
32
+ INCHIDIFF_DIFF_TG_ENDP = 0x00000100, /* lists of tg endpoints are different */
33
+ INCHIDIFF_NUM_TG = 0x00000200, /* different number of tautomeric groups */
34
+ INCHIDIFF_TG = 0x00000200, /* different tautomeric groups */
35
+ INCHIDIFF_NUM_ISO_AT = 0x00000400, /* ?severe: restored struct. has different number of isotopic atoms */
36
+ INCHIDIFF_ISO_AT = 0x00000400, /* ?severe: restored struct. has different locations/isotopes of isotopic atoms */
37
+ INCHIDIFF_REM_ISO_H = 0x00000800, /* isotopic H removed */
38
+ INCHIDIFF_MOB_ISO_H = 0x00001000, /* different number of mobile exchangeable isotopic H */
39
+ INCHIDIFF_CHARGE = 0x00002000, /* restored structure has different charge */
40
+ INCHIDIFF_REM_PROT = 0x00004000, /* proton(s) removed/added from the restored structure */
41
+ INCHIDIFF_MOBH_PROTONS = 0x00008000, /* different proton balance */
42
+ INCHIDIFF_SC_INV = 0x00010000, /* restores structure has different inversion stereocenter mark */
43
+ INCHIDIFF_SC_PARITY = 0x00020000, /* restored structure has stereoatoms or allenes with different parity */
44
+ INCHIDIFF_SC_EXTRA_UNDF = 0x00040000, /* restored structure has extra undefined stereocenter(s) */
45
+ INCHIDIFF_SC_EXTRA = 0x00080000, /* restored structure has extra stereocenter(s) */
46
+ INCHIDIFF_SC_MISS_UNDF = 0x00100000, /* restored structure has not some undefined stereocenter(s) */
47
+ INCHIDIFF_SC_MISS = 0x00200000, /* restored structure has not some stereocenters that are not undefined */
48
+ INCHIDIFF_SB_PARITY = 0x00400000, /* restored structure has stereobonds or cumulenes with different parity */
49
+ INCHIDIFF_SB_EXTRA_UNDF = 0x00800000, /* restored structure has extra undefined stereobond(s) */
50
+ INCHIDIFF_SB_EXTRA = 0x01000000, /* restored structure has extra stereobond(s) */
51
+ INCHIDIFF_SB_MISS_UNDF = 0x02000000, /* restored structure has not some undefined stereocenters */
52
+ INCHIDIFF_SB_MISS = 0x04000000, /* restored structure has not some stereobonds that are not undefined */
53
+ INCHIDIFF_COMP_HLAYER = 0x08000000, /* Restored component has Mobile-H layer instead of both Mobile-H & Fixed-H or both instead of one */
54
+ INCHIDIFF_COMP_NUMBER = 0x10000000, /* wrong number of components */
55
+ INCHIDIFF_STR2INCHI_ERR = 0x20000000 /* Restored structure to InChI conversion error */
56
+ /* reserved
57
+ 0x40000000
58
+ 0x80000000
59
+ */
60
+ } INCHIDIFF;
61
+
62
+ typedef enum tagtagCompareInchiMsgGroupID {
63
+ IDGRP_ZERO = 0,
64
+ IDGRP_ERR = 1,
65
+ IDGRP_H = 2,
66
+ IDGRP_MOB_GRP = 3,
67
+ IDGRP_ISO_AT = 4,
68
+ IDGRP_CHARGE = 5,
69
+ IDGRP_PROTONS = 6,
70
+ IDGRP_ISO_H = 7,
71
+ IDGRP_SC = 8,
72
+ IDGRP_SB = 9,
73
+ IDGRP_HLAYER =10,
74
+ IDGRP_COMP =11,
75
+ IDGRP_CONV_ERR =12
76
+ } CMP_INCHI_MSG_GROUP_ID;
77
+
78
+
79
+ typedef struct tagCompareInchiMsg {
80
+ INCHIDIFF nBit;
81
+ CMP_INCHI_MSG_GROUP_ID nGroupID;
82
+ const char *szMsg;
83
+ } CMP_INCHI_MSG;
84
+
85
+ typedef struct tagCompareInchiMsgGroup {
86
+ CMP_INCHI_MSG_GROUP_ID nGroupID;
87
+ const char *szGroupName;
88
+ } CMP_INCHI_MSG_GROUP;
89
+
90
+
91
+
92
+
93
+
94
+
95
+ #define INCHIDIFF_SB (INCHIDIFF_SB_PARITY | INCHIDIFF_SB_EXTRA_UNDF | INCHIDIFF_SB_EXTRA | INCHIDIFF_SB_MISS_UNDF | INCHIDIFF_SB_MISS)
96
+ #define INCHIDIFF_SC (INCHIDIFF_SC_PARITY | INCHIDIFF_SC_EXTRA_UNDF | INCHIDIFF_SC_EXTRA | INCHIDIFF_SC_MISS_UNDF | INCHIDIFF_SC_MISS)
97
+
98
+ #define INCHIDIFF_CONSTIT (INCHIDIFF_POSITION_H | INCHIDIFF_MORE_FH | INCHIDIFF_LESS_FH | INCHIDIFF_MORE_H | INCHIDIFF_LESS_H |\
99
+ INCHIDIFF_NO_TAUT | INCHIDIFF_WRONG_TAUT | INCHIDIFF_SINGLE_TG | INCHIDIFF_MULTIPLE_TG | \
100
+ INCHIDIFF_NUM_TG | INCHIDIFF_EXTRA_TG_ENDP | INCHIDIFF_MISS_TG_ENDP | INCHIDIFF_TG | \
101
+ INCHIDIFF_NUM_ISO_AT | INCHIDIFF_ISO_AT | INCHIDIFF_CHARGE | INCHIDIFF_REM_PROT | INCHIDIFF_REM_ISO_H |\
102
+ INCHIDIFF_DIFF_TG_ENDP)
103
+ #define INCHIDIFF_STEREO (INCHIDIFF_SC_INV | INCHIDIFF_SC_PARITY | INCHIDIFF_SC_EXTRA_UNDF | INCHIDIFF_SC_EXTRA | \
104
+ INCHIDIFF_SC_MISS_UNDF | INCHIDIFF_SC_MISS | INCHIDIFF_SB_PARITY | INCHIDIFF_SB_EXTRA_UNDF |\
105
+ INCHIDIFF_SB_EXTRA | INCHIDIFF_SB_MISS_UNDF | INCHIDIFF_SB_MISS)
106
+
107
+ #endif /* __INCHICMP_H__ */