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,39 +2,170 @@
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
 
10
10
  #ifndef __STRUTIL_H__
11
11
  #define __STRUTIL_H__
12
12
 
13
-
14
13
  #ifndef INCHI_ALL_CPP
15
14
  #ifdef __cplusplus
16
15
  extern "C" {
17
16
  #endif
18
17
  #endif
19
18
 
19
+ /* forward declaration */
20
+ struct tagTautomerGroupsInfo;
21
+
20
22
  int ExtractConnectedComponent( inp_ATOM *at, int num_at, int component_number, inp_ATOM *component_at );
21
23
  int SetConnectedComponentNumber( inp_ATOM *at, int num_at, int component_number );
22
24
  INChI *Alloc_INChI( inp_ATOM *at, int num_at, int *found_num_bonds, int *found_num_isotopic, int nAllocMode );
23
25
  int Free_INChI(INChI **ppINChI);
26
+ int Free_INChI_Members(INChI *pINChI);
27
+ int Free_INChI_Stereo( INChI_Stereo *pINChI_Stereo );
28
+
24
29
  INChI_Aux *Alloc_INChI_Aux( int num_at, int num_isotopic_atoms, int nAllocMode, int bOrigData );
25
30
  int Free_INChI_Aux( INChI_Aux **ppINChI_Aux );
26
31
  int Create_INChI( INChI **ppINChI, INChI_Aux **ppINChI_Aux, ORIG_ATOM_DATA *orig_inp_data,
27
32
  inp_ATOM *inp_at, INP_ATOM_DATA *inp_norm_data[2],
28
33
  int num_inp_at, INCHI_MODE nUserMode,
29
34
  INCHI_MODE *pbTautFlags, INCHI_MODE *pbTautFlagsDone,
30
- struct tagInchiTime *ulMaxTime, char *pStrErrStruct);
35
+ struct tagInchiTime *ulMaxTime, struct tagTautomerGroupsInfo *ti_out, char *pStrErrStruct);
31
36
  int FillOutInfAtom(inp_ATOM *norm_at, INF_ATOM_DATA *inf_norm_at_data, int init_num_at,
32
- int num_removed_H, int nNumRemovedProtons, NUM_H *nNumRemovedProtonsIsotopic, int bIsotopic,
37
+ int num_removed_H, int bAdd_DT_to_num_H, int nNumRemovedProtons, NUM_H *nNumRemovedProtonsIsotopic, int bIsotopic,
33
38
  INChI *pINChI, INChI_Aux *pINChI_Aux, int bAbcNumbers, INCHI_MODE nMode );
34
39
  int FillOutCompositeCanonInfAtom(COMP_ATOM_DATA *composite_norm_data, INF_ATOM_DATA *inf_norm_at_data,
35
40
  int bIsotopic, int bTautomeric,
36
41
  PINChI2 *pINChI2, PINChI_Aux2 *pINChI_Aux2, int bAbcNumbers, INCHI_MODE nMode);
37
42
 
43
+ typedef enum tagInchiDiffBits {
44
+ IDIF_PROBLEM = 0x00000001, /* severe: at least one InChI does not exist */
45
+ IDIF_NUM_AT = 0x00000001, /* severe: different number of atoms in the skeleton */
46
+ IDIF_ATOMS = 0x00000001, /* severe: diiferent types of skeleton atoms */
47
+ IDIF_NUM_EL = 0x00000001, /* severe: formulas differ in another element */
48
+ IDIF_CON_LEN = 0x00000001, /* severe: different connection table lengths */
49
+ IDIF_CON_TBL = 0x00000001, /* severe: different connection tables */
50
+ IDIF_POSITION_H = 0x00000002, /* difference in non-taut (Mobile-H) or all H (Fixed-H) location/number */
51
+ IDIF_MORE_FH = 0x00000004, /* extra fixed H */
52
+ IDIF_LESS_FH = 0x00000008, /* missing fixed H */
53
+ IDIF_MORE_H = 0x00000010, /* formulas differ in number of H */
54
+ IDIF_LESS_H = 0x00000020, /* formulas differ in number of H */
55
+ /*IDIF_TAUT_LEN = 0x00000008,*/ /* different lengths of tautomer lists */
56
+ IDIF_NO_TAUT = 0x00000040, /* restored structure has no taut groups while the original InChI has some */
57
+ IDIF_WRONG_TAUT = 0x00000080, /* restored has tautomerism while the original does not have it */
58
+ IDIF_SINGLE_TG = 0x00000100, /* restored has 1 taut. group while the original InChI has multiple tg */
59
+ IDIF_MULTIPLE_TG = 0x00000200, /* restored has multiple tg while the original InChI has only one tg */
60
+ IDIF_NUM_TG = 0x00000400, /* different number of tautomeric groups */
61
+ /*IDIF_LESS_TG_ENDP = 0x00000200,*/ /* restores structure has less taut. endpoints */
62
+ /*IDIF_MORE_TG_ENDP = 0x00000400,*/ /* restores structure has more taut. endpoints */
63
+ IDIF_EXTRA_TG_ENDP = 0x00000800, /* extra tautomeric endpoint(s) in restored structure */
64
+ IDIF_MISS_TG_ENDP = 0x00001000, /* one or more tg endpoint is not in the restored structure */
65
+ IDIF_DIFF_TG_ENDP = 0x00002000, /* lists of tg endpoints are different */
66
+ IDIF_TG = 0x00004000, /* different tautomeric groups */
67
+ IDIF_NUM_ISO_AT = 0x00008000, /* ?severe: restored struct. has different number of isotopic atoms */
68
+ IDIF_ISO_AT = 0x00010000, /* ?severe: restored struct. has different locations/isotopes of isotopic atoms */
69
+ IDIF_CHARGE = 0x00020000, /* restored structure has different charge */
70
+ IDIF_REM_PROT = 0x00040000, /* proton(s) removed/added from the restored structure */
71
+ IDIF_REM_ISO_H = 0x00080000, /* isotopic H removed */
72
+ IDIF_SC_INV = 0x00100000, /* restores structure has different inversion stereocenter mark */
73
+ IDIF_SC_PARITY = 0x00200000, /* restored structure has stereoatoms or allenes with different parity */
74
+ IDIF_SC_EXTRA_UNDF = 0x00400000, /* restored structure has extra undefined stereocenter(s) */
75
+ IDIF_SC_EXTRA = 0x00800000, /* restored structure has extra stereocenter(s) */
76
+ IDIF_SC_MISS_UNDF = 0x01000000, /* restored structure has not some undefined stereocenter(s) */
77
+ IDIF_SC_MISS = 0x02000000, /* restored structure has not some stereocenters that are not undefined */
78
+ IDIF_SB_PARITY = 0x04000000, /* restored structure has stereobonds or cumulenes with different parity */
79
+ IDIF_SB_EXTRA_UNDF = 0x08000000, /* restored structure has extra undefined stereobond(s) */
80
+ IDIF_SB_EXTRA = 0x10000000, /* restored structure has extra stereobond(s) */
81
+ IDIF_SB_MISS_UNDF = 0x20000000, /* restored structure has not some undefined stereocenters */
82
+ IDIF_SB_MISS = 0x40000000 /* restored structure has not some stereobonds that are not undefined */
83
+ } IDIF;
84
+
85
+
86
+ #define IDIFF_SB (IDIF_SB_PARITY | IDIF_SB_EXTRA_UNDF | IDIF_SB_EXTRA | IDIF_SB_MISS_UNDF | IDIF_SB_MISS)
87
+ #define IDIFF_SC (IDIF_SC_PARITY | IDIF_SC_EXTRA_UNDF | IDIF_SC_EXTRA | IDIF_SC_MISS_UNDF | IDIF_SC_MISS)
88
+
89
+ #define IDIFF_CONSTIT (IDIF_POSITION_H | IDIF_MORE_FH | IDIF_LESS_FH | IDIF_MORE_H | IDIF_LESS_H |\
90
+ IDIF_NO_TAUT | IDIF_WRONG_TAUT | IDIF_SINGLE_TG | IDIF_MULTIPLE_TG | \
91
+ IDIF_NUM_TG | IDIF_EXTRA_TG_ENDP | IDIF_MISS_TG_ENDP | IDIF_TG | \
92
+ IDIF_NUM_ISO_AT | IDIF_ISO_AT | IDIF_CHARGE | IDIF_REM_PROT | IDIF_REM_ISO_H |\
93
+ IDIF_DIFF_TG_ENDP)
94
+ #define IDIFF_STEREO (IDIF_SC_INV | IDIF_SC_PARITY | IDIF_SC_EXTRA_UNDF | IDIF_SC_EXTRA | \
95
+ IDIF_SC_MISS_UNDF | IDIF_SC_MISS | IDIF_SB_PARITY | IDIF_SB_EXTRA_UNDF |\
96
+ IDIF_SB_EXTRA | IDIF_SB_MISS_UNDF | IDIF_SB_MISS)
97
+
98
+
99
+ /*************************************************************************************/
100
+ #define ICR_MAX_ENDP_IN1_ONLY 32
101
+ #define ICR_MAX_ENDP_IN2_ONLY 32
102
+ #define ICR_MAX_DIFF_FIXED_H 32
103
+ #define ICR_MAX_SB_IN1_ONLY 32
104
+ #define ICR_MAX_SB_IN2_ONLY 32
105
+ #define ICR_MAX_SC_IN1_ONLY 32
106
+ #define ICR_MAX_SC_IN2_ONLY 32
107
+ #define ICR_MAX_SB_UNDF 32
108
+ #define ICR_MAX_SC_UNDF 32
109
+ typedef struct tagInChICompareResults {
110
+
111
+ INCHI_MODE flags;
112
+
113
+ int tot_num_H1;
114
+ int tot_num_H2;
115
+ int num_taut_H1;
116
+ int num_taut_H2;
117
+ int num_taut_M1;
118
+ int num_taut_M2;
119
+
120
+ /* 1 => InChI from reversed struct. 2 => input InChI */
121
+
122
+ AT_NUMB endp_in1_only[ICR_MAX_ENDP_IN1_ONLY]; /* endpoint canonical number = index+1 */
123
+ int num_endp_in1_only;
124
+
125
+ AT_NUMB endp_in2_only[ICR_MAX_ENDP_IN2_ONLY]; /* endpoint canonical number = index+1 */
126
+ int num_endp_in2_only;
127
+
128
+ AT_NUMB diff_pos_H_at[ICR_MAX_DIFF_FIXED_H]; /* non-tautomeric H */
129
+ S_CHAR diff_pos_H_nH[ICR_MAX_DIFF_FIXED_H];
130
+ int num_diff_pos_H;
131
+
132
+ AT_NUMB fixed_H_at1_more[ICR_MAX_DIFF_FIXED_H]; /* extra fixed_H */
133
+ S_CHAR fixed_H_nH1_more[ICR_MAX_DIFF_FIXED_H];
134
+ int num_fixed_H1_more;
135
+
136
+ AT_NUMB fixed_H_at2_more[ICR_MAX_DIFF_FIXED_H]; /* missed fixed_H */
137
+ S_CHAR fixed_H_nH2_more[ICR_MAX_DIFF_FIXED_H];
138
+ int num_fixed_H2_more;
139
+
140
+ AT_NUMB sc_in1_only[ICR_MAX_SC_IN1_ONLY];
141
+ int num_sc_in1_only;
142
+ AT_NUMB sc_in2_only[ICR_MAX_SC_IN2_ONLY];
143
+ int num_sc_in2_only;
144
+
145
+ AT_NUMB sb_in1_only[ICR_MAX_SB_IN1_ONLY];
146
+ int num_sb_in1_only;
147
+ AT_NUMB sb_in2_only[ICR_MAX_SB_IN2_ONLY];
148
+ int num_sb_in2_only;
149
+
150
+ AT_NUMB sb_undef_in1_only[ICR_MAX_SC_UNDF];
151
+ int num_sb_undef_in1_only;
152
+ AT_NUMB sb_undef_in2_only[ICR_MAX_SC_UNDF];
153
+ int num_sb_undef_in2_only;
154
+
155
+ AT_NUMB sc_undef_in1_only[ICR_MAX_SB_UNDF];
156
+ int num_sc_undef_in1_only;
157
+ AT_NUMB sc_undef_in2_only[ICR_MAX_SB_UNDF];
158
+ int num_sc_undef_in2_only;
159
+
160
+ } ICR;
161
+
162
+
163
+ INCHI_MODE CompareReversedINChI2( INChI *i1 /* InChI from reversed struct */, INChI *i2 /* input InChI */, INChI_Aux *a1, INChI_Aux *a2, ICR *picr, int *err );
164
+ int CompareIcr( ICR *picr1, ICR *picr2, INCHI_MODE *pin1, INCHI_MODE *pin2, INCHI_MODE mask );
165
+
166
+ int CompareReversedINChI( INChI *i1, INChI *i2, INChI_Aux *a1, INChI_Aux *a2 );
167
+ const char *CompareReversedInchiMsg( int code );
168
+
38
169
  #define EQL_EXISTS 1
39
170
  #define EQL_SP3 2
40
171
  #define EQL_SP3_INV 4
@@ -122,6 +253,7 @@ int INChI_SegmentAction( char cDifSegs );
122
253
  #define FLAG_SORT_PRINT_NO_NFIX_H_REC 8 /* no fixed H non-isotopic in the reconnected InChI layer */
123
254
  #define FLAG_SORT_PRINT_NO_IFIX_H_BAS 16 /* no fixed H isotopic in the main InChI layer */
124
255
  #define FLAG_SORT_PRINT_NO_IFIX_H_REC 32 /* no fixed H isotopic in the the reconnected InChI layer */
256
+ #define FLAG_SORT_PRINT_ReChI_PREFIX 64 /* Output ReChI instead of InChI */
125
257
 
126
258
  int OutputINChI1( char *pStr, int nStrLen, INCHI_SORT *pINChISortTautAndNonTaut[][TAUT_NUM], int iINChI,
127
259
  ORIG_STRUCT *pOrigStruct,
@@ -153,20 +285,27 @@ int OutputINChIXmlStructEndTag( INCHI_FILE *output_file, char *pStr, int nStrLen
153
285
 
154
286
  int GetInpStructErrorType(INPUT_PARMS *ip, int err, char *pStrErrStruct, int num_inp_atoms );
155
287
  int ProcessStructError( INCHI_FILE *output_file, INCHI_FILE *log_file, /*int err,*/ char *pStrErrStruct, int nErrorType,
156
- int *bXmlStructStarted, int num_inp, INPUT_PARMS *ip, char *pStr, int nStrLen );
288
+ int *bXmlStructStarted, long num_inp, INPUT_PARMS *ip, char *pStr, int nStrLen );
157
289
 
158
290
  int bNumHeterAtomHasIsotopicH( inp_ATOM *atom, int num_atoms );
159
291
 
160
292
  int WriteToSDfile( const INP_ATOM_DATA *inp_at_data, INCHI_FILE* fcb, const char* name, const char* comment,
161
293
  const char *szLabel, const char *szValue );
162
294
  int WriteOrigAtomDataToSDfile( const ORIG_ATOM_DATA *inp_at_data, INCHI_FILE* fcb, const char* name, const char* comment,
163
- int bChiral, const char *szLabel, const char *szValue);
295
+ int bChiral, int bAtomsDT, const char *szLabel, const char *szValue);
296
+ int bIsMetalSalt( inp_ATOM *at, int i );
164
297
 
165
298
 
166
- extern char gsMissing[];
167
- extern char gsEmpty[];
168
- extern char gsSpace[];
169
- extern char gsEqual[];
299
+ extern const char gsMissing[];
300
+ extern const char gsEmpty[];
301
+ extern const char gsSpace[];
302
+ extern const char gsEqual[];
303
+ /*
304
+ #define gsMissing "is missing"
305
+ #define gsEmpty ""
306
+ #define gsSpace " "
307
+ #define gsEqual "="
308
+ */
170
309
  /* format string for SDF_LBL_VAL(L,V): %s%s%s%s (four strings) */
171
310
  /*#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, ((L)&&(L)[0])?((V)&&(V)[0]?V:gsMissing):gsEmpty*/
172
311
  #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:gsEmpty
@@ -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
 
@@ -34,6 +34,7 @@ typedef struct tagElData {
34
34
  int nNormAtMass; /* Atomic mass of the most abundant isotope */
35
35
  double dAtMass; /* exact mw of the most abundant isotope */
36
36
  int nType; /* METAL or METAL2 */
37
+ int nElNegPauling10; /* Pauling electronegativity x 10; 0 => unknown */
37
38
  int bDoNotAddH; /* InChI does not add imlicit H to atoms that have bDoNotAddH != 0 */
38
39
  S_CHAR cValence[NUM_ATOM_CHARGES][MAX_NUM_VALENCES];
39
40
  } ELDATA;
@@ -41,115 +42,115 @@ typedef struct tagElData {
41
42
  /* 2004=05-10: Added valences {1,3,5,7,} for As(2-) */
42
43
 
43
44
  const ELDATA ElData[] = {
44
- /* avg norm No -------- Valence(s) of an ion or neutral atom -------------*/
45
- /* mw mass exact mw type H -2 -1 0 +1 +2 */
46
- { "H", 1, 1, 1.007825035, 0 , 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
47
- { "D", 2, 2, 2.014101778, 0 , 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
48
- { "T", 3, 3, 3.016049268, 0 , 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
49
- { "He", 4, 4, 4.002600000, 0 , 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
50
- { "Li", 7, 7, 7.016000000, METAL , 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
51
- { "Be", 9, 9, 9.012180000, METAL , 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
52
- { "B", 11, 11, 11.009300000, 0 , 0, {{3,}, {4,}, {3,}, {2,}, {1,} }},
53
- { "C", 12, 12, 12.000000000, 0 , 0, {{2,}, {3,}, {4,}, {3,}, {2,} }},
54
- { "N", 14, 14, 14.003074000, 0 , 0, {{1,}, {2,}, {3,5}, {4,}, {3,} }},
55
- { "O", 16, 16, 15.994914630, 0 , 0, {{0,}, {1,}, {2,}, {3,5,}, {4,} }},
56
- { "F", 19, 19, 18.998403220, 0 , 0, {{0,}, {0,}, {1,}, {2,}, {3,5} }},
57
- { "Ne", 20, 20, 19.992440000, 0 , 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
58
- { "Na", 23, 23, 22.989770000, METAL , 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
59
- { "Mg", 24, 24, 23.985000000, METAL , 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
60
- { "Al", 27, 27, 26.981540000, METAL , 0, {{3,5,}, {4,}, {3,}, {2,}, {1,} }},
61
- { "Si", 28, 28, 27.976927100, 0 , 0, {{2,}, {3,5}, {4,}, {3,}, {2,} }},
62
- { "P", 31, 31, 30.973762000, 0 , 0, {{1,3,5,7,}, {2,4,6,}, {3,5,}, {4,}, {3,} }},
63
- { "S", 32, 32, 31.972070700, 0 , 0, {{0,}, {1,3,5,7,}, {2,4,6}, {3,5,}, {4,} }},
64
- { "Cl", 35, 35, 34.968852730, 0 , 0, {{0,}, {0,}, {1,3,5,7}, {2,4,6}, {3,5,} }},
65
- { "Ar", 40, 40, 39.962400000, 0 , 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
66
- { "K", 39, 39, 38.963700000, METAL , 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
67
- { "Ca", 40, 40, 39.962600000, METAL , 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
68
- { "Sc", 45, 45, 44.955910000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
69
- { "Ti", 48, 48, 47.947950000, METAL , 1, {{0,}, {0,}, {3,4}, {0,}, {0,} }},
70
- { "V", 51, 51, 50.943960000, METAL , 1, {{0,}, {0,}, {2,3,4,5,}, {0,}, {0,} }},
71
- { "Cr", 52, 52, 51.940500000, METAL , 1, {{0,}, {0,}, {2,3,6,}, {0,}, {0,} }},
72
- { "Mn", 55, 55, 54.938050000, METAL2, 1, {{0,}, {0,}, {2,3,4,6,}, {0,}, {0,} }},
73
- { "Fe", 56, 56, 55.934900000, METAL2, 1, {{0,}, {0,}, {2,3,4,6,}, {0,}, {0,} }},
74
- { "Co", 59, 59, 58.933200000, METAL2, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
75
- { "Ni", 59, 58, 57.935300000, METAL2, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
76
- { "Cu", 64, 63, 62.929600000, METAL , 1, {{0,}, {0,}, {1,2,}, {0,}, {0,} }},
77
- { "Zn", 65, 64, 63.929147000, METAL , 1, {{0,}, {0,}, {2,}, {0,}, {0,} }},
78
- { "Ga", 70, 69, 68.925600000, METAL , 0, {{3,5,}, {4,}, {3,}, {0,}, {1,} }},
79
- { "Ge", 73, 74, 73.921177400, 0 , 0, {{2,4,6,}, {3,5,}, {4,}, {3,}, {0,} }},
80
- { "As", 75, 75, 74.921594200, 0 , 0, {{1,3,5,7,}, {2,4,6,}, {3,5,}, {4,}, {3,} }},
81
- { "Se", 79, 80, 79.916519600, 0 , 0, {{0,}, {1,3,5,7,}, {2,4,6,}, {3,5,}, {4,} }},
82
- { "Br", 80, 79, 78.918336100, 0 , 0, {{0,}, {0,}, {1,3,5,7,}, {2,4,6,}, {3,5,} }},
83
- { "Kr", 84, 84, 83.911500000, 0 , 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
84
- { "Rb", 85, 85, 84.911800000, METAL , 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
85
- { "Sr", 88, 88, 87.905600000, METAL , 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
86
- { "Y", 89, 89, 88.905860000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
87
- { "Zr", 91, 90, 89.904700000, METAL , 1, {{0,}, {0,}, {4,}, {0,}, {0,} }},
88
- { "Nb", 93, 93, 92.906400000, METAL , 1, {{0,}, {0,}, {3,5,}, {0,}, {0,} }},
89
- { "Mo", 96, 98, 97.905400000, METAL , 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
90
- { "Tc", 98, 98, 97.907200000, METAL , 1, {{0,}, {0,}, {7,}, {0,}, {0,} }},
91
- { "Ru", 101, 102, 101.904300000, METAL , 1, {{0,}, {0,}, {2,3,4,6,}, {0,}, {0,} }},
92
- { "Rh", 103, 103, 102.905500000, METAL , 1, {{0,}, {0,}, {2,3,4,}, {0,}, {0,} }},
93
- { "Pd", 106, 106, 105.903500000, METAL , 1, {{0,}, {0,}, {2,4,}, {0,}, {0,} }},
94
- { "Ag", 108, 107, 106.905100000, METAL , 1, {{0,}, {0,}, {1,}, {0,}, {0,} }},
95
- { "Cd", 112, 114, 113.903400000, METAL , 1, {{0,}, {0,}, {2,}, {0,}, {0,} }},
96
- { "In", 115, 115, 114.903900000, METAL , 0, {{3,5,}, {2,4,}, {3,}, {0,}, {1,} }},
97
- { "Sn", 119, 120, 119.902200000, METAL2, 0, {{2,4,6,}, {3,5}, {2,4,}, {3,}, {0,} }},
98
- { "Sb", 122, 121, 120.903800000, METAL, 0, {{1,3,5,7,}, {2,4,6,}, {3,5,}, {2,4,}, {3,} }},
99
- { "Te", 128, 130, 129.906200000, 0 , 0, {{0,}, {1,3,5,7,}, {2,4,6,}, {3,5,}, {2,4,} }},
100
- { "I", 127, 127, 126.904500000, 0 , 0, {{0,}, {0,}, {1,3,5,7,}, {2,4,6}, {3,5,} }},
101
- { "Xe", 131, 132, 131.904100000, 0 , 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
102
- { "Cs", 133, 133, 132.905430000, METAL , 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
103
- { "Ba", 137, 138, 137.905200000, METAL , 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
104
- { "La", 139, 139, 138.906360000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
105
- { "Ce", 140, 140, 139.905400000, METAL2, 1, {{0,}, {0,}, {3,4,}, {0,}, {0,} }},
106
- { "Pr", 141, 141, 140.907660000, METAL2, 1, {{0,}, {0,}, {3,4,}, {0,}, {0,} }},
107
- { "Nd", 144, 142, 141.907719000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
108
- { "Pm", 145, 145, 144.912800000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
109
- { "Sm", 150, 152, 151.919700000, METAL2, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
110
- { "Eu", 152, 153, 152.921200000, METAL2, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
111
- { "Gd", 157, 158, 157.924099000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
112
- { "Tb", 159, 159, 158.925350000, METAL2, 1, {{0,}, {0,}, {3,4,}, {0,}, {0,} }},
113
- { "Dy", 163, 164, 163.929200000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }}, /* mw rounding uncertain */
114
- { "Ho", 165, 165, 164.930300000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
115
- { "Er", 167, 166, 165.930300000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
116
- { "Tm", 169, 169, 168.934230000, METAL2, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
117
- { "Yb", 173, 174, 173.938900000, METAL2, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
118
- { "Lu", 175, 175, 174.940800000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
119
- { "Hf", 178, 180, 179.946600000, METAL , 1, {{0,}, {0,}, {4,}, {0,}, {0,} }},
120
- { "Ta", 181, 181, 180.948010000, METAL , 1, {{0,}, {0,}, {5,}, {0,}, {0,} }},
121
- { "W", 184, 184, 183.951000000, METAL2, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
122
- { "Re", 186, 187, 186.955800000, METAL2, 1, {{0,}, {0,}, {2,4,6,7,}, {0,}, {0,} }},
123
- { "Os", 190, 192, 191.961500000, METAL2, 1, {{0,}, {0,}, {2,3,4,6,}, {0,}, {0,} }},
124
- { "Ir", 192, 193, 192.962900000, METAL2, 1, {{0,}, {0,}, {2,3,4,6,}, {0,}, {0,} }},
125
- { "Pt", 195, 195, 194.964800000, METAL2, 1, {{0,}, {0,}, {2,4,}, {0,}, {0,} }},
126
- { "Au", 197, 197, 196.966560000, METAL , 1, {{0,}, {0,}, {1,3,}, {0,}, {0,} }},
127
- { "Hg", 201, 202, 201.970617000, METAL2, 1, {{0,}, {0,}, {1,2,}, {0,}, {0,} }},
128
- { "Tl", 204, 205, 204.974400000, METAL2, 0, {{3,5,}, {2,4,}, {1,3,}, {0,}, {0,} }},
129
- { "Pb", 207, 208, 207.976627000, METAL2, 0, {{2,4,6,}, {3,5}, {2,4,}, {3,}, {0,} }},
130
- { "Bi", 209, 209, 208.980390000, METAL , 0, {{1,3,5,7,}, {2,4,6,}, {3,5,}, {2,4,}, {3,} }},
131
- { "Po", 209, 209, 208.982400000, METAL2, 0, {{0,}, {1,3,5,7,}, {2,4,6,}, {3,5,}, {2,4,} }},
132
- { "At", 210, 210, 209.987100000, 0 , 0, {{0,}, {0,}, {1,3,5,7,}, {2,4,6}, {3,5,} }},
133
- { "Rn", 222, 222, 222.017500000, 0 , 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
134
- { "Fr", 223, 223, 223.019700000, METAL , 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
135
- { "Ra", 226, 226, 226.025410000, METAL , 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
136
- { "Ac", 227, 227, 227.027750000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
137
- { "Th", 232, 232, 232.038050000, METAL2, 1, {{0,}, {0,}, {3,4,}, {0,}, {0,} }},
138
- { "Pa", 231, 231, 231.035880000, METAL2, 1, {{0,}, {0,}, {3,4,5,}, {0,}, {0,} }},
139
- { "U", 238, 238, 238.050790000, METAL2, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
140
- { "Np", 237, 237, 237.048170000, METAL2, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
141
- { "Pu", 244, 244, 244.064200000, METAL2, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
142
- { "Am", 243, 243, 243.061370000, METAL2, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
143
- { "Cm", 247, 247, 247.070300000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
144
- { "Bk", 247, 247, 247.070300000, METAL , 1, {{0,}, {0,}, {3,4,}, {0,}, {0,} }},
145
- { "Cf", 251, 251, 251.079600000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
146
- { "Es", 252, 252, 252.082800000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
147
- { "Fm", 257, 257, 257.095100000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
148
- { "Md", 258, 258, 258.098600000, METAL , 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
149
- { "No", 259, 259, 259.100900000, METAL , 1, {{0,}, {0,}, {1,}, {0,}, {0,} }},
150
- { "Lr", 260, 260, 260.105400000, METAL , 1, {{0,}, {0,}, {1,}, {0,}, {0,} }},
151
- { "Rf", 261, 261, 261.108700000, METAL , 1, {{0,}, {0,}, {1,}, {0,}, {0,} }},
152
- { "", 0, 0, 0.000000000, 0 , 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
45
+ /* avg norm El No -------- Valence(s) of an ion or neutral atom -------------*/
46
+ /* mw mass exact mw type neg H -2 -1 0 +1 +2 */
47
+ { "H", 1, 1, 1.007825035, 0 , 21, 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
48
+ { "D", 2, 2, 2.014101778, 0 , 21, 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
49
+ { "T", 3, 3, 3.016049268, 0 , 21, 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
50
+ { "He", 4, 4, 4.002600000, 0 , 0, 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
51
+ { "Li", 7, 7, 7.016000000, METAL , 10, 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
52
+ { "Be", 9, 9, 9.012180000, METAL , 15, 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
53
+ { "B", 11, 11, 11.009300000, 0 , 20, 0, {{3,}, {4,}, {3,}, {2,}, {1,} }},
54
+ { "C", 12, 12, 12.000000000, 0 , 25, 0, {{2,}, {3,}, {4,}, {3,}, {2,} }},
55
+ { "N", 14, 14, 14.003074000, 0 , 30, 0, {{1,}, {2,}, {3,5}, {4,}, {3,} }},
56
+ { "O", 16, 16, 15.994914630, 0 , 35, 0, {{0,}, {1,}, {2,}, {3,5,}, {4,} }},
57
+ { "F", 19, 19, 18.998403220, 0 , 40, 0, {{0,}, {0,}, {1,}, {2,}, {3,5} }},
58
+ { "Ne", 20, 20, 19.992440000, 0 , 0, 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
59
+ { "Na", 23, 23, 22.989770000, METAL , 9, 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
60
+ { "Mg", 24, 24, 23.985000000, METAL , 12, 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
61
+ { "Al", 27, 27, 26.981540000, METAL , 15, 0, {{3,5,}, {4,}, {3,}, {2,}, {1,} }},
62
+ { "Si", 28, 28, 27.976927100, 0 , 18, 0, {{2,}, {3,5}, {4,}, {3,}, {2,} }},
63
+ { "P", 31, 31, 30.973762000, 0 , 21, 0, {{1,3,5,7,}, {2,4,6,}, {3,5,}, {4,}, {3,} }},
64
+ { "S", 32, 32, 31.972070700, 0 , 25, 0, {{0,}, {1,3,5,7,}, {2,4,6}, {3,5,}, {4,} }},
65
+ { "Cl", 35, 35, 34.968852730, 0 , 30, 0, {{0,}, {0,}, {1,3,5,7}, {2,4,6}, {3,5,} }},
66
+ { "Ar", 40, 40, 39.962400000, 0 , 0, 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
67
+ { "K", 39, 39, 38.963700000, METAL , 8, 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
68
+ { "Ca", 40, 40, 39.962600000, METAL , 10, 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
69
+ { "Sc", 45, 45, 44.955910000, METAL , 13, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
70
+ { "Ti", 48, 48, 47.947950000, METAL , 15, 1, {{0,}, {0,}, {3,4}, {0,}, {0,} }},
71
+ { "V", 51, 51, 50.943960000, METAL , 16, 1, {{0,}, {0,}, {2,3,4,5,}, {0,}, {0,} }},
72
+ { "Cr", 52, 52, 51.940500000, METAL , 16, 1, {{0,}, {0,}, {2,3,6,}, {0,}, {0,} }},
73
+ { "Mn", 55, 55, 54.938050000, METAL2, 15, 1, {{0,}, {0,}, {2,3,4,6,}, {0,}, {0,} }},
74
+ { "Fe", 56, 56, 55.934900000, METAL2, 18, 1, {{0,}, {0,}, {2,3,4,6,}, {0,}, {0,} }},
75
+ { "Co", 59, 59, 58.933200000, METAL2, 18, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
76
+ { "Ni", 59, 58, 57.935300000, METAL2, 18, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
77
+ { "Cu", 64, 63, 62.929600000, METAL , 19, 1, {{0,}, {0,}, {1,2,}, {0,}, {0,} }},
78
+ { "Zn", 65, 64, 63.929147000, METAL , 16, 1, {{0,}, {0,}, {2,}, {0,}, {0,} }},
79
+ { "Ga", 70, 69, 68.925600000, METAL , 18, 0, {{3,5,}, {4,}, {3,}, {0,}, {1,} }},
80
+ { "Ge", 73, 74, 73.921177400, 0 , 18, 0, {{2,4,6,}, {3,5,}, {4,}, {3,}, {0,} }},
81
+ { "As", 75, 75, 74.921594200, 0 , 20, 0, {{1,3,5,7,}, {2,4,6,}, {3,5,}, {4,}, {3,} }},
82
+ { "Se", 79, 80, 79.916519600, 0 , 24, 0, {{0,}, {1,3,5,7,}, {2,4,6,}, {3,5,}, {4,} }},
83
+ { "Br", 80, 79, 78.918336100, 0 , 28, 0, {{0,}, {0,}, {1,3,5,7,}, {2,4,6,}, {3,5,} }},
84
+ { "Kr", 84, 84, 83.911500000, 0 , 0, 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
85
+ { "Rb", 85, 85, 84.911800000, METAL , 8, 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
86
+ { "Sr", 88, 88, 87.905600000, METAL , 10, 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
87
+ { "Y", 89, 89, 88.905860000, METAL , 12, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
88
+ { "Zr", 91, 90, 89.904700000, METAL , 14, 1, {{0,}, {0,}, {4,}, {0,}, {0,} }},
89
+ { "Nb", 93, 93, 92.906400000, METAL , 16, 1, {{0,}, {0,}, {3,5,}, {0,}, {0,} }},
90
+ { "Mo", 96, 98, 97.905400000, METAL , 18, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
91
+ { "Tc", 98, 98, 97.907200000, METAL , 19, 1, {{0,}, {0,}, {7,}, {0,}, {0,} }},
92
+ { "Ru", 101, 102, 101.904300000, METAL , 22, 1, {{0,}, {0,}, {2,3,4,6,}, {0,}, {0,} }},
93
+ { "Rh", 103, 103, 102.905500000, METAL , 22, 1, {{0,}, {0,}, {2,3,4,}, {0,}, {0,} }},
94
+ { "Pd", 106, 106, 105.903500000, METAL , 22, 1, {{0,}, {0,}, {2,4,}, {0,}, {0,} }},
95
+ { "Ag", 108, 107, 106.905100000, METAL , 19, 1, {{0,}, {0,}, {1,}, {0,}, {0,} }},
96
+ { "Cd", 112, 114, 113.903400000, METAL , 17, 1, {{0,}, {0,}, {2,}, {0,}, {0,} }},
97
+ { "In", 115, 115, 114.903900000, METAL , 17, 0, {{3,5,}, {2,4,}, {3,}, {0,}, {1,} }},
98
+ { "Sn", 119, 120, 119.902200000, METAL2, 18, 0, {{2,4,6,}, {3,5}, {2,4,}, {3,}, {0,} }},
99
+ { "Sb", 122, 121, 120.903800000, METAL, 19, 0, {{1,3,5,7,}, {2,4,6,}, {3,5,}, {2,4,}, {3,} }},
100
+ { "Te", 128, 130, 129.906200000, 0 , 21, 0, {{0,}, {1,3,5,7,}, {2,4,6,}, {3,5,}, {2,4,} }},
101
+ { "I", 127, 127, 126.904500000, 0 , 25, 0, {{0,}, {0,}, {1,3,5,7,}, {2,4,6}, {3,5,} }},
102
+ { "Xe", 131, 132, 131.904100000, 0 , 0, 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
103
+ { "Cs", 133, 133, 132.905430000, METAL , 7, 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
104
+ { "Ba", 137, 138, 137.905200000, METAL , 9, 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
105
+ { "La", 139, 139, 138.906360000, METAL , 11, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
106
+ { "Ce", 140, 140, 139.905400000, METAL2, 0, 1, {{0,}, {0,}, {3,4,}, {0,}, {0,} }},
107
+ { "Pr", 141, 141, 140.907660000, METAL2, 0, 1, {{0,}, {0,}, {3,4,}, {0,}, {0,} }},
108
+ { "Nd", 144, 142, 141.907719000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
109
+ { "Pm", 145, 145, 144.912800000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
110
+ { "Sm", 150, 152, 151.919700000, METAL2, 0, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
111
+ { "Eu", 152, 153, 152.921200000, METAL2, 0, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
112
+ { "Gd", 157, 158, 157.924099000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
113
+ { "Tb", 159, 159, 158.925350000, METAL2, 0, 1, {{0,}, {0,}, {3,4,}, {0,}, {0,} }},
114
+ { "Dy", 163, 164, 163.929200000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }}, /* mw rounding uncertain */
115
+ { "Ho", 165, 165, 164.930300000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
116
+ { "Er", 167, 166, 165.930300000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
117
+ { "Tm", 169, 169, 168.934230000, METAL2, 0, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
118
+ { "Yb", 173, 174, 173.938900000, METAL2, 0, 1, {{0,}, {0,}, {2,3,}, {0,}, {0,} }},
119
+ { "Lu", 175, 175, 174.940800000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
120
+ { "Hf", 178, 180, 179.946600000, METAL , 13, 1, {{0,}, {0,}, {4,}, {0,}, {0,} }},
121
+ { "Ta", 181, 181, 180.948010000, METAL , 15, 1, {{0,}, {0,}, {5,}, {0,}, {0,} }},
122
+ { "W", 184, 184, 183.951000000, METAL2, 17, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
123
+ { "Re", 186, 187, 186.955800000, METAL2, 19, 1, {{0,}, {0,}, {2,4,6,7,}, {0,}, {0,} }},
124
+ { "Os", 190, 192, 191.961500000, METAL2, 22, 1, {{0,}, {0,}, {2,3,4,6,}, {0,}, {0,} }},
125
+ { "Ir", 192, 193, 192.962900000, METAL2, 22, 1, {{0,}, {0,}, {2,3,4,6,}, {0,}, {0,} }},
126
+ { "Pt", 195, 195, 194.964800000, METAL2, 22, 1, {{0,}, {0,}, {2,4,}, {0,}, {0,} }},
127
+ { "Au", 197, 197, 196.966560000, METAL , 24, 1, {{0,}, {0,}, {1,3,}, {0,}, {0,} }},
128
+ { "Hg", 201, 202, 201.970617000, METAL2, 19, 1, {{0,}, {0,}, {1,2,}, {0,}, {0,} }},
129
+ { "Tl", 204, 205, 204.974400000, METAL2, 18, 0, {{3,5,}, {2,4,}, {1,3,}, {0,}, {0,} }},
130
+ { "Pb", 207, 208, 207.976627000, METAL2, 18, 0, {{2,4,6,}, {3,5}, {2,4,}, {3,}, {0,} }},
131
+ { "Bi", 209, 209, 208.980390000, METAL , 19, 0, {{1,3,5,7,}, {2,4,6,}, {3,5,}, {2,4,}, {3,} }},
132
+ { "Po", 209, 209, 208.982400000, METAL2, 20, 0, {{0,}, {1,3,5,7,}, {2,4,6,}, {3,5,}, {2,4,} }},
133
+ { "At", 210, 210, 209.987100000, 0 , 22, 0, {{0,}, {0,}, {1,3,5,7,}, {2,4,6}, {3,5,} }},
134
+ { "Rn", 222, 222, 222.017500000, 0 , 0, 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
135
+ { "Fr", 223, 223, 223.019700000, METAL , 0, 0, {{0,}, {0,}, {1,}, {0,}, {0,} }},
136
+ { "Ra", 226, 226, 226.025410000, METAL , 0, 0, {{0,}, {0,}, {2,}, {1,}, {0,} }},
137
+ { "Ac", 227, 227, 227.027750000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
138
+ { "Th", 232, 232, 232.038050000, METAL2, 0, 1, {{0,}, {0,}, {3,4,}, {0,}, {0,} }},
139
+ { "Pa", 231, 231, 231.035880000, METAL2, 0, 1, {{0,}, {0,}, {3,4,5,}, {0,}, {0,} }},
140
+ { "U", 238, 238, 238.050790000, METAL2, 0, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
141
+ { "Np", 237, 237, 237.048170000, METAL2, 0, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
142
+ { "Pu", 244, 244, 244.064200000, METAL2, 0, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
143
+ { "Am", 243, 243, 243.061370000, METAL2, 0, 1, {{0,}, {0,}, {3,4,5,6,}, {0,}, {0,} }},
144
+ { "Cm", 247, 247, 247.070300000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
145
+ { "Bk", 247, 247, 247.070300000, METAL , 0, 1, {{0,}, {0,}, {3,4,}, {0,}, {0,} }},
146
+ { "Cf", 251, 251, 251.079600000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
147
+ { "Es", 252, 252, 252.082800000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
148
+ { "Fm", 257, 257, 257.095100000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
149
+ { "Md", 258, 258, 258.098600000, METAL , 0, 1, {{0,}, {0,}, {3,}, {0,}, {0,} }},
150
+ { "No", 259, 259, 259.100900000, METAL , 0, 1, {{0,}, {0,}, {1,}, {0,}, {0,} }},
151
+ { "Lr", 260, 260, 260.105400000, METAL , 0, 1, {{0,}, {0,}, {1,}, {0,}, {0,} }},
152
+ { "Rf", 261, 261, 261.108700000, METAL , 0, 1, {{0,}, {0,}, {1,}, {0,}, {0,} }},
153
+ { "", 0, 0, 0.000000000, 0 , 0, 0, {{0,}, {0,}, {0,}, {0,}, {0,} }},
153
154
 
154
155
  };
155
156
  /*
@@ -247,18 +248,28 @@ int get_unusual_el_valence( int nPeriodicNum, int charge, int radical, int bonds
247
248
  /***********************************************************************************
248
249
  * output valence needed to unumbiguosly reconstruct number of H
249
250
  ***********************************************************************************/
250
- int needed_unusual_el_valence( int nPeriodicNum, int charge, int radical, int bonds_valence, int num_H, int num_bonds )
251
+ int needed_unusual_el_valence( int nPeriodicNum, int charge, int radical, int bonds_valence,
252
+ int actual_bonds_valence, int num_H, int num_bonds )
251
253
  {
252
254
  int i, num_found, num_found_known, chem_valence, rad_adj, known_chem_valence, exact_found;
255
+ int num_H_expected;
256
+ char szElement[4];
253
257
  /*
254
258
  if ( !num_bonds && !num_H )
255
259
  return 0;
256
260
  */
261
+ if ( num_bonds && !GetElementFormulaFromAtNum(nPeriodicNum, szElement ) ) {
262
+ num_H_expected = get_num_H( szElement, 0, NULL, charge, radical, actual_bonds_valence, 0,0,0,0 );
263
+ } else {
264
+ num_H_expected = num_H;
265
+ }
266
+
257
267
  chem_valence = bonds_valence + num_H;
258
268
  if ( charge < MIN_ATOM_CHARGE || charge > MAX_ATOM_CHARGE ||
259
269
  !get_el_valence( nPeriodicNum, charge, 0 ) ||
260
- do_not_add_H( nPeriodicNum ) ) {
261
- if ( !num_H )
270
+ do_not_add_H( nPeriodicNum ) || bonds_valence != actual_bonds_valence ||
271
+ num_H_expected != num_H ) {
272
+ if ( !num_H && !num_H_expected && bonds_valence == actual_bonds_valence )
262
273
  return 0; /* no H */
263
274
  return chem_valence; /* needs to add H-atoms */
264
275
  }
@@ -515,8 +526,11 @@ int get_num_H (const char* elname, int inp_num_H, S_CHAR inp_num_iso_H[],
515
526
  */
516
527
  num_H = inchi_max( 0, val - chem_bonds_valence );
517
528
  }
518
- for ( i = 0, num_iso_H = 0; i < NUM_H_ISOTOPES; i ++ ) {
519
- num_iso_H += inp_num_iso_H[i];
529
+ num_iso_H = 0;
530
+ if ( inp_num_iso_H ) {
531
+ for ( i = 0; i < NUM_H_ISOTOPES; i ++ ) {
532
+ num_iso_H += inp_num_iso_H[i];
533
+ }
520
534
  }
521
535
  /* should not happen because atom here is not aliased */
522
536
  if ( num_iso_H ) {
@@ -634,7 +648,7 @@ char *fgetsTab( char *szLine, int len, FILE *f );
634
648
  /*******************************************************************/
635
649
  char *fgetsTab( char *szLine, int len, FILE *f )
636
650
  {
637
- int length=0, c;
651
+ int length=0, c=0;
638
652
  len --;
639
653
  while ( length < len && EOF != (c = fgetc( f )) ) {
640
654
  if ( c == '\t' )
@@ -718,6 +732,31 @@ int my_fgets( char *szLine, int len, FILE *f, int *bTooLongLine )
718
732
  } while ( !length );
719
733
  return length;
720
734
  }
735
+ #if ( FIX_READ_LONG_LINE_BUG == 1 )
736
+ /********************************************************************/
737
+ int my_fgetsUpToLfOrTab( char *szLine, int len, FILE *f )
738
+ {
739
+ int length;
740
+ char *p;
741
+ char szSkip[256];
742
+ int bTooLongLine = 0;
743
+ do {
744
+ p = fgetsTab( szLine, len, f );
745
+ if ( !p ) {
746
+ return -1; /* end of file or cannot read */
747
+ }
748
+ bTooLongLine = ( (int)strlen(szLine) == len-1 && szLine[len-2] != '\n' );
749
+ LtrimRtrim( szLine, &length );
750
+ } while ( !length );
751
+ if ( bTooLongLine ) {
752
+ while ( p = fgetsTab( szSkip, sizeof(szSkip)-1, f ) ) {
753
+ if ( strchr( szSkip, '\n' ) )
754
+ break;
755
+ }
756
+ }
757
+ return length;
758
+ }
759
+ #else
721
760
  /********************************************************************/
722
761
  int my_fgetsUpToLfOrTab( char *szLine, int len, FILE *f )
723
762
  {
@@ -746,6 +785,7 @@ int my_fgetsUpToLfOrTab( char *szLine, int len, FILE *f )
746
785
  }
747
786
  return length;
748
787
  }
788
+ #endif
749
789
  /******************************************************************/
750
790
  /* read not more than line_len bytes from an lf-terminated line */
751
791
  /* if input line is too long quietly ignore the rest of the line */
@@ -829,6 +869,24 @@ AT_NUMB *is_in_the_list( AT_NUMB *pathAtom, AT_NUMB nNextAtom, int nPathLen )
829
869
  ;
830
870
  return nPathLen? pathAtom : NULL;
831
871
  }
872
+ /******************************************************************************************************/
873
+ int nBondsValToMetal( inp_ATOM* at, int iat )
874
+ {
875
+ int i, neigh, bond_type, nVal2Metal = 0;
876
+ inp_ATOM* a = at + iat;
877
+ for ( i = 0; i < a->valence; i ++ ) {
878
+ neigh = a->neighbor[i];
879
+ if ( is_el_a_metal( at[(int)a->neighbor[i]].el_number ) ) {
880
+ bond_type = a->bond_type[i];
881
+ if ( bond_type <= BOND_TYPE_TRIPLE ) {
882
+ nVal2Metal += bond_type;
883
+ } else {
884
+ return -1; /* bond to metal order is not well defined */
885
+ }
886
+ }
887
+ }
888
+ return nVal2Metal;
889
+ }
832
890
  /************************************************************************/
833
891
  int num_of_H( inp_ATOM *at, int iat )
834
892
  {
@@ -1070,7 +1128,7 @@ int MakeRemovedProtonsString( int nNumRemovedProtons, NUM_H *nNumExchgIsotopicH,
1070
1128
  /*************************************************************************/
1071
1129
  #define __MYTOLOWER(c) ( ((c) >= 'A') && ((c) <= 'Z') ? ((c) - 'A' + 'a') : (c) )
1072
1130
 
1073
- #if ( !defined(_MSC_VER) || defined(__STDC__) && __STDC__ == 1 )
1131
+ #if ( defined(ADD_NON_ANSI_FUNCTIONS) || defined(__STDC__) && __STDC__ == 1 )
1074
1132
  /* support (VC++ Language extensions) = OFF && defined(INCHI_ANSI_ONLY) */
1075
1133
  int memicmp ( const void * p1, const void * p2, size_t length )
1076
1134
  {