third_party/inchi/INCHI_BASE/src/runichi3.c
void OAD_PolymerUnit_DelistIntraRingBackboneBonds( OAD_PolymerUnit *unit,
                                                   ORIG_ATOM_DATA  *at_data,
                                                   int             *err,
                                                   char            *pStrErr )
{
    int nrings = 0;
    int *num_ring_sys = NULL;

    if (!unit)
    {
        return;
    }
    if (unit->nbkbonds < 1)
    {
        return;
    }

    /* Establish ring systems assignments for all related atoms */

    *err = 1;
    num_ring_sys = (int *) inchi_calloc( at_data->num_inp_atoms + 1, sizeof( int ) );
    if (!num_ring_sys)
    {
        goto exit_function;
    }

    *err = 0;

    nrings = OAD_Polymer_FindRingSystems( at_data->polymer, at_data->at, at_data->num_inp_atoms, &at_data->num_inp_bonds,
                                          num_ring_sys, NULL, unit->end_atom1 - 1 ); /* NB: start dfs within connected compt! */

    if (nrings == 0)
    {
        goto exit_function;
    }
    else
    {
        int at1, at2, j = 0;
repeatj:
        at1 = unit->bkbonds[j][0];
        at2 = unit->bkbonds[j][1];
        if (( num_ring_sys[at1] == num_ring_sys[at2] ) && ( num_ring_sys[at1] != -1 ))
        {
            OAD_PolymerUnit_RemoveLinkFromCRUChain( at1, at2, &unit->nbkbonds, unit->bkbonds );
        }
        else
        {
            ++j;
        }
        if (j < unit->nbkbonds)
        {
            goto repeatj;
        }
    }

exit_function:
    if (num_ring_sys)
    {
        inchi_free( num_ring_sys );
    }

    return;
}
/****************************************************************************
 Remove intra-ring bonds from the list of frame-shiftable bonds
****************************************************************************/
Remove intra-ring bonds from the list of frame-shiftable bonds
Remove intra - ring bonds from the list of frame - shiftable bonds
void OAD_PolymerUnit_DelistIntraRingBackboneBonds( OAD_PolymerUnit *unit,
                                                   ORIG_ATOM_DATA  *at_data,
                                                   int             *err,
                                                   char            *pStrErr )
{
    int nrings = 0;
    int *num_ring_sys = NULL;
    if (!unit)
    {
        return;
    }
    if (unit->nbkbonds < 1)
    {
        return;
    }
    *err = 1;
    num_ring_sys = (int *) inchi_calloc( at_data->num_inp_atoms + 1, sizeof( int ) );
    if (!num_ring_sys)
    {
        goto exit_function;
    }
    *err = 0;
    nrings = OAD_Polymer_FindRingSystems( at_data->polymer, at_data->at, at_data->num_inp_atoms, &at_data->num_inp_bonds,
                                          num_ring_sys, NULL, unit->end_atom1 - 1 ); 
    if (nrings == 0)
    {
        goto exit_function;
    }
    else
    {
        int at1, at2, j = 0;
repeatj:
        at1 = unit->bkbonds[j][0];
        at2 = unit->bkbonds[j][1];
        if (( num_ring_sys[at1] == num_ring_sys[at2] ) && ( num_ring_sys[at1] != -1 ))
        {
            OAD_PolymerUnit_RemoveLinkFromCRUChain( at1, at2, &unit->nbkbonds, unit->bkbonds );
        }
        else
        {
            ++j;
        }
        if (j < unit->nbkbonds)
        {
            goto repeatj;
        }
    }
exit_function:
    if (num_ring_sys)
    {
        inchi_free( num_ring_sys );
    }
    return;
}
void OAD_PolymerUnit_DelistIntraRingBackboneBonds ( OAD_PolymerUnit * unit , ORIG_ATOM_DATA * at_data , int * err , char * pStrErr ) { int nrings = 0 ; int * num_ring_sys = NULL ; if ( ! unit ) { return ; } if ( unit -> nbkbonds < 1 ) { return ; } * err = 1 ; num_ring_sys = ( int * ) inchi_calloc ( at_data -> num_inp_atoms + 1 , sizeof ( int ) ) ; if ( ! num_ring_sys ) { goto exit_function ; } * err = 0 ; nrings = OAD_Polymer_FindRingSystems ( at_data -> polymer , at_data -> at , at_data -> num_inp_atoms , & at_data -> num_inp_bonds , num_ring_sys , NULL , unit -> end_atom1 - 1 ) ; if ( nrings == 0 ) { goto exit_function ; } else { int at1 , at2 , j = 0 ; repeatj : at1 = unit -> bkbonds [ j ] [ 0 ] ; at2 = unit -> bkbonds [ j ] [ 1 ] ; if ( ( num_ring_sys [ at1 ] == num_ring_sys [ at2 ] ) && ( num_ring_sys [ at1 ] != -1 ) ) { OAD_PolymerUnit_RemoveLinkFromCRUChain ( at1 , at2 , & unit -> nbkbonds , unit -> bkbonds ) ; } else { ++ j ; } if ( j < unit -> nbkbonds ) { goto repeatj ; } } exit_function : if ( num_ring_sys ) { inchi_free ( num_ring_sys ) ; } return ; }
Remove intra-ring bonds from the list of frame-shiftable bonds
Remove intra - ring bonds from the list of frame - shiftable bonds
/* Establish ring systems assignments for all related atoms */ /* NB: start dfs within connected compt! */