InChI
 
Loading...
Searching...
No Matches
runichi2.c File Reference
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include <ctype.h>
#include "mode.h"
#include "ichitime.h"
#include "ichister.h"
#include "ichimain.h"
#include "ichi_io.h"
#include "mol_fmt.h"
#include "inchi_api.h"
#include "readinch.h"
#include "inchi_gui.h"
#include "ichirvrs.h"
#include "bcf_s.h"
+ Include dependency graph for runichi2.c:

Data Structures

struct  tagModSCenterInfo
 
struct  tagDiylFrag
 

Typedefs

typedef struct tagModSCenterInfo ModSCenterInfo
 
typedef struct tagDiylFrag DiylFrag
 

Functions

static DiylFrag * DiylFrag_New (int na, int e1nd, int end2, char *s)
 
static void DiylFrag_Free (DiylFrag *pfrag)
 
static void DiylFrag_MakeSignature (DiylFrag *pfrag, int nxc, int *xc, int *tmp)
 
static int DiylFrag_Diff (DiylFrag *pfrag1, DiylFrag *pfrag2)
 
static void DiylFrag_DebugTrace (DiylFrag *pfrag)
 
static int NDefStereoBonds (inp_ATOM *at, int iatom, int bOnlyPointedEndMatters)
 
static void ModSCenter_Init (ModSCenterInfo *scinfo, inp_ATOM *at, int iatom)
 
static void ModSCenter_AddTo (ModSCenterInfo *scinfo, int iadd)
 
static void ModSCenter_DelFrom (ModSCenterInfo *scinfo, int idel)
 
static int ModSCenter_IsChanged (ModSCenterInfo *scinfo, inp_ATOM *at)
 
static int GetFrameShiftInfoFrom105PlusInChI (char *sinchi, int *alist, int max_crossing)
 
static int analyze_CRU_folding (ORIG_ATOM_DATA *orig_at_data, int iunit, int n_all_bkb, int *all_bkb, int nxclasses, int *xc, OAD_StructureEdits *ed)
 
static int count_colors_in_sequence (int *entries, int n_entries, int max_distinct, int *counts)
 
static int len_repeating_subsequence (int *color, int *color2, int n)
 
int GetOneStructure (INCHI_CLOCK *ic, STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, INCHI_IOSTREAM *inp_file, INCHI_IOSTREAM *log_file, INCHI_IOSTREAM *out_file, INCHI_IOSTREAM *prb_file, ORIG_ATOM_DATA *orig_inp_data, long *num_inp, STRUCT_FPTRS *struct_fptrs)
 
static int BuildPolymerCrossingBondEndpointMask (INP_ATOM_DATA *inp_cur_data, const ORIG_ATOM_DATA *orig_inp_data, const INPUT_PARMS *ip, int component_number)
 
int GetOneComponent (INCHI_CLOCK *ic, STRUCT_DATA *sd, INPUT_PARMS *ip, INCHI_IOSTREAM *log_file, INCHI_IOSTREAM *out_file, INP_ATOM_DATA *inp_cur_data, ORIG_ATOM_DATA *orig_inp_data, int i, long num_inp)
 
int ReadTheStructure (struct tagINCHI_CLOCK *ic, STRUCT_DATA *sd, INPUT_PARMS *ip, INCHI_IOSTREAM *inp_file, ORIG_ATOM_DATA *orig_inp_data, int inp_index, int *out_index)
 
int TreatErrorsInReadTheStructure (STRUCT_DATA *sd, INPUT_PARMS *ip, int nLogMask, INCHI_IOSTREAM *inp_file, INCHI_IOSTREAM *log_file, INCHI_IOSTREAM *out_file, INCHI_IOSTREAM *prb_file, ORIG_ATOM_DATA *orig_inp_data, long *num_inp)
 
int InchiToOrigAtom (INCHI_IOSTREAM *inp_molfile, ORIG_ATOM_DATA *orig_at_data, int bMergeAllInputStructures, int bGetOrigCoord, int bDoNotAddH, int vABParityUnknown, INPUT_TYPE nInputType, char *pSdfLabel, char *pSdfValue, unsigned long *lSdfId, INCHI_MODE *pInpAtomFlags, int *err, char *pStrErr)
 Convert InChI representation to original atom data.
 
int bIsSameBond (int a1, int a2, int b1, int b2)
 Check if two bonds are the same.
 
int extract_orig_nums_from_auxinfo_string (char *saux, int *orig)
 Parse AuxInfostring and get a list of original atom numbers orig[cano_num].
 
int extract_nonstereo_eq_classes_from_auxinfo_string (char *saux, int nat, int *orig, int *nclasses, int *eclass, int *eclass_by_origs)
 Parse AuxInfostring and get non-stereo equivalence classes.
 
int POSEContext_Init (POSEContext *context, STRUCT_DATA *sd, INPUT_PARMS *ip, char *szTitle, PINChI2 *pINChI2[INCHI_NUM], PINChI_Aux2 *pINChI_Aux2[INCHI_NUM], INCHI_IOSTREAM *inp_file, INCHI_IOSTREAM *log_file, INCHI_IOSTREAM *out_file, INCHI_IOSTREAM *prb_file, ORIG_ATOM_DATA *orig_inp_data, ORIG_ATOM_DATA *prep_inp_data, long num_inp, INCHI_IOS_STRING *strbuf, unsigned char save_opt_bits)
 
void POSEContext_Free (POSEContext *context)
 
void POSEContext_DebugPrint (POSEContext *context)
 
int OAD_StructureEdits_Init (OAD_StructureEdits *ed)
 Initialize structure edits.
 
void OAD_StructureEdits_Clear (OAD_StructureEdits *ed)
 Clear structure edits.
 
void OAD_StructureEdits_DebugPrint (OAD_StructureEdits *ed)
 Debug print structure edits.
 
int OAD_Polymer_PrepareFoldCRUEdits (ORIG_ATOM_DATA *orig_at_data, char *sinchi_noedits, char *saux_noedits, char *sinchi, char *saux, OAD_StructureEdits *ed)
 Prepare CRU edits for polymer data structure (prepare CRU fold edits as suggested by the strings with preliminary generated interim (1.05+ flavoured) InChI and AuxInfo)
 
int OAD_Polymer_PrepareFrameShiftEdits (ORIG_ATOM_DATA *orig_at_data, char *sinchi, char *saux, OAD_StructureEdits *ed)
 Prepare frame shift edits for polymer data structure (prepare frame shift edits as suggested by the strings with preliminary generated interim (1.05+ flavoured) InChI and AuxInfo)
 

Variables

int ec_opp [MAX_ATOMS]
 
int ec_cano_opp [MAX_ATOMS]
 
int at_stereo_mark_orig_opp [MAX_ATOMS]
 
int xc_opp [MAX_ATOMS]
 

Typedef Documentation

◆ DiylFrag

typedef struct tagDiylFrag DiylFrag

◆ ModSCenterInfo

Function Documentation

◆ analyze_CRU_folding()

int analyze_CRU_folding ( ORIG_ATOM_DATA *  orig_at_data,
int  iunit,
int  n_all_bkb,
int *  all_bkb,
int  nxclasses,
int *  xc,
OAD_StructureEdits *  ed 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bIsSameBond()

int bIsSameBond ( int  a1,
int  a2,
int  b1,
int  b2 
)

Check if two bonds are the same.

Parameters
a1Atom a1 index
a2Atom a2 index
b1Atom b1 index
b2Atom b2 index
Returns
int Returns 1 if bonds (a1,a2) and (b1,b2) are the same, -1 if atoms swapped, 0 if not the same
+ Here is the caller graph for this function:

◆ BuildPolymerCrossingBondEndpointMask()

static int BuildPolymerCrossingBondEndpointMask ( INP_ATOM_DATA *  inp_cur_data,
const ORIG_ATOM_DATA *  orig_inp_data,
const INPUT_PARMS *  ip,
int  component_number 
)
static

@nnuk

Build a component-local mask of polymer crossing-bond endpoints.

The polymer crossing-bond list (OAD_PolymerUnit.blist) uses whole-structure, 1-based atom numbering, whereas inp_cur_data contains only atoms from the selected connected component. ExtractConnectedComponent() preserves the original atom order within the component, allowing the corresponding local atom index to be reconstructed.

The mask is later consulted by remove_terminal_HDT() to preserve explicit H/D/T atoms that participate in polymer crossing bonds.

Parameters
inp_cur_datachemical structure information for the current component
orig_inp_datachemical structure information for the whole structure
ipinput parameters
component_numbernumber of component in the chemical structure
Returns
Return 0 on success or when no mask is required; return -1 on allocation failure.
+ Here is the caller graph for this function:

◆ count_colors_in_sequence()

int count_colors_in_sequence ( int *  entries,
int  n_entries,
int  max_distinct,
int *  counts 
)
static
+ Here is the caller graph for this function:

◆ DiylFrag_DebugTrace()

void DiylFrag_DebugTrace ( DiylFrag *  pfrag)
static
+ Here is the caller graph for this function:

◆ DiylFrag_Diff()

int DiylFrag_Diff ( DiylFrag *  pfrag1,
DiylFrag *  pfrag2 
)
static
+ Here is the caller graph for this function:

◆ DiylFrag_Free()

void DiylFrag_Free ( DiylFrag *  pfrag)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DiylFrag_MakeSignature()

void DiylFrag_MakeSignature ( DiylFrag *  pfrag,
int  nxc,
int *  xc,
int *  tmp 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DiylFrag_New()

DiylFrag * DiylFrag_New ( int  na,
int  e1nd,
int  end2,
char *  s 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extract_nonstereo_eq_classes_from_auxinfo_string()

int extract_nonstereo_eq_classes_from_auxinfo_string ( char *  saux,
int  nat,
int *  orig,
int *  have_eclass_info,
int *  eclass,
int *  eclass_by_origs 
)

Parse AuxInfostring and get non-stereo equivalence classes.

Parameters
sauxPointer to AuxInfo string
natNumber of atoms
origPointer to array of original atom numbers
have_eclass_infoPointer to output flag indicating if equivalence class info is present
eclassPointer to output array of equivalence classes by canonical atom number
eclass_by_origsPointer to output array of equivalence classes by original atom number
Returns
int Status code
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extract_orig_nums_from_auxinfo_string()

int extract_orig_nums_from_auxinfo_string ( char *  saux,
int *  orig 
)

Parse AuxInfostring and get a list of original atom numbers orig[cano_num].

Parameters
sauxPointer to AuxInfo string
origPointer to output array of original atom numbers
Returns
int Status code
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetFrameShiftInfoFrom105PlusInChI()

static int GetFrameShiftInfoFrom105PlusInChI ( char *  sinchi,
int *  alist,
int  max_crossing 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOneComponent()

int GetOneComponent ( INCHI_CLOCK *  ic,
STRUCT_DATA *  sd,
INPUT_PARMS *  ip,
INCHI_IOSTREAM *  log_file,
INCHI_IOSTREAM *  out_file,
INP_ATOM_DATA *  inp_cur_data,
ORIG_ATOM_DATA *  orig_inp_data,
int  i,
long  num_inp 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOneStructure()

int GetOneStructure ( INCHI_CLOCK *  ic,
STRUCT_DATA *  sd,
INPUT_PARMS *  ip,
char *  szTitle,
INCHI_IOSTREAM *  inp_file,
INCHI_IOSTREAM *  log_file,
INCHI_IOSTREAM *  out_file,
INCHI_IOSTREAM *  prb_file,
ORIG_ATOM_DATA *  orig_inp_data,
long *  num_inp,
STRUCT_FPTRS *  struct_fptrs 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InchiToOrigAtom()

int InchiToOrigAtom ( INCHI_IOSTREAM *  infile,
ORIG_ATOM_DATA *  orig_at_data,
int  bMergeAllInputStructures,
int  bGetOrigCoord,
int  bDoNotAddH,
int  vABParityUnknown,
INPUT_TYPE  nInputType,
char *  pSdfLabel,
char *  pSdfValue,
unsigned long *  lSdfId,
INCHI_MODE *  pInpAtomFlags,
int *  err,
char *  pStrErr 
)

Convert InChI representation to original atom data.

Parameters
infileInput file stream
orig_at_dataPointer to original atom data structure to be filled
bMergeAllInputStructuresFlag indicating whether to merge all input structures
bGetOrigCoordFlag indicating whether to get original coordinates
bDoNotAddHFlag indicating whether to avoid adding hydrogens
vABParityUnknownFlag indicating whether to treat vAB parity as unknown
nInputTypeInput type
pSdfLabelPointer to SDF label
pSdfValuePointer to SDF value
lSdfIdPointer to SDF ID
pInpAtomFlagsPointer to input atom flags
errPointer to error code
pStrErrPointer to error string
Returns
int Status code
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ len_repeating_subsequence()

int len_repeating_subsequence ( int *  color,
int *  color2,
int  n 
)
static
+ Here is the caller graph for this function:

◆ ModSCenter_AddTo()

void ModSCenter_AddTo ( ModSCenterInfo *  scinfo,
int  iadd 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ModSCenter_DelFrom()

void ModSCenter_DelFrom ( ModSCenterInfo *  scinfo,
int  idel 
)
static
+ Here is the caller graph for this function:

◆ ModSCenter_Init()

void ModSCenter_Init ( ModSCenterInfo *  scinfo,
inp_ATOM *  at,
int  iatom 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ModSCenter_IsChanged()

int ModSCenter_IsChanged ( ModSCenterInfo *  scinfo,
inp_ATOM *  at 
)
static

!! TUT NADO NE TAK base2 tot, kogo net v new_nbr new_base2 - tot, kogo net v nbr

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NDefStereoBonds()

int NDefStereoBonds ( inp_ATOM *  at,
int  iatom,
int  bOnlyPointedEndMatters 
)
static
+ Here is the caller graph for this function:

◆ OAD_Polymer_PrepareFoldCRUEdits()

int OAD_Polymer_PrepareFoldCRUEdits ( ORIG_ATOM_DATA *  orig_at_data,
char *  sinchi_noedits,
char *  saux_noedits,
char *  sinchi,
char *  saux,
OAD_StructureEdits *  ed 
)

Prepare CRU edits for polymer data structure (prepare CRU fold edits as suggested by the strings with preliminary generated interim (1.05+ flavoured) InChI and AuxInfo)

Parameters
orig_at_dataPointer to original atom data structure
sinchi_noeditsPointer to InChI string without edits
saux_noeditsPointer to auxiliary InChI string without edits
sinchiPointer to InChI string with edits
sauxPointer to auxiliary InChI string with edits
edPointer to structure edits to be filled
Returns
int Status code
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OAD_Polymer_PrepareFrameShiftEdits()

int OAD_Polymer_PrepareFrameShiftEdits ( ORIG_ATOM_DATA *  orig_at_data,
char *  sinchi,
char *  saux,
OAD_StructureEdits *  ed 
)

Prepare frame shift edits for polymer data structure (prepare frame shift edits as suggested by the strings with preliminary generated interim (1.05+ flavoured) InChI and AuxInfo)

Parameters
orig_at_dataPointer to original atom data structure
sinchiPointer to InChI string with edits
sauxPointer to auxiliary InChI string with edits
edPointer to structure edits to be filled
Returns
int Status code
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OAD_StructureEdits_Clear()

void OAD_StructureEdits_Clear ( OAD_StructureEdits *  ed)

Clear structure edits.

Parameters
edPointer to structure edits
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OAD_StructureEdits_DebugPrint()

void OAD_StructureEdits_DebugPrint ( OAD_StructureEdits *  ed)

Debug print structure edits.

Parameters
edPointer to structure edits
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OAD_StructureEdits_Init()

int OAD_StructureEdits_Init ( OAD_StructureEdits *  ed)

Initialize structure edits.

Parameters
edPointer to structure edits
Returns
int Error status code
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ POSEContext_DebugPrint()

void POSEContext_DebugPrint ( POSEContext *  context)

◆ POSEContext_Free()

void POSEContext_Free ( POSEContext *  context)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ POSEContext_Init()

int POSEContext_Init ( POSEContext *  context,
STRUCT_DATA *  sd,
INPUT_PARMS *  ip,
char *  szTitle,
PINChI2 *  pINChI2[INCHI_NUM],
PINChI_Aux2 *  pINChI_Aux2[INCHI_NUM],
INCHI_IOSTREAM *  inp_file,
INCHI_IOSTREAM *  log_file,
INCHI_IOSTREAM *  out_file,
INCHI_IOSTREAM *  prb_file,
ORIG_ATOM_DATA *  orig_inp_data,
ORIG_ATOM_DATA *  prep_inp_data,
long  num_inp,
INCHI_IOS_STRING *  strbuf,
unsigned char  save_opt_bits 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadTheStructure()

int ReadTheStructure ( struct tagINCHI_CLOCK *  ic,
STRUCT_DATA *  sd,
INPUT_PARMS *  ip,
INCHI_IOSTREAM *  inp_file,
ORIG_ATOM_DATA *  orig_inp_data,
int  inp_index,
int *  out_index 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TreatErrorsInReadTheStructure()

int TreatErrorsInReadTheStructure ( STRUCT_DATA *  sd,
INPUT_PARMS *  ip,
int  nLogMask,
INCHI_IOSTREAM *  inp_file,
INCHI_IOSTREAM *  log_file,
INCHI_IOSTREAM *  out_file,
INCHI_IOSTREAM *  prb_file,
ORIG_ATOM_DATA *  orig_inp_data,
long *  num_inp 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ at_stereo_mark_orig_opp

int at_stereo_mark_orig_opp[MAX_ATOMS]

◆ ec_cano_opp

int ec_cano_opp[MAX_ATOMS]

◆ ec_opp

int ec_opp[MAX_ATOMS]

◆ xc_opp

int xc_opp[MAX_ATOMS]