third_party/inchi/INCHI_BASE/src/ichiread.c
int extract_all_backbone_bonds_from_inchi_string(char *sinchi, 
                                                 int *n_all_bkb_orig, 
                                                 int *orig, 
                                                 int *all_bkb_orig)
{
    InpInChI OneInput;
    int i, ret = _IS_OKAY;

    ret = extract_from_inchi_string(sinchi, &OneInput);
    if (ret== _IS_ERROR || ret== _IS_FATAL)
    {
        ret = _IS_ERROR;
        goto exit_function;
    }

    for (i = 0; i < OneInput.polymer->n; i++)
    {
        int j;
        OAD_PolymerUnit *u = OneInput.polymer->units[i];
        for (j = 0; j < u->nbkbonds; j++)
        {
            int icano1, iorig1, icano2, iorig2;
            icano1 = u->bkbonds[j][0];
            iorig1 = orig[icano1];
            icano2 = u->bkbonds[j][1];
            iorig2 = orig[icano2];

            all_bkb_orig[2 * (*n_all_bkb_orig)]		= iorig1;
            all_bkb_orig[2 * (*n_all_bkb_orig) + 1]	= iorig2;
            (*n_all_bkb_orig)++;
        }
    }

    FreeInpInChI(&OneInput);
    
exit_function:
    return ret;
}
/****************************************************************************
Extract all backbone bonds, in all units, from InChI string
NB: as units are not 'inter-crossing' any bkbond belongs to some unique CRU
****************************************************************************/
Extract all backbone bonds, in all units, from InChI string
NB: as units are not 'inter-crossing' any bkbond belongs to some unique CRU
Extract all backbone bonds in all units from InChI string NB : as units are not ' inter - crossing ' any bkbond belongs to some unique CRU
int extract_all_backbone_bonds_from_inchi_string(char *sinchi, 
                                                 int *n_all_bkb_orig, 
                                                 int *orig, 
                                                 int *all_bkb_orig)
{
    InpInChI OneInput;
    int i, ret = _IS_OKAY;
    ret = extract_from_inchi_string(sinchi, &OneInput);
    if (ret== _IS_ERROR || ret== _IS_FATAL)
    {
        ret = _IS_ERROR;
        goto exit_function;
    }
    for (i = 0; i < OneInput.polymer->n; i++)
    {
        int j;
        OAD_PolymerUnit *u = OneInput.polymer->units[i];
        for (j = 0; j < u->nbkbonds; j++)
        {
            int icano1, iorig1, icano2, iorig2;
            icano1 = u->bkbonds[j][0];
            iorig1 = orig[icano1];
            icano2 = u->bkbonds[j][1];
            iorig2 = orig[icano2];
            all_bkb_orig[2 * (*n_all_bkb_orig)]		= iorig1;
            all_bkb_orig[2 * (*n_all_bkb_orig) + 1]	= iorig2;
            (*n_all_bkb_orig)++;
        }
    }
    FreeInpInChI(&OneInput);
exit_function:
    return ret;
}
int extract_all_backbone_bonds_from_inchi_string ( char * sinchi , int * n_all_bkb_orig , int * orig , int * all_bkb_orig ) { InpInChI OneInput ; int i , ret = _IS_OKAY ; ret = extract_from_inchi_string ( sinchi , & OneInput ) ; if ( ret == _IS_ERROR || ret == _IS_FATAL ) { ret = _IS_ERROR ; goto exit_function ; } for ( i = 0 ; i < OneInput . polymer -> n ; i ++ ) { int j ; OAD_PolymerUnit * u = OneInput . polymer -> units [ i ] ; for ( j = 0 ; j < u -> nbkbonds ; j ++ ) { int icano1 , iorig1 , icano2 , iorig2 ; icano1 = u -> bkbonds [ j ] [ 0 ] ; iorig1 = orig [ icano1 ] ; icano2 = u -> bkbonds [ j ] [ 1 ] ; iorig2 = orig [ icano2 ] ; all_bkb_orig [ 2 * ( * n_all_bkb_orig ) ] = iorig1 ; all_bkb_orig [ 2 * ( * n_all_bkb_orig ) + 1 ] = iorig2 ; ( * n_all_bkb_orig ) ++ ; } } FreeInpInChI ( & OneInput ) ; exit_function : return ret ; }
Extract all backbone bonds, in all units, from InChI string
NB: as units are not 'inter-crossing' any bkbond belongs to some unique CRU
Extract all backbone bonds in all units from InChI string NB : as units are not ' inter - crossing ' any bkbond belongs to some unique CRU