third_party/inchi/INCHI_BASE/src/runichi3.c
void OAD_Polymer_SmartReopenCyclizedUnits( OAD_Polymer *p,
                                           inp_ATOM    *at,
                                           int         nat,
                                           int         *num_inp_bonds )
{
    int i;
    OAD_AtProps *aprops = NULL;

    if (!p)
    {
        return;
    }
    if (p->n < 1)
    {
        return;
    }
    if (!p->really_do_frame_shift)
    {
        return;
    }

    /*ITRACE_( "\n\n*********************************************************************\n* ENTERING OAD_Polymer_SmartReopenCyclizedUnits()" );
    OAD_Polymer_DebugTrace( p );*/

    /* Set atom properties for sorting */
    aprops = (OAD_AtProps *) inchi_calloc( nat + 1, sizeof( OAD_AtProps ) );
                                        /* nat + 1: add extra element for possibe 1-based indexing */
    if (!aprops)
    {
        return;
    }
    OAD_Polymer_SetAtProps( p, at, nat, num_inp_bonds, aprops, NULL ); /* NULL as we alredy are in 1-based cano_nums while at i2s/i2i*/
    for (i = 0; i < p->n; i++)
    {
        OAD_PolymerUnit *u = p->units[i];
        if (p->frame_shift_scheme == FSS_NONE)
        {
            continue;
        }
        if ( /* !u->cyclizable || u->cyclized  || */
            u->nbkbonds < 1 ||
            u->cap1 < 1 || u->cap2 < 1 ||
            u->cap1 > nat || u->cap2 > nat)
        {
            continue;
        }
        if (OAD_PolymerUnit_SetReopeningDetails( u, at ))
        {
            int senior_bond;
            OAD_PolymerUnit_SortBackboneBondsAndSetSeniors( u, at, aprops, &senior_bond );
        }
        OAD_PolymerUnit_ReopenCyclized( u, at, aprops, nat, num_inp_bonds );
    }

    p->really_do_frame_shift = 0;
    inchi_free( aprops );

    return;
}
/****************************************************************************
 Open pre-cyclized CRUs appropriately (i.e., make frame shift)
****************************************************************************/
Open pre-cyclized CRUs appropriately
Open pre - cyclized CRUs appropriately
void OAD_Polymer_SmartReopenCyclizedUnits( OAD_Polymer *p,
                                           inp_ATOM    *at,
                                           int         nat,
                                           int         *num_inp_bonds )
{
    int i;
    OAD_AtProps *aprops = NULL;
    if (!p)
    {
        return;
    }
    if (p->n < 1)
    {
        return;
    }
    if (!p->really_do_frame_shift)
    {
        return;
    }
    aprops = (OAD_AtProps *) inchi_calloc( nat + 1, sizeof( OAD_AtProps ) );
    if (!aprops)
    {
        return;
    }
    OAD_Polymer_SetAtProps( p, at, nat, num_inp_bonds, aprops, NULL ); 
    for (i = 0; i < p->n; i++)
    {
        OAD_PolymerUnit *u = p->units[i];
        if (p->frame_shift_scheme == FSS_NONE)
        {
            continue;
        }
        if ( 
            u->nbkbonds < 1 ||
            u->cap1 < 1 || u->cap2 < 1 ||
            u->cap1 > nat || u->cap2 > nat)
        {
            continue;
        }
        if (OAD_PolymerUnit_SetReopeningDetails( u, at ))
        {
            int senior_bond;
            OAD_PolymerUnit_SortBackboneBondsAndSetSeniors( u, at, aprops, &senior_bond );
        }
        OAD_PolymerUnit_ReopenCyclized( u, at, aprops, nat, num_inp_bonds );
    }
    p->really_do_frame_shift = 0;
    inchi_free( aprops );
    return;
}
void OAD_Polymer_SmartReopenCyclizedUnits ( OAD_Polymer * p , inp_ATOM * at , int nat , int * num_inp_bonds ) { int i ; OAD_AtProps * aprops = NULL ; if ( ! p ) { return ; } if ( p -> n < 1 ) { return ; } if ( ! p -> really_do_frame_shift ) { return ; } aprops = ( OAD_AtProps * ) inchi_calloc ( nat + 1 , sizeof ( OAD_AtProps ) ) ; if ( ! aprops ) { return ; } OAD_Polymer_SetAtProps ( p , at , nat , num_inp_bonds , aprops , NULL ) ; for ( i = 0 ; i < p -> n ; i ++ ) { OAD_PolymerUnit * u = p -> units [ i ] ; if ( p -> frame_shift_scheme == FSS_NONE ) { continue ; } if ( u -> nbkbonds < 1 || u -> cap1 < 1 || u -> cap2 < 1 || u -> cap1 > nat || u -> cap2 > nat ) { continue ; } if ( OAD_PolymerUnit_SetReopeningDetails ( u , at ) ) { int senior_bond ; OAD_PolymerUnit_SortBackboneBondsAndSetSeniors ( u , at , aprops , & senior_bond ) ; } OAD_PolymerUnit_ReopenCyclized ( u , at , aprops , nat , num_inp_bonds ) ; } p -> really_do_frame_shift = 0 ; inchi_free ( aprops ) ; return ; }
Open pre-cyclized CRUs appropriately (i.e., make frame shift)
Open pre - cyclized CRUs appropriately ( i . e . make frame shift )
/*ITRACE_( "\n\n*********************************************************************\n* ENTERING OAD_Polymer_SmartReopenCyclizedUnits()" );
    OAD_Polymer_DebugTrace( p );*/ /* Set atom properties for sorting */ /* nat + 1: add extra element for possibe 1-based indexing */ /* NULL as we alredy are in 1-based cano_nums while at i2s/i2i*/ /* !u->cyclizable || u->cyclized  || */