InChI
 
Loading...
Searching...
No Matches
ichimake.c File Reference
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <locale.h>
#include "mode.h"
#include "ichimake.h"
#include "inchi_api.h"
#include "ichimain.h"
#include "ichister.h"
#include "ichi_io.h"
#include "ichitime.h"
#include "ichi_bns.h"
#include "bcf_s.h"
+ Include dependency graph for ichimake.c:

Data Structures

struct  tagOrderStruct
 

Macros

#define nFirstFmlSegm   DIFS_f_FORMULA
 
#define nFirstIsoSegm   DIFS_i_IATOMS
 

Typedefs

typedef enum tagSp3StereoTypeTmp SP3_TYPE_TMP
 
typedef struct tagOrderStruct OrderStruct
 

Enumerations

enum  tagSp3StereoTypeTmp {
  SP3_NONE = 0 , SP3_ONLY = 1 , SP3_ABS = 2 , SP3_REL = 4 ,
  SP3_RAC = 8 , SP3_TYPE = (SP3_ABS | SP3_REL | SP3_RAC) , SP3_ANY = (SP3_ABS | SP3_REL | SP3_RAC | SP3_ONLY)
}
 

Functions

int inp2spATOM (inp_ATOM *inp_at, int num_inp_at, sp_ATOM *at)
 
int GetElementAndCount (const char **f, char *szEl, int *count)
 
int CompareHillFormulas (const char *f1, const char *f2)
 
int CompareInchiStereo (INChI_Stereo *Stereo1, INCHI_MODE nFlags1, INChI_Stereo *Stereo2, INCHI_MODE nFlags2)
 
int CompareReversedStereoINChI (INChI_Stereo *s1, INChI_Stereo *s2)
 
int GetAtomOrdNbrInCanonOrd (struct tagCANON_GLOBALS *pCG, inp_ATOM *norm_at, AT_NUMB *nAtomOrdNbr, AT_NUMB *nOrigAtNosInCanonOrd, int num_at)
 
int FillOutCanonInfAtom (struct tagCANON_GLOBALS *pCG, inp_ATOM *norm_at, INF_ATOM_DATA *inf_norm_at_data, int init_num_at, int bIsotopic, INChI *pINChI, INChI_Aux *pINChI_Aux, int bAbcNumbers, INCHI_MODE nMode)
 
int FillOutOneCanonInfAtom (struct tagCANON_GLOBALS *pCG, inp_ATOM *inp_norm_at, INF_ATOM_DATA *inf_norm_at_data, AT_NUMB *pStereoFlags, int init_num_at, int offset, int offset_H, int bIsotopic, INChI *pINChI, INChI_Aux *pINChI_Aux, int bAbcNumbers, INCHI_MODE nMode)
 
int FillOutInputInfAtom (inp_ATOM *inp_at, INF_ATOM_DATA *inf_at_data, int init_num_at, int num_removed_H, int bAdd_DT_to_num_H, int nNumRemovedProtons, NUM_H *nNumRemovedProtonsIsotopic, int bIsotopic, int bAbcNumbers)
 
int CheckCanonNumberingCorrectness (int num_atoms, int num_at_tg, sp_ATOM *at, CANON_STAT *pCS, CANON_GLOBALS *pCG, int bTautomeric, char *pStrErrStruct)
 
static int CompareDfsDescendants4CT (const void *a1, const void *a2, void *)
 
int GetSp3RelRacAbs (const INChI *pINChI, INChI_Stereo *Stereo)
 
int CompareReversedStereoINChI2 (INChI_Stereo *s1, INChI_Stereo *s2, ICR *picr)
 
int CompareHillFormulasNoH (const char *f1, const char *f2, int *num_H1, int *num_H2)
 
int CompareTautNonIsoPartOfINChI (const INChI *i1, const INChI *i2)
 
int CompINChITautVsNonTaut (const INCHI_SORT *p1, const INCHI_SORT *p2, int bCompareIsotopic)
 Compare tautomeric vs non-tautomeric information.
 
int CompINChILayers (const INCHI_SORT *p1, const INCHI_SORT *p2, char sDifSegs[][DIFS_LENGTH], int bFixTranspChargeBug)
 Compare InChI layers.
 
int INChI_SegmentAction (char cDifSegs)
 Action to take per segment (?)
 
int MarkUnusedAndEmptyLayers (char sDifSegs[][DIFS_LENGTH])
 Mark unused and empty layers.
 
int CompINChI2 (const INCHI_SORT *p1, const INCHI_SORT *p2, int bTaut, int bCompareIsotopic)
 Compares two INChI data structures (qsort)
 
int CompINChINonTaut2 (const void *p1, const void *p2)
 Compare function for qsort (normal structure)
 
int CompINChITaut2 (const void *p1, const void *p2)
 Compare function for qsort (tautomeric structures)
 
void mystrrev (char *p)
 Reverse a string in place.
 
AT_NUMBGetDfsOrder4CT (CANON_GLOBALS *pCG, AT_NUMB *LinearCT, int nLenCT, S_CHAR *nNum_H, int num_atoms, int nCtMode)
 
int GetInpStructErrorType (INPUT_PARMS *ip, int err, char *pStrErrStruct, int num_inp_atoms)
 Get the input struct error type.
 
int ProcessStructError (INCHI_IOSTREAM *out_file, INCHI_IOSTREAM *log_file, char *pStrErrStruct, int nErrorType, long num_inp, INPUT_PARMS *ip)
 
int CompareReversedINChI (INChI *i1, INChI *i2, INChI_Aux *a1, INChI_Aux *a2)
 Compares two InChIs (1)
 
int CompareIcr (ICR *picr1, ICR *picr2, INCHI_MODE *pin1, INCHI_MODE *pin2, INCHI_MODE mask)
 Compares results from InChI comparison.
 
INCHI_MODE CompareReversedINChI2 (INChI *i1, INChI *i2, INChI_Aux *a1, INChI_Aux *a2, ICR *picr, int *err)
 Compares two InChIs (2)
 
int Create_INChI (CANON_GLOBALS *pCG, INCHI_CLOCK *ic, INPUT_PARMS *ip, INChI **ppINChI, INChI_Aux **ppINChI_Aux, ORIG_ATOM_DATA *orig_inp_data, inp_ATOM *inp_at, INP_ATOM_DATA *out_norm_data[2], int num_inp_at, INCHI_MODE nUserMode, INCHI_MODE *pbTautFlags, INCHI_MODE *pbTautFlagsDone, struct tagInchiTime *ulMaxTime, T_GROUP_INFO *ti_out, char *pStrErrStruct)
 Create INChI.
 

Macro Definition Documentation

◆ nFirstFmlSegm

#define nFirstFmlSegm   DIFS_f_FORMULA

◆ nFirstIsoSegm

#define nFirstIsoSegm   DIFS_i_IATOMS

Typedef Documentation

◆ OrderStruct

typedef struct tagOrderStruct OrderStruct

◆ SP3_TYPE_TMP

Enumeration Type Documentation

◆ tagSp3StereoTypeTmp

Enumerator
SP3_NONE 
SP3_ONLY 
SP3_ABS 
SP3_REL 
SP3_RAC 
SP3_TYPE 
SP3_ANY 

Function Documentation

◆ CheckCanonNumberingCorrectness()

int CheckCanonNumberingCorrectness ( int  num_atoms,
int  num_at_tg,
sp_ATOM at,
CANON_STAT pCS,
CANON_GLOBALS pCG,
int  bTautomeric,
char *  pStrErrStruct 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompareDfsDescendants4CT()

static int CompareDfsDescendants4CT ( const void *  a1,
const void *  a2,
void *  p 
)
static
+ Here is the caller graph for this function:

◆ CompareHillFormulas()

int CompareHillFormulas ( const char *  f1,
const char *  f2 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompareHillFormulasNoH()

int CompareHillFormulasNoH ( const char *  f1,
const char *  f2,
int *  num_H1,
int *  num_H2 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompareIcr()

int CompareIcr ( ICR picr1,
ICR picr2,
INCHI_MODE pin1,
INCHI_MODE pin2,
INCHI_MODE  mask 
)

Compares results from InChI comparison.

Parameters
picr1Pointer to first comparison results
picr2Pointer to second comparison results
pin1Pointer to first InChI mode (never used?)
pin2Pointer to second InChI mode (never used?)
maskEither IDIFF_CONSTIT or IDIFF_STEREO
Returns
* int 2 if undefined results, 1 if unequal, 0 if equal, -1 if unequal
+ Here is the caller graph for this function:

◆ CompareInchiStereo()

int CompareInchiStereo ( INChI_Stereo Stereo1,
INCHI_MODE  nFlags1,
INChI_Stereo Stereo2,
INCHI_MODE  nFlags2 
)
+ Here is the caller graph for this function:

◆ CompareReversedINChI()

int CompareReversedINChI ( INChI i1,
INChI i2,
INChI_Aux a1,
INChI_Aux a2 
)

Compares two InChIs (1)

Parameters
i1Pointer to first InChI (InChI from reversed struct)
i2Pointer to second InChI
a1Pointer to first InChI AuxInfo
a2Pointer to second InChI AuxInfo
Returns
int 0 if NULL, 1 if one is NULL, >1 if difference in structure
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompareReversedINChI2()

INCHI_MODE CompareReversedINChI2 ( INChI i1,
INChI i2,
INChI_Aux a1,
INChI_Aux a2,
ICR picr,
int *  err 
)

Compares two InChIs (2)

Parameters
i1Pointer to first InChI (InChI from reversed struct)
i2Pointer to second InChI
a1Pointer to first InChI AuxInfo
a2Pointer to second InChI AuxInfo
picrPointer to comparison results
errPointer to error code
Returns
INCHI_MODE Returns code from IDIF
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompareReversedStereoINChI()

int CompareReversedStereoINChI ( INChI_Stereo s1,
INChI_Stereo s2 
)
+ Here is the caller graph for this function:

◆ CompareReversedStereoINChI2()

int CompareReversedStereoINChI2 ( INChI_Stereo s1,
INChI_Stereo s2,
ICR picr 
)
+ Here is the caller graph for this function:

◆ CompareTautNonIsoPartOfINChI()

int CompareTautNonIsoPartOfINChI ( const INChI i1,
const INChI i2 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompINChI2()

int CompINChI2 ( const INCHI_SORT p1,
const INCHI_SORT p2,
int  bTaut,
int  bCompareIsotopic 
)

Compares two INChI data structures (qsort)

Parameters
p1Pointer to the first INCHI_SORT data structure
p2Pointer to the second INCHI_SORT data structure
bTautFlag for tautomeric comparison
bCompareIsotopicFlag for isotopic comparison
Returns
int -1 if *p1 > *p2, return +1 if *p1 < *p2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompINChILayers()

int CompINChILayers ( const INCHI_SORT p1,
const INCHI_SORT p2,
char  sDifSegs[][DIFS_LENGTH],
int  bFixTranspChargeBug 
)

Compare InChI layers.

Parameters
p1Pointer to InChI component 1
p2Pointer to InChI component 2
sDifSegsArray of different layers
bFixTranspChargeBugFlag to fix charge bug (?)
Returns
int -1 if *p1 > *p2, return +1 if *p1 < *p2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompINChINonTaut2()

int CompINChINonTaut2 ( const void *  p1,
const void *  p2 
)

Compare function for qsort (normal structure)

Parameters
p1Pointer to first INCHI_SORT structure
p2Pointer to second INCHI_SORT structure
Returns
int -1 if *p1 > *p2, return +1 if *p1 < *p2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompINChITaut2()

int CompINChITaut2 ( const void *  p1,
const void *  p2 
)

Compare function for qsort (tautomeric structures)

Parameters
p1Pointer to first INCHI_SORT structure
p2Pointer to second INCHI_SORT structure
Returns
int -1 if *p1 > *p2, return +1 if *p1 < *p2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CompINChITautVsNonTaut()

int CompINChITautVsNonTaut ( const INCHI_SORT p1,
const INCHI_SORT p2,
int  bCompareIsotopic 
)

Compare tautomeric vs non-tautomeric information.

Parameters
p1Pointer to the first INCHI_SORT data structure
p2Pointer to the second INCHI_SORT data structure
bCompareIsotopicFlag for comparing isotopic non-tautomeric part
Returns
int -1 if *p1 > *p2, return +1 if *p1 < *p2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Create_INChI()

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.

Parameters
pCGPointer to canonicalization globals data structure
icPointer to InChI clock data structure
ipPointer to input parameters
ppINChIPointer to INChI data structure
ppINChI_AuxPointer to AuxInfo data structure
orig_inp_dataPointer to original atom data
inp_atPointer to atom array
inp_norm_dataPointer to normalized atom data
num_inp_atNumber of atoms
nUserModeUser mode
pbTautFlagsTautomer flags
pbTautFlagsDoneTautomer flags completed
ulMaxTimeMaximum time
ti_outTautomer info
pStrErrStructStore error or warning messages
Returns
int Status code
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FillOutCanonInfAtom()

int FillOutCanonInfAtom ( struct tagCANON_GLOBALS pCG,
inp_ATOM norm_at,
INF_ATOM_DATA inf_norm_at_data,
int  init_num_at,
int  bIsotopic,
INChI pINChI,
INChI_Aux pINChI_Aux,
int  bAbcNumbers,
INCHI_MODE  nMode 
)

◆ FillOutInputInfAtom()

int FillOutInputInfAtom ( inp_ATOM inp_at,
INF_ATOM_DATA inf_at_data,
int  init_num_at,
int  num_removed_H,
int  bAdd_DT_to_num_H,
int  nNumRemovedProtons,
NUM_H nNumRemovedProtonsIsotopic,
int  bIsotopic,
int  bAbcNumbers 
)

◆ FillOutOneCanonInfAtom()

int FillOutOneCanonInfAtom ( struct tagCANON_GLOBALS pCG,
inp_ATOM inp_norm_at,
INF_ATOM_DATA inf_norm_at_data,
AT_NUMB pStereoFlags,
int  init_num_at,
int  offset,
int  offset_H,
int  bIsotopic,
INChI pINChI,
INChI_Aux pINChI_Aux,
int  bAbcNumbers,
INCHI_MODE  nMode 
)

◆ GetAtomOrdNbrInCanonOrd()

int GetAtomOrdNbrInCanonOrd ( struct tagCANON_GLOBALS pCG,
inp_ATOM norm_at,
AT_NUMB nAtomOrdNbr,
AT_NUMB nOrigAtNosInCanonOrd,
int  num_at 
)

◆ GetDfsOrder4CT()

AT_NUMB * GetDfsOrder4CT ( CANON_GLOBALS pCG,
AT_NUMB LinearCT,
int  nLenCT,
S_CHAR nNum_H,
int  num_atoms,
int  nCtMode 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetElementAndCount()

int GetElementAndCount ( const char **  f,
char *  szEl,
int *  count 
)
+ Here is the caller graph for this function:

◆ GetInpStructErrorType()

int GetInpStructErrorType ( INPUT_PARMS ip,
int  err,
char *  pStrErrStruct,
int  num_inp_atoms 
)

Get the input struct error type.

Parameters
ipPointer to input parameters
errError code
pStrErrStructPointer to error string
num_inp_atomsNumber of input atoms
Returns
int Returns type of error
+ Here is the caller graph for this function:

◆ GetSp3RelRacAbs()

int GetSp3RelRacAbs ( const INChI pINChI,
INChI_Stereo Stereo 
)
+ Here is the caller graph for this function:

◆ INChI_SegmentAction()

int INChI_SegmentAction ( char  cDifSegs)

Action to take per segment (?)

Parameters
cDifSegsSegment bits
Returns
int Type of segment action (INCHI_SEGM_OMIT, INCHI_SEGM_EMPTY, INCHI_SEGM_FILL)
+ Here is the caller graph for this function:

◆ inp2spATOM()

int inp2spATOM ( inp_ATOM inp_at,
int  num_inp_at,
sp_ATOM at 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MarkUnusedAndEmptyLayers()

int MarkUnusedAndEmptyLayers ( char  sDifSegs[][DIFS_LENGTH])

Mark unused and empty layers.

Parameters
sDifSegsArray of different layers
Returns
int returns 0
+ Here is the caller graph for this function:

◆ mystrrev()

void mystrrev ( char *  p)

Reverse a string in place.

Parameters
pPointer to the string to reverse
+ Here is the caller graph for this function:

◆ ProcessStructError()

int ProcessStructError ( INCHI_IOSTREAM out_file,
INCHI_IOSTREAM log_file,
char *  pStrErrStruct,
int  nErrorType,
long  num_inp,
INPUT_PARMS ip 
)
Parameters
out_filePointer to output file
log_filePointer to log file
pStrErrStructPointer to error string
nErrorTypeError type
num_inpNumber of input structure (?)
ipPointer to input parameters
Returns
int Retunrs error type
+ Here is the call graph for this function:
+ Here is the caller graph for this function: