third_party/inchi/INCHI_BASE/src/runichi3.c
int OAD_Polymer_CyclizeCloseableUnits( ORIG_ATOM_DATA *orig_at_data,
                                       int treat_polymers,
                                       char *pStrErr,
                                       int bNoWarnings )
{
    int i, ncyclized = 0, err = 0;

    for (i = 0; i < orig_at_data->polymer->n; i++)
    {
        OAD_PolymerUnit *unit = orig_at_data->polymer->units[i];

        if (!unit->cyclizable)
        {
            continue;
        }

        /* Find stars and their partners */
        OAD_PolymerUnit_SetEndsAndCaps( unit, orig_at_data, &err, pStrErr );
            /*	Reveal and store CRU caps and ends('stars and partners')
                Also set `unit->cap1_is_undef`, `unit->cap2_is_undef`, `unit->cyclizable` 
            */
        if (err)
        {
            break;
        }
        if (!unit->cyclizable)
        {
            continue;
        }


        if (OAD_PolymerUnit_HasMetal( unit, orig_at_data->at ))
        {
            /*unit->cyclizable = CLOSING_SRU_NOT_APPLICABLE;*/
            if (unit->cyclizable == CLOSING_SRU_RING)
            {
                /*unit->cyclizable = CLOSING_SRU_HIGHER_ORDER_BOND;*/
                if (!bNoWarnings)
                {
                    WarningMessage( pStrErr, "Frame shift in metallated polymer unit may be missed" );
                }
            }
        }

        /* Now remove bonds to cap ("star atoms and cyclize a SRU */
        OAD_PolymerUnit_UnlinkCapsAndConnectEndAtoms( unit, orig_at_data, &err, pStrErr );

        if (err)
        {
            break;
        }
        if (!unit->cyclizable)
        {
            continue;
        }

        ncyclized++;
    }

    /*
    if ( ncyclized )
    {
        if (!bNoWarnings)
        {
            WarningMessage( pStrErr, "Made provision for frame shift in polymer unit(s)" );
        }
    }
    */

    return err;
}
/****************************************************************************
 Preprocess OAD_Polymer (NB: frame shift is invoked from here)
****************************************************************************/
Preprocess OAD_Polymer (NB: frame shift is invoked from here)
Preprocess OAD_Polymer ( NB : frame shift is invoked from here )
int OAD_Polymer_CyclizeCloseableUnits( ORIG_ATOM_DATA *orig_at_data,
                                       int treat_polymers,
                                       char *pStrErr,
                                       int bNoWarnings )
{
    int i, ncyclized = 0, err = 0;
    for (i = 0; i < orig_at_data->polymer->n; i++)
    {
        OAD_PolymerUnit *unit = orig_at_data->polymer->units[i];
        if (!unit->cyclizable)
        {
            continue;
        }
        OAD_PolymerUnit_SetEndsAndCaps( unit, orig_at_data, &err, pStrErr );
        if (err)
        {
            break;
        }
        if (!unit->cyclizable)
        {
            continue;
        }
        if (OAD_PolymerUnit_HasMetal( unit, orig_at_data->at ))
        {
            if (unit->cyclizable == CLOSING_SRU_RING)
            {
                if (!bNoWarnings)
                {
                    WarningMessage( pStrErr, "Frame shift in metallated polymer unit may be missed" );
                }
            }
        }
        OAD_PolymerUnit_UnlinkCapsAndConnectEndAtoms( unit, orig_at_data, &err, pStrErr );
        if (err)
        {
            break;
        }
        if (!unit->cyclizable)
        {
            continue;
        }
        ncyclized++;
    }
    return err;
}
int OAD_Polymer_CyclizeCloseableUnits ( ORIG_ATOM_DATA * orig_at_data , int treat_polymers , char * pStrErr , int bNoWarnings ) { int i , ncyclized = 0 , err = 0 ; for ( i = 0 ; i < orig_at_data -> polymer -> n ; i ++ ) { OAD_PolymerUnit * unit = orig_at_data -> polymer -> units [ i ] ; if ( ! unit -> cyclizable ) { continue ; } OAD_PolymerUnit_SetEndsAndCaps ( unit , orig_at_data , & err , pStrErr ) ; if ( err ) { break ; } if ( ! unit -> cyclizable ) { continue ; } if ( OAD_PolymerUnit_HasMetal ( unit , orig_at_data -> at ) ) { if ( unit -> cyclizable == CLOSING_SRU_RING ) { if ( ! bNoWarnings ) { WarningMessage ( pStrErr , " " ) ; } } } OAD_PolymerUnit_UnlinkCapsAndConnectEndAtoms ( unit , orig_at_data , & err , pStrErr ) ; if ( err ) { break ; } if ( ! unit -> cyclizable ) { continue ; } ncyclized ++ ; } return err ; }
Preprocess OAD_Polymer (NB: frame shift is invoked from here)
Preprocess OAD_Polymer ( NB : frame shift is invoked from here )
/* Find stars and their partners */ /*	Reveal and store CRU caps and ends('stars and partners')
                Also set `unit->cap1_is_undef`, `unit->cap2_is_undef`, `unit->cyclizable` 
            */ /*unit->cyclizable = CLOSING_SRU_NOT_APPLICABLE;*/ /*unit->cyclizable = CLOSING_SRU_HIGHER_ORDER_BOND;*/ /* Now remove bonds to cap ("star atoms and cyclize a SRU */ /*
    if ( ncyclized )
    {
        if (!bNoWarnings)
        {
            WarningMessage( pStrErr, "Made provision for frame shift in polymer unit(s)" );
        }
    }
    */