File: util.h

package info (click to toggle)
openbabel 2.3.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 75,308 kB
  • ctags: 41,952
  • sloc: cpp: 321,252; ansic: 89,228; python: 7,262; perl: 6,418; pascal: 793; sh: 194; xml: 97; ruby: 55; makefile: 47; java: 23
file content (128 lines) | stat: -rw-r--r-- 4,531 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
 * International Chemical Identifier (InChI)
 * Version 1
 * Software version 1.04
 * September 9, 2011
 *
 * The InChI library and programs are free software developed under the
 * auspices of the International Union of Pure and Applied Chemistry (IUPAC).
 * Originally developed at NIST. Modifications and additions by IUPAC 
 * and the InChI Trust.
 *
 * IUPAC/InChI-Trust Licence for the International Chemical Identifier (InChI) 
 * Software version 1.0.
 * Copyright (C) IUPAC and InChI Trust Limited
 * 
 * This library is free software; you can redistribute it and/or modify it under the 
 * terms of the IUPAC/InChI Trust Licence for the International Chemical Identifier 
 * (InChI) Software version 1.0; either version 1.0 of the License, or 
 * (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 * See the IUPAC/InChI Trust Licence for the International Chemical Identifier (InChI) 
 * Software version 1.0 for more details.
 * 
 * You should have received a copy of the IUPAC/InChI Trust Licence for the 
 * International Chemical Identifier (InChI) Software version 1.0 along with 
 * this library; if not, write to:
 * 
 * The InChI Trust
 * c/o FIZ CHEMIE Berlin
 * Franklinstrasse 11
 * 10587 Berlin
 * GERMANY
 * 
 */


#ifndef __UTIL_H__
#define __UTIL_H__

#include "inpdef.h"

/* BILLY 8/6/04 */
#ifndef COMPILE_ALL_CPP
#ifdef __cplusplus
extern "C" {
#endif
#endif

int get_atw(const char *elname);
int get_atw_from_elnum( int nAtNum );
int get_num_H (const char* elname, int inp_num_H, S_CHAR num_iso_H[], int charge, int radical,
              int chem_bonds_valence, int atom_input_valence, int bAliased, int bDoNotAddH, int bHasMetalNeighbor );
int extract_ChargeRadical( char *elname, int *pnRadical, int *pnCharge );
int extract_H_atoms( char *elname, S_CHAR num_iso_H[] );
int normalize_name( char* name );

int mystrncpy(char *target,const char *source,unsigned maxlen);
char* LtrimRtrim( char *p, int* nLen );

void remove_trailing_spaces( char* p );
void remove_one_lf( char* p);
void mystrrev( char *p );






#define ALPHA_BASE  27
long inchi_strtol( const char *str, const char **p, int base);
double inchi_strtod( const char *str, const char **p );

AT_NUMB *is_in_the_list( AT_NUMB *pathAtom, AT_NUMB nNextAtom, int nPathLen );
int get_periodic_table_number( const char* elname );
int is_el_a_metal( int nPeriodicNum );
int get_el_valence( int nPeriodicNum, int charge, int val_num );
int get_unusual_el_valence( int nPeriodicNum, int charge, int radical, int bonds_valence, int num_H, int num_bonds );
int detect_unusual_el_valence( int nPeriodicNum, int charge, int radical, int bonds_valence, int num_H, int num_bonds );
int needed_unusual_el_valence( int nPeriodicNum, int charge, int radical, int bonds_valence,
                               int actual_bonds_val, int num_H, int num_bonds );
int get_el_type( int nPeriodicNum );
int get_el_number( const char* elname );
int do_not_add_H( int nPeriodicNum );
int GetElementFormulaFromAtNum(int nAtNum, char *szElement );
int MakeRemovedProtonsString( int nNumRemovedProtons, NUM_H *nNumExchgIsotopicH, NUM_H *nNumRemovedProtonsIsotopic,
                              int bIsotopic, char *szRemovedProtons, int *num_removed_iso_H );

/* ion pairs and fixing bonds */
int num_of_H( inp_ATOM *at, int iat );
int has_other_ion_neigh( inp_ATOM *at, int iat, int iat_ion_neigh, const char *el, int el_len );
int has_other_ion_in_sphere_2(inp_ATOM *at, int iat, int iat_ion_neigh, const char *el, int el_len );
int nNoMetalNumBonds( inp_ATOM *at, int at_no );
int nNoMetalBondsValence( inp_ATOM *at, int at_no );
int nNoMetalNeighIndex( inp_ATOM *at, int at_no );
int nNoMetalOtherNeighIndex( inp_ATOM *at, int at_no, int cur_neigh );
int nNoMetalOtherNeighIndex2( inp_ATOM *at, int at_no, int cur_neigh, int cur_neigh2 );

void extract_inchi_substring(char ** buf, const char *str, size_t slen);

/* mol2atom.c */
int nBondsValToMetal( inp_ATOM* at, int iat );

/* ichi_bns.c */
int nBondsValenceInpAt( const inp_ATOM *at, int *nNumAltBonds, int *nNumWrongBonds );

int bHeteroAtomMayHaveXchgIsoH( inp_ATOM *atom, int iat );

/* IChICan2.c */
int SetBitFree( void );

void WriteCoord( char *str, double x );


extern int ERR_ELEM;
extern int nElDataLen;

/* BILLY 8/6/04 */
#ifndef COMPILE_ALL_CPP
#ifdef __cplusplus
}
#endif
#endif

#endif /* __UTIL_H__*/