third_party/inchi/INCHI_BASE/src/runichi3.c
int OrigAtData_bCheckUnusualValences( ORIG_ATOM_DATA *orig_at_data,
                                      int bAddIsoH,
                                      char *pStrErrStruct,
                                      int bNoWarnings)
{
    int i, val, num_found = 0;
    char msg[32];
    int len, num_H;

    int already_here = ( orig_at_data && orig_at_data->num_inp_atoms > 0 );

    inp_ATOM *at = already_here ? orig_at_data->at : NULL;

    if (at)
    {
        for (i = 0, num_found = 0; i < orig_at_data->num_inp_atoms; i++)
        {
            num_H = bAddIsoH ? NUMH( at, i ) : at[i].num_H;

            val = detect_unusual_el_valence( at[i].el_number,
                                             at[i].charge,
                                             at[i].radical,
                                             at[i].chem_bonds_valence,
                                             num_H,
                                             at[i].valence );
            if (val)
            {
                num_found++;
                if (!bNoWarnings)
                {
                    WarningMessage( pStrErrStruct, "Accepted unusual valence(s):" );
                }
                len = sprintf( msg, "%s", at[i].elname );
                if (at[i].charge)
                {
                    len += sprintf( msg + len, "%+d", at[i].charge );
                }
                if (at[i].radical)
                {
                    len += sprintf( msg + len, ",%s", at[i].radical == RADICAL_SINGLET ? "s" :
                                                      at[i].radical == RADICAL_DOUBLET ? "d" :
                                                      at[i].radical == RADICAL_TRIPLET ? "t" : "?" );
                }
                len += sprintf( msg + len, "(%d)", val );
                if (!bNoWarnings)
                {
                    WarningMessage( pStrErrStruct, msg );
                }
            }
        }
    }

    return num_found;
}
/****************************************************************************
  Check inp_ATOM's for unusual valence
****************************************************************************/
Check inp_ATOM's for unusual valence
Check inp_ATOM ' s for unusual valence
int OrigAtData_bCheckUnusualValences( ORIG_ATOM_DATA *orig_at_data,
                                      int bAddIsoH,
                                      char *pStrErrStruct,
                                      int bNoWarnings)
{
    int i, val, num_found = 0;
    char msg[32];
    int len, num_H;
    int already_here = ( orig_at_data && orig_at_data->num_inp_atoms > 0 );
    inp_ATOM *at = already_here ? orig_at_data->at : NULL;
    if (at)
    {
        for (i = 0, num_found = 0; i < orig_at_data->num_inp_atoms; i++)
        {
            num_H = bAddIsoH ? NUMH( at, i ) : at[i].num_H;
            val = detect_unusual_el_valence( at[i].el_number,
                                             at[i].charge,
                                             at[i].radical,
                                             at[i].chem_bonds_valence,
                                             num_H,
                                             at[i].valence );
            if (val)
            {
                num_found++;
                if (!bNoWarnings)
                {
                    WarningMessage( pStrErrStruct, "Accepted unusual valence(s):" );
                }
                len = sprintf( msg, "%s", at[i].elname );
                if (at[i].charge)
                {
                    len += sprintf( msg + len, "%+d", at[i].charge );
                }
                if (at[i].radical)
                {
                    len += sprintf( msg + len, ",%s", at[i].radical == RADICAL_SINGLET ? "s" :
                                                      at[i].radical == RADICAL_DOUBLET ? "d" :
                                                      at[i].radical == RADICAL_TRIPLET ? "t" : "?" );
                }
                len += sprintf( msg + len, "(%d)", val );
                if (!bNoWarnings)
                {
                    WarningMessage( pStrErrStruct, msg );
                }
            }
        }
    }
    return num_found;
}
int OrigAtData_bCheckUnusualValences ( ORIG_ATOM_DATA * orig_at_data , int bAddIsoH , char * pStrErrStruct , int bNoWarnings ) { int i , val , num_found = 0 ; char msg [ 32 ] ; int len , num_H ; int already_here = ( orig_at_data && orig_at_data -> num_inp_atoms > 0 ) ; inp_ATOM * at = already_here ? orig_at_data -> at : NULL ; if ( at ) { for ( i = 0 , num_found = 0 ; i < orig_at_data -> num_inp_atoms ; i ++ ) { num_H = bAddIsoH ? NUMH ( at , i ) : at [ i ] . num_H ; val = detect_unusual_el_valence ( at [ i ] . el_number , at [ i ] . charge , at [ i ] . radical , at [ i ] . chem_bonds_valence , num_H , at [ i ] . valence ) ; if ( val ) { num_found ++ ; if ( ! bNoWarnings ) { WarningMessage ( pStrErrStruct , " " ) ; } len = sprintf ( msg , " " , at [ i ] . elname ) ; if ( at [ i ] . charge ) { len += sprintf ( msg + len , " " , at [ i ] . charge ) ; } if ( at [ i ] . radical ) { len += sprintf ( msg + len , " " , at [ i ] . radical == RADICAL_SINGLET ? " " : at [ i ] . radical == RADICAL_DOUBLET ? " " : at [ i ] . radical == RADICAL_TRIPLET ? " " : " " ) ; } len += sprintf ( msg + len , " " , val ) ; if ( ! bNoWarnings ) { WarningMessage ( pStrErrStruct , msg ) ; } } } } return num_found ; }
Check inp_ATOM's for unusual valence
Check inp_ATOM ' s for unusual valence