Back to index

wims  3.65+svn20090927
Classes | Defines | Typedefs | Enumerations | Functions | Variables
checkmolc.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "safemem.h"

Go to the source code of this file.

Classes

struct  atom_rec
struct  bond_rec
struct  molstat_rec
struct  ringprop_rec
struct  p_3d
struct  connval_rec

Defines

#define version   "0.3p C"
#define max_ringpath_recursion_depth   500000
#define max_match_recursion_depth   500000
#define tweaklevel   2
#define max_atoms   1024
#define max_bonds   1024
#define slack   8192
#define max_ringsize   128
#define max_rings   1024
#define max_fg   256
#define max_neighbors   16 /* new in v0.2h */
#define TAB   '\t'
#define max_matchpath_length   256
#define pmCheckMol   1001
#define pmMatchMol   1002
#define rs_sar   2001 /* ring search mode: SAR = set of all rings */
#define rs_ssr   2002
#define btopo_any   0 /* bond topology, new in v0.3d */
#define btopo_ring   1
#define btopo_chain   2
#define btopo_always_any   3 /* even in "strict mode" */
#define btopo_excess_rc   4
#define btopo_exact_rc   5
#define bstereo_any   0
#define bstereo_xyz   1
#define bstereo_up   11 /* new in v0.3f, flags for single bonds */
#define bstereo_down   16
#define bstereo_either   14 /* 0.3x */
#define bstereo_double_either   13 /* 0.3x */
#define fpf_boolean   3001
#define fpf_decimal   3002
#define fp_blocksize   62
#define ssr_vringsize   12 /* v0.3n; max. ring size in SSR mode */
#define fg_cation   1
#define fg_anion   2
#define fg_carbonyl   3
#define fg_aldehyde   4
#define fg_ketone   5
#define fg_thiocarbonyl   6
#define fg_thioaldehyde   7
#define fg_thioketone   8
#define fg_imine   9
#define fg_hydrazone   10
#define fg_semicarbazone   11
#define fg_thiosemicarbazone   12
#define fg_oxime   13
#define fg_oxime_ether   14
#define fg_ketene   15
#define fg_ketene_acetal_deriv   16
#define fg_carbonyl_hydrate   17
#define fg_hemiacetal   18
#define fg_acetal   19
#define fg_hemiaminal   20
#define fg_aminal   21
#define fg_thiohemiaminal   22
#define fg_thioacetal   23
#define fg_enamine   24
#define fg_enol   25
#define fg_enolether   26
#define fg_hydroxy   27
#define fg_alcohol   28
#define fg_prim_alcohol   29
#define fg_sec_alcohol   30
#define fg_tert_alcohol   31
#define fg_1_2_diol   32
#define fg_1_2_aminoalcohol   33
#define fg_phenol   34
#define fg_1_2_diphenol   35
#define fg_enediol   36
#define fg_ether   37
#define fg_dialkylether   38
#define fg_alkylarylether   39
#define fg_diarylether   40
#define fg_thioether   41
#define fg_disulfide   42
#define fg_peroxide   43
#define fg_hydroperoxide   44
#define fg_hydrazine   45
#define fg_hydroxylamine   46
#define fg_amine   47
#define fg_prim_amine   48
#define fg_prim_aliph_amine   49
#define fg_prim_arom_amine   50
#define fg_sec_amine   51
#define fg_sec_aliph_amine   52
#define fg_sec_mixed_amine   53
#define fg_sec_arom_amine   54
#define fg_tert_amine   55
#define fg_tert_aliph_amine   56
#define fg_tert_mixed_amine   57
#define fg_tert_arom_amine   58
#define fg_quart_ammonium   59
#define fg_n_oxide   60
#define fg_halogen_deriv   61
#define fg_alkyl_halide   62
#define fg_alkyl_fluoride   63
#define fg_alkyl_chloride   64
#define fg_alkyl_bromide   65
#define fg_alkyl_iodide   66
#define fg_aryl_halide   67
#define fg_aryl_fluoride   68
#define fg_aryl_chloride   69
#define fg_aryl_bromide   70
#define fg_aryl_iodide   71
#define fg_organometallic   72
#define fg_organolithium   73
#define fg_organomagnesium   74
#define fg_carboxylic_acid_deriv   75
#define fg_carboxylic_acid   76
#define fg_carboxylic_acid_salt   77
#define fg_carboxylic_acid_ester   78
#define fg_lactone   79
#define fg_carboxylic_acid_amide   80
#define fg_carboxylic_acid_prim_amide   81
#define fg_carboxylic_acid_sec_amide   82
#define fg_carboxylic_acid_tert_amide   83
#define fg_lactam   84
#define fg_carboxylic_acid_hydrazide   85
#define fg_carboxylic_acid_azide   86
#define fg_hydroxamic_acid   87
#define fg_carboxylic_acid_amidine   88
#define fg_carboxylic_acid_amidrazone   89
#define fg_nitrile   90
#define fg_acyl_halide   91
#define fg_acyl_fluoride   92
#define fg_acyl_chloride   93
#define fg_acyl_bromide   94
#define fg_acyl_iodide   95
#define fg_acyl_cyanide   96
#define fg_imido_ester   97
#define fg_imidoyl_halide   98
#define fg_thiocarboxylic_acid_deriv   99
#define fg_thiocarboxylic_acid   100
#define fg_thiocarboxylic_acid_ester   101
#define fg_thiolactone   102
#define fg_thiocarboxylic_acid_amide   103
#define fg_thiolactam   104
#define fg_imido_thioester   105
#define fg_oxohetarene   106
#define fg_thioxohetarene   107
#define fg_iminohetarene   108
#define fg_orthocarboxylic_acid_deriv   109
#define fg_carboxylic_acid_orthoester   110
#define fg_carboxylic_acid_amide_acetal   111
#define fg_carboxylic_acid_anhydride   112
#define fg_carboxylic_acid_imide   113
#define fg_carboxylic_acid_unsubst_imide   114
#define fg_carboxylic_acid_subst_imide   115
#define fg_co2_deriv   116
#define fg_carbonic_acid_deriv   117
#define fg_carbonic_acid_monoester   118
#define fg_carbonic_acid_diester   119
#define fg_carbonic_acid_ester_halide   120
#define fg_thiocarbonic_acid_deriv   121
#define fg_thiocarbonic_acid_monoester   122
#define fg_thiocarbonic_acid_diester   123
#define fg_thiocarbonic_acid_ester_halide   124
#define fg_carbamic_acid_deriv   125
#define fg_carbamic_acid   126
#define fg_carbamic_acid_ester   127
#define fg_carbamic_acid_halide   128
#define fg_thiocarbamic_acid_deriv   129
#define fg_thiocarbamic_acid   130
#define fg_thiocarbamic_acid_ester   131
#define fg_thiocarbamic_acid_halide   132
#define fg_urea   133
#define fg_isourea   134
#define fg_thiourea   135
#define fg_isothiourea   136
#define fg_guanidine   137
#define fg_semicarbazide   138
#define fg_thiosemicarbazide   139
#define fg_azide   140
#define fg_azo_compound   141
#define fg_diazonium_salt   142
#define fg_isonitrile   143
#define fg_cyanate   144
#define fg_isocyanate   145
#define fg_thiocyanate   146
#define fg_isothiocyanate   147
#define fg_carbodiimide   148
#define fg_nitroso_compound   149
#define fg_nitro_compound   150
#define fg_nitrite   151
#define fg_nitrate   152
#define fg_sulfuric_acid_deriv   153
#define fg_sulfuric_acid   154
#define fg_sulfuric_acid_monoester   155
#define fg_sulfuric_acid_diester   156
#define fg_sulfuric_acid_amide_ester   157
#define fg_sulfuric_acid_amide   158
#define fg_sulfuric_acid_diamide   159
#define fg_sulfuryl_halide   160
#define fg_sulfonic_acid_deriv   161
#define fg_sulfonic_acid   162
#define fg_sulfonic_acid_ester   163
#define fg_sulfonamide   164
#define fg_sulfonyl_halide   165
#define fg_sulfone   166
#define fg_sulfoxide   167
#define fg_sulfinic_acid_deriv   168
#define fg_sulfinic_acid   169
#define fg_sulfinic_acid_ester   170
#define fg_sulfinic_acid_halide   171
#define fg_sulfinic_acid_amide   172
#define fg_sulfenic_acid_deriv   173
#define fg_sulfenic_acid   174
#define fg_sulfenic_acid_ester   175
#define fg_sulfenic_acid_halide   176
#define fg_sulfenic_acid_amide   177
#define fg_thiol   178
#define fg_alkylthiol   179
#define fg_arylthiol   180
#define fg_phosphoric_acid_deriv   181
#define fg_phosphoric_acid   182
#define fg_phosphoric_acid_ester   183
#define fg_phosphoric_acid_halide   184
#define fg_phosphoric_acid_amide   185
#define fg_thiophosphoric_acid_deriv   186
#define fg_thiophosphoric_acid   187
#define fg_thiophosphoric_acid_ester   188
#define fg_thiophosphoric_acid_halide   189
#define fg_thiophosphoric_acid_amide   190
#define fg_phosphonic_acid_deriv   191
#define fg_phosphonic_acid   192
#define fg_phosphonic_acid_ester   193
#define fg_phosphine   194
#define fg_phosphinoxide   195
#define fg_boronic_acid_deriv   196
#define fg_boronic_acid   197
#define fg_boronic_acid_ester   198
#define fg_alkene   199
#define fg_alkyne   200
#define fg_aromatic   201
#define fg_heterocycle   202
#define fg_alpha_aminoacid   203
#define fg_alpha_hydroxyacid   204
#define sc   ';'

Typedefs

typedef char str2 [3]
typedef char str3 [4]
typedef char str4 [5]
typedef char str5 [6]
typedef char str8 [9]
typedef struct atom_rec atom_rec
typedef struct bond_rec bond_rec
typedef int ringpath_type [max_ringsize]
typedef int matchpath_type [max_matchpath_length]
typedef atom_rec atomlist [max_atoms]
typedef bond_rec bondlist [max_bonds]
typedef ringpath_type ringlist [max_rings]
typedef int neighbor_rec [max_neighbors]
typedef boolean fglist [max_fg]
typedef char molbuftype [max_atoms+max_bonds+slack][256]
typedef boolean matchmatrix [max_neighbors][max_neighbors]
typedef struct molstat_rec molstat_rec
typedef struct ringprop_rec ringprop_rec
typedef ringprop_rec ringprop_type [max_rings]
typedef struct p_3d p_3d
typedef int chirpath_type [4]
typedef struct connval_rec connval_rec
typedef connval_rec connval_type [max_atoms]

Enumerations

enum  boolean { false = 0, true }

Functions

static boolean file_exists (const char *fileName)
static void lblank (int cols, char *nstr)
static double radtodeg (double rads)
static void strdelete (char *s, int pos, int len)
static int strpos2 (char *s, char *pat, int pos)
static char * strsub (char *ret, char *s, int pos, int len)
static void all_lowercase (char *astring)
static void init_globals ()
static void init_molstat (molstat_rec *mstat)
static void debugoutput (char *dstr)
static void left_trim (char *trimstr)
static int left_int (char *trimstr)
static int path_pos (int id, int *a_path)
static int path_length (int *a_path)
static int get_bond (int ba1, int ba2)
static void clear_atom_tags ()
static void set_atom_tags ()
static void order_ringpath (int *r_path)
static void clear_ndl_atom_tags ()
static void set_ndl_atom_tags ()
static int count_tagged_ndl_heavyatoms ()
static double dist3d (p_3d p1, p_3d p2)
static p_3d subtract_3d (p_3d p1, p_3d p2)
static p_3d add_3d (p_3d p1, p_3d p2)
static void vec2origin (p_3d *p1, p_3d *p2)
static double scalar_prod (p_3d p1, p_3d p2, p_3d p3)
static p_3d cross_prod (p_3d p1, p_3d p2, p_3d p3)
static double angle_3d (p_3d p1, p_3d p2, p_3d p3)
static double torsion (p_3d p1, p_3d p2, p_3d p3, p_3d p4)
static double ctorsion (p_3d p1, p_3d p2, p_3d p3, p_3d p4)
static boolean is_cis (p_3d p1, p_3d p2, p_3d p3, p_3d p4)
static void show_usage ()
static void list_molstat_codes ()
static void parse_args (int argc, char *argv[])
static char * get_filetype (char *Result, char *f)
static void zap_molecule ()
static void zap_needle ()
static void zap_tmp ()
static boolean is_heavyatom (int id)
static boolean ndl_alkene_C (int ba)
static boolean is_metal (int id)
static int get_nvalences (char *a_el)
static char * convert_type (char *Result, char *oldtype)
static char * convert_sybtype (char *Result, char *oldtype)
static char * convert_MDLtype (char *Result, char *oldtype)
static char * get_element (char *Result, char *oldtype)
static char * get_sybelement (char *Result, char *oldtype)
static char * get_MDLelement (char *Result, char *oldtype)
static void read_molfile (char *mfilename)
static void read_mol2file (char *mfilename)
static void read_charges (char *chgstring_)
static void read_isotopes (char *isotopestring_)
static void read_radicals (char *radstring_)
static void read_MDLmolfile (char *mfilename)
static void write_MDLmolfile ()
static boolean is_electroneg (char *a_el)
static void count_neighbors ()
static void get_neighbors (int *Result, int id)
static void get_ndl_neighbors (int *Result, int id)
static int * get_nextneighbors (int *Result, int id, int prev_id)
static int * get_ndl_nextneighbors (int *Result, int id, int prev_id)
static int matchpath_pos (int id, int *a_path)
static int matchpath_length (int *a_path)
static int get_ndl_bond (int ba1, int ba2)
static int ringcompare (int *rp1, int *rp2)
static boolean rc_identical (int rc_int)
static boolean rc_1in2 (int rc_int)
static boolean rc_2in1 (int rc_int)
static boolean rc_different (int rc_int)
static boolean rc_independent (int rc_int)
static boolean is_newring (int *n_path)
static void add_ring (int *n_path)
static boolean is_ringpath (int *s_path)
static boolean is_ringbond (int b_id)
static void chk_ringbonds ()
static int raw_hetbond_count (int a)
static int hetbond_count (int a)
static int hetatom_count (int a)
static int ndl_hetbond_count (int a)
static int ndl_hetatom_count (int a)
static boolean is_oxo_C (int id)
static boolean is_thioxo_C (int id)
static boolean is_imino_C (int id)
static boolean is_true_imino_C (int id)
static boolean is_true_exocyclic_imino_C (int id, int r_id)
static boolean is_exocyclic_imino_C (int id, int r_id)
static int find_exocyclic_methylene_C (int id, int r_id)
static boolean is_hydroxy (int a_view, int a_ref)
static boolean is_sulfanyl (int a_view, int a_ref)
static boolean is_amino (int a_view, int a_ref)
static boolean is_alkyl (int a_view, int a_ref)
static boolean is_true_alkyl (int a_view, int a_ref)
static boolean is_alkenyl (int a_view, int a_ref)
static boolean is_alkynyl (int a_view, int a_ref)
static boolean is_aryl (int a_view, int a_ref)
static boolean is_alkoxy (int a_view, int a_ref)
static boolean is_siloxy (int a_view, int a_ref)
static boolean is_true_alkoxy (int a_view, int a_ref)
static boolean is_aryloxy (int a_view, int a_ref)
static boolean is_alkenyloxy (int a_view, int a_ref)
static boolean is_alkynyloxy (int a_view, int a_ref)
static boolean is_alkylsulfanyl (int a_view, int a_ref)
static boolean is_true_alkylsulfanyl (int a_view, int a_ref)
static boolean is_arylsulfanyl (int a_view, int a_ref)
static boolean is_alkenylsulfanyl (int a_view, int a_ref)
static boolean is_alkynylsulfanyl (int a_view, int a_ref)
static boolean is_alkylamino (int a_view, int a_ref)
static boolean is_dialkylamino (int a_view, int a_ref)
static boolean is_arylamino (int a_view, int a_ref)
static boolean is_diarylamino (int a_view, int a_ref)
static boolean is_alkylarylamino (int a_view, int a_ref)
static boolean is_C_monosubst_amino (int a_view, int a_ref)
static boolean is_C_disubst_amino (int a_view, int a_ref)
static boolean is_subst_amino (int a_view, int a_ref)
static boolean is_true_alkylamino (int a_view, int a_ref)
static boolean is_true_dialkylamino (int a_view, int a_ref)
static boolean is_true_alkylarylamino (int a_view, int a_ref)
static boolean is_hydroxylamino (int a_view, int a_ref)
static boolean is_nitro (int a_view, int a_ref)
static boolean is_azido (int a_view, int a_ref)
static boolean is_diazonium (int a_view, int a_ref)
static boolean is_hydroximino_C (int id)
static boolean is_hydrazono_C (int id)
static boolean is_alkoxycarbonyl (int a_view, int a_ref)
static boolean is_aryloxycarbonyl (int a_view, int a_ref)
static boolean is_carbamoyl (int a_view, int a_ref)
static boolean is_alkoxythiocarbonyl (int a_view, int a_ref)
static boolean is_aryloxythiocarbonyl (int a_view, int a_ref)
static boolean is_thiocarbamoyl (int a_view, int a_ref)
static boolean is_alkanoyl (int a_view, int a_ref)
static boolean is_aroyl (int a_view, int a_ref)
static boolean is_acyl (int a_view, int a_ref)
static boolean is_acyl_gen (int a_view, int a_ref)
static boolean is_acylamino (int a_view, int a_ref)
static boolean is_subst_acylamino (int a_view, int a_ref)
static boolean is_hydrazino (int a_view, int a_ref)
static boolean is_nitroso (int a_view, int a_ref)
static boolean is_subst_hydrazino (int a_view, int a_ref)
static boolean is_cyano (int a_view, int a_ref)
static boolean is_cyano_c (int a_ref)
static boolean is_nitrile (int a_view, int a_ref)
static boolean is_isonitrile (int a_view, int a_ref)
static boolean is_cyanate (int a_view, int a_ref)
static boolean is_thiocyanate (int a_view, int a_ref)
static void update_Htotal ()
static void update_atypes ()
static void chk_arom ()
static void write_mol ()
static void write_needle_mol ()
static void chk_so2_deriv (int a_ref)
static void chk_p_deriv (int a_ref)
static void chk_b_deriv (int a_ref)
static void chk_ammon (int a_ref)
static void swap_atoms (int *a1, int *a2)
static void orient_bond (int *a1, int *a2)
static void chk_imine (int a_ref, int a_view)
static void chk_carbonyl_deriv (int a_view, int a_ref)
static void chk_carboxyl_deriv (int a_view, int a_ref)
static void chk_co2_sp2 (int a_view, int a_ref)
static void chk_co2_sp (int a_view, int a_ref)
static void chk_triple (int a1, int a2)
static void chk_ccx (int a_view, int a_ref)
static void chk_xccx (int a_view, int a_ref)
static void chk_n_o_dbl (int a1, int a2)
static void chk_sulfoxide (int a1, int a2)
static void chk_double (int a1, int a2)
static void chk_c_hal (int a1, int a2)
static void chk_c_o (int a1, int a2)
static void chk_c_s (int a1, int a2)
static void chk_c_n (int a1, int a2)
static void chk_c_c (int a1, int a2)
static void chk_x_y_single (int a_view, int a_ref)
static void chk_single (int a1, int a2)
static void chk_carbonyl_deriv_sp3 (int a_ref)
static void chk_carboxyl_deriv_sp3 (int a_ref)
static void chk_anhydride (int a_ref)
static void chk_imide (int a_ref)
static void chk_12diphenol (int a_view, int a_ref)
static void chk_arom_fg (int a1, int a2)
static boolean is_arene (int r_id)
static boolean is_heterocycle (int r_id)
static void chk_oxo_thioxo_imino_hetarene (int r_id)
static void chk_ion (int a_ref)
static void chk_functionalgroups ()
static void write_fg_text ()
static void write_fg_text_de ()
static void write_fg_code ()
static void write_fg_binary ()
static void write_fg_bitstring ()
static void readinputfile (char *molfilename)
static void copy_mol_to_needle ()
static void copy_mol_to_tmp ()
static void copy_tmp_to_mol ()
static void get_ringstat (int r_id)
static void get_molstat ()
static void fix_ssr_ringcounts ()
static void write_molstat ()
static void write_molstat_X ()
static int find_ndl_ref_atom ()
static void cv_init ()
static int cv_count ()
static int cv_iterate (int n_cv_prev)
static int find_ndl_ref_atom_cv ()
static boolean atomtypes_OK_strict (int ndl_a, int hst_a)
static boolean atomtypes_OK (int ndl_a, int hst_a)
static boolean bondtypes_OK_strict (int ndl_b, int hst_b)
static boolean bondtypes_OK (int ndl_b, int hst_b)
static boolean matrix_OK (boolean *m, int ndl_dim, int hst_dim)
static boolean is_flat (double angle_deg)
static boolean chirality_OK (int *ndl_cp, int *hst_cp)
static boolean ndl_maybe_chiral (int na)
static boolean is_matching (int *ndl_xmp, int *hst_xmp)
static boolean quick_match ()
static void perform_match ()
static void clear_rings ()
static int ring_lastpos (int *s)
static void remove_redundant_rings ()
static int count_aromatic_rings ()
static void chk_envelopes ()
static void update_ringcount ()
static boolean normalize_ionic_bonds ()
static void chk_wildcard_rings ()
int main (int argc, char *argv[])

Variables

static int progmode
static char progname [256]
static int i
static int li
static boolean opt_none
static boolean opt_verbose
static boolean opt_text
static boolean opt_text_de
static boolean opt_code
static boolean opt_bin
static boolean opt_bitstring
static boolean opt_stdin
static boolean opt_exact
static boolean opt_debug
static boolean opt_molout
static boolean opt_molstat
static boolean opt_molstat_X
static boolean opt_xmdlout
static boolean opt_strict
static boolean opt_metalrings
static boolean opt_geom
static boolean opt_chiral
static boolean opt_iso
static boolean opt_chg
static boolean opt_rad
static int opt_rs
static boolean opt_fp
static int fpformat
static char filetype [256]
static char molfilename [256]
static char ndl_molfilename [256]
static char molname [256]
static char ndl_molname [256]
static char tmp_molname [256]
static char molcomment [256]
static int n_atoms
static int n_bonds
static int n_rings
static int n_countablerings
static int n_cmrings
static int n_heavyatoms
static int n_heavybonds
static int ndl_n_atoms
static int ndl_n_bonds
static int ndl_n_rings
static int ndl_n_heavyatoms
static int ndl_n_heavybonds
static boolean found_arominfo
static boolean found_querymol
static boolean ndl_querymol
static int tmp_n_atoms
static int tmp_n_bonds
static int tmp_n_rings
static int tmp_n_heavyatoms
static int tmp_n_heavybonds
static atom_recatom
static bond_recbond
static ringpath_typering
static ringprop_recringprop
static atom_recndl_atom
static bond_recndl_bond
static ringpath_typendl_ring
static ringprop_recndl_ringprop
static int ndl_ref_atom
static atom_rectmp_atom
static bond_rectmp_bond
static ringpath_typetmp_ring
static ringprop_rectmp_ringprop
static boolean matchresult
static boolean matchsummary
static matchpath_type ndl_matchpath
static matchpath_type hst_matchpath
static fglist fg
static str4 atomtype
static str3 newatomtype
static char(* molbuf )[256]
static int molbufindex
static boolean mol_in_queue
static int mol_count
static molstat_rec molstat
static molstat_rec ndl_molstat
static molstat_rec tmp_molstat
static int ringsearch_mode
static int max_vringsize
static FILE * rfile
static boolean rfile_is_open
static boolean mol_OK
static int n_ar
static int prev_n_ar
static boolean ez_search
static boolean rs_search
static boolean ez_flag
static boolean chir_flag
static boolean rs_strict
static int n_Ctot
static int n_Otot
static int n_Ntot
static int ndl_n_Ctot
static int ndl_n_Otot
static int ndl_n_Ntot
static int tmp_n_Ctot
static int tmp_n_Otot
static int tmp_n_Ntot
static boolean ether_generic
static boolean amine_generic
static boolean hydroxy_generic
static connval_reccv
static long long fpdecimal
static long long fpincrement
static int fpindex
static boolean fp_exacthit
static boolean fp_exactblock
static int tmfcode
static boolean tmfmismatch
static boolean auto_ssr
static int recursion_depth

Class Documentation

struct atom_rec

Definition at line 604 of file checkmolc.c.

Class Members
boolean arom
str3 atype
str2 element
int formal_charge
boolean heavy
int Hexp
int Htot
boolean metal
int neighbor_count
int nucleon_number
int nvalences
boolean q_arom
int radical_type
float real_charge
int ring_count
boolean stereo_care
boolean tag
float x
float y
float z
struct bond_rec

Definition at line 624 of file checkmolc.c.

Class Members
int a1
int a2
boolean arom
char btype
int mdl_stereo
boolean q_arom
int ring_count
int stereo
int topo
struct molstat_rec

Definition at line 650 of file checkmolc.c.

Class Members
int n_B
int n_b1
int n_b2
int n_b3
int n_bar
int n_Br
int n_br2p
int n_C
int n_C1
int n_C1O
int n_C2
int n_C2O
int n_CHB1p
int n_CHB2p
int n_CHB3p
int n_CHB4
int n_chg
int n_Cl
int n_CN
int n_F
int n_I
int n_iso
int n_Met
int n_N1
int n_N2
int n_N3
int n_O2
int n_O3
int n_P
int n_psg01
int n_psg02
int n_psg13
int n_psg14
int n_psg15
int n_psg16
int n_psg17
int n_psg18
int n_psla
int n_pstm
int n_QA
int n_QB
int n_r10
int n_r11
int n_r12
int n_r13p
int n_r3
int n_r4
int n_r5
int n_r6
int n_r7
int n_r8
int n_r9
int n_rad
int n_rAr
int n_rBz
int n_rN
int n_rN1
int n_rN2
int n_rN3p
int n_rO
int n_rO1
int n_rO2p
int n_rS
int n_rX
int n_S
int n_SeTe
int n_X
int n_XY
struct ringprop_rec

Definition at line 696 of file checkmolc.c.

Class Members
boolean arom
boolean envelope
int size
struct p_3d

Definition at line 705 of file checkmolc.c.

Class Members
double x
double y
double z
struct connval_rec

Definition at line 717 of file checkmolc.c.

Class Members
int def
int tmp

Define Documentation

Definition at line 367 of file checkmolc.c.

#define bstereo_double_either   13 /* 0.3x */

Definition at line 374 of file checkmolc.c.

#define bstereo_down   16

Definition at line 372 of file checkmolc.c.

#define bstereo_either   14 /* 0.3x */

Definition at line 373 of file checkmolc.c.

#define bstereo_up   11 /* new in v0.3f, flags for single bonds */

Definition at line 371 of file checkmolc.c.

Definition at line 369 of file checkmolc.c.

#define btopo_always_any   3 /* even in "strict mode" */

Definition at line 359 of file checkmolc.c.

#define btopo_any   0 /* bond topology, new in v0.3d */

Definition at line 356 of file checkmolc.c.

Definition at line 358 of file checkmolc.c.

Definition at line 364 of file checkmolc.c.

Definition at line 360 of file checkmolc.c.

#define btopo_ring   1

Definition at line 357 of file checkmolc.c.

Definition at line 417 of file checkmolc.c.

#define fg_1_2_diol   32

Definition at line 416 of file checkmolc.c.

Definition at line 419 of file checkmolc.c.

#define fg_acetal   19

Definition at line 403 of file checkmolc.c.

Definition at line 478 of file checkmolc.c.

Definition at line 477 of file checkmolc.c.

Definition at line 480 of file checkmolc.c.

Definition at line 476 of file checkmolc.c.

Definition at line 475 of file checkmolc.c.

Definition at line 479 of file checkmolc.c.

#define fg_alcohol   28

Definition at line 412 of file checkmolc.c.

Definition at line 388 of file checkmolc.c.

#define fg_alkene   199

Definition at line 583 of file checkmolc.c.

Definition at line 449 of file checkmolc.c.

Definition at line 448 of file checkmolc.c.

Definition at line 447 of file checkmolc.c.

Definition at line 446 of file checkmolc.c.

Definition at line 450 of file checkmolc.c.

Definition at line 423 of file checkmolc.c.

#define fg_alkylthiol   179

Definition at line 563 of file checkmolc.c.

#define fg_alkyne   200

Definition at line 584 of file checkmolc.c.

Definition at line 587 of file checkmolc.c.

Definition at line 588 of file checkmolc.c.

#define fg_aminal   21

Definition at line 405 of file checkmolc.c.

#define fg_amine   47

Definition at line 431 of file checkmolc.c.

#define fg_anion   2

Definition at line 386 of file checkmolc.c.

#define fg_aromatic   201

Definition at line 585 of file checkmolc.c.

Definition at line 454 of file checkmolc.c.

Definition at line 453 of file checkmolc.c.

Definition at line 452 of file checkmolc.c.

Definition at line 451 of file checkmolc.c.

Definition at line 455 of file checkmolc.c.

#define fg_arylthiol   180

Definition at line 564 of file checkmolc.c.

#define fg_azide   140

Definition at line 524 of file checkmolc.c.

Definition at line 525 of file checkmolc.c.

Definition at line 581 of file checkmolc.c.

Definition at line 580 of file checkmolc.c.

Definition at line 582 of file checkmolc.c.

Definition at line 510 of file checkmolc.c.

Definition at line 509 of file checkmolc.c.

Definition at line 511 of file checkmolc.c.

Definition at line 512 of file checkmolc.c.

Definition at line 532 of file checkmolc.c.

Definition at line 501 of file checkmolc.c.

Definition at line 503 of file checkmolc.c.

Definition at line 504 of file checkmolc.c.

Definition at line 502 of file checkmolc.c.

Definition at line 387 of file checkmolc.c.

Definition at line 401 of file checkmolc.c.

Definition at line 460 of file checkmolc.c.

Definition at line 464 of file checkmolc.c.

Definition at line 495 of file checkmolc.c.

Definition at line 472 of file checkmolc.c.

Definition at line 473 of file checkmolc.c.

Definition at line 496 of file checkmolc.c.

Definition at line 470 of file checkmolc.c.

Definition at line 459 of file checkmolc.c.

Definition at line 462 of file checkmolc.c.

Definition at line 469 of file checkmolc.c.

Definition at line 497 of file checkmolc.c.

Definition at line 494 of file checkmolc.c.

Definition at line 465 of file checkmolc.c.

Definition at line 461 of file checkmolc.c.

Definition at line 466 of file checkmolc.c.

Definition at line 499 of file checkmolc.c.

Definition at line 467 of file checkmolc.c.

Definition at line 498 of file checkmolc.c.

#define fg_cation   1

Definition at line 385 of file checkmolc.c.

#define fg_co2_deriv   116

Definition at line 500 of file checkmolc.c.

#define fg_cyanate   144

Definition at line 528 of file checkmolc.c.

Definition at line 422 of file checkmolc.c.

Definition at line 424 of file checkmolc.c.

Definition at line 526 of file checkmolc.c.

#define fg_disulfide   42

Definition at line 426 of file checkmolc.c.

#define fg_enamine   24

Definition at line 408 of file checkmolc.c.

#define fg_enediol   36

Definition at line 420 of file checkmolc.c.

#define fg_enol   25

Definition at line 409 of file checkmolc.c.

#define fg_enolether   26

Definition at line 410 of file checkmolc.c.

#define fg_ether   37

Definition at line 421 of file checkmolc.c.

#define fg_guanidine   137

Definition at line 521 of file checkmolc.c.

Definition at line 445 of file checkmolc.c.

Definition at line 402 of file checkmolc.c.

Definition at line 404 of file checkmolc.c.

Definition at line 586 of file checkmolc.c.

#define fg_hydrazine   45

Definition at line 429 of file checkmolc.c.

#define fg_hydrazone   10

Definition at line 394 of file checkmolc.c.

Definition at line 428 of file checkmolc.c.

Definition at line 471 of file checkmolc.c.

#define fg_hydroxy   27

Definition at line 411 of file checkmolc.c.

Definition at line 430 of file checkmolc.c.

Definition at line 481 of file checkmolc.c.

Definition at line 489 of file checkmolc.c.

Definition at line 482 of file checkmolc.c.

#define fg_imine   9

Definition at line 393 of file checkmolc.c.

Definition at line 492 of file checkmolc.c.

#define fg_isocyanate   145

Definition at line 529 of file checkmolc.c.

#define fg_isonitrile   143

Definition at line 527 of file checkmolc.c.

Definition at line 531 of file checkmolc.c.

Definition at line 520 of file checkmolc.c.

#define fg_isourea   134

Definition at line 518 of file checkmolc.c.

#define fg_ketene   15

Definition at line 399 of file checkmolc.c.

Definition at line 400 of file checkmolc.c.

#define fg_ketone   5

Definition at line 389 of file checkmolc.c.

#define fg_lactam   84

Definition at line 468 of file checkmolc.c.

#define fg_lactone   79

Definition at line 463 of file checkmolc.c.

#define fg_n_oxide   60

Definition at line 444 of file checkmolc.c.

#define fg_nitrate   152

Definition at line 536 of file checkmolc.c.

#define fg_nitrile   90

Definition at line 474 of file checkmolc.c.

#define fg_nitrite   151

Definition at line 535 of file checkmolc.c.

Definition at line 534 of file checkmolc.c.

Definition at line 533 of file checkmolc.c.

Definition at line 457 of file checkmolc.c.

Definition at line 458 of file checkmolc.c.

Definition at line 456 of file checkmolc.c.

Definition at line 493 of file checkmolc.c.

#define fg_oxime   13

Definition at line 397 of file checkmolc.c.

Definition at line 398 of file checkmolc.c.

Definition at line 490 of file checkmolc.c.

#define fg_peroxide   43

Definition at line 427 of file checkmolc.c.

#define fg_phenol   34

Definition at line 418 of file checkmolc.c.

#define fg_phosphine   194

Definition at line 578 of file checkmolc.c.

Definition at line 579 of file checkmolc.c.

Definition at line 576 of file checkmolc.c.

Definition at line 575 of file checkmolc.c.

Definition at line 577 of file checkmolc.c.

Definition at line 566 of file checkmolc.c.

Definition at line 569 of file checkmolc.c.

Definition at line 565 of file checkmolc.c.

Definition at line 567 of file checkmolc.c.

Definition at line 568 of file checkmolc.c.

Definition at line 413 of file checkmolc.c.

Definition at line 433 of file checkmolc.c.

Definition at line 432 of file checkmolc.c.

Definition at line 434 of file checkmolc.c.

Definition at line 443 of file checkmolc.c.

Definition at line 414 of file checkmolc.c.

Definition at line 436 of file checkmolc.c.

#define fg_sec_amine   51

Definition at line 435 of file checkmolc.c.

Definition at line 438 of file checkmolc.c.

Definition at line 437 of file checkmolc.c.

Definition at line 522 of file checkmolc.c.

Definition at line 395 of file checkmolc.c.

Definition at line 558 of file checkmolc.c.

Definition at line 561 of file checkmolc.c.

Definition at line 557 of file checkmolc.c.

Definition at line 559 of file checkmolc.c.

Definition at line 560 of file checkmolc.c.

Definition at line 553 of file checkmolc.c.

Definition at line 556 of file checkmolc.c.

Definition at line 552 of file checkmolc.c.

Definition at line 554 of file checkmolc.c.

Definition at line 555 of file checkmolc.c.

Definition at line 548 of file checkmolc.c.

#define fg_sulfone   166

Definition at line 550 of file checkmolc.c.

Definition at line 546 of file checkmolc.c.

Definition at line 545 of file checkmolc.c.

Definition at line 547 of file checkmolc.c.

Definition at line 549 of file checkmolc.c.

#define fg_sulfoxide   167

Definition at line 551 of file checkmolc.c.

Definition at line 538 of file checkmolc.c.

Definition at line 542 of file checkmolc.c.

Definition at line 541 of file checkmolc.c.

Definition at line 537 of file checkmolc.c.

Definition at line 543 of file checkmolc.c.

Definition at line 540 of file checkmolc.c.

Definition at line 539 of file checkmolc.c.

Definition at line 544 of file checkmolc.c.

Definition at line 415 of file checkmolc.c.

Definition at line 440 of file checkmolc.c.

Definition at line 439 of file checkmolc.c.

Definition at line 442 of file checkmolc.c.

Definition at line 441 of file checkmolc.c.

Definition at line 407 of file checkmolc.c.

Definition at line 391 of file checkmolc.c.

Definition at line 514 of file checkmolc.c.

Definition at line 513 of file checkmolc.c.

Definition at line 515 of file checkmolc.c.

Definition at line 516 of file checkmolc.c.

Definition at line 505 of file checkmolc.c.

Definition at line 507 of file checkmolc.c.

Definition at line 508 of file checkmolc.c.

Definition at line 506 of file checkmolc.c.

Definition at line 390 of file checkmolc.c.

Definition at line 484 of file checkmolc.c.

Definition at line 487 of file checkmolc.c.

Definition at line 483 of file checkmolc.c.

Definition at line 485 of file checkmolc.c.

Definition at line 530 of file checkmolc.c.

#define fg_thioether   41

Definition at line 425 of file checkmolc.c.

Definition at line 406 of file checkmolc.c.

Definition at line 392 of file checkmolc.c.

#define fg_thiol   178

Definition at line 562 of file checkmolc.c.

#define fg_thiolactam   104

Definition at line 488 of file checkmolc.c.

Definition at line 486 of file checkmolc.c.

Definition at line 571 of file checkmolc.c.

Definition at line 574 of file checkmolc.c.

Definition at line 570 of file checkmolc.c.

Definition at line 572 of file checkmolc.c.

Definition at line 573 of file checkmolc.c.

Definition at line 523 of file checkmolc.c.

Definition at line 396 of file checkmolc.c.

#define fg_thiourea   135

Definition at line 519 of file checkmolc.c.

Definition at line 491 of file checkmolc.c.

#define fg_urea   133

Definition at line 517 of file checkmolc.c.

#define fp_blocksize   62

Definition at line 380 of file checkmolc.c.

#define fpf_boolean   3001

Definition at line 376 of file checkmolc.c.

#define fpf_decimal   3002

Definition at line 378 of file checkmolc.c.

#define max_atoms   1024

Definition at line 338 of file checkmolc.c.

#define max_bonds   1024

Definition at line 339 of file checkmolc.c.

#define max_fg   256

Definition at line 343 of file checkmolc.c.

Definition at line 334 of file checkmolc.c.

Definition at line 348 of file checkmolc.c.

#define max_neighbors   16 /* new in v0.2h */

Definition at line 344 of file checkmolc.c.

Definition at line 331 of file checkmolc.c.

#define max_rings   1024

Definition at line 342 of file checkmolc.c.

#define max_ringsize   128

Definition at line 341 of file checkmolc.c.

#define pmCheckMol   1001

Definition at line 349 of file checkmolc.c.

#define pmMatchMol   1002

Definition at line 350 of file checkmolc.c.

#define rs_sar   2001 /* ring search mode: SAR = set of all rings */

Definition at line 352 of file checkmolc.c.

#define rs_ssr   2002

Definition at line 353 of file checkmolc.c.

#define sc   ';'

Definition at line 10158 of file checkmolc.c.

#define slack   8192

Definition at line 340 of file checkmolc.c.

#define ssr_vringsize   12 /* v0.3n; max. ring size in SSR mode */

Definition at line 382 of file checkmolc.c.

#define TAB   '\t'

Definition at line 346 of file checkmolc.c.

#define tweaklevel   2

Definition at line 336 of file checkmolc.c.

#define version   "0.3p C"

Definition at line 325 of file checkmolc.c.


Typedef Documentation

typedef struct atom_rec atom_rec

Definition at line 639 of file checkmolc.c.

typedef struct bond_rec bond_rec

Definition at line 640 of file checkmolc.c.

typedef int chirpath_type[4]

Definition at line 711 of file checkmolc.c.

typedef struct connval_rec connval_rec

Definition at line 724 of file checkmolc.c.

typedef boolean fglist[max_fg]

Definition at line 643 of file checkmolc.c.

Definition at line 647 of file checkmolc.c.

Definition at line 637 of file checkmolc.c.

typedef char molbuftype[max_atoms+max_bonds+slack][256]

Definition at line 645 of file checkmolc.c.

typedef struct molstat_rec molstat_rec

Definition at line 642 of file checkmolc.c.

typedef struct p_3d p_3d

Definition at line 641 of file checkmolc.c.

Definition at line 636 of file checkmolc.c.

typedef struct ringprop_rec ringprop_rec

Definition at line 703 of file checkmolc.c.

typedef char str2[3]

Definition at line 594 of file checkmolc.c.

typedef char str3[4]

Definition at line 596 of file checkmolc.c.

typedef char str4[5]

Definition at line 598 of file checkmolc.c.

typedef char str5[6]

Definition at line 600 of file checkmolc.c.

typedef char str8[9]

Definition at line 602 of file checkmolc.c.


Enumeration Type Documentation

enum boolean
Enumerator:
false 
true 

Definition at line 590 of file checkmolc.c.

{ false = 0, true } boolean;

Function Documentation

static p_3d add_3d ( p_3d  p1,
p_3d  p2 
) [static]

Definition at line 1314 of file checkmolc.c.

{
  p_3d p;

  p.x = p1.x + p2.x;
  p.y = p1.y + p2.y;
  p.z = p1.z + p2.z;
  return p;
}

Here is the caller graph for this function:

static void add_ring ( int *  n_path) [static]

Definition at line 4087 of file checkmolc.c.

{
  /* new in v0.3: store rings in an ordered way (with ascending ring size) */
  int i;
  int j = 0;
  int k, s, pl;
/* p2c: checkmol.pas, line 2862:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  char dstr[256];
  int FORLIM;

  /*$ENDIF */
  pl = path_length (n_path);

  if (pl < 1)
    return;

  if (n_rings >= max_rings)
    {

/* p2c: checkmol.pas, line 2906:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
      /*$IFDEF debug 
         debugoutput ("max_rings exceeded!");
         /*$ENDIF */
      return;
    }
  n_rings++;

/* p2c: checkmol.pas, line 2871:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  /* dstr := '';
     for j := 1 to pl do dstr := dstr + inttostr((n_path[j])) + ' ';
     debugoutput('adding ring '+inttostr(n_rings)+':  '+dstr); */
  /*$ENDIF */
  if (n_rings > 1)
    {
      FORLIM = n_rings;
      for (i = 1; i < FORLIM; i++)
       {
         s = ringprop[i - 1].size;
         if (pl >= s)
           j = i;
       }
    }
  j++;                      /* the next position is ours */
  if (j < n_rings)
    {                       /* push up the remaining rings by one position */
      for (k = n_rings; k > j; k--)
       {
         ringprop[k - 1].size = ringprop[k - 2].size;
         /*ringprop^[k].arom := ringprop^[(k-1)].arom; */
         for (i = 0; i < max_ringsize; i++)
           ring[k - 1][i] = ring[k - 2][i];
       }
    }
  ringprop[j - 1].size = pl;
  for (i = 0; i < max_ringsize; i++)
    {
      ring[j - 1][i] = n_path[i];
      /*inc(atom^[(n_path[i])].ring_count); */
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void all_lowercase ( char *  astring) [inline, static]

Definition at line 942 of file checkmolc.c.

{
  int i;
  int l = strlen (astring);

  for (i = 0; i < l; i++)
    {
      astring[i] = tolower (astring[i]);
    }
}

Here is the caller graph for this function:

static double angle_3d ( p_3d  p1,
p_3d  p2,
p_3d  p3 
) [static]

Definition at line 1378 of file checkmolc.c.

{
  p_3d lp1, lp2, lp3, p;
  double res = 0.0;
  double magn_1, magn_2, cos_phi;

  lp1 = p1;
  lp2 = p2;
  lp3 = p3;
  p = subtract_3d (lp2, lp1);
  lp2 = p;
  p = subtract_3d (lp3, lp1);
  lp3 = p;
  lp1.x = 0.0;
  lp1.y = 0.0;
  lp1.z = 0.0;
  magn_1 = dist3d (lp1, lp2);
  magn_2 = dist3d (lp1, lp3);
  if (magn_1 * magn_2 == 0) /* emergency exit */
    return M_PI;
  cos_phi = scalar_prod (lp1, lp2, lp3) / (magn_1 * magn_2);
  if (cos_phi < -1)
    cos_phi = -1.0;
  if (cos_phi > 1)
    cos_phi = 1.0;
  res = acos (cos_phi);
  return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static boolean atomtypes_OK ( int  ndl_a,
int  hst_a 
) [static]

Definition at line 12341 of file checkmolc.c.

{
  str2 ndl_el, hst_el;
  int ndl_nbc, hst_nbc, ndl_Hexp, hst_Htot;
  boolean res = false;

  if (ndl_a < 1 || ndl_a > ndl_n_atoms || hst_a < 1 || hst_a > n_atoms)
    return false;
  /* check for opposite charges;  v0.3l, refined in v0.3o, 0.3x */
  /* except in strict mode, matching pairs of charged+uncharged atoms  */
  /* are tolerated (this is a feature, not a bug) */
  if (opt_chg)
    {
      if (ndl_atom[ndl_a - 1].formal_charge != atom[hst_a - 1].formal_charge)
       return false;
    }
//  else
//    {
//      if (ndl_atom[ndl_a - 1].formal_charge != 0 &&
//        atom[hst_a - 1].formal_charge != 0 &&
//        ndl_atom[ndl_a - 1].formal_charge != atom[hst_a - 1].formal_charge)
//      return false;
//    }
//
//  /* v0.3x: isotopes must be the same */
  if (opt_iso)
    {
      if (ndl_atom[ndl_a - 1].nucleon_number !=
         atom[hst_a - 1].nucleon_number)
       return false;
    }
//  else
//    {
//      if (ndl_atom[ndl_a - 1].nucleon_number != 0 &&
//        atom[hst_a - 1].nucleon_number != 0 &&
//        ndl_atom[ndl_a - 1].nucleon_number !=
//        atom[hst_a - 1].nucleon_number)
//      return false;
//    }
//
//  /* v0.3x: radicals must be the same */
  if (opt_rad)
    {
      if (ndl_atom[ndl_a - 1].radical_type != atom[hst_a - 1].radical_type)
       return false;
    }
//  else
//    {
//      if (ndl_atom[ndl_a - 1].radical_type != 0 &&
//        atom[hst_a - 1].radical_type != 0 &&
//        ndl_atom[ndl_a - 1].radical_type != atom[hst_a - 1].radical_type)
//      return false;
//    }

  /* in exact mode, check if (disconnected) fragment is already tagged; v0.3o */
  if (opt_exact && atom[hst_a - 1].tag == true)
    {
/* p2c: checkmol.pas, line 8899:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
      /*$IFDEF debug */
      /* debugoutput('fragmnet already tagged at '+inttostr(hst_a)); */
      /*$ENDIF */
      return false;
    }
  if (opt_strict)           /* new in v0.2f */
    return (atomtypes_OK_strict (ndl_a, hst_a));
  strcpy (ndl_el, ndl_atom[ndl_a - 1].element);
  ndl_nbc = ndl_atom[ndl_a - 1].neighbor_count;
  ndl_Hexp = ndl_atom[ndl_a - 1].Hexp;
  strcpy (hst_el, atom[hst_a - 1].element);
  hst_nbc = atom[hst_a - 1].neighbor_count;
  hst_Htot = atom[hst_a - 1].Htot;
  if (!strcmp (ndl_el, hst_el))    /* very simplified... */
    res = true;
  if (!strcmp (ndl_el, "A ") && atom[hst_a - 1].heavy)
    res = true;
  if (!strcmp (ndl_el, "Q "))
    {
      if (atom[hst_a - 1].heavy && strcmp (hst_el, "C "))
       res = true;
    }
  if (!strcmp (ndl_el, "X "))
    {
      if (!strcmp (hst_el, "F ") || !strcmp (hst_el, "CL") ||
         !strcmp (hst_el, "BR") || !strcmp (hst_el, "I ")
         || !strcmp (hst_el, "AT"))
       res = true;
    }
  /* v0.3o: in exact mode, check for identical neighbor_count */
  if (opt_exact)
    {
      if (ndl_nbc != hst_nbc)
       {
         res = false;
/* p2c: checkmol.pas, line 8934:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
         /*$IFDEF debug */
         //debugoutput
         //  ("exact match failed: different number of neighbor atoms");
         /*$ENDIF */
       }
    }
  /* if needle atom has more substituents than haystack atom ==> no match */
  if (ndl_nbc > hst_nbc)
    res = false;
  /* check for explicit hydrogens */
  if (ndl_Hexp > hst_Htot)
    res = false;
/* p2c: checkmol.pas, line 8943:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  /* if res then debugoutput('atom types OK ('+inttostr(ndl_a)+'/'+inttostr(hst_a)+')')
     else debugoutput('atom types not OK ('+inttostr(ndl_a)+'/'+inttostr(hst_a)+')'); */
  /*$ENDIF */
  return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static boolean atomtypes_OK_strict ( int  ndl_a,
int  hst_a 
) [static]

Definition at line 12259 of file checkmolc.c.

{
  /* new in v0.2f */
  str2 ndl_el;
  str3 ndl_atype;
  str2 hst_el;
  str3 hst_atype;
  int ndl_nbc, hst_nbc, ndl_Hexp, hst_Htot;
  boolean res = false;

  strcpy (ndl_el, ndl_atom[ndl_a - 1].element);
  strcpy (ndl_atype, ndl_atom[ndl_a - 1].atype);
  ndl_nbc = ndl_atom[ndl_a - 1].neighbor_count;
  ndl_Hexp = ndl_atom[ndl_a - 1].Hexp;
  strcpy (hst_el, atom[hst_a - 1].element);
  strcpy (hst_atype, atom[hst_a - 1].atype);
  hst_nbc = atom[hst_a - 1].neighbor_count;
  hst_Htot = atom[hst_a - 1].Htot;
  /* v0.3o: formal charges must be the same */

  if (ndl_atom[ndl_a - 1].formal_charge != atom[hst_a - 1].formal_charge)
    return false;

  /* v0.3x: isotope nucleon numbers must be the same */

  if (ndl_atom[ndl_a - 1].nucleon_number != atom[hst_a - 1].nucleon_number)
    return false;

  /* v0.3x: radicals must be the same */

  if (ndl_atom[ndl_a - 1].radical_type != atom[hst_a - 1].radical_type)
    return false;

  if (!strcmp (ndl_atype, hst_atype))
    res = true;
  else
    {
      if (!strcmp (ndl_el, hst_el) && ndl_atom[ndl_a - 1].arom &&
         atom[hst_a - 1].arom)
       res = true;
      if (ndl_querymol
         && (ndl_atom[ndl_a - 1].q_arom && atom[hst_a - 1].arom))
       res = true;          /* 0.3 p */
    }
  if (!strcmp (ndl_el, "A ") && atom[hst_a - 1].heavy)
    res = true;
  if (!strcmp (ndl_el, "Q "))
    {
      if (atom[hst_a - 1].heavy && strcmp (hst_el, "C "))
       res = true;
    }
  if (!strcmp (ndl_el, "X "))
    {
      if (!strcmp (hst_el, "F ") || !strcmp (hst_el, "CL") ||
         !strcmp (hst_el, "BR") || !strcmp (hst_el, "I ")
         || !strcmp (hst_el, "AT"))
       res = true;
    }
  /* if needle atom has more substituents than haystack atom ==> no match */
  if (ndl_nbc > hst_nbc)
    res = false;
  /* check for explicit hydrogens */
  if (ndl_Hexp > hst_Htot)
    res = false;
/* p2c: checkmol.pas, line 8859:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  /* if res then debugoutput('atom types OK ('+inttostr(ndl_a)+'/'+inttostr(hst_a)+')')
     else debugoutput('atom types not OK ('+inttostr(ndl_a)+':'+ndl_atype+'/'+inttostr(hst_a)+':'+hst_atype+')'); */
  /*$ENDIF */
  /* new in v0.3m: in "fingerprint mode", also query atom symbols must match */
  if (opt_fp)
    {
      if (strcmp (ndl_el, hst_el))
       res = false;
    }
  return res;
}

Here is the caller graph for this function:

static boolean bondtypes_OK ( int  ndl_b,
int  hst_b 
) [static]

Definition at line 12564 of file checkmolc.c.

{
  boolean ndl_arom, hst_arom;
  char ndl_btype, hst_btype;
  int ndl_rc;               /* new in v0.3d */
  int hst_rc;               /* new in v0.3d */
  int ndl_btopo;            /* new in v0.3d */
  boolean res = false;
/* p2c: checkmol.pas, line 9032:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  char na[256], ha[256];
  char tstr[256];
  /*$ENDIF */
  int a1, a2;
  str2 a1_el, a2_el;

  if (ndl_b < 1 || ndl_b > ndl_n_bonds || hst_b < 1 || hst_b > n_bonds)
    return false;
  if (opt_strict)           /* new in v0.2f */
    return (bondtypes_OK_strict (ndl_b, hst_b));
/* p2c: checkmol.pas, line 9051:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  *tstr = '\0';                    /* for debug purposes only */
  /*$ENDIF */
  ndl_arom = ndl_bond[ndl_b - 1].arom;
  ndl_btype = ndl_bond[ndl_b - 1].btype;
  hst_arom = bond[hst_b - 1].arom;
  hst_btype = bond[hst_b - 1].btype;
  ndl_rc = ndl_bond[ndl_b - 1].ring_count;
  hst_rc = bond[hst_b - 1].ring_count;
  ndl_btopo = ndl_bond[ndl_b - 1].topo;
/* p2c: checkmol.pas, line 9061:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  //if (ndl_arom)
//    strcpy (na, "(ar)");
//  else
//    *na = '\0';
//  if (hst_arom)
//    strcpy (ha, "(ar)");
//  else
//    *ha = '\0';
  /*$ENDIF */
  if (ndl_arom == true && hst_arom == true)
    res = true;
  if (ndl_arom == false && hst_arom == false)
    {
      if (ndl_btype == hst_btype)
       res = true;
      if (ndl_btype == 'l' && (hst_btype == 'S' || hst_btype == 'D'))
       res = true;
      if (ndl_btype == 's' && hst_btype == 'S')
       res = true;
      if (ndl_btype == 'd' && hst_btype == 'D')
       res = true;
    }
  /* a little exception: */
  if (ndl_arom == false && hst_arom == true)
    {
      if (ndl_btype == 'A')
       res = true;
      if (ndl_btype == 's' || ndl_btype == 'd')
       res = true;
      if (ndl_btype == 'D')
       {                    /* added in 0.2d: do not accept C=O etc. as C-O/arom */
         a1 = ndl_bond[ndl_b - 1].a1;
         a2 = ndl_bond[ndl_b - 1].a2;
         strcpy (a1_el, ndl_atom[a1 - 1].element);
         strcpy (a2_el, ndl_atom[a2 - 1].element);
         if (strcmp (a1_el, "O ") && strcmp (a2_el, "O ")
             && strcmp (a1_el, "S ") && strcmp (a2_el, "S ")
             && strcmp (a1_el, "SE") && strcmp (a2_el, "SE")
             && strcmp (a1_el, "TE") && strcmp (a2_el, "TE"))
           res = true;
       }
      if (ndl_bond[ndl_b - 1].q_arom)
       res = true;          /* 0.3p */
    }
  if (ndl_btype == 'a')
    res = true;
  /* new in v0.3d: obey topology requirements in query structure */
  if (ndl_btopo != btopo_any && ndl_btopo != btopo_always_any)
    {
  if (ndl_btopo == btopo_ring && hst_rc == 0)
    res = false;
  if (ndl_btopo == btopo_chain && hst_rc > 0)
    res = false;
  if (ndl_btopo == btopo_excess_rc && hst_rc <= ndl_rc)
    res = false;
  if (ndl_btopo == btopo_exact_rc && hst_rc != ndl_rc)
    res = false;
}    
/* p2c: checkmol.pas, line 9098:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  /* if res = false then tstr := ' bond topology mismatch '+inttostr(ndl_rc)+'/'+inttostr(hst_rc); */
  /*$ENDIF */
/* p2c: checkmol.pas, line 9102:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  /*
     if res then debugoutput('bond types OK ('+inttostr(ndl_b)+':'+ndl_btype+na+'/'+inttostr(hst_b)+':'+hst_btype+ha+')') else
     debugoutput('bond types not OK ('+inttostr(ndl_b)+':'+ndl_btype+na+'/'+inttostr(hst_b)+':'+hst_btype+ha+tstr+')'); */
  /*$ENDIF */
  return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static boolean bondtypes_OK_strict ( int  ndl_b,
int  hst_b 
) [static]

Definition at line 12461 of file checkmolc.c.

{
  boolean ndl_arom, hst_arom;
  char ndl_btype, hst_btype;
  int ndl_rc;               /* new in v0.3d */
  int hst_rc;               /* new in v0.3d */
  int ndl_btopo;            /* new in v0.3d */
  boolean res = false;
/* p2c: checkmol.pas, line 8960:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  char na[256], ha[256];
  char tstr[256];

  /*$ENDIF */
/* p2c: checkmol.pas, line 8966:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  *tstr = '\0';                    /* for debugging purposes only */
  /*$ENDIF */
  ndl_arom = ndl_bond[ndl_b - 1].arom;
  ndl_btype = ndl_bond[ndl_b - 1].btype;
  ndl_rc = ndl_bond[ndl_b - 1].ring_count;
  ndl_btopo = ndl_bond[ndl_b - 1].topo;
  hst_arom = bond[hst_b - 1].arom;
  hst_btype = bond[hst_b - 1].btype;
  hst_rc = bond[hst_b - 1].ring_count;
/* p2c: checkmol.pas, line 8976:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  /*if (ndl_arom)
    strcpy (na, "(ar)");
  else
    *na = '\0';
  if (hst_arom)
    strcpy (ha, "(ar)");
  else
    *ha = '\0';*/
  /*$ENDIF */
  if (ndl_arom == true && hst_arom == true)
    res = true;
  if (ndl_arom == false && hst_arom == false)
    {
      if (ndl_btype == hst_btype)
       res = true;
      if (ndl_btype == 'l' && (hst_btype == 'S' || hst_btype == 'D'))
       res = true;
      if (ndl_btype == 's' && hst_btype == 'S')
       res = true;
      if (ndl_btype == 'd' && hst_btype == 'D')
       res = true;
    }
  /* a little exception: */
  if (ndl_arom == false && hst_arom == true)
    {
      if (ndl_btype == 'A')
       res = true;
      if (ndl_btype == 's' || ndl_btype == 'd')
       res = true;
      if (ndl_bond[ndl_b - 1].q_arom)
       res = true;          /* 0.3p */
    }
  if (ndl_btype == 'a')
    res = true;
  /* new in v0.3d: strict comparison of topology (and even ring_count!) */
  if (ndl_btopo < btopo_always_any || ndl_btopo == btopo_exact_rc)
    {
      if (ndl_rc != hst_rc)
       {
         res = false;              /* this excludes further ring annulations as well as */
/* p2c: checkmol.pas, line 9001:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
         /*$IFDEF debug */
         /* open-chains query structures to be found in rings */
         /*
            tstr := ' ringcount mismatch ('+inttostr(ndl_rc)+'/'+inttostr(hst_rc)+')';   */
         /*$ENDIF */
       }
    }
  else
    {
      if (ndl_btopo == btopo_excess_rc && hst_rc <= ndl_rc)
       {
         res = false;
/* p2c: checkmol.pas, line 9010:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
         /*$IFDEF debug */
         /* tstr := ' ringcount mismatch ('+inttostr(ndl_rc)+'/'+inttostr(hst_rc)+')'; */
         /*$ENDIF */
       }
    }
/* p2c: checkmol.pas, line 9015:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
  /*$IFDEF debug */
  /* if res then debugoutput('bond types OK ('+inttostr(ndl_b)+':'+ndl_btype+na+'/'+inttostr(hst_b)+':'+hst_btype+ha+')') else
     debugoutput('bond types not OK ('+inttostr(ndl_b)+':'+ndl_btype+na+'/'+inttostr(hst_b)+':'+hst_btype+ha+tstr+')'); */
  /*$ENDIF */
  return res;
}

Here is the caller graph for this function:

static boolean chirality_OK ( int *  ndl_cp,
int *  hst_cp 
) [static]

Definition at line 12740 of file checkmolc.c.

{
  boolean res = true;
  double ndl_ct, hst_ct, ndl_ct_deg, hst_ct_deg;
  p_3d np1, np2, np3, np4, hp1, hp2, hp3, hp4;
  int level = 0;
  int i;
  boolean up = false, down = false, updown = false;
  int ta1, ta2, ta3, ta4, ba1, ba2, FORLIM;

  /* fill temporary atom variables */
  ta1 = ndl_cp[0];          /* this is the central atom */
  ta2 = ndl_cp[1];
  ta3 = ndl_cp[2];
  ta4 = ndl_cp[3];
  /* first, get the central atom of the needle */
  np2.x = ndl_atom[ta1 - 1].x;
  np2.y = ndl_atom[ta1 - 1].y;
  np2.z = ndl_atom[ta1 - 1].z;
  /* next, do the same for all 3 substituent atoms */
  np1.x = ndl_atom[ta2 - 1].x;
  np1.y = ndl_atom[ta2 - 1].y;
  np1.z = ndl_atom[ta2 - 1].z;
  np3.x = ndl_atom[ta3 - 1].x;
  np3.y = ndl_atom[ta3 - 1].y;
  np3.z = ndl_atom[ta3 - 1].z;
  np4.x = ndl_atom[ta4 - 1].x;
  np4.y = ndl_atom[ta4 - 1].y;
  np4.z = ndl_atom[ta4 - 1].z;
  /* now check all needle bonds if we should care about up/down bonds */
  if (ndl_n_bonds > 0)
    {
      FORLIM = ndl_n_bonds;
      for (i = 0; i < FORLIM; i++)
       {
         if (ndl_bond[i].stereo == bstereo_up ||
             ndl_bond[i].stereo == bstereo_down)
           {
             ba1 = ndl_bond[i].a1;
             ba2 = ndl_bond[i].a2;
             if (ba1 == ta1 && ndl_bond[i].stereo == bstereo_up)
              {
                up = true;
                if (ba2 == ta2 || ba2 == ta3 || ba2 == ta4)
                  {
                    updown = true;
                    if (ba2 == ta2)
                     np1.z += 0.8;
                    if (ba2 == ta3)
                     np3.z += 0.8;
                    if (ba2 == ta4)
                     np4.z += 0.8;
                  }
                else
                  level++;
              }
             if (ba1 == ta1 && ndl_bond[i].stereo == bstereo_down)
              {
                down = true;
                if (ba2 == ta2 || ba2 == ta3 || ba2 == ta4)
                  {
                    updown = true;
                    if (ba2 == ta2)
                     np1.z -= 0.8;
                    if (ba2 == ta3)
                     np3.z -= 0.8;
                    if (ba2 == ta4)
                     np4.z -= 0.8;
                  }
                else
                  level--;
              }
             if (ba2 == ta1 && ndl_bond[i].stereo == bstereo_up)
              {
                down = true;
                if (ba1 == ta2 || ba1 == ta3 || ba1 == ta4)
                  {
                    updown = true;
                    if (ba1 == ta2)
                     np1.z -= 0.8;
                    if (ba1 == ta3)
                     np3.z -= 0.8;
                    if (ba1 == ta4)
                     np4.z -= 0.8;
                  }
                else
                  level--;
              }
             if (ba2 == ta1 && ndl_bond[i].stereo == bstereo_down)
              {
                up = true;
                if (ba1 == ta2 || ba1 == ta3 || ba1 == ta4)
                  {
                    updown = true;
                    if (ba1 == ta2)
                     np1.z += 0.8;
                    if (ba1 == ta3)
                     np3.z += 0.8;
                    if (ba1 == ta4)
                     np4.z += 0.8;
                  }
                else
                  level++;
              }
           }
       }                    /* for i ... */
      if (updown == false && level != 0)
       {
         if (level > 0)
           np2.z += 0.3;
         if (level < 0)
           np2.z -= 0.3;
       }
      else
       {
         if (up)
           np2.z += 0.1;
         if (down)
           np2.z -= 0.1;
       }
    }
  /* fill temporary atom variables again */
  ta1 = hst_cp[0];
  ta2 = hst_cp[1];
  ta3 = hst_cp[2];
  ta4 = hst_cp[3];
  /* then, get the central atom of the haystack */
  hp2.x = atom[ta1 - 1].x;
  hp2.y = atom[ta1 - 1].y;
  hp2.z = atom[ta1 - 1].z;
  /* next, do the same for all 3 substituent atoms */
  hp1.x = atom[ta2 - 1].x;
  hp1.y = atom[ta2 - 1].y;
  hp1.z = atom[ta2 - 1].z;
  hp3.x = atom[ta3 - 1].x;
  hp3.y = atom[ta3 - 1].y;
  hp3.z = atom[ta3 - 1].z;
  hp4.x = atom[ta4 - 1].x;
  hp4.y = atom[ta4 - 1].y;
  hp4.z = atom[ta4 - 1].z;
  /* now check all haystack bonds if we should care about up/down bonds */
  level = 0;
  updown = false;
  up = false;
  down = false;
  if (n_bonds > 0)
    {
      FORLIM = n_bonds;
      for (i = 0; i < FORLIM; i++)
       {
         if (bond[i].stereo == bstereo_up || bond[i].stereo == bstereo_down)
           {
             ba1 = bond[i].a1;
             ba2 = bond[i].a2;
             if (ba1 == ta1 && bond[i].stereo == bstereo_up)
              {
                up = true;
                if (ba2 == ta2 || ba2 == ta3 || ba2 == ta4)
                  {
                    updown = true;
                    if (ba2 == ta2)
                     hp1.z += 0.8;
                    if (ba2 == ta3)
                     hp3.z += 0.8;
                    if (ba2 == ta4)
                     hp4.z += 0.8;
                  }
                else
                  level++;
              }
             if (ba1 == ta1 && bond[i].stereo == bstereo_down)
              {
                down = true;
                if (ba2 == ta2 || ba2 == ta3 || ba2 == ta4)
                  {
                    updown = true;
                    if (ba2 == ta2)
                     hp1.z -= 0.8;
                    if (ba2 == ta3)
                     hp3.z -= 0.8;
                    if (ba2 == ta4)
                     hp4.z -= 0.8;
                  }
                else
                  level--;
              }
             if (ba2 == ta1 && bond[i].stereo == bstereo_up)
              {
                down = true;
                if (ba1 == ta2 || ba1 == ta3 || ba1 == ta4)
                  {
                    updown = true;
                    if (ba1 == ta2)
                     hp1.z -= 0.8;
                    if (ba1 == ta3)
                     hp3.z -= 0.8;
                    if (ba1 == ta4)
                     hp4.z -= 0.8;
                  }
                else
                  level--;
              }
             if (ba2 == ta1 && bond[i].stereo == bstereo_down)
              {
                up = true;
                if (ba1 == ta2 || ba1 == ta3 || ba1 == ta4)
                  {
                    updown = true;
                    if (ba1 == ta2)
                     hp1.z += 0.8;
                    if (ba1 == ta3)
                     hp3.z += 0.8;
                    if (ba1 == ta4)
                     hp4.z += 0.8;
                  }
                else
                  level++;
              }
           }
       }                    /* for i ... */
      if (updown == false && level != 0)
       {
         if (level > 0)
           hp2.z += 0.3;
         if (level < 0)
           hp2.z -= 0.3;
       }
      else
       {
         if (up)
           hp2.z += 0.1;
         if (down)
           hp2.z -= 0.1;
       }
    }
  /* get the pseudo-torsion angles */
  ndl_ct = ctorsion (np1, np2, np3, np4);
  hst_ct = ctorsion (hp1, hp2, hp3, hp4);
  ndl_ct_deg = radtodeg (ndl_ct);
  hst_ct_deg = radtodeg (hst_ct);
  /* now do a plausibility check and finally check the sense */
  /* (clockwise or counterclockwise) */
  /*
     if (abs(ndl_ct_deg) > 5) and (abs(ndl_ct_deg) < 175) and
     (abs(hst_ct_deg) > 5) and (abs(hst_ct_deg) < 175) and
     (ndl_ct_deg * hst_ct_deg < 0) then res := false;
   */
  if (((!is_flat (ndl_ct_deg)) && (!is_flat (hst_ct_deg))) &&
      ndl_ct_deg * hst_ct_deg < 0)
    res = false;
  if (rs_strict)
    {
      if (((is_flat (ndl_ct_deg) && (!is_flat (hst_ct_deg))) |
          (is_flat (hst_ct_deg) && (!is_flat (ndl_ct_deg)))) ||
         ndl_ct_deg * hst_ct_deg < 0)
       res = false;
    }
  return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_12diphenol ( int  a_view,
int  a_ref 
) [static]

Definition at line 9006 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  int oh_count = 0;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_view);
  FORLIM = atom[a_view - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_view, nb[i]) - 1].btype == 'S')
       {
         if (is_hydroxy (a_view, nb[i]))
           oh_count++;
       }
    }
  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_ref);
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_ref, nb[i]) - 1].btype == 'S')
       {
         if (is_hydroxy (a_ref, nb[i]))
           oh_count++;
       }
    }
  if (oh_count == 2)
    fg[fg_1_2_diphenol - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_ammon ( int  a_ref) [static]

Definition at line 7270 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int het_count = 0, o_count = 0, or_count = 0, r_count = 0;
  char bt;                  /* v0.3k */
  float bo_sum = 0.0;
  boolean ha;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  if (strcmp (atom[a_ref - 1].atype, "N3+")
      && atom[a_ref - 1].formal_charge == 0)
    return;
  if (strcmp (atom[a_ref - 1].element, "N "))    /* just to be sure;  v0.3i */
    return;
  get_neighbors (nb, a_ref);
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      bt = bond[get_bond (a_ref, nb[i]) - 1].btype;     /* v0.3k */
      strcpy (nb_el, atom[nb[i] - 1].element);   /* v0.3k */
      ha = atom[nb[i] - 1].heavy;  /* v0.3k */
      if (bt == 'S')
       {
         if (ha)
           bo_sum += 1.0;
         if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
             /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "DU"))
           {                /* added 'D ' in v0.3n */
             het_count++;
             if (!strcmp (nb_el, "O "))
              {
                o_count++;
                if (atom[nb[i] - 1].neighbor_count > 1)
                  or_count++;
              }
           }
         if (is_alkyl (a_ref, nb[i]) || is_aryl (a_ref, nb[i]) |
             is_alkenyl (a_ref, nb[i]) || is_alkynyl (a_ref, nb[i]))
           /* v0.3k */
           r_count++;
       }
      if (bt == 'D')
       {
         if (ha)
           bo_sum += 2.0;
         if (strcmp (nb_el, "C "))
           {
             het_count += 2;
             if (!strcmp (nb_el, "O "))
              o_count += 2;
           }
         if (!strcmp (nb_el, "C "))
           r_count++;
       }
      if (bt == 'A' && ha)
       bo_sum += 1.5;
    }                       /* v0.3k: corrected end of "for ..." loop */
  if (het_count == 0 && r_count == 4)
    fg[fg_quart_ammonium - 1] = true;
  if (het_count != 1 || atom[a_ref - 1].neighbor_count < 3)
    return;
  if (o_count == 1 && or_count == 0 && bo_sum > 3)
    fg[fg_n_oxide - 1] = true;     /* finds only aliphatic N-oxides! */
  if ((o_count == 1 && or_count == 1 || o_count == 0) &&
      atom[a_ref - 1].arom == true)
    fg[fg_quart_ammonium - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_anhydride ( int  a_ref) [static]

Definition at line 8952 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  int acyl_count = 0;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_ref);
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (is_acyl (a_ref, nb[i]) || is_carbamoyl (a_ref, nb[i]))
       acyl_count++;
    }
  if (acyl_count == 2 && !strcmp (atom[a_ref - 1].atype, "O3 "))
    {
      fg[fg_carboxylic_acid_deriv - 1] = true;
      fg[fg_carboxylic_acid_anhydride - 1] = true;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_arom ( ) [static]

Definition at line 6591 of file checkmolc.c.

{
  int i, j, pi_count, ring_size, b, a1, a2;      /* v0.3n */
  ringpath_type testring;
  int a_ref, a_prev, a_next, b_bk, b_fw, b_exo;
  char bt_bk, bt_fw;
  boolean ar_bk, ar_fw, ar_exo;    /* new in v0.3 */
  boolean conj_intr, ko, aromatic, aromatic_bt;  /* v0.3n */
  int n_db, n_sb, n_ar;
  boolean cumul;
  int exo_mC;               /* v0.3j */
  int arom_pi_diff;         /* v0.3j */
  int FORLIM;

  if (n_rings < 1)
    return;
  FORLIM = n_rings;
  /* first, do a very quick check for benzene, pyridine, etc. */
  for (i = 0; i < FORLIM; i++)
    {
      ring_size = ringprop[i].size;
      if (ring_size == 6)
       {
         memset (testring, 0, sizeof (ringpath_type));
         for (j = 0; j < ring_size; j++)
           testring[j] = ring[i][j];
         cumul = false;
         n_sb = 0;
         n_db = 0;
         n_ar = 0;
         a_prev = testring[ring_size - 1];
         for (j = 1; j <= ring_size; j++)
           {
             a_ref = testring[j - 1];
             if (j < ring_size)
              a_next = testring[j];
             else
              a_next = testring[0];
             b_bk = get_bond (a_prev, a_ref);
             b_fw = get_bond (a_ref, a_next);
             bt_bk = bond[b_bk - 1].btype;
             bt_fw = bond[b_fw - 1].btype;
             if (bt_fw == 'S')
              n_sb++;
             if (bt_fw == 'D')
              n_db++;
             if (bt_fw == 'A')
              n_ar++;
             if (bt_fw != 'A' && bt_bk == bt_fw)
              cumul = true;
             a_prev = a_ref;
           }
         if (n_ar == 6 || n_sb == 3 && n_db == 3 && cumul == false)
           {                /* this ring is aromatic */
             a_prev = testring[ring_size - 1];
             for (j = 0; j < ring_size; j++)
              {
                a_ref = testring[j];
                b_bk = get_bond (a_prev, a_ref);
                bond[b_bk - 1].arom = true;
                a_prev = a_ref;
              }
             ringprop[i].arom = true;
           }
       }
    }
  FORLIM = n_rings;
  for (i = 1; i <= FORLIM; i++)
    {
      if (ringprop[i - 1].arom == false)
       {
         /* do the hard work only for those rings which are not yet flagged aromatic */
         memset (testring, 0, sizeof (ringpath_type));
         ring_size = ringprop[i - 1].size;       /* v0.3j */
         for (j = 0; j < ring_size; j++)  /* v0.3j */
           testring[j] = ring[i - 1][j];
         pi_count = 0;
         arom_pi_diff = 0;  /* v0.3j */
/* p2c: checkmol.pas: Note: Eliminated unused assignment statement [338] */
         ko = false;
         a_prev = testring[ring_size - 1];
         for (j = 1; j <= ring_size; j++)
           {
             a_ref = testring[j - 1];
             if (j < ring_size)
              a_next = testring[j];
             else
              a_next = testring[0];
             b_bk = get_bond (a_prev, a_ref);
             b_fw = get_bond (a_ref, a_next);
             bt_bk = bond[b_bk - 1].btype;
             bt_fw = bond[b_fw - 1].btype;
             ar_bk = bond[b_bk - 1].arom;
             ar_fw = bond[b_fw - 1].arom;
             if (bt_bk == 'S' && bt_fw == 'S' && ar_bk == false
                && ar_fw == false)
              {
                /* first, assume the worst case (interrupted conjugation) */
                conj_intr = true;
                /* conjugation can be restored by hetero atoms */
                if (!strcmp (atom[a_ref - 1].atype, "O3 ") ||
                    !strcmp (atom[a_ref - 1].atype, "S3 ") ||
                    !strcmp (atom[a_ref - 1].element, "N ") ||
                    !strcmp (atom[a_ref - 1].element, "SE"))
                  {
                    conj_intr = false;
                    pi_count += 2; /* lone pair adds for 2 pi electrons */
                  }
                /* conjugation can be restored by a formal charge at a methylene group */
                if (!strcmp (atom[a_ref - 1].element, "C ") &&
                    atom[a_ref - 1].formal_charge != 0)
                  {
                    conj_intr = false;
                    pi_count -= atom[a_ref - 1].formal_charge;
                    /* neg. charge increases pi_count! */
                  }
                /* conjugation can be restored by carbonyl groups etc. */
                if (is_oxo_C (a_ref) || is_thioxo_C (a_ref) |
                    is_exocyclic_imino_C (a_ref, i))
                  conj_intr = false;
                /* conjugation can be restored by exocyclic C=C double bond, */
                /* adds 2 pi electrons to 5-membered rings, not to 7-membered rings (CAUTION!) */
                /* apply only to non-aromatic exocyclic C=C bonds */
                exo_mC = find_exocyclic_methylene_C (a_ref, i);       /* v0.3j */
                if (exo_mC > 0 && (ring_size & 1))
                  {         /* v0.3j */
                    b_exo = get_bond (a_ref, exo_mC);   /* v0.3j  */
                    ar_exo = bond[b_exo - 1].arom;
                    if (((ring_size - 1) & 3) == 0)
                     {      /* 5-membered rings and related */
                       conj_intr = false;
                       pi_count += 2;
                     }
                    else
                     {
                       if (!ar_exo)
                         conj_intr = false;
                     }
                  }
                /* 7-membered rings and related */
                /* if conjugation is still interrupted ==> knock-out */
                if (conj_intr)
                  ko = true;
              }
             else
              {
                if (bt_bk == 'S' && bt_fw == 'S' && ar_bk == true
                    && ar_fw == true)
                  {
                    if (!strcmp (atom[a_ref - 1].atype, "O3 ") ||
                       !strcmp (atom[a_ref - 1].atype, "S3 ") ||
                       !strcmp (atom[a_ref - 1].element, "N ") ||
                       !strcmp (atom[a_ref - 1].element, "SE"))
                     pi_count += 2;       /* lone pair adds for 2 pi electrons */
                    if (!strcmp (atom[a_ref - 1].element, "C ") &&
                       atom[a_ref - 1].formal_charge != 0)
                     pi_count -= atom[a_ref - 1].formal_charge;
                    /* neg. charge increases pi_count! */
                    exo_mC = find_exocyclic_methylene_C (a_ref, i);   /* v0.3j */
                    if (exo_mC > 0 && (ring_size & 1))
                     {      /* v0.3j */
                       b_exo = get_bond (a_ref, exo_mC);       /* v0.3j */
/* p2c: checkmol.pas: Note: Eliminated unused assignment statement [338] */
                       if (((ring_size - 1) & 3) == 0)
                         /* 5-membered rings and related */
                         pi_count += 2;
                     }
                  }
                else
                  {
                    pi_count++;    /* v0.3j; adjustment for bridgehead N: see below */
                    if (bt_bk == 'S' && bt_fw == 'S' &&
                       (ar_bk == true && ar_fw == false ||
                        ar_bk == false && ar_fw == true))
                     {
                       /* v0.3j; if a bridgehead N were not aromatic, it could  */
                       /* contribute 2 pi electrons --> try also this variant */
                       /* (example: CAS 32278-54-9) */
                       if (!strcmp (atom[a_ref - 1].element, "N "))
                         {
                           arom_pi_diff++;
                           /* any other case: increase pi count by one electron */
                         }
                     }
                  }
              }
             /* last command: */
             a_prev = a_ref;
           }                /* for j := 1 to ring_size */
         /* now we can draw our conclusion */
         /*if not ((ko) or (odd(pi_count))) then */
         if (!ko)
           /* v0.3j; odd pi_count might be compensated by arom_pi_diff */
           {                /* apply Hueckel's rule */
             if (labs (ring_size - pi_count) < 2 &&
                (((pi_count - 2) & 3) == 0 ||
                 ((pi_count + arom_pi_diff - 2) & 3) == 0))
              {
                /* this ring is aromatic */
                ringprop[i - 1].arom = true;
                /* now mark _all_ bonds in the ring as aromatic */
                a_prev = testring[ring_size - 1];
                for (j = 0; j < ring_size; j++)
                  {
                    a_ref = testring[j];
                    bond[get_bond (a_prev, a_ref) - 1].arom = true;
                    a_prev = a_ref;
                  }
              }
           }
       }
    }                       /* (for i := 1 to n_rings) */
  FORLIM = n_bonds;
  /* finally, mark all involved atoms as aromatic */
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[i].arom)
       {
         a1 = bond[i].a1;   /* v0.3n */
         a2 = bond[i].a2;   /* v0.3n */
         atom[a1 - 1].arom = true;
         atom[a2 - 1].arom = true;
         /* v0.3n: update atom types if applicable (C and N) */
         if (!strcmp (atom[a1 - 1].element, "C "))
           strcpy (atom[a1 - 1].atype, "CAR");
         if (!strcmp (atom[a2 - 1].element, "C "))
           strcpy (atom[a2 - 1].atype, "CAR");
         if (!strcmp (atom[a1 - 1].element, "N "))
           strcpy (atom[a1 - 1].atype, "NAR");
         if (!strcmp (atom[a2 - 1].element, "N "))
           strcpy (atom[a2 - 1].atype, "NAR");
       }
    }
  FORLIM = n_rings;
  /* update aromaticity information in ringprop */
  /* new in v0.3n: accept rings as aromatic if all bonds are of type 'A' */
  for (i = 0; i < FORLIM; i++)
    {
      memcpy (testring, ring[i], sizeof (ringpath_type));
      /*ring_size := path_length(testring); */
      ring_size = ringprop[i].size;       /* v0.3j */
      aromatic = true;
      aromatic_bt = true;   /* v0.3n */
      a_prev = testring[ring_size - 1];
      for (j = 0; j < ring_size; j++)
       {
         a_ref = testring[j];
         b = get_bond (a_prev, a_ref);    /* v0.3n */
         if (!bond[b - 1].arom)
           aromatic = false;
         if (bond[b - 1].btype != 'A')    /* v0.3n */
           aromatic_bt = false;
         a_prev = a_ref;
       }
      if (aromatic_bt && !aromatic)
       {                    /* v0.3n: update aromaticity flag */
         a_prev = testring[ring_size - 1];
         for (j = 0; j < ring_size; j++)
           {
             a_ref = testring[j];
             b = get_bond (a_prev, a_ref);
             bond[b - 1].arom = true;
             if (!strcmp (atom[a_ref - 1].element, "C "))
              strcpy (atom[a_ref - 1].atype, "CAR");
             if (!strcmp (atom[a_ref - 1].element, "N "))
              strcpy (atom[a_ref - 1].atype, "NAR");
             a_prev = a_ref;
           }
         aromatic = true;
       }                    /* end v0.3n block   */
      if (aromatic)
       ringprop[i].arom = true;
      else
       ringprop[i].arom = false;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_arom_fg ( int  a1,
int  a2 
) [static]

Definition at line 9042 of file checkmolc.c.

{
  if ((hetbond_count (a1) == 1) && (hetbond_count (a2) == 1))
    chk_12diphenol (a1, a2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_b_deriv ( int  a_ref) [static]

Definition at line 7218 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int het_count = 0, oh_count = 0, or_count = 0, hal_count = 0, n_count = 0,
    c_count = 0;
  int FORLIM;

  if (strcmp (atom[a_ref - 1].element, "B "))
    return;
  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_ref);
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_ref, nb[i]) - 1].btype == 'S')
       {
         strcpy (nb_el, atom[nb[i] - 1].element);
         if (!strcmp (nb_el, "C "))
           c_count++;
         else if (strcmp (nb_el, "H ") /*&& strcmp (nb_el, "D ") */  &&
                 strcmp (nb_el, "LP"))
           /* v0.3n: D */
           het_count++;
         if (is_hydroxy (a_ref, nb[i]))
           oh_count++;
         if (is_alkoxy (a_ref, nb[i]) || is_aryloxy (a_ref, nb[i]))
           /* fixed in v0.3b */
           or_count++;
         if (!strcmp (nb_el, "N "))
           n_count++;
         if (!strcmp (nb_el, "F ") || !strcmp (nb_el, "CL") ||
             !strcmp (nb_el, "BR") || !strcmp (nb_el, "I ")
             || !strcmp (nb_el, "AT"))
           hal_count++;
       }
    }
  het_count = oh_count + or_count + hal_count + n_count;
  /* fixed in v0.3b */
  if (c_count != 1 || het_count != 2)
    return;
  fg[fg_boronic_acid_deriv - 1] = true;
  if (oh_count == 2)
    fg[fg_boronic_acid - 1] = true;
  if (or_count > 0)
    fg[fg_boronic_acid_ester - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_c_c ( int  a1,
int  a2 
) [static]

Definition at line 8676 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  int oh_count, nhr_count, FORLIM;

  /* ignore aromatic rings */
  if (atom[a2 - 1].arom == true)
    return;
  /*check for 1,2-diols and 1,2-aminoalcoholes */
  if (!strcmp (atom[a1 - 1].atype, "C3 ")
      && !strcmp (atom[a2 - 1].atype, "C3 "))
    {
      if ((hetbond_count (a1) == 1) && (hetbond_count (a2) == 1))
       {
         oh_count = 0;
         nhr_count = 0;
         memset (nb, 0, sizeof (neighbor_rec));
         get_neighbors (nb, a1);
         FORLIM = atom[a1 - 1].neighbor_count;
         for (i = 0; i < FORLIM; i++)
           {
             if (nb[i] != a2)
              {
                if (is_hydroxy (a1, nb[i]))
                  oh_count++;
                if (is_amino (a1, nb[i]) || is_alkylamino (a1, nb[i]) |
                    is_arylamino (a1, nb[i]))
                  nhr_count++;
              }
           }
         memset (nb, 0, sizeof (neighbor_rec));
         get_neighbors (nb, a2);
         FORLIM = atom[a2 - 1].neighbor_count;
         for (i = 0; i < FORLIM; i++)
           {
             if (nb[i] != a1)
              {
                if (is_hydroxy (a2, nb[i]))
                  oh_count++;
                if (is_amino (a2, nb[i]) || is_alkylamino (a2, nb[i]) |
                    is_arylamino (a2, nb[i]))
                  nhr_count++;
              }
           }
         if (oh_count == 2)
           fg[fg_1_2_diol - 1] = true;
         if (oh_count == 1 && nhr_count == 1)
           fg[fg_1_2_aminoalcohol - 1] = true;
       }
    }
  /* check for alpha-aminoacids and alpha-hydroxyacids */
  if (strcmp (atom[a1 - 1].atype, "C3 ")
      || strcmp (atom[a2 - 1].atype, "C2 "))
    return;
  if (!((hetbond_count (a1) == 1) && (hetbond_count (a2) == 3)))
    return;
  oh_count = 0;
  nhr_count = 0;
  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a1);
  FORLIM = atom[a1 - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (nb[i] != a2)
       {
         if (is_hydroxy (a1, nb[i]))
           oh_count++;
         if (is_amino (a1, nb[i]) || is_alkylamino (a1, nb[i]) |
             is_arylamino (a1, nb[i]))
           nhr_count++;
       }
    }
  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a2);
  FORLIM = atom[a2 - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (nb[i] != a1)
       {
         if (is_hydroxy (a2, nb[i]))
           oh_count++;
       }
    }
  if ((oh_count == 2) && is_oxo_C (a2))
    fg[fg_alpha_hydroxyacid - 1] = true;
  if ((oh_count == 1 && nhr_count == 1) && is_oxo_C (a2))
    fg[fg_alpha_aminoacid - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_c_hal ( int  a1,
int  a2 
) [static]

Definition at line 8368 of file checkmolc.c.

{
  str2 a2_el;

  strcpy (a2_el, atom[a2 - 1].element);
  fg[fg_halogen_deriv - 1] = true;
  if (atom[a1 - 1].arom)
    {
      fg[fg_aryl_halide - 1] = true;
      if (!strcmp (a2_el, "F "))
       fg[fg_aryl_fluoride - 1] = true;
      if (!strcmp (a2_el, "CL"))
       fg[fg_aryl_chloride - 1] = true;
      if (!strcmp (a2_el, "BR"))
       fg[fg_aryl_bromide - 1] = true;
      if (!strcmp (a2_el, "I "))
       fg[fg_aryl_iodide - 1] = true;
      return;
    }
  if ((strcmp (atom[a1 - 1].atype, "C3 ") == 0) && (hetbond_count (a1) <= 2))
    {                       /* alkyl halides */
      fg[fg_alkyl_halide - 1] = true;
      if (!strcmp (a2_el, "F "))
       fg[fg_alkyl_fluoride - 1] = true;
      if (!strcmp (a2_el, "CL"))
       fg[fg_alkyl_chloride - 1] = true;
      if (!strcmp (a2_el, "BR"))
       fg[fg_alkyl_bromide - 1] = true;
      if (!strcmp (a2_el, "I "))
       fg[fg_alkyl_iodide - 1] = true;
    }
  if ((strcmp (atom[a1 - 1].atype, "C2 ") == 0) && (hetbond_count (a1) == 3))
    {                       /* acyl halides and related compounds */
      if (is_oxo_C (a1))
       {
         fg[fg_acyl_halide - 1] = true;
         if (!strcmp (a2_el, "F "))
           fg[fg_acyl_fluoride - 1] = true;
         if (!strcmp (a2_el, "CL"))
           fg[fg_acyl_chloride - 1] = true;
         if (!strcmp (a2_el, "BR"))
           fg[fg_acyl_bromide - 1] = true;
         if (!strcmp (a2_el, "I "))
           fg[fg_acyl_iodide - 1] = true;
       }
      if (is_thioxo_C (a1))
       fg[fg_thiocarboxylic_acid_deriv - 1] = true;
      if (is_imino_C (a1))
       fg[fg_imidoyl_halide - 1] = true;
    }
  if (!
      ((strcmp (atom[a1 - 1].atype, "C2 ") == 0)
       && (hetbond_count (a1) == 4)))
    /* chloroformates etc. */
    return;
  /* still missing: polyhalogen compounds (-CX2H, -CX3) */
  fg[fg_co2_deriv - 1] = true;
  if (is_oxo_C (a1))
    {
      fg[fg_carbonic_acid_deriv - 1] = true;
      if (is_alkoxycarbonyl (a2, a1) || is_aryloxycarbonyl (a2, a1))
       fg[fg_carbonic_acid_ester_halide - 1] = true;
      if (is_carbamoyl (a2, a1))
       {
         fg[fg_carbamic_acid_deriv - 1] = true;
         fg[fg_carbamic_acid_halide - 1] = true;
       }
    }
  if (!is_thioxo_C (a1))
    return;
  fg[fg_thiocarbonic_acid_deriv - 1] = true;
  if (is_alkoxythiocarbonyl (a2, a1) || is_aryloxythiocarbonyl (a2, a1))
    fg[fg_thiocarbonic_acid_ester_halide - 1] = true;
  if (is_thiocarbamoyl (a2, a1))
    {
      fg[fg_thiocarbamic_acid_deriv - 1] = true;
      fg[fg_thiocarbamic_acid_halide - 1] = true;
      /* end of non-aromatic halogen compounds */
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_c_n ( int  a1,
int  a2 
) [static]

Definition at line 8587 of file checkmolc.c.

{
  /* ignore heteroaromatic rings (like furan, thiophene, pyrrol, etc.) */
  if (atom[a2 - 1].arom == true)
    return;
  if (is_true_alkyl (a2, a1) && is_amino (a1, a2))
    {
      fg[fg_amine - 1] = true;
      fg[fg_prim_amine - 1] = true;
      fg[fg_prim_aliph_amine - 1] = true;
    }
  if (is_aryl (a2, a1) && is_amino (a1, a2))
    {
      fg[fg_amine - 1] = true;
      fg[fg_prim_amine - 1] = true;
      fg[fg_prim_arom_amine - 1] = true;
    }
  if (is_true_alkyl (a2, a1) && is_true_alkylamino (a1, a2))
    {
      fg[fg_amine - 1] = true;
      fg[fg_sec_amine - 1] = true;
      fg[fg_sec_aliph_amine - 1] = true;
    }
  if (is_aryl (a2, a1) && is_true_alkylamino (a1, a2))
    {
      fg[fg_amine - 1] = true;
      fg[fg_sec_amine - 1] = true;
      fg[fg_sec_mixed_amine - 1] = true;
    }
  if (is_aryl (a2, a1) && is_arylamino (a1, a2))
    {
      fg[fg_amine - 1] = true;
      fg[fg_sec_amine - 1] = true;
      fg[fg_sec_arom_amine - 1] = true;
    }
  if (is_true_alkyl (a2, a1) && is_true_dialkylamino (a1, a2))
    {
      fg[fg_amine - 1] = true;
      fg[fg_tert_amine - 1] = true;
      fg[fg_tert_aliph_amine - 1] = true;
    }
  if ((is_true_alkyl (a2, a1) && is_diarylamino (a1, a2)) |
      (is_aryl (a2, a1) && is_true_dialkylamino (a1, a2)))
    {
      fg[fg_amine - 1] = true;
      fg[fg_tert_amine - 1] = true;
      fg[fg_tert_mixed_amine - 1] = true;
    }
  if (is_aryl (a2, a1) && is_diarylamino (a1, a2))
    {
      fg[fg_amine - 1] = true;
      fg[fg_tert_amine - 1] = true;
      fg[fg_tert_arom_amine - 1] = true;
    }
  if ((is_alkyl (a2, a1) || is_aryl (a2, a1) || is_alkenyl (a2, a1) |
       is_alkynyl (a2, a1)) && is_hydroxylamino (a1, a2) && (is_acyl_gen (a2,
                                                                 a1)
                                                      == false))
    /* v0.3k */
    fg[fg_hydroxylamine - 1] = true;
  /* v0.3k */
  /* v0.3k  */
  if ((is_alkyl (a2, a1) || is_aryl (a2, a1) || is_acyl (a2, a1) |
       is_alkenyl (a2, a1) || is_alkynyl (a2, a1)) && is_hydrazino (a1, a2))
    fg[fg_hydrazine - 1] = true;
  if ((is_alkyl (a2, a1) || is_aryl (a2, a1) || is_alkenyl (a2, a1) |
       is_alkynyl (a2, a1)) && is_azido (a1, a2))
    /* v0.3k */
    fg[fg_azide - 1] = true;
  if ((is_alkyl (a2, a1) || is_aryl (a2, a1) || is_alkenyl (a2, a1) |
       is_alkynyl (a2, a1)) && is_diazonium (a1, a2))
    /* v0.3k */
    fg[fg_diazonium_salt - 1] = true;
  if ((is_alkyl (a2, a1) || is_aryl (a2, a1) || is_alkenyl (a2, a1) |
       is_alkynyl (a2, a1)) && is_nitro (a1, a2))
    /* v0.3k */
    fg[fg_nitro_compound - 1] = true;
  if (is_alkynyl (a2, a1) &
      (is_amino (a1, a2) || is_C_monosubst_amino (a1, a2) |
       (is_C_disubst_amino (a1, a2) && (!is_acylamino (a1, a2)))))
    {
      fg[fg_amine - 1] = true;
      amine_generic = true;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_c_o ( int  a1,
int  a2 
) [static]

Definition at line 8452 of file checkmolc.c.

{
  /* ignore heteroaromatic rings (like furan, thiophene, etc.) */
  if (bond[get_bond (a1, a2) - 1].arom == true)
    return;
  if (is_true_alkyl (a2, a1) && is_hydroxy (a1, a2))
    {
      fg[fg_hydroxy - 1] = true;
      fg[fg_alcohol - 1] = true;
      if (atom[a1 - 1].neighbor_count <= 2)
       fg[fg_prim_alcohol - 1] = true;
      if (atom[a1 - 1].neighbor_count == 3)
       fg[fg_sec_alcohol - 1] = true;
      if (atom[a1 - 1].neighbor_count == 4)
       fg[fg_tert_alcohol - 1] = true;
    }
  if (is_aryl (a2, a1) && is_hydroxy (a1, a2))
    {
      fg[fg_hydroxy - 1] = true;
      fg[fg_phenol - 1] = true;
    }
  if (is_true_alkyl (a2, a1) && is_true_alkoxy (a1, a2))
    {
      fg[fg_ether - 1] = true;
      fg[fg_dialkylether - 1] = true;
    }
  if ((is_true_alkyl (a2, a1) && is_aryloxy (a1, a2)) |
      (is_aryl (a2, a1) && is_true_alkoxy (a1, a2)))
    {
      fg[fg_ether - 1] = true;
      fg[fg_alkylarylether - 1] = true;
    }
  if (is_aryl (a2, a1) && is_aryloxy (a1, a2))
    {
      fg[fg_ether - 1] = true;
      fg[fg_diarylether - 1] = true;
    }
  if ((is_true_alkyl (a2, a1) || is_aryl (a2, a1)) && is_alkynyloxy (a1, a2))
    {
      fg[fg_ether - 1] = true;
      ether_generic = true;
    }
  if (is_alkynyl (a2, a1) && is_hydroxy (a1, a2))
    {
      fg[fg_hydroxy - 1] = true;
      hydroxy_generic = true;
    }

}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_c_s ( int  a1,
int  a2 
) [static]

Definition at line 8505 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int o_count = 0, oh_count = 0, or_count = 0, n_count = 0, c_count = 0,
    hal_count = 0;
  int FORLIM;

  /* ignore heteroaromatic rings (like furan, thiophene, etc.) */
  if (bond[get_bond (a1, a2) - 1].arom == true)
    return;
  if (is_alkyl (a2, a1) && is_sulfanyl (a1, a2))
    {
      fg[fg_thiol - 1] = true;
      fg[fg_alkylthiol - 1] = true;
    }
  if (is_aryl (a2, a1) && is_sulfanyl (a1, a2))
    {
      fg[fg_thiol - 1] = true;
      fg[fg_arylthiol - 1] = true;
    }
  if (is_true_alkyl (a2, a1) && is_true_alkylsulfanyl (a1, a2))
    fg[fg_thioether - 1] = true;
  if ((is_true_alkyl (a2, a1) && is_arylsulfanyl (a1, a2)) |
      (is_aryl (a2, a1) && is_true_alkylsulfanyl (a1, a2)))
    fg[fg_thioether - 1] = true;
  if (is_aryl (a2, a1) && is_arylsulfanyl (a1, a2))
    fg[fg_thioether - 1] = true;
  /* check for sulfinic/sulfenic acid derivatives */
  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a2);
  FORLIM = atom[a2 - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      strcpy (nb_el, atom[nb[i] - 1].element);
      if (is_alkyl (a2, nb[i]) || is_aryl (a2, nb[i]))
       c_count++;
      if (is_hydroxy (a2, nb[i]))
       oh_count++;
      if (is_alkoxy (a2, nb[i]) || is_aryloxy (a2, nb[i]))
       or_count++;
      if (is_amino (a2, nb[i]) || is_subst_amino (a2, nb[i]))
       n_count++;
      if (!strcmp (nb_el, "F ") || !strcmp (nb_el, "CL") ||
         !strcmp (nb_el, "BR") || !strcmp (nb_el, "I "))
       hal_count++;
      if (!strcmp (nb_el, "O "))
       o_count++;
    }
  if (c_count != 1)
    return;
  if (atom[a2 - 1].neighbor_count == 3 && o_count - oh_count - or_count == 1)
    {                       /* sulfinic acid && derivs */
      fg[fg_sulfinic_acid_deriv - 1] = true;
      if (oh_count == 1)
       fg[fg_sulfinic_acid - 1] = true;
      if (or_count == 1)
       fg[fg_sulfinic_acid_ester - 1] = true;
      if (hal_count == 1)
       fg[fg_sulfinic_acid_halide - 1] = true;
      if (n_count == 1)
       fg[fg_sulfinic_acid_amide - 1] = true;
    }
  if (atom[a2 - 1].neighbor_count != 2 || o_count - oh_count - or_count != 0)
    /* sulfenic acid && derivs */
    return;

  fg[fg_sulfenic_acid_deriv - 1] = true;
  if (oh_count == 1)
    fg[fg_sulfenic_acid - 1] = true;
  if (or_count == 1)
    fg[fg_sulfenic_acid_ester - 1] = true;
  if (hal_count == 1)
    fg[fg_sulfenic_acid_halide - 1] = true;
  if (n_count == 1)
    fg[fg_sulfenic_acid_amide - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_carbonyl_deriv ( int  a_view,
int  a_ref 
) [static]

Definition at line 7508 of file checkmolc.c.

{
  /* a_view = C */
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int c_count = 0, cn_count = 0;
  char bt;                  /* new in v0.3b */
  int n_db = 0;                    /* new in v0.3b */
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_view);
  FORLIM = atom[a_view - 1].neighbor_count;
  /* new in v0.3b */
  for (i = 0; i < FORLIM; i++)
    {
      bt = bond[get_bond (a_view, nb[i]) - 1].btype;
      if (bt == 'S')
       {
         strcpy (nb_el, atom[nb[i] - 1].element);
         if (!strcmp (nb_el, "C "))
           {
             if (is_cyano_c (nb[i]))
              cn_count++;
             else
              c_count++;
           }
       }
      else
       {
         if (bt == 'D')
           n_db++;
       }
    }
  /* new in v0.3b */
  if (is_oxo_C (a_view))
    {
      fg[fg_carbonyl - 1] = true;
      if (c_count + cn_count < 2)
       {                    /* new in v0.3b (detection of ketenes) */
         if (n_db <= 1)
           fg[fg_aldehyde - 1] = true;
         else
           fg[fg_ketene - 1] = true;
       }
      if (c_count == 2)
       {
         if (atom[a_view - 1].arom)
           fg[fg_oxohetarene - 1] = true;
         else
           fg[fg_ketone - 1] = true;
       }
      if (cn_count > 0)
       fg[fg_acyl_cyanide - 1] = true;
    }
  if (is_thioxo_C (a_view))
    {
      fg[fg_thiocarbonyl - 1] = true;
      if (c_count < 2)
       fg[fg_thioaldehyde - 1] = true;
      if (c_count == 2)
       {
         if (atom[a_view - 1].arom)
           fg[fg_thioxohetarene - 1] = true;
         else
           fg[fg_thioketone - 1] = true;
       }
    }
  if (is_imino_C (a_view))
    chk_imine (a_view, a_ref);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_carbonyl_deriv_sp3 ( int  a_ref) [static]

Definition at line 8861 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  int oh_count = 0, or_count = 0, n_count = 0, sh_count = 0, sr_count = 0;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_ref);
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (is_hydroxy (a_ref, nb[i]))
       oh_count++;
      if (is_alkoxy (a_ref, nb[i]) || is_aryloxy (a_ref, nb[i]) |
         is_alkenyloxy (a_ref, nb[i]) || is_alkynyloxy (a_ref, nb[i]))
       or_count++;
      if (is_sulfanyl (a_ref, nb[i]))
       sh_count++;
      if (is_alkylsulfanyl (a_ref, nb[i]) || is_arylsulfanyl (a_ref, nb[i]) |
         is_alkenylsulfanyl (a_ref, nb[i]) || is_alkynylsulfanyl (a_ref,
                                                           nb[i]))
       sr_count++;
      if (!strcmp (atom[nb[i] - 1].atype, "N3 ") ||
         !strcmp (atom[nb[i] - 1].atype, "NAM"))
       n_count++;
    }
  if (oh_count == 2)
    fg[fg_carbonyl_hydrate - 1] = true;
  if (oh_count == 1 && or_count == 1)
    fg[fg_hemiacetal - 1] = true;
  if (or_count == 2)
    fg[fg_acetal - 1] = true;
  if ((oh_count == 1 || or_count == 1) && n_count == 1)
    fg[fg_hemiaminal - 1] = true;
  if (n_count == 2)
    fg[fg_aminal - 1] = true;
  if ((sh_count == 1 || sr_count == 1) && n_count == 1)
    fg[fg_thiohemiaminal - 1] = true;
  if (sr_count == 2 || or_count == 1 && sr_count == 1)
    fg[fg_thioacetal - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_carboxyl_deriv ( int  a_view,
int  a_ref 
) [static]

Definition at line 7584 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int o_count = 0, n_count = 0, s_count = 0;
  int a_o, a_n, a_s, FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_view);
  FORLIM = atom[a_view - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_view, nb[i]) - 1].btype == 'S')
       {
         strcpy (nb_el, atom[nb[i] - 1].element);
         if (strcmp (nb_el, "C "))
           {
             if (!strcmp (nb_el, "O "))
              {
                o_count++;
                a_o = nb[i];
              }
             if (!strcmp (nb_el, "N "))
              {
                n_count++;
                a_n = nb[i];
              }
             if (!strcmp (nb_el, "S "))
              {
                s_count++;
                a_s = nb[i];
              }
           }
       }
    }
  if (is_oxo_C (a_view))
    {
      if (o_count == 1)
       {                    /* anhydride is checked somewhere else */
         if (bond[get_bond (a_view, a_o) - 1].arom == false)
           fg[fg_carboxylic_acid_deriv - 1] = true;
         if (is_hydroxy (a_view, a_o))
           {
             if (atom[a_o - 1].formal_charge == 0)
              fg[fg_carboxylic_acid - 1] = true;
             if (atom[a_o - 1].formal_charge == -1)
              fg[fg_carboxylic_acid_salt - 1] = true;
           }
         if (is_alkoxy (a_view, a_o) || is_aryloxy (a_view, a_o) |
             is_alkenyloxy (a_view, a_o) || is_alkynyloxy (a_view, a_o))
           {
             if (bond[get_bond (a_view, a_o) - 1].arom == false)
              fg[fg_carboxylic_acid_ester - 1] = true;
             if (bond[get_bond (a_view, a_o) - 1].ring_count > 0)
              {
                if (bond[get_bond (a_view, a_o) - 1].arom == true)
                  {
                    /*fg[fg_lactone_heteroarom] := true else fg[fg_lactone] := true; */
                    fg[fg_oxohetarene - 1] = true;
                  }
                else
                  fg[fg_lactone - 1] = true;
              }
           }
       }
      if (n_count == 1)
       {
         if (bond[get_bond (a_view, a_n) - 1].arom == false)
           fg[fg_carboxylic_acid_deriv - 1] = true;
         else
           {
             /*fg[fg_lactam_heteroarom] := true;  (* catches also pyridazines, 1,2,3-triazines, etc. */
             fg[fg_oxohetarene - 1] = true;
           }
         if (is_amino (a_view, a_n)
             || (!strcmp (atom[a_n - 1].atype, "NAM")
                && atom[a_n - 1].neighbor_count == 1))
           {
             fg[fg_carboxylic_acid_amide - 1] = true;
             fg[fg_carboxylic_acid_prim_amide - 1] = true;
           }
         /*if (is_alkylamino(a_view,a_n)) or (is_arylamino(a_view,a_n)) then  */
         if (is_C_monosubst_amino (a_view, a_n) &
             (!is_subst_acylamino (a_view, a_n)))
           {                /* v0.3j */
             if (bond[get_bond (a_view, a_n) - 1].arom == false)
              fg[fg_carboxylic_acid_amide - 1] = true;
             if (bond[get_bond (a_view, a_n) - 1].arom == false)
              fg[fg_carboxylic_acid_sec_amide - 1] = true;
             if (bond[get_bond (a_view, a_n) - 1].ring_count > 0)
              {
                if (bond[get_bond (a_view, a_n) - 1].arom == true)
                  {
                    /*fg[fg_lactam_heteroarom]    := true else  */
                    fg[fg_oxohetarene - 1] = true;
                  }
                else
                  fg[fg_lactam - 1] = true;
              }
           }
         /*if (is_dialkylamino(a_view,a_n)) or (is_alkylarylamino(a_view,a_n)) or */
         /*   (is_diarylamino(a_view,a_n)) then  */
         if (is_C_disubst_amino (a_view, a_n) &
             (!is_subst_acylamino (a_view, a_n)))
           {                /* v0.3j */
             if (bond[get_bond (a_view, a_n) - 1].arom == false)
              fg[fg_carboxylic_acid_amide - 1] = true;
             if (bond[get_bond (a_view, a_n) - 1].arom == false)
              fg[fg_carboxylic_acid_tert_amide - 1] = true;
             if (bond[get_bond (a_view, a_n) - 1].ring_count > 0)
              {
                if (bond[get_bond (a_view, a_n) - 1].arom == true)
                  {
                    /*fg[fg_lactam_heteroarom]    := true else  */
                    fg[fg_oxohetarene - 1] = true;
                  }
                else
                  fg[fg_lactam - 1] = true;
              }
           }
         if (is_hydroxylamino (a_view, a_n))
           fg[fg_hydroxamic_acid - 1] = true;
         if (is_hydrazino (a_view, a_n))
           fg[fg_carboxylic_acid_hydrazide - 1] = true;
         if (is_azido (a_view, a_n))
           fg[fg_carboxylic_acid_azide - 1] = true;
       }
      if (s_count == 1)
       {                    /* anhydride is checked somewhere else */
         if (bond[get_bond (a_view, a_s) - 1].arom == false)
           fg[fg_thiocarboxylic_acid_deriv - 1] = true;
         if (is_sulfanyl (a_view, a_s))
           fg[fg_thiocarboxylic_acid - 1] = true;
         if (is_alkylsulfanyl (a_view, a_s) || is_arylsulfanyl (a_view, a_s))
           {
             if (bond[get_bond (a_view, a_s) - 1].arom == false)
              fg[fg_thiocarboxylic_acid_ester - 1] = true;
             if (bond[get_bond (a_view, a_s) - 1].ring_count > 0)
              {
                if (bond[get_bond (a_view, a_s) - 1].arom == true)
                  {
                    /*fg[fg_thiolactone_heteroarom] := true else fg[fg_thiolactone] := true; */
                    fg[fg_oxohetarene - 1] = true;
                  }
                else
                  fg[fg_thiolactone - 1] = true;
              }
           }
       }
    }                       /* end Oxo-C */
  if (is_thioxo_C (a_view))
    {
      /* fg[fg_thiocarboxylic_acid_deriv]  := true; */
      if (o_count == 1)
       {                    /* anhydride is checked somewhere else */
         if (bond[get_bond (a_view, a_o) - 1].arom == false)
           fg[fg_thiocarboxylic_acid_deriv - 1] = true;
         if (is_hydroxy (a_view, a_o))
           fg[fg_thiocarboxylic_acid - 1] = true;       /* fixed in v0.3c */
         if (is_alkoxy (a_view, a_o) || is_aryloxy (a_view, a_o))
           {
             if (bond[get_bond (a_view, a_s) - 1].arom == false)
              fg[fg_thiocarboxylic_acid_ester - 1] = true;
             if (bond[get_bond (a_view, a_o) - 1].ring_count > 0)
              {
                if (bond[get_bond (a_view, a_o) - 1].arom == true)
                  {
                    /*fg[fg_thiolactone_heteroarom] := true else fg[fg_thiolactone] := true; */
                    fg[fg_thioxohetarene - 1] = true;
                  }
                else
                  fg[fg_thiolactone - 1] = true;
              }
           }
       }
      if (n_count == 1)
       {
         if (bond[get_bond (a_view, a_n) - 1].arom == false)
           fg[fg_thiocarboxylic_acid_deriv - 1] = true;
         else
           {
             /*fg[fg_thiolactam_heteroarom] := true;  (* catches also pyridazines, 1,2,3-triazines, etc. */
             fg[fg_thioxohetarene - 1] = true;
           }
         /* catches also pyridazines, 1,2,3-triazines, etc. */
         if (is_amino (a_view, a_n))
           {
             fg[fg_thiocarboxylic_acid_amide - 1] = true;
             /* fg[fg_thiocarboxylic_acid_prim_amide] := true; */
           }
         /*if (is_alkylamino(a_view,a_n)) or (is_arylamino(a_view,a_n)) then  */
         if (is_C_monosubst_amino (a_view, a_n) &
             (!is_subst_acylamino (a_view, a_n)))
           {                /* v0.3j */
             if (bond[get_bond (a_view, a_n) - 1].arom == false)
              fg[fg_thiocarboxylic_acid_amide - 1] = true;
             /*fg[fg_thiocarboxylic_acid_sec_amide]  := true; */
             if (bond[get_bond (a_view, a_n) - 1].ring_count > 0)
              {
                if (bond[get_bond (a_view, a_n) - 1].arom == true)
                  {
                    /*fg[fg_thiolactam_heteroarom] := true else fg[fg_thiolactam] := true; */
                    fg[fg_thioxohetarene - 1] = true;
                  }
                else
                  fg[fg_thiolactam - 1] = true;
              }
           }
         /*if (is_dialkylamino(a_view,a_n)) or (is_alkylarylamino(a_view,a_n)) or */
         /*   (is_diarylamino(a_view,a_n)) then  */
         if (is_C_disubst_amino (a_view, a_n) &
             (!is_subst_acylamino (a_view, a_n)))
           {                /* v0.3j */
             if (bond[get_bond (a_view, a_n) - 1].arom == false)
              fg[fg_thiocarboxylic_acid_amide - 1] = true;
             /*fg[fg_thiocarboxylic_acid_tert_amide] := true; */
             if (bond[get_bond (a_view, a_n) - 1].ring_count > 0)
              {
                if (bond[get_bond (a_view, a_n) - 1].arom == true)
                  {
                    /*fg[fg_thiolactam_heteroarom] := true else fg[fg_thiolactam] := true; */
                    fg[fg_thioxohetarene - 1] = true;
                  }
                else
                  fg[fg_thiolactam - 1] = true;
              }
           }
       }
      if (s_count == 1)
       {                    /* anhydride is checked somewhere else */
         if (bond[get_bond (a_view, a_s) - 1].arom == false)
           fg[fg_thiocarboxylic_acid_deriv - 1] = true;
         if (is_sulfanyl (a_view, a_s))
           fg[fg_thiocarboxylic_acid - 1] = true;
         if (is_alkylsulfanyl (a_view, a_s) || is_arylsulfanyl (a_view, a_s))
           {
             if (bond[get_bond (a_view, a_s) - 1].arom == false)
              fg[fg_thiocarboxylic_acid_ester - 1] = true;
             if (bond[get_bond (a_view, a_s) - 1].ring_count > 0)
              {
                if (bond[get_bond (a_view, a_s) - 1].arom == true)
                  {
                    /*fg[fg_thiolactone_heteroarom] := true else fg[fg_thiolactone] := true; */
                    fg[fg_thioxohetarene - 1] = true;
                  }
                else
                  fg[fg_thiolactone - 1] = true;
              }
           }
       }
    }                       /* end Thioxo-C */
  if (is_true_imino_C (a_view))
    {
      if (o_count == 1)
       {
         if (bond[get_bond (a_view, a_o) - 1].arom == false)
           fg[fg_carboxylic_acid_deriv - 1] = true;
         if (is_alkoxy (a_view, a_o) || is_aryloxy (a_view, a_o))
           {
             if (bond[get_bond (a_view, a_o) - 1].arom == false)
              fg[fg_imido_ester - 1] = true;
           }
       }
      if ((n_count == 1) && (bond[get_bond (a_view, a_n) - 1].arom == false))
       {
         if (bond[get_bond (a_view, a_n) - 1].arom == false)
           fg[fg_carboxylic_acid_deriv - 1] = true;
         if (is_amino (a_view, a_n) || is_subst_amino (a_view, a_n))
           {
             if (bond[get_bond (a_view, a_n) - 1].arom == false)
              fg[fg_carboxylic_acid_deriv - 1] = true;
             fg[fg_carboxylic_acid_amidine - 1] = true;
           }
         if (is_hydrazino (a_view, a_n))
           {
             if (bond[get_bond (a_view, a_n) - 1].arom == false)
              fg[fg_carboxylic_acid_amidrazone - 1] = true;
           }
       }
      if ((n_count == 1) && (bond[get_bond (a_view, a_n) - 1].arom == true))
       /* catches also pyridazines, 1,2,3-triazines, etc. */
       fg[fg_iminohetarene - 1] = true;
      if (s_count == 1)
       {
         if (bond[get_bond (a_view, a_s) - 1].arom == false)
           fg[fg_carboxylic_acid_deriv - 1] = true;
         if (is_alkylsulfanyl (a_view, a_s) || is_arylsulfanyl (a_view, a_s))
           {
             if (bond[get_bond (a_view, a_s) - 1].arom == false)
              fg[fg_imido_thioester - 1] = true;
           }
       }
    }
  if (is_hydroximino_C (a_view))
    {
      if (bond[get_bond (a_view, a_n) - 1].arom == false)
       fg[fg_carboxylic_acid_deriv - 1] = true;
      if (o_count == 1)
       {
         if (is_hydroxy (a_view, a_o))
           fg[fg_hydroxamic_acid - 1] = true;
       }
    }
  if (!is_hydrazono_C (a_view))
    return;
  if (bond[get_bond (a_view, a_n) - 1].arom == false)
    fg[fg_carboxylic_acid_deriv - 1] = true;
  if (n_count == 1)
    {
      if (is_amino (a_view, a_n) || is_subst_amino (a_view, a_n))
       fg[fg_carboxylic_acid_amidrazone - 1] = true;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_carboxyl_deriv_sp3 ( int  a_ref) [static]

Definition at line 8907 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  int or_count = 0, oh_count = 0, n_count = 0;   /* oh_count new in v0.3c */
  int electroneg_count = 0; /* new in v0.3j */
  int hal_count = 0;
  str2 nb_el;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_ref);
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      strcpy (nb_el, atom[nb[i] - 1].element);   /* v0.3j */
      if (is_electroneg (nb_el))
       electroneg_count++;
      if (!strcmp (nb_el, "F ") || !strcmp (nb_el, "CL") ||
         !strcmp (nb_el, "BR") || !strcmp (nb_el, "I ")
         || !strcmp (nb_el, "AT"))
       hal_count++;
      if (is_alkoxy (a_ref, nb[i]) || is_aryloxy (a_ref, nb[i]) |
         is_siloxy (a_ref, nb[i]))
       or_count++;
      if (is_hydroxy (a_ref, nb[i]))      /* new in v0.3c    */
       oh_count++;
      if (!strcmp (atom[nb[i] - 1].atype, "N3 ") ||
         !strcmp (atom[nb[i] - 1].atype, "NAM"))
       n_count++;
    }
  /*if (or_count + n_count > 1) then fg[fg_orthocarboxylic_acid_deriv] := true;  (* until v0.3i */
  if (electroneg_count == 3 && hal_count < 3)    /* v0.3j */
    fg[fg_orthocarboxylic_acid_deriv - 1] = true;
  if (or_count == 3)
    fg[fg_carboxylic_acid_orthoester - 1] = true;
  if (or_count == 2 && n_count == 1)
    fg[fg_carboxylic_acid_amide_acetal - 1] = true;
  if (oh_count > 0 && oh_count + or_count + n_count == 3)      /* new in v0.3c */
    fg[fg_orthocarboxylic_acid_deriv - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_ccx ( int  a_view,
int  a_ref 
) [static]

Definition at line 8133 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  int oh_count = 0, or_count = 0, n_count = 0;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_ref);
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_ref, nb[i]) - 1].btype == 'S')
       {
         if (is_hydroxy (a_ref, nb[i]))
           oh_count++;
         if (is_alkoxy (a_ref, nb[i]) || is_aryloxy (a_ref, nb[i]) |
             is_siloxy (a_ref, nb[i]))
           or_count++;
         if (!strcmp (atom[nb[i] - 1].atype, "N3 ") ||
             !strcmp (atom[nb[i] - 1].atype, "NAM"))
           n_count++;
       }
    }
  if (oh_count == 1)
    fg[fg_enol - 1] = true;
  if (or_count == 1)
    fg[fg_enolether - 1] = true;
  if (n_count == 1)
    fg[fg_enamine - 1] = true;
  /* new in v0.2f   (regard anything else as an alkene) */
  if (oh_count + or_count + n_count == 0)
    fg[fg_alkene - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_co2_sp ( int  a_view,
int  a_ref 
) [static]

Definition at line 8071 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int o_count = 0, n_count = 0, s_count = 0;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_view);
  FORLIM = atom[a_view - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_view, nb[i]) - 1].btype == 'D')
       {
         strcpy (nb_el, atom[nb[i] - 1].element);
         if (strcmp (nb_el, "C "))
           {
             if (!strcmp (nb_el, "O "))
              o_count++;
             if (!strcmp (nb_el, "N "))
              n_count++;
             if (!strcmp (nb_el, "S "))
              s_count++;
           }
       }
    }
  if (o_count + s_count == 2)      /* new in v0.3b */
    fg[fg_co2_deriv - 1] = true;
  if (o_count == 1 && n_count == 1)
    fg[fg_isocyanate - 1] = true;
  if (s_count == 1 && n_count == 1)
    fg[fg_isothiocyanate - 1] = true;
  if (n_count == 2)
    fg[fg_carbodiimide - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_co2_sp2 ( int  a_view,
int  a_ref 
) [static]

Definition at line 7902 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int o_count = 0, or_count = 0, n_count = 0, nn_count = 0, nnx_count = 0,
    s_count = 0, sr_count = 0;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_view);
  FORLIM = atom[a_view - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_view, nb[i]) - 1].btype == 'S')
       {
         strcpy (nb_el, atom[nb[i] - 1].element);
         if (strcmp (nb_el, "C "))
           {
             if (!strcmp (nb_el, "O "))
              {
                o_count++;
                if (is_alkoxy (a_view, nb[i]) |
                    is_alkenyloxy (a_view, nb[i]) || is_aryloxy (a_view,
                                                           nb[i]))
                  /* v0.3j */
                  or_count++;
              }
             if (!strcmp (nb_el, "N "))
              {
                n_count++;
                if (is_hydrazino (a_view, nb[i]))
                  nn_count++;
                if (is_subst_hydrazino (a_view, nb[i])) /* more general... */
                  nnx_count++;
              }
             if (!strcmp (nb_el, "S "))
              {
                s_count++;
                if (is_alkylsulfanyl (a_view, nb[i]) |
                    is_arylsulfanyl (a_view, nb[i]))
                  sr_count++;
              }
           }
       }
    }
  if (is_oxo_C (a_view))
    {
      if (o_count == 2)
       {
         fg[fg_carbonic_acid_deriv - 1] = true;
         if (or_count == 1)
           fg[fg_carbonic_acid_monoester - 1] = true;
         if (or_count == 2)
           fg[fg_carbonic_acid_diester - 1] = true;
       }
      if (o_count == 1 && s_count == 1)
       {
         fg[fg_thiocarbonic_acid_deriv - 1] = true;
         if (or_count + sr_count == 1)
           fg[fg_thiocarbonic_acid_monoester - 1] = true;
         if (or_count + sr_count == 2)
           fg[fg_thiocarbonic_acid_diester - 1] = true;
       }
      if (s_count == 2)
       {
         fg[fg_thiocarbonic_acid_deriv - 1] = true;
         if (sr_count == 1)
           fg[fg_thiocarbonic_acid_monoester - 1] = true;
         if (sr_count == 2)
           fg[fg_thiocarbonic_acid_diester - 1] = true;
       }
      if (o_count == 1 && n_count == 1)
       {
         fg[fg_carbamic_acid_deriv - 1] = true;
         if (or_count == 0)
           fg[fg_carbamic_acid - 1] = true;
         if (or_count == 1)
           fg[fg_carbamic_acid_ester - 1] = true;
       }
      if (s_count == 1 && n_count == 1)
       {
         fg[fg_thiocarbamic_acid_deriv - 1] = true;
         if (sr_count == 0)
           fg[fg_thiocarbamic_acid - 1] = true;
         if (sr_count == 1)
           fg[fg_thiocarbamic_acid_ester - 1] = true;
       }
      if (n_count == 2)
       {
         if (nn_count == 1)
           fg[fg_semicarbazide - 1] = true;
         else
           {
             if (nnx_count == 0)   /* excludes semicarbazones */
              fg[fg_urea - 1] = true;
           }
       }
    }                       /* end Oxo-C */
  if (is_thioxo_C (a_view))
    {
      if (o_count == 2)
       {
         fg[fg_thiocarbonic_acid_deriv - 1] = true;
         if (or_count == 1)
           fg[fg_thiocarbonic_acid_monoester - 1] = true;
         if (or_count == 2)
           fg[fg_thiocarbonic_acid_diester - 1] = true;
       }
      if (o_count == 1 && s_count == 1)
       {
         fg[fg_thiocarbonic_acid_deriv - 1] = true;
         if (or_count + sr_count == 1)
           fg[fg_thiocarbonic_acid_monoester - 1] = true;
         if (or_count + sr_count == 2)
           fg[fg_thiocarbonic_acid_diester - 1] = true;
       }
      if (s_count == 2)
       {
         fg[fg_thiocarbonic_acid_deriv - 1] = true;
         if (sr_count == 1)
           fg[fg_thiocarbonic_acid_monoester - 1] = true;
         if (sr_count == 2)
           fg[fg_thiocarbonic_acid_diester - 1] = true;
       }
      if (o_count == 1 && n_count == 1)
       {
         fg[fg_thiocarbamic_acid_deriv - 1] = true;
         if (or_count == 0)
           fg[fg_thiocarbamic_acid - 1] = true;
         if (or_count == 1)
           fg[fg_thiocarbamic_acid_ester - 1] = true;
       }
      if (s_count == 1 && n_count == 1)
       {
         fg[fg_thiocarbamic_acid_deriv - 1] = true;
         if (sr_count == 0)
           fg[fg_thiocarbamic_acid - 1] = true;
         if (sr_count == 1)
           fg[fg_thiocarbamic_acid_ester - 1] = true;
       }
      if (n_count == 2)
       {
         if (nn_count == 1)
           fg[fg_thiosemicarbazide - 1] = true;
         else
           {
             if (nnx_count == 0)   /* excludes thiosemicarbazones */
              fg[fg_thiourea - 1] = true;
           }
       }
    }                       /* end Thioxo-C */
  if (!
      (is_true_imino_C (a_view) &
       (bond[get_bond (a_view, a_ref) - 1].arom == false)))
    {
      return;
    }                       /* end Imino-C */
  if (o_count == 1 && n_count == 1)
    fg[fg_isourea - 1] = true;
  if (s_count == 1 && n_count == 1)
    fg[fg_isothiourea - 1] = true;
  if (n_count == 2)
    fg[fg_guanidine - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_double ( int  a1,
int  a2 
) [static]

Definition at line 8316 of file checkmolc.c.

{
  str2 a1_el, a2_el;

  strcpy (a1_el, atom[a1 - 1].element);
  strcpy (a2_el, atom[a2 - 1].element);
  if ((!strcmp (a1_el, "C ") && strcmp (a2_el, "C ")) &
      (bond[get_bond (a1, a2) - 1].arom == false))
    {
      if (hetbond_count (a1) == 2)
       chk_carbonyl_deriv (a1, a2);
      if (hetbond_count (a1) == 3)
       chk_carboxyl_deriv (a1, a2);
      if (hetbond_count (a1) == 4)
       {
         if (!strcmp (atom[a1 - 1].atype, "C2 "))
           chk_co2_sp2 (a1, a2);
         if (!strcmp (atom[a1 - 1].atype, "C1 "))
           chk_co2_sp (a1, a2);
       }
    }                       /* end C=X */
  if ((!strcmp (atom[a1 - 1].atype, "C2 ")
       && !strcmp (atom[a2 - 1].atype,
                 "C2 ")) && (bond[get_bond (a1, a2) - 1].arom == false))
    {
      if ((hetbond_count (a1) == 0) && (hetbond_count (a2) == 2))
       fg[fg_ketene_acetal_deriv - 1] = true;
      if ((hetbond_count (a1) == 0) && (hetbond_count (a2) == 1))
       chk_ccx (a1, a2);
      if ((hetbond_count (a1) == 1) && (hetbond_count (a2) == 1))
       chk_xccx (a1, a2);
      if (((hetbond_count (a1) == 0) && (hetbond_count (a2) == 0)) &&
         atom[a1 - 1].arom == false && atom[a2 - 1].arom == false)
       fg[fg_alkene - 1] = true;
    }
  if (((!strcmp (a1_el, "N ")
       && !strcmp (a2_el,
                  "N ")) && (hetbond_count (a1) ==
                            2) && (hetbond_count (a2) ==
                                  2) && (bond[get_bond (a1, a2) -
                                            1].arom == false))
      && atom[a1 - 1].neighbor_count == 2 && atom[a2 - 1].neighbor_count == 2)
    fg[fg_azo_compound - 1] = true;
  if (!strcmp (a1_el, "N ") && !strcmp (a2_el, "O "))
    chk_n_o_dbl (a1, a2);
  if (!strcmp (a1_el, "S ") && !strcmp (a2_el, "O "))
    chk_sulfoxide (a1, a2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_envelopes ( ) [static]

Definition at line 13835 of file checkmolc.c.

{
  /* new in v0.3d */
  /* checks if a ring completely contains one or more other rings */
  int a, i, j, k, l, pl, pli;
  boolean found_atom, found_all_atoms, found_ring;
  int FORLIM;
  if (n_rings < 2)
    return;
  FORLIM = n_rings;
  for (i = 1; i < FORLIM; i++)
    {
      found_ring = false;
      j = 0;
      pli = ringprop[i].size;      /* path_length(ring^[i]); */
      while (j < i && found_ring == false)
       {
         j++;
         found_all_atoms = true;
         pl = ringprop[j - 1].size;       /* path_length(ring^[j]); */
         for (k = 0; k < pl; k++)
           {
             found_atom = false;
             a = ring[j - 1][k];
             for (l = 0; l < pli; l++)
              {
                if (ring[i][l] == a)
                  found_atom = true;
              }
             if (found_atom == false)
              found_all_atoms = false;
           }
         if (found_all_atoms)
           found_ring = true;
       }
      if (found_ring)
       ringprop[i].envelope = true;
    }
}

Here is the caller graph for this function:

static void chk_functionalgroups ( ) [static]

Definition at line 9168 of file checkmolc.c.

{
  int i, a1, a2;
  char bt;
  int pos_chg = 0, neg_chg = 0;
  int FORLIM;

  if (n_atoms < 1 || n_bonds < 1)
    return;
  FORLIM = n_atoms;
  for (i = 1; i <= FORLIM; i++)
    {                       /* a few groups are best discovered in the atom list */
      if (!strcmp (atom[i - 1].atype, "SO2"))
       chk_so2_deriv (i);
      /*if (atom^[i].atype = 'SO ') then fg[fg_sulfoxide] := true;  (* do another check in the bond list!! */
      if (!strcmp (atom[i - 1].element, "P "))
       chk_p_deriv (i);
      if (!strcmp (atom[i - 1].element, "B "))
       chk_b_deriv (i);
      if (!strcmp (atom[i - 1].atype, "N3+") || atom[i - 1].formal_charge > 0)
       chk_ammon (i);
      if ((strcmp (atom[i - 1].atype, "C3 ") == 0)
         && (hetbond_count (i) == 2))
       chk_carbonyl_deriv_sp3 (i);
      if ((strcmp (atom[i - 1].atype, "C3 ") == 0)
         && (hetbond_count (i) == 3))
       chk_carboxyl_deriv_sp3 (i);
      if (!strcmp (atom[i - 1].atype, "O3 ")
         && atom[i - 1].neighbor_count == 2)
       chk_anhydride (i);
      if ((!strcmp (atom[i - 1].atype, "N3 ")
          || !strcmp (atom[i - 1].atype, "NAM"))
         && atom[i - 1].neighbor_count >= 2)
       chk_imide (i);
      if (atom[i - 1].formal_charge > 0)
       pos_chg += atom[i - 1].formal_charge;
      if (atom[i - 1].formal_charge < 0)
       neg_chg += atom[i - 1].formal_charge;
      chk_ion (i);
    }
  FORLIM = n_bonds;
  for (i = 0; i < FORLIM; i++)
    {                       /* most groups are best discovered in the bond list */
      a1 = bond[i].a1;
      a2 = bond[i].a2;
      bt = bond[i].btype;
      if (atom[a1 - 1].heavy && atom[a2 - 1].heavy)
       {
         orient_bond (&a1, &a2);
         if (bt == 'T')
           chk_triple (a1, a2);
         if (bt == 'D')
           chk_double (a1, a2);
         if (bt == 'S')
           chk_single (a1, a2);
         if (bond[i].arom)
           chk_arom_fg (a1, a2);
       }
    }
  if (n_rings > 0)
    {
      FORLIM = n_rings;
      for (i = 1; i <= FORLIM; i++)
       {
         chk_oxo_thioxo_imino_hetarene (i);
         if (is_arene (i))
           fg[fg_aromatic - 1] = true;
         if (is_heterocycle (i))
           fg[fg_heterocycle - 1] = true;
       }
    }
  if (pos_chg + neg_chg > 0)
    fg[fg_cation - 1] = true;
  if (pos_chg + neg_chg < 0)
    fg[fg_anion - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_imide ( int  a_ref) [static]

Definition at line 8977 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  int acyl_count = 0;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_ref);
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (is_acyl_gen (a_ref, nb[i]) || is_carbamoyl (a_ref, nb[i]))  /* v0.3j */
       acyl_count++;
    }
  if (acyl_count < 2 || strcmp (atom[a_ref - 1].element, "N "))
    /* v0.3j: accept also N-acyl-imides */
    return;
  fg[fg_carboxylic_acid_deriv - 1] = true;
  fg[fg_carboxylic_acid_imide - 1] = true;
  if (atom[a_ref - 1].neighbor_count == 2)
    fg[fg_carboxylic_acid_unsubst_imide - 1] = true;
  if (atom[a_ref - 1].neighbor_count == 3)
    fg[fg_carboxylic_acid_subst_imide - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_imine ( int  a_ref,
int  a_view 
) [static]

Definition at line 7392 of file checkmolc.c.

{
  /* a_ref = C, a_view = N */
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int a_het, a_c;
  int het_count = 0, c_count = 0, o_count = 0;   /* v0.3k */
  int FORLIM;

  /* v0.3k */
  if (atom[a_view - 1].neighbor_count == 1)
    {
      if (atom[a_ref - 1].arom == false)
       fg[fg_imine - 1] = true;
      return;
    }
  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_view);
  if (atom[a_view - 1].neighbor_count <= 1)
    return;
  FORLIM = atom[a_view - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if ((nb[i] != a_ref) && (bond[get_bond (a_view, nb[i]) - 1].btype ==
                            'S'))
       {
         strcpy (nb_el, atom[nb[i] - 1].element);
         if (!strcmp (nb_el, "C "))
           {
             a_c = nb[i];
             c_count++;
           }
         if (!strcmp (nb_el, "O ") || !strcmp (nb_el, "N "))
           {
             a_het = nb[i];
             het_count++;
           }
         if ((!strcmp (nb_el, "O ")
              && atom[nb[i] - 1].neighbor_count ==
              1) && (bond[get_bond (a_view, nb[i]) - 1].arom == false))
           /* v0.3k */
           o_count++;
       }
      if ((nb[i] != a_ref) && (bond[get_bond (a_view, nb[i]) - 1].btype ==
                            'D'))
       {                    /* v0.3k; make sure we do not count nitro groups in "azi" form etc. */
         strcpy (nb_el, atom[nb[i] - 1].element);
         if (!strcmp (nb_el, "O ") || !strcmp (nb_el, "N ")
             || !strcmp (nb_el, "S "))
           {
             a_het = nb[i]; /* v0.3m */
             het_count++;
           }
         if ((!strcmp (nb_el, "O ")
              && atom[nb[i] - 1].neighbor_count ==
              1) && (bond[get_bond (a_view, nb[i]) - 1].arom == false))
           /* v0.3k */
           o_count++;
       }
    }
  if (c_count == 1)
    {
      if ((is_alkyl (a_view, a_c) || is_aryl (a_view, a_c) |
          is_alkenyl (a_view, a_c) || is_alkynyl (a_view, a_c))
         && atom[a_ref - 1].arom == false && het_count == 0)
       /* v0.3k */
       fg[fg_imine - 1] = true;
    }
  if (het_count == 1)
    {
      strcpy (nb_el, atom[a_het - 1].element);
      if (!strcmp (nb_el, "O "))
       {
         if (is_hydroxy (a_view, a_het))
           fg[fg_oxime - 1] = true;
         if (is_alkoxy (a_view, a_het) || is_aryloxy (a_view, a_het) |
             is_alkenyloxy (a_view, a_het) || is_alkynyloxy (a_view, a_het))
           fg[fg_oxime_ether - 1] = true;
       }
      if (!strcmp (nb_el, "N "))
       {
         if (is_amino (a_view, a_het) || is_alkylamino (a_view, a_het) |
             is_dialkylamino (a_view, a_het) || is_alkylarylamino (a_view,
                                                            a_het) |
             is_arylamino (a_view, a_het) || is_diarylamino (a_view, a_het))
           fg[fg_hydrazone - 1] = true;
         else
           {
             memset (nb, 0, sizeof (neighbor_rec));
             get_neighbors (nb, a_het);
             if (atom[a_het - 1].neighbor_count > 1)
              {
                FORLIM = atom[a_het - 1].neighbor_count;
                for (i = 0; i < FORLIM; i++)
                  {
                    if (nb[i] != a_view)
                     {
                       if (is_carbamoyl (a_het, nb[i]))
                         fg[fg_semicarbazone - 1] = true;
                       if (is_thiocarbamoyl (a_het, nb[i]))
                         fg[fg_thiosemicarbazone - 1] = true;
                     }
                  }
              }
           }
       }
    }                       /* v0.3k: nitro groups in "azi" form */
  /* check for semicarbazone or thiosemicarbazone */
  if (het_count == 2 && o_count == 2)
    fg[fg_nitro_compound - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_ion ( int  a_ref) [static]

Definition at line 9144 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  int charge, FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_ref);
  charge = atom[a_ref - 1].formal_charge;
  if (charge == 0)
    /* check if charge is neutralized by an adjacent opposite charge */
    return;
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    charge += atom[nb[i] - 1].formal_charge;
  if (charge > 0)
    fg[fg_cation - 1] = true;
  if (charge < 0)
    fg[fg_anion - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_n_o_dbl ( int  a1,
int  a2 
) [static]

Definition at line 8222 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int or_count = 0, n_count = 0, c_count = 0;
  int b;                    /* v0.3j */
  int het_count = 0;        /* v0.3k */
  char bt;                  /* v0.3k */
  float bo_sum = 0.0;              /* v0.3k */
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a1);
  FORLIM = atom[a1 - 1].neighbor_count;
  /* v0.3k */
  /* v0.3k */
  for (i = 0; i < FORLIM; i++)
    {
      if (nb[i] != a2)
       {
         b = get_bond (a1, nb[i]); /* v0.3j */
         strcpy (nb_el, atom[nb[i] - 1].element);
         bt = bond[b - 1].btype;   /* v0.3k */
         if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
             /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "DU")
             && strcmp (nb_el, "LP") && bond[b - 1].arom == false)
           /* added 'D ' in v0.3n */
           het_count++;
         /* v0.3k: ignore hetero atoms */
         /* in aromatic rings like isoxazole  */
         if (bt == 'S')
           bo_sum += 1.0;
         if (bt == 'D')
           bo_sum += 2.0;
         if (bt == 'A')
           bo_sum += 1.5;
         if (!strcmp (nb_el, "O "))
           or_count++;
         if (!strcmp (nb_el, "N "))
           n_count++;
         if (!strcmp (nb_el, "C ") && bond[b - 1].btype == 'S')       /* v0.3k */
           c_count++;
         /* if (is_alkyl(a1,nb[i])) or (is_aryl(a1,nb[i])) then inc(c_count); */
       }
    }
  if (or_count + n_count + c_count == 1 && atom[a1 - 1].neighbor_count == 2)
    {                       /* excludes nitro etc. */
      if (or_count == 1)
       fg[fg_nitrite - 1] = true;
      if (c_count == 1)
       fg[fg_nitroso_compound - 1] = true;
      if (n_count == 1)            /* instead of nitrosamine  v0.3j */
       fg[fg_nitroso_compound - 1] = true;
      /*if (n_count = 1) then fg[fg_nitrosamine]   := true;  (* still missing */
    }
  /*if ((c_count > 1) and (or_count = 0) and (n_count = 0)) then */
  /*  begin */
  /*    fg[fg_n_oxide] := true; */
  /*  end; */
  /* new approach in v0.3k */
  if (het_count == 0 && bo_sum > 2)       /* =O does not count! */
    fg[fg_n_oxide - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_oxo_thioxo_imino_hetarene ( int  r_id) [static]

Definition at line 9112 of file checkmolc.c.

{
  int i, j;
  ringpath_type testring;
  int ring_size, a_ref;

  if (r_id < 1 || r_id > n_rings)
    return;
  memset (testring, 0, sizeof (ringpath_type));
  ring_size = ringprop[r_id - 1].size;    /* v0.3j */
  /*for j := 1 to max_ringsize do if ring^[r_id,j] > 0 then testring[j] := ring^[r_id,j]; */
  for (j = 0; j < ring_size; j++)  /* v0.3j */
    testring[j] = ring[r_id - 1][j];
  /*ring_size := path_length(testring); */
  /*if (is_arene(r_id)) and (odd(ring_size) = false) then */
  if (!is_arene (r_id))            /* v0.3j */
    return;
  for (i = 0; i < ring_size; i++)
    {
      a_ref = testring[i];
      if (is_oxo_C (a_ref))
       fg[fg_oxohetarene - 1] = true;
      if (is_thioxo_C (a_ref))
       fg[fg_thioxohetarene - 1] = true;
      if (is_true_exocyclic_imino_C (a_ref, r_id))      /* v0.3j */
       fg[fg_iminohetarene - 1] = true;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_p_deriv ( int  a_ref) [static]

Definition at line 7122 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  str2 nb_el, dbl_het;
  int het_count;
  int oh_count = 0, or_count = 0, hal_count = 0, n_count = 0, c_count = 0;
  int FORLIM;

  if (strcmp (atom[a_ref - 1].element, "P "))
    return;
  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_ref);
  *dbl_het = '\0';
/* p2c: checkmol.pas: Note: Eliminated unused assignment statement [338] */
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_ref, nb[i]) - 1].btype == 'D')
       strcpy (dbl_het, atom[nb[i] - 1].element);
      if (bond[get_bond (a_ref, nb[i]) - 1].btype == 'S')
       {
         strcpy (nb_el, atom[nb[i] - 1].element);
         if (!strcmp (nb_el, "C "))
           c_count++;
         if (is_hydroxy (a_ref, nb[i]))
           oh_count++;
         if (is_alkoxy (a_ref, nb[i]) || is_aryloxy (a_ref, nb[i]))
           or_count++;
         if (!strcmp (nb_el, "N "))
           n_count++;
         if (!strcmp (nb_el, "F ") || !strcmp (nb_el, "CL") ||
             !strcmp (nb_el, "BR") || !strcmp (nb_el, "I ")
             || !strcmp (nb_el, "AT"))
           hal_count++;
       }
    }
  het_count = oh_count + or_count + hal_count + n_count;
  if (!strcmp (atom[a_ref - 1].atype, "P3D") ||
      !strcmp (atom[a_ref - 1].atype, "P4 "))
    {
      if (!strcmp (dbl_het, "O "))
       {
         if (c_count == 0)
           {
             fg[fg_phosphoric_acid_deriv - 1] = true;
             if (oh_count == 3)
              fg[fg_phosphoric_acid - 1] = true;
             if (or_count > 0)
              fg[fg_phosphoric_acid_ester - 1] = true;
             if (hal_count > 0)
              fg[fg_phosphoric_acid_halide - 1] = true;
             if (n_count > 0)
              fg[fg_phosphoric_acid_amide - 1] = true;
           }
         if (c_count == 1)
           {
             fg[fg_phosphonic_acid_deriv - 1] = true;
             if (oh_count == 2)
              fg[fg_phosphonic_acid - 1] = true;
             if (or_count > 0)
              fg[fg_phosphonic_acid_ester - 1] = true;
             /*if (hal_count > 0)  then fg[fg_phosphonic_acid_halide] := true;             */
             /*if (n_count > 0)    then fg[fg_phosphonic_acid_amide]  := true; */
           }
         if (c_count == 3)
           fg[fg_phosphinoxide - 1] = true;
       }
      if (!strcmp (dbl_het, "S "))
       {
         if (c_count == 0)
           {
             fg[fg_thiophosphoric_acid_deriv - 1] = true;
             if (oh_count == 3)
              fg[fg_thiophosphoric_acid - 1] = true;
             if (or_count > 0)
              fg[fg_thiophosphoric_acid_ester - 1] = true;
             if (hal_count > 0)
              fg[fg_thiophosphoric_acid_halide - 1] = true;
             if (n_count > 0)
              fg[fg_thiophosphoric_acid_amide - 1] = true;
           }
       }
    }
  /*  if (atom^[a_ref].atype = 'P4 ') then fg[fg_phosphoric_acid_deriv] := true; */
  if (strcmp (atom[a_ref - 1].atype, "P3 "))     /* changed P3D into P3 in v0.3b */
    return;
  if (c_count == 3 && het_count == 0)
    fg[fg_phosphine - 1] = true;
  if (c_count == 3 && oh_count == 1)
    fg[fg_phosphinoxide - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_ringbonds ( ) [static]

Definition at line 4404 of file checkmolc.c.

{
  int i, a1rc, a2rc;

  if (n_bonds < 1)
    return;

  for (i = 0; i < n_bonds; i++)
    {
      a1rc = atom[bond[i].a1 - 1].ring_count;
      a2rc = atom[bond[i].a2 - 1].ring_count;
      if (n_rings == 0 || a1rc < n_rings && a2rc < n_rings)
       {
         is_ringbond (i + 1);
         /*inc(bond^[i].ring_count); */
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_single ( int  a1,
int  a2 
) [static]

Definition at line 8827 of file checkmolc.c.

{
  str2 a1_el, a2_el;

  strcpy (a1_el, atom[a1 - 1].element);
  strcpy (a2_el, atom[a2 - 1].element);
  if (!strcmp (a1_el, "C ") &&
      (!strcmp (a2_el, "F ") || !strcmp (a2_el, "CL")
       || !strcmp (a2_el, "BR") || !strcmp (a2_el, "I ")))
    chk_c_hal (a1, a2);
  if (!strcmp (a1_el, "C ") && !strcmp (a2_el, "O "))
    chk_c_o (a1, a2);
  if (!strcmp (a1_el, "C ") && !strcmp (a2_el, "S "))
    chk_c_s (a1, a2);
  if (!strcmp (a1_el, "C ") && !strcmp (a2_el, "N "))
    chk_c_n (a1, a2);
  if ((strcmp (a1_el, "C ") == 0) && atom[a2 - 1].metal && (is_cyano_c (a1) ==
                                                     false))
    {
      fg[fg_organometallic - 1] = true;
      if (!strcmp (a2_el, "LI"))
       fg[fg_organolithium - 1] = true;
      if (!strcmp (a2_el, "MG"))
       fg[fg_organomagnesium - 1] = true;
    }
  if (!strcmp (a1_el, "C ") && !strcmp (a2_el, "C "))
    chk_c_c (a1, a2);
  if (strcmp (a1_el, "C ") && strcmp (a2_el, "C "))
    chk_x_y_single (a1, a2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_so2_deriv ( int  a_ref) [static]

Definition at line 7039 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int het_count = 0, o_count = 0, or_count = 0, hal_count = 0, n_count = 0,
    c_count = 0;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  if (strcmp (atom[a_ref - 1].atype, "SO2"))
    return;
  get_neighbors (nb, a_ref);
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_ref, nb[i]) - 1].btype == 'S')
       {
         strcpy (nb_el, atom[nb[i] - 1].element);
         if (strcmp (nb_el, "C ") && strcmp (nb_el, "H ")
             /*&&  strcmp (nb_el, "D ") */  && strcmp (nb_el, "DU")
             && strcmp (nb_el, "LP"))
           /* added 'D ' in v0.3n */
           het_count++;
         if (!strcmp (nb_el, "O "))
           {
             o_count++;
             if (is_alkoxy (a_ref, nb[i]) || is_aryloxy (a_ref, nb[i]))
              or_count++;
           }
         if (!strcmp (nb_el, "N "))
           n_count++;
         if (!strcmp (nb_el, "C "))
           c_count++;
         if (!strcmp (nb_el, "F ") || !strcmp (nb_el, "CL") ||
             !strcmp (nb_el, "BR") || !strcmp (nb_el, "I ")
             || !strcmp (nb_el, "AT"))
           hal_count++;
       }
    }
  if (het_count == 2)
    {                       /* sulfuric acid derivative */
      fg[fg_sulfuric_acid_deriv - 1] = true;
      if (o_count == 2)
       {
         if (or_count == 0)
           fg[fg_sulfuric_acid - 1] = true;
         if (or_count == 1)
           fg[fg_sulfuric_acid_monoester - 1] = true;
         if (or_count == 2)
           fg[fg_sulfuric_acid_diester - 1] = true;
       }
      if (o_count == 1)
       {
         if (or_count == 1 && n_count == 1)
           fg[fg_sulfuric_acid_amide_ester - 1] = true;
         if (or_count == 0 && n_count == 1)
           fg[fg_sulfuric_acid_amide - 1] = true;
       }
      if (n_count == 2)
       fg[fg_sulfuric_acid_diamide - 1] = true;
      if (hal_count > 0)
       fg[fg_sulfuryl_halide - 1] = true;
    }
  if (het_count == 1 && c_count == 1)
    {                       /* sulfonic acid derivative */
      fg[fg_sulfonic_acid_deriv - 1] = true;
      if (o_count == 1 && or_count == 0)
       fg[fg_sulfonic_acid - 1] = true;
      if (o_count == 1 && or_count == 1)
       fg[fg_sulfonic_acid_ester - 1] = true;
      if (n_count == 1)
       fg[fg_sulfonamide - 1] = true;
      if (hal_count == 1)
       fg[fg_sulfonyl_halide - 1] = true;
    }
  if (het_count == 0 && c_count == 2)     /* sulfone */
    fg[fg_sulfone - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_sulfoxide ( int  a1,
int  a2 
) [static]

Definition at line 8290 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  str2 nb_el;
  int o_count = 0, c_count = 0;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a1);
  FORLIM = atom[a1 - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      strcpy (nb_el, atom[nb[i] - 1].element);
      if (!strcmp (nb_el, "O "))
       o_count++;
      if (is_alkyl (a1, nb[i]) || is_aryl (a1, nb[i]))
       c_count++;
    }
  if (o_count == 1 && c_count == 2)
    fg[fg_sulfoxide - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_triple ( int  a1,
int  a2 
) [static]

Definition at line 8111 of file checkmolc.c.

{
  str2 a1_el, a2_el;

  strcpy (a1_el, atom[a1 - 1].element);
  strcpy (a2_el, atom[a2 - 1].element);
  if ((!strcmp (a1_el, "C ") && !strcmp (a2_el, "C ")) &
      (bond[get_bond (a1, a2) - 1].arom == false))
    fg[fg_alkyne - 1] = true;
  if (is_nitrile (a1, a2))
    fg[fg_nitrile - 1] = true;
  if (is_isonitrile (a1, a2))
    fg[fg_isonitrile - 1] = true;
  if (is_cyanate (a1, a2))
    fg[fg_cyanate - 1] = true;
  if (is_thiocyanate (a1, a2))
    fg[fg_thiocyanate - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_wildcard_rings ( ) [static]

Definition at line 13942 of file checkmolc.c.

{

  int i, j, rs;
  int a1, a2, b;
  boolean wcr;
  str3 at;
  char bt;

  if (ndl_querymol == false)
    return;
  if (ndl_n_rings == 0)
    return;
  // now look for any not-yet-aromatic rings which contain a wildcard
  for (i = 0; i < ndl_n_rings; i++)
    {
      wcr = false;
      if (ndl_ringprop[i].arom == false)
       {
         rs = ndl_ringprop[i].size;
         a2 = ndl_ring[i][rs];
         for (j = 0; j < rs; j++)
           {
             a1 = ndl_ring[i][j];
             b = get_ndl_bond (a1, a2);
             strcpy (at, ndl_atom[a1].atype);
             bt = ndl_bond[b].btype;
             if (!strcmp (at, "A  ") || !strcmp (at, "Q  "))
              wcr = true;
             if (bt == 'l' || bt == 's' || bt == 'd' || bt == 'a')
              wcr = true;
             a2 = a1;
           }
         if (wcr)
           {                // if yes, flag all atoms and bonds in this ring as "potentially" aromatic
             // {$IFDEF debug}
             // debugoutput('wildcard ring found');
             // {$ENDIF}
             a2 = ndl_ring[i][rs];
             for (j = 0; j < rs; j++)
              {
                a1 = ndl_ring[i][j];
                b = get_ndl_bond (a1, a2);
                strcpy (at, ndl_atom[a1].atype);
                bt = ndl_bond[b].btype;
                ndl_atom[a1].q_arom = true;
                ndl_bond[b].q_arom = true;
                a2 = a1;
              }
           }
       }
    }
  // and now undo this flagging for all rings which contain no wildcard
  for (i = 0; i < ndl_n_rings; i++)
    {
      wcr = false;
      rs = ndl_ringprop[i].size;
      a2 = ndl_ring[i][rs];
      for (j = 0; j < rs; j++)
       {
         a1 = ndl_ring[i][j];
         b = get_ndl_bond (a1, a2);
         strcpy (at, ndl_atom[a1].atype);
         bt = ndl_bond[b].btype;
         if (!strcmp (at, "A  ") || !strcmp (at, "Q  "))
           wcr = true;
         if (bt == 'l' || bt == 's' || bt == 'd' || bt == 'a')
           wcr = true;
         a2 = a1;
       }
      if (!wcr)
       {                    // if yes, unflag all atoms and bonds in this ring
         a2 = ndl_ring[i][rs];
         for (j = 0; j < rs; j++)
           {
             a1 = ndl_ring[i][j];
             b = get_ndl_bond (a1, a2);
             strcpy (at, ndl_atom[a1].atype);
             bt = ndl_bond[b].btype;
             ndl_atom[a1].q_arom = false;
             ndl_bond[b].q_arom = false;
             a2 = a1;
           }
       }
    }
  // some further refinement would be necessary here in order to unflag everything
  // which contains a wildcard but which definitely cannot be aromatic
}

Here is the call graph for this function:

static void chk_x_y_single ( int  a_view,
int  a_ref 
) [static]

Definition at line 8769 of file checkmolc.c.

{
  if (!strcmp (atom[a_view - 1].atype, "O3 ") &&
      !strcmp (atom[a_ref - 1].atype, "O3 "))
    {
      if (is_hydroxy (a_ref, a_view) || is_hydroxy (a_view, a_ref))
       fg[fg_hydroperoxide - 1] = true;
      if ((is_alkoxy (a_ref, a_view) || is_aryloxy (a_ref, a_view) |
          is_siloxy (a_ref, a_view)) && (is_alkoxy (a_view,
                                               a_ref) |
                                     is_aryloxy (a_view,
                                                a_ref) |
                                     is_siloxy (a_view, a_ref)))
       fg[fg_peroxide - 1] = true;
    }                       /* still missing: peracid */
  if (!strcmp (atom[a_view - 1].atype, "S3 ") &&
      !strcmp (atom[a_ref - 1].atype, "S3 "))
    {
      if (atom[a_view - 1].neighbor_count == 2 &&
         atom[a_ref - 1].neighbor_count == 2)
       fg[fg_disulfide - 1] = true;
    }
  if ((!strcmp (atom[a_view - 1].element, "N ") &&
       !strcmp (atom[a_ref - 1].element,
              "N ")) && (hetbond_count (a_view) ==
                        1) && (hetbond_count (a_ref) == 1))
    {
      /*if ((is_amino(a_ref,a_view)) or  */
      /*    (is_subst_amino(a_ref,a_view)) or */
      /*    (is_acylamino(a_ref,a_view))) and */
      /*   ((is_amino(a_view,a_ref)) or  */
      /*    (is_subst_amino(a_view,a_ref)) or */
      /*    (is_acylamino(a_ref,a_view))) then  */
      if (bond[get_bond (a_view, a_ref) - 1].arom == false)
       fg[fg_hydrazine - 1] = true;
    }
  if (!strcmp (atom[a_view - 1].element, "N ") &&
      !strcmp (atom[a_ref - 1].atype, "O3 "))
    {                       /* bond is in "opposite" direction */
      if ((is_alkoxy (a_view, a_ref) || is_aryloxy (a_view, a_ref)) &
         is_nitro (a_ref, a_view))
       fg[fg_nitrate - 1] = true;
      if ((is_nitro (a_ref, a_view) == false
          && atom[a_view - 1].arom == false) && (is_amino (a_ref,
                                                     a_view) |
                                            is_subst_amino (a_ref,
                                                          a_view)) &
         (is_acylamino (a_ref, a_view) == false))
       fg[fg_hydroxylamine - 1] = true;   /* new in v0.3c */
    }
  if (!strcmp (atom[a_view - 1].element, "S ") &&
      !strcmp (atom[a_ref - 1].element, "O "))
    chk_sulfoxide (a_view, a_ref);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void chk_xccx ( int  a_view,
int  a_ref 
) [static]

Definition at line 8171 of file checkmolc.c.

{
  int i;
  neighbor_rec nb;
  int oh_count = 0, or_count = 0, n_count = 0;
  int FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_view);
  FORLIM = atom[a_view - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_view, nb[i]) - 1].btype == 'S')
       {
         if (is_hydroxy (a_view, nb[i]))
           oh_count++;
         if (is_alkoxy (a_view, nb[i]) || is_aryloxy (a_view, nb[i]) |
             is_siloxy (a_view, nb[i]))
           or_count++;
         if (!strcmp (atom[nb[i] - 1].atype, "N3 ") ||
             !strcmp (atom[nb[i] - 1].atype, "NAM"))
           n_count++;
       }
    }
  memset (nb, 0, sizeof (neighbor_rec));
  get_neighbors (nb, a_ref);
  FORLIM = atom[a_ref - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (a_ref, nb[i]) - 1].btype == 'S')
       {
         if (is_hydroxy (a_ref, nb[i]))
           oh_count++;
         if (is_alkoxy (a_ref, nb[i]) || is_aryloxy (a_ref, nb[i]) |
             is_siloxy (a_ref, nb[i]))
           or_count++;
         if (!strcmp (atom[nb[i] - 1].atype, "N3 ") ||
             !strcmp (atom[nb[i] - 1].atype, "NAM"))
           n_count++;
       }
    }
  if (oh_count == 2)
    fg[fg_enediol - 1] = true;
  /* new in v0.2f   (regard anything else as an alkene) */
  if (oh_count + or_count + n_count == 0)
    fg[fg_alkene - 1] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void clear_atom_tags ( ) [static]

Definition at line 1138 of file checkmolc.c.

{
  int i, FORLIM;

  if (n_atoms > 0)
    {
      FORLIM = n_atoms;
      for (i = 0; i < FORLIM; i++)
       atom[i].tag = false;
    }
}

Here is the caller graph for this function:

static void clear_ndl_atom_tags ( ) [static]

Definition at line 1221 of file checkmolc.c.

{
  int i;

  if (ndl_n_atoms > 0)
    {

      for (i = 0; i < ndl_n_atoms; i++)
       ndl_atom[i].tag = false;
    }
}

Here is the caller graph for this function:

static void clear_rings ( ) [static]

Definition at line 13733 of file checkmolc.c.

{
  int i, FORLIM;
  n_rings = 0;
  memset (ring, 0, sizeof (ringlist));
  for (i = 0; i < max_rings; i++)
    {                       /* new in v0.3 */
      ringprop[i].size = 0;
      ringprop[i].arom = false;
      ringprop[i].envelope = false;
    }
  if (n_atoms > 0)
    {
      FORLIM = n_atoms;
      for (i = 0; i < FORLIM; i++)
       atom[i].ring_count = 0;
    }
  if (n_bonds > 0)
    {
      FORLIM = n_bonds;
      for (i = 0; i < FORLIM; i++)
       bond[i].ring_count = 0;
    }
}

Here is the caller graph for this function:

static char* convert_MDLtype ( char *  Result,
char *  oldtype 
) [static]

Definition at line 2479 of file checkmolc.c.

{
  str3 newtype;

  /*  NewType := Copy(OldType,1,3); */
  /*  For i := 1 To 3 Do NewType[i] := UpCase(NewType[i]); */
  /*  If NewType[1] = '~' Then NewType := 'VAL'; */
  /*  If NewType[1] = '*' Then NewType := 'STR'; */
  strcpy (newtype, "DU ");
  if (!strcmp (oldtype, "H  "))
    strcpy (newtype, "H  ");
  if (!strcmp (oldtype, "C  "))
    strcpy (newtype, "C3 ");
  if (!strcmp (oldtype, "O  "))
    strcpy (newtype, "O2 ");
  if (!strcmp (oldtype, "N  "))
    strcpy (newtype, "N3 ");
  if (!strcmp (oldtype, "F  "))
    strcpy (newtype, "F  ");
  if (!strcmp (oldtype, "Cl "))
    strcpy (newtype, "CL ");
  if (!strcmp (oldtype, "Br "))
    strcpy (newtype, "BR ");
  if (!strcmp (oldtype, "I  "))
    strcpy (newtype, "I  ");
  if (!strcmp (oldtype, "Al "))
    strcpy (newtype, "AL ");
  if (!strcmp (oldtype, "ANY"))
    strcpy (newtype, "A  ");
  if (!strcmp (oldtype, "Ca "))
    strcpy (newtype, "CA ");
  if (!strcmp (oldtype, "Du "))
    strcpy (newtype, "DU ");
  if (!strcmp (oldtype, "K  "))
    strcpy (newtype, "K  ");
  if (!strcmp (oldtype, "Li "))
    strcpy (newtype, "LI ");
  if (!strcmp (oldtype, "LP "))
    strcpy (newtype, "LP ");
  if (!strcmp (oldtype, "Na "))
    strcpy (newtype, "NA ");
  if (!strcmp (oldtype, "P  "))
    strcpy (newtype, "P3 ");
  if (!strcmp (oldtype, "S  "))
    strcpy (newtype, "S3 ");
  if (!strcmp (oldtype, "Si "))
    strcpy (newtype, "SI ");
  if (!strcmp (oldtype, "P  "))
    strcpy (newtype, "P4 ");
  if (!strcmp (oldtype, "A  "))
    strcpy (newtype, "A  ");
  if (!strcmp (oldtype, "Q  "))
    strcpy (newtype, "Q  ");
  return strcpy (Result, newtype);
}

Here is the caller graph for this function:

static char* convert_sybtype ( char *  Result,
char *  oldtype 
) [static]

Definition at line 2379 of file checkmolc.c.

{
  str3 newtype;

  /*  NewType := Copy(OldType,1,3); */
  /*  For i := 1 To 3 Do NewType[i] := UpCase(NewType[i]); */
  /*  If NewType[1] = '~' Then NewType := 'VAL'; */
  /*  If NewType[1] = '*' Then NewType := 'STR'; */
  strcpy (newtype, "DU ");
  if (!strcmp (oldtype, "H    "))
    strcpy (newtype, "H  ");
  if (!strcmp (oldtype, "C.ar "))
    strcpy (newtype, "CAR");
  if (!strcmp (oldtype, "C.2  "))
    strcpy (newtype, "C2 ");
  if (!strcmp (oldtype, "C.3  "))
    strcpy (newtype, "C3 ");
  if (!strcmp (oldtype, "C.1  "))
    strcpy (newtype, "C1 ");
  if (!strcmp (oldtype, "O.2  "))
    strcpy (newtype, "O2 ");
  if (!strcmp (oldtype, "O.3  "))
    strcpy (newtype, "O3 ");
  if (!strcmp (oldtype, "O.co2"))
    strcpy (newtype, "O2 ");
  if (!strcmp (oldtype, "O.spc"))
    strcpy (newtype, "O3 ");
  if (!strcmp (oldtype, "O.t3p"))
    strcpy (newtype, "O3 ");
  if (!strcmp (oldtype, "N.1  "))
    strcpy (newtype, "N1 ");
  if (!strcmp (oldtype, "N.2  "))
    strcpy (newtype, "N2 ");
  if (!strcmp (oldtype, "N.3  "))
    strcpy (newtype, "N3 ");
  if (!strcmp (oldtype, "N.pl3"))
    strcpy (newtype, "NPL");
  if (!strcmp (oldtype, "N.4  "))
    strcpy (newtype, "N3+");
  if (!strcmp (oldtype, "N.am "))
    strcpy (newtype, "NAM");
  if (!strcmp (oldtype, "N.ar "))
    strcpy (newtype, "NAR");
  if (!strcmp (oldtype, "F    "))
    strcpy (newtype, "F  ");
  if (!strcmp (oldtype, "Cl   "))
    strcpy (newtype, "CL ");
  if (!strcmp (oldtype, "Br   "))
    strcpy (newtype, "BR ");
  if (!strcmp (oldtype, "I    "))
    strcpy (newtype, "I  ");
  if (!strcmp (oldtype, "Al   "))
    strcpy (newtype, "AL ");
  if (!strcmp (oldtype, "ANY  "))
    strcpy (newtype, "A  ");
  if (!strcmp (oldtype, "Ca   "))
    strcpy (newtype, "CA ");
  if (!strcmp (oldtype, "Du   "))
    strcpy (newtype, "DU ");
  if (!strcmp (oldtype, "Du.C "))
    strcpy (newtype, "DU ");
  if (!strcmp (oldtype, "H.spc"))
    strcpy (newtype, "H  ");
  if (!strcmp (oldtype, "H.t3p"))
    strcpy (newtype, "H  ");
  if (!strcmp (oldtype, "HAL  "))
    strcpy (newtype, "Cl ");
  if (!strcmp (oldtype, "HET  "))
    strcpy (newtype, "Q  ");
  if (!strcmp (oldtype, "HEV  "))
    strcpy (newtype, "DU ");
  if (!strcmp (oldtype, "K    "))
    strcpy (newtype, "K  ");
  if (!strcmp (oldtype, "Li   "))
    strcpy (newtype, "LI ");
  if (!strcmp (oldtype, "LP   "))
    strcpy (newtype, "LP ");
  if (!strcmp (oldtype, "Na   "))
    strcpy (newtype, "NA ");
  if (!strcmp (oldtype, "P.3  "))
    strcpy (newtype, "P3 ");
  if (!strcmp (oldtype, "S.2  "))
    strcpy (newtype, "S2 ");
  if (!strcmp (oldtype, "S.3  "))
    strcpy (newtype, "S3 ");
  if (!strcmp (oldtype, "S.o  "))
    strcpy (newtype, "SO ");
  if (!strcmp (oldtype, "S.o2 "))
    strcpy (newtype, "SO2");
  if (!strcmp (oldtype, "Si   "))
    strcpy (newtype, "SI ");
  if (!strcmp (oldtype, "P.4  "))
    strcpy (newtype, "P4 ");
  return strcpy (Result, newtype);
}

Here is the caller graph for this function:

static char* convert_type ( char *  Result,
char *  oldtype 
) [static]

Definition at line 2360 of file checkmolc.c.

{
  int i;
  str3 newtype;

  sprintf (newtype, "%.3s", oldtype);
  for (i = 0; i <= 2; i++)
    newtype[i] = toupper (newtype[i]);
  if (newtype[0] == '~')
    strcpy (newtype, "VAL");
  if (newtype[0] == '*')
    strcpy (newtype, "STR");
  return strcpy (Result, newtype);
}

Here is the caller graph for this function:

static void copy_mol_to_needle ( ) [static]

Definition at line 10912 of file checkmolc.c.

{
  //int i, j, FORLIM;

  /*if (n_atoms == 0)
     return; *///If a NoStruct is read, this leads to madness and illegal memory access


  ndl_atom = (atom_rec *) safe_calloc (n_atoms, sizeof (atom_rec));
  ndl_bond = (bond_rec *) safe_calloc (n_bonds, sizeof (bond_rec));
  ndl_ring = (ringpath_type *) safe_calloc (1, sizeof (ringlist));
  ndl_ringprop = (ringprop_rec *) safe_calloc (1, sizeof (ringprop_type));


  ndl_n_atoms = n_atoms;
  ndl_n_bonds = n_bonds;
  ndl_n_rings = n_rings;
  ndl_n_heavyatoms = n_heavyatoms;
  ndl_n_heavybonds = n_heavybonds;
  strcpy (ndl_molname, molname);
  ndl_n_Ctot = n_Ctot;
  ndl_n_Otot = n_Otot;
  ndl_n_Ntot = n_Ntot;
  memcpy (ndl_atom, atom, n_atoms * sizeof (atom_rec));

  if (n_bonds > 0)
    memcpy (ndl_bond, bond, n_bonds * sizeof (bond_rec));

  if (n_rings > 0)
    {
      memcpy (ndl_ring, ring, sizeof (ringlist));
      memcpy (ndl_ringprop, ringprop, sizeof (ringprop_type));
    }

  memcpy (&ndl_molstat, &molstat, sizeof (molstat));


  // make sure some modes can be switched on only by the query file 
  // and not by subsequent haystack file(s) 
  if (ez_flag)                     // new in v0.3f 
    ez_search = true;

  if (chir_flag)            // new in v0.3f 
    rs_search = true;

  ndl_querymol = found_querymol;   /* 0.3p */

}

Here is the call graph for this function:

Here is the caller graph for this function:

static void copy_mol_to_tmp ( ) [static]

Definition at line 10962 of file checkmolc.c.

{
  //int i, j, FORLIM;

  /*if (n_atoms == 0)
     return; *///If a NoStruct is read, this leads to madness and illegal memory access


  tmp_atom = (atom_rec *) safe_calloc (n_atoms, sizeof (atom_rec));
  tmp_bond = (bond_rec *) safe_calloc (n_bonds, sizeof (bond_rec));
  tmp_ring = (ringpath_type *) safe_calloc (1, sizeof (ringlist));
  tmp_ringprop = (ringprop_rec *) safe_calloc (1, sizeof (ringprop_type));


  tmp_n_atoms = n_atoms;
  tmp_n_bonds = n_bonds;
  tmp_n_rings = n_rings;
  tmp_n_heavyatoms = n_heavyatoms;
  tmp_n_heavybonds = n_heavybonds;
  strcpy (tmp_molname, molname);
  tmp_n_Ctot = n_Ctot;
  tmp_n_Otot = n_Otot;
  tmp_n_Ntot = n_Ntot;
  memcpy (tmp_atom, atom, n_atoms * sizeof (atom_rec));

  if (n_bonds > 0)
    memcpy (tmp_bond, bond, n_bonds * sizeof (bond_rec));

  if (n_rings > 0)
    {
      memcpy (tmp_ring, ring, sizeof (ringlist));
      memcpy (tmp_ringprop, ringprop, sizeof (ringprop_type));
    }

  memcpy (&tmp_molstat, &molstat, sizeof (molstat));


  // make sure some modes can be switched on only by the query file 
  // and not by subsequent haystack file(s) 
  if (ez_flag)                     // new in v0.3f 
    ez_search = true;

  if (chir_flag)            // new in v0.3f 
    rs_search = true;

  ndl_querymol = found_querymol;   /* 0.3p */

}

Here is the call graph for this function:

Here is the caller graph for this function:

static void copy_tmp_to_mol ( ) [static]

Definition at line 11161 of file checkmolc.c.

{
  //int i, j, FORLIM;

  /*if (n_atoms == 0)
     return; *///If a NoStruct is read, this leads to madness and illegal memory access


  atom = (atom_rec *) safe_calloc (n_atoms, sizeof (atom_rec));
  bond = (bond_rec *) safe_calloc (n_bonds, sizeof (bond_rec));
  ring = (ringpath_type *) safe_calloc (1, sizeof (ringlist));
  ringprop = (ringprop_rec *) safe_calloc (1, sizeof (ringprop_type));


  n_atoms = tmp_n_atoms;
  n_bonds = tmp_n_bonds;
  n_rings = tmp_n_rings;
  n_heavyatoms = tmp_n_heavyatoms;
  n_heavybonds = tmp_n_heavybonds;
  strcpy (molname, tmp_molname);
  n_Ctot = tmp_n_Ctot;
  n_Otot = tmp_n_Otot;
  n_Ntot = tmp_n_Ntot;
  memcpy (atom, tmp_atom, tmp_n_atoms * sizeof (atom_rec));

  if (tmp_n_bonds > 0)
    memcpy (bond, tmp_bond, tmp_n_bonds * sizeof (bond_rec));

  if (tmp_n_rings > 0)
    {
      memcpy (ring, tmp_ring, sizeof (ringlist));
      memcpy (ringprop, tmp_ringprop, sizeof (ringprop_type));
    }

  memcpy (&molstat, &tmp_molstat, sizeof (tmp_molstat));


  // make sure some modes can be switched on only by the query file 
  // and not by subsequent haystack file(s) 
  if (ez_flag)                     // new in v0.3f 
    ez_search = true;

  if (chir_flag)            // new in v0.3f 
    rs_search = true;

}

Here is the call graph for this function:

Here is the caller graph for this function:

static int count_aromatic_rings ( ) [static]

Definition at line 13817 of file checkmolc.c.

{
  int i;
  int n = 0;
  int FORLIM;
  if (n_rings <= 0)
    return n;
  FORLIM = n_rings;
  for (i = 0; i < FORLIM; i++)
    {
      if (ringprop[i].arom)
       n++;
    }
  return n;
}

Here is the caller graph for this function:

static void count_neighbors ( ) [static]

Definition at line 3701 of file checkmolc.c.

{
  /* counts heavy-atom neighbors and explicit hydrogens */
  int i, FORLIM;

  if (n_atoms < 1 || n_bonds < 1)
    return;
  FORLIM = n_bonds;
  for (i = 0; i < FORLIM; i++)
    {
      if (atom[bond[i].a1 - 1].heavy)
       atom[bond[i].a2 - 1].neighbor_count++;
      if (atom[bond[i].a2 - 1].heavy)
       atom[bond[i].a1 - 1].neighbor_count++;
      if (!strcmp (atom[bond[i].a1 - 1].element, "H "))
       atom[bond[i].a2 - 1].Hexp++;
      if (!strcmp (atom[bond[i].a2 - 1].element, "H "))
       atom[bond[i].a1 - 1].Hexp++;
      /* plausibility check (new in v02.i) */
      if (atom[bond[i].a1 - 1].neighbor_count > max_neighbors ||
         atom[bond[i].a2 - 1].neighbor_count > max_neighbors)
       {
         mol_OK = false;
         /*writeln('invalid molecule!'); */
       }
    }
}

Here is the caller graph for this function:

static int count_tagged_ndl_heavyatoms ( ) [static]

Definition at line 1249 of file checkmolc.c.

{
  int i;
  int n = 0;

  if (ndl_n_atoms < 1)
    return n;

  for (i = 0; i < ndl_n_atoms; i++)
    {
      if (ndl_atom[i].heavy && ndl_atom[i].tag)
       n++;
    }
  return n;
}

Here is the caller graph for this function:

static p_3d cross_prod ( p_3d  p1,
p_3d  p2,
p_3d  p3 
) [static]

Definition at line 1360 of file checkmolc.c.

{
  p_3d p, orig_p1;

  orig_p1 = p1;
  p = subtract_3d (p2, p1);
  p2 = p;
  p = subtract_3d (p3, p1);
  p3 = p;
  p.x = p2.y * p3.z - p2.z * p3.y;
  p.y = p2.z * p3.x - p2.x * p3.z;
  p.z = p2.x * p3.y - p2.y * p3.x;
  return (add_3d (orig_p1, p));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static double ctorsion ( p_3d  p1,
p_3d  p2,
p_3d  p3,
p_3d  p4 
) [static]

Definition at line 1447 of file checkmolc.c.

{
  /* calculates "pseudo-torsion" defined by atoms 3 and 4, being both */
  /* attached to atom 2, with respect to axis of atoms 1 and 2 */
  p_3d lp1, lp2, lp3, lp4;
  /*d1 : p_3d; */
  p_3d c1, c2;
  double res;
  p_3d c1xc2, c2xc1;
  double dist1, dist2, sign;

  /* copy everything into local variables */
  lp1 = p1;
  lp2 = p2;
  lp3 = p3;
  lp4 = p4;
  /* get the cross product vectors */
  c1 = cross_prod (lp2, lp1, lp3);
  c2 = cross_prod (lp2, lp1, lp4);
  res = angle_3d (p2, c1, c2);
  /*now check if it is clockwise or anticlockwise: */
  /*first, make the cross products of the two cross products c1 and c2 (both ways) */
  c1xc2 = cross_prod (lp2, c1, c2);
  c2xc1 = cross_prod (lp2, c2, c1);
  /*next, get the distances from these points to our refernce point lp1 */
  dist1 = dist3d (lp1, c1xc2);
  dist2 = dist3d (lp1, c2xc1);
  if (dist1 <= dist2)
    sign = 1.0;
  else
    sign = -1.0;
  return (sign * res);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int cv_count ( ) [static]

Definition at line 12109 of file checkmolc.c.

{
  /* new in v0.3j, modified in v0.3m */
  int i, j;
  int cvlist[max_atoms];
  int cvdef;
  boolean isnew;
  int entries = 0;
  int FORLIM;

  if (cv == NULL)
    return 0;
  memset (cvlist, 0, sizeof (int) * max_atoms);
  FORLIM = ndl_n_atoms;
  for (i = 0; i < FORLIM; i++)
    {
      if (ndl_atom[i].heavy == true)
       {
         cvdef = cv[i].def;
         isnew = true;
         if (entries > 0)
           {
             for (j = 0; j < entries; j++)
              {
                if (cvlist[j] == cvdef)
                  isnew = false;
              }
           }
         if (isnew)
           {
             entries++;
             cvlist[entries - 1] = cvdef;
           }
         /* now we have a list of unique connection values */
       }
    }
  return entries;
}

Here is the caller graph for this function:

static void cv_init ( ) [static]

Definition at line 12094 of file checkmolc.c.

{
  /* new in v0.3j */
  int i;

  if (cv == NULL)
    return;
  memset (cv, 0, sizeof (connval_type));

  for (i = 0; i < ndl_n_atoms; i++)
    cv[i].def = ndl_atom[i].neighbor_count;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int cv_iterate ( int  n_cv_prev) [static]

Definition at line 12150 of file checkmolc.c.

{
  /* new in v0.3j, modified in v0.3m */
  int Result, i, j;
  neighbor_rec nb;
  int nnb, nsum, n_cv, FORLIM;

  if (cv == NULL || ndl_n_atoms == 0)
    return Result;
  FORLIM = ndl_n_atoms;
  /* update the connection values (Morgan algorithm) */

  memset (nb, 0, sizeof (neighbor_rec));

  for (i = 1; i <= FORLIM; i++)
    {
      if (ndl_atom[i - 1].heavy == true)
       {
         get_ndl_neighbors (nb, i);
         nnb = ndl_atom[i - 1].neighbor_count;
         nsum = 0;
         if (nnb > 0)
           {
             for (j = 0; j < nnb; j++)
              {
                if (ndl_atom[nb[j] - 1].heavy == true)
                  nsum += cv[nb[j] - 1].def;
              }
           }
         cv[i - 1].tmp = nsum;
       }
    }
  n_cv = cv_count ();
  if (n_cv > n_cv_prev)
    {
      FORLIM = ndl_n_atoms;
      for (i = 0; i < FORLIM; i++)
       cv[i].def = cv[i].tmp;
    }
  return n_cv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void debugoutput ( char *  dstr) [static]

Definition at line 1053 of file checkmolc.c.

{
  if (opt_debug)
    printf ("%s\n", dstr);
}
static double dist3d ( p_3d  p1,
p_3d  p2 
) [static]

Definition at line 1270 of file checkmolc.c.

{
  double res, TEMP, TEMP1, TEMP2;

  TEMP = p1.x - p2.x;
  TEMP1 = p1.y - p2.y;
  TEMP2 = p1.z - p2.z;
  res = sqrt (TEMP * TEMP + TEMP1 * TEMP1 + TEMP2 * TEMP2);
  return res;
}

Here is the caller graph for this function:

static boolean file_exists ( const char *  fileName) [static]

Definition at line 842 of file checkmolc.c.

{
  struct stat filestat;

  return stat (fileName, &filestat) == 0 ? true : false;
}

Here is the caller graph for this function:

static int find_exocyclic_methylene_C ( int  id,
int  r_id 
) [static]

Definition at line 4794 of file checkmolc.c.

{
  /* renamed and rewritten in v0.3j */
  int i, j;
  int r = 0;
  neighbor_rec nb;
  ringpath_type testring;
  int ring_size, FORLIM;

  memset (nb, 0, sizeof (neighbor_rec));
  if (id < 1 || id > n_atoms)
    return 0;
  get_neighbors (nb, id);
  memset (testring, 0, sizeof (ringpath_type));
  ring_size = ringprop[r_id - 1].size;    /* v0.3j */
  for (j = 0; j < ring_size; j++)  /* v0.3j */
    testring[j] = ring[r_id - 1][j];
  if (strcmp (atom[id - 1].element, "C ") || atom[id - 1].neighbor_count <= 0)
    return r;
  FORLIM = atom[id - 1].neighbor_count;
  for (i = 0; i < FORLIM; i++)
    {
      if (bond[get_bond (id, nb[i]) - 1].btype == 'D' &&
         !strcmp (atom[nb[i] - 1].element, "C "))
       {
         r = nb[i];
         for (j = 0; j < ring_size; j++)
           {
             if (nb[i] == ring[r_id - 1][j])
              r = 0;
           }
       }
    }
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int find_ndl_ref_atom ( ) [static]

Definition at line 12028 of file checkmolc.c.

{
  int Result, i;
  int score = -1, index = 0;
  int n_nb, n_hc, FORLIM;

  /* finds a characteristic atom in the needle molecule, */
  /* i.e., one with as many substituents as possible and */
  /* with as many heteroatom substitutents as possible; */
  /* added in v0.2d: make sure that reference atom is a heavy atom */
  /* and not (accidentally) an explicit hydrogen; */
  /* new in v0.3d: special treatment in case of E/Z geometry search */
  /* to ensure that the entire A-B=C-D fragment is enclosed in one */
  /* matchpath, regardless where the recursive search starts; */
  /* refined in v0.3f: exclude only alkene-C as reference atoms */
  /* added in v0.3o: needle atom must be "tagged" in order to be */
  /* selected (prevents unconnected fragments from being overlooked) */
  if (ndl_n_atoms == 0)
    return Result;
  if (ez_search && ndl_n_heavyatoms > 2)
    {
      FORLIM = ndl_n_atoms;
      for (i = 1; i <= FORLIM; i++)
       {                    /* ignore sp2-carbons if not aromatic */
         /*if ((ndl_atom^[i].atype <> 'C2 ') or (ndl_atom^[i].arom = true)) then */
         if (ndl_alkene_C (i) == false && ndl_atom[i - 1].tag)
           {                /* v0.3o */
             n_nb = ndl_atom[i - 1].neighbor_count;
             n_hc = ndl_hetatom_count (i);
             if (n_nb * 11 + n_hc * 7 > score && ndl_atom[i - 1].heavy)
              {
                /* v0.3j */
                index = i;
                score = n_nb * 11 + n_hc * 7;    /* changed in v0.3j */
              }
           }
       }
    }
  /* it is possible that no suitable reference atom has been found here */
  /* (e.g., with "pure" polyenes), so we need a fallback option anyway */
  if (index == 0)
    {
      ez_search = false;    /* just in case it was true */
      opt_geom = false;            /* just in case it was true */
      FORLIM = ndl_n_atoms;
      for (i = 1; i <= FORLIM; i++)
       {
         n_nb = ndl_atom[i - 1].neighbor_count;
         n_hc = ndl_hetatom_count (i);
         if (n_nb * 11 + n_hc * 7 > score && ndl_atom[i - 1].heavy &&
             ndl_atom[i - 1].tag)
           {                /* v0.3j */
             index = i;
             score = n_nb * 11 + n_hc * 7;       /* changed in v0.3j */
           }
         /* v0.3o */
       }
    }
  /* now index must be > 0 in any case (except for H2, or all tags have been cleared) */
  if (index == 0)           /* just to be sure... */
    index++;
  return index;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int find_ndl_ref_atom_cv ( ) [static]

Definition at line 12195 of file checkmolc.c.

{
  /* new in v0.3j, modified in v0.3m */
  int Result, i;
  int res = 1, it = 0;
  int n_cv;
  int n_cv_prev = 0;
  boolean finished = false;
  int cvmax = 0;
  int FORLIM;

  if (ndl_n_atoms == 0)
    return 0;
  /* try */
  cv = (connval_rec *) safe_malloc (sizeof (connval_type));
  /* except
     on e:Eoutofmemory do
     begin
     res := find_ndl_ref_atom;
     $IFDEF debug
     debugoutput('memory allocation for connection values failed, reverting to standard procedure');
     $ENDIF
     end;
     end; */
  cv_init ();
  do
    {
      it++;                 /* iteration counter (a safeguard against infinite loops) */
      n_cv = cv_iterate (n_cv_prev);
      if (n_cv <= n_cv_prev)
       finished = true;
      n_cv_prev = n_cv;
    }
  while (!(finished || it > 10000));
  FORLIM = ndl_n_atoms;
  /* now that we have canonical connection values (Morgan algorithm), */
  /* pick the atom with the highest value */
  /* added in v0.3o: atom must be "tagged" */
  for (i = 1; i <= FORLIM; i++)
    {
      /*writeln('cv for atom ',i,': ',cv^[i].def); */
      if (((cv[i - 1].def > cvmax) && (ndl_alkene_C (i) == false ||
                                   ez_search == false))
         && ndl_atom[i - 1].tag)
       {                    /* v0.3o */
         cvmax = cv[i - 1].def;
         res = i;
       }
    }
  Result = res;
  /* try */
  if (cv != NULL)
    {
      free (cv);
      cv = NULL;
    }
  /* except
     on e:Einvalidpointer do begin end;
     end; */
  return Result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void fix_ssr_ringcounts ( ) [static]

Definition at line 11733 of file checkmolc.c.

{
  /* new in v0.3n */
  /* if SAR -> SSR fallback happens, set some molstat values */
  /* to a maximum (ring counts for various ring sizes); */
  /* this should be necessary only for ring sizes which */
  /* are a) too large for the SSR (depending on ssr_vringsize) */
  /* and b) which are likely to contain "envelope rings" */
  /* (size 6 and above) */
  /*  if (molstat.n_r3 = 0) then molstat.n_r3 := max_rings; */
  /*  if (molstat.n_r4 = 0) then molstat.n_r4 := max_rings; */
  /*  if (molstat.n_r5 = 0) then molstat.n_r5 := max_rings; */
  if (molstat.n_r6 == 0)
    molstat.n_r6 = max_rings;
  if (molstat.n_r7 == 0)
    molstat.n_r7 = max_rings;
  if (molstat.n_r8 == 0)
    molstat.n_r8 = max_rings;
  if (molstat.n_r9 == 0)
    molstat.n_r9 = max_rings;
  if (molstat.n_r10 == 0)
    molstat.n_r10 = max_rings;
  if (molstat.n_r11 == 0)
    molstat.n_r11 = max_rings;
  if (molstat.n_r12 == 0)
    molstat.n_r12 = max_rings;
  if (molstat.n_r13p == 0)
    molstat.n_r13p = max_rings;
}

Here is the caller graph for this function:

static int get_bond ( int  ba1,
int  ba2 
) [static]

Definition at line 1119 of file checkmolc.c.

{
  int i;
  int b_id = 0;
  int FORLIM;

  if (n_bonds <= 0)
    return b_id;
  FORLIM = n_bonds;
  for (i = 1; i <= FORLIM; i++)
    {
      if (bond[i - 1].a1 == ba1 && bond[i - 1].a2 == ba2 ||
         bond[i - 1].a1 == ba2 && bond[i - 1].a2 == ba1)
       b_id = i;
    }
  return b_id;
}
static char* get_element ( char *  Result,
char *  oldtype 
) [static]

Definition at line 2538 of file checkmolc.c.

{
  char elemstr[256];

  if (!strcmp (oldtype, "H   "))
    strcpy (elemstr, "H ");
  /* if (!strcmp (oldtype, "D   "))      /* v0.3n 
     strcpy (elemstr, "D "); */
  if (!strcmp (oldtype, "CAR "))
    strcpy (elemstr, "C ");
  if (!strcmp (oldtype, "C2  "))
    strcpy (elemstr, "C ");
  if (!strcmp (oldtype, "C3  "))
    strcpy (elemstr, "C ");
  if (!strcmp (oldtype, "C1  "))
    strcpy (elemstr, "C ");
  if (!strcmp (oldtype, "O2  "))
    strcpy (elemstr, "O ");
  if (!strcmp (oldtype, "O3  "))
    strcpy (elemstr, "O ");
  if (!strcmp (oldtype, "O2  "))
    strcpy (elemstr, "O ");
  if (!strcmp (oldtype, "O3  "))
    strcpy (elemstr, "O ");
  if (!strcmp (oldtype, "O3  "))
    strcpy (elemstr, "O ");
  if (!strcmp (oldtype, "N1  "))
    strcpy (elemstr, "N ");
  if (!strcmp (oldtype, "N2  "))
    strcpy (elemstr, "N ");
  if (!strcmp (oldtype, "N3  "))
    strcpy (elemstr, "N ");
  if (!strcmp (oldtype, "NPL "))
    strcpy (elemstr, "N ");
  if (!strcmp (oldtype, "N3+ "))
    strcpy (elemstr, "N ");
  if (!strcmp (oldtype, "NAM "))
    strcpy (elemstr, "N ");
  if (!strcmp (oldtype, "NAR "))
    strcpy (elemstr, "N ");
  if (!strcmp (oldtype, "F   "))
    strcpy (elemstr, "F ");
  if (!strcmp (oldtype, "CL  "))
    strcpy (elemstr, "CL");
  if (!strcmp (oldtype, "BR  "))
    strcpy (elemstr, "BR");
  if (!strcmp (oldtype, "I   "))
    strcpy (elemstr, "I ");
  if (!strcmp (oldtype, "AT  "))
    strcpy (elemstr, "AT");
  if (!strcmp (oldtype, "AL  "))
    strcpy (elemstr, "AL");
  if (!strcmp (oldtype, "DU  "))
    strcpy (elemstr, "DU");
  if (!strcmp (oldtype, "CA  "))
    strcpy (elemstr, "CA");
  if (!strcmp (oldtype, "DU  "))
    strcpy (elemstr, "DU");
  if (!strcmp (oldtype, "Cl  "))
    strcpy (elemstr, "CL");
  if (!strcmp (oldtype, "K   "))
    strcpy (elemstr, "K ");
  if (!strcmp (oldtype, "LI  "))
    strcpy (elemstr, "LI");
  if (!strcmp (oldtype, "LP  "))
    strcpy (elemstr, "LP");
  if (!strcmp (oldtype, "NA  "))
    strcpy (elemstr, "NA");
  if (!strcmp (oldtype, "P3  "))
    strcpy (elemstr, "P ");
  if (!strcmp (oldtype, "S2  "))
    strcpy (elemstr, "S ");
  if (!strcmp (oldtype, "S3  "))
    strcpy (elemstr, "S ");
  if (!strcmp (oldtype, "SO  "))
    strcpy (elemstr, "S ");
  if (!strcmp (oldtype, "SO2 "))
    strcpy (elemstr, "S ");
  if (!strcmp (oldtype, "SI  "))
    strcpy (elemstr, "SI");
  if (!strcmp (oldtype, "P4  "))
    strcpy (elemstr, "P ");
  if (!strcmp (oldtype, "A   "))
    strcpy (elemstr, "A ");
  if (!strcmp (oldtype, "Q   "))
    strcpy (elemstr, "Q ");
  return strcpy (Result, elemstr);
}

Here is the caller graph for this function:

static char* get_filetype ( char *  Result,
char *  f 
) [static]

Definition at line 2046 of file checkmolc.c.

{
  char rline[256];
  char auxstr[256];
  int i;
  boolean mdl1 = false;
  int ri;
  int sepcount = 0;
  char STR1[256], STR6[256], STR7[256];

  strcpy (auxstr, "unknown");
  i = li;
  ri = li - 1;
  while (ri < molbufindex && sepcount < 1)
    {
      ri++;
      strcpy (rline, molbuf[ri - 1]);
      if (strpos2 (rline, "$$$$", 1) > 0)
       sepcount++;
      if ((i == li) && (strcmp (strsub (STR1, rline, 7, 5), "ATOMS") == 0) &&
         (strcmp (strsub (STR6, rline, 20, 5), "BONDS") == 0) &&
         (strcmp (strsub (STR7, rline, 33, 7), "CHARGES") == 0))
       strcpy (auxstr, "alchemy");
      if ((i == li + 3) && (strcmp (strsub (STR1, rline, 35, 5), "V2000") ==
                         0))
       /* and (copy(rline,31,3)='999') */
       mdl1 = true;
      if ((i == li + 1) && (strcmp (strsub (STR1, rline, 3, 6), "-ISIS-") ==
                         0))
       mdl1 = true;
      if ((i == li + 1) && (strcmp (strsub (STR1, rline, 3, 8), "WLViewer") ==
                         0))
       mdl1 = true;
      if ((i == li + 1) && (strcmp (strsub (STR1, rline, 3, 8), "CheckMol") ==
                         0))
       mdl1 = true;
      if ((i == li + 1) && (strcmp (strsub (STR1, rline, 3, 8), "CATALYST") ==
                         0))
       {
         mdl1 = true;
         strcpy (auxstr, "mdl");
       }
      if (strpos2 (rline, "M  END", 1) == 1 || mdl1)
       strcpy (auxstr, "mdl");
      if (strpos2 (rline, "@<TRIPOS>MOLECULE", 1) > 0)
       strcpy (auxstr, "sybyl");
      i++;
    }
  /* new in v0.2j: try to identify non-conformant SD-files */
  if (!strcmp (auxstr, "unknown") && sepcount > 0)
    strcpy (auxstr, "mdl");
  return strcpy (Result, auxstr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* get_MDLelement ( char *  Result,
char *  oldtype 
) [static]

Definition at line 2653 of file checkmolc.c.

{
  int i;
  str2 elemstr;

  sprintf (elemstr, "%.2s", oldtype);
  for (i = 0; i <= 1; i++)
    elemstr[i] = toupper (elemstr[i]);
  if (elemstr[0] == '~')
    strcpy (elemstr, "??");
  if (elemstr[0] == '*')
    strcpy (elemstr, "??");
  return strcpy (Result, elemstr);
}

Here is the caller graph for this function:

static void get_molstat ( ) [static]

Definition at line 11475 of file checkmolc.c.

{
  int i;
  str2 elem;
  str3 atype;
  int a1, a2;
  str2 a1el, a2el;
  char btype;
  int hbc;
  int n_b2formal = 0;              /* new in v0.2e */
  int FORLIM;

  if (n_atoms == 0)
    return;
  FORLIM = n_atoms;
  for (i = 0; i < FORLIM; i++)
    {
      if (atom[i].heavy)
       {
         strcpy (elem, atom[i].element);
         strcpy (atype, atom[i].atype);
         if (!strcmp (atype, "C1 "))
           molstat.n_C1++;
         if (!strcmp (atype, "C2 ") || !strcmp (atype, "CAR"))
           molstat.n_C2++;
         if (!strcmp (elem, "C "))
           molstat.n_C++;
         if (!strcmp (atype, "O2 "))
           molstat.n_O2++;
         if (!strcmp (atype, "O3 "))
           molstat.n_O3++;
         if (!strcmp (atype, "N1 "))
           molstat.n_N1++;
         if (!strcmp (atype, "N2 ") || !strcmp (atype, "NAR") ||
             !strcmp (atype, "NAM") && atom[i].arom == true)
           /* v0.3n */
           molstat.n_N2++;
         if (!strcmp (atype, "N3 ") || !strcmp (atype, "NPL") ||
             !strcmp (atype, "N3+") ||
             !strcmp (atype, "NAM") && atom[i].arom == false)
           /* v0.3n */
           molstat.n_N3++;
         if (!strcmp (elem, "A ")) /* query atom */
           molstat.n_QA++;
         if (!strcmp (elem, "Q ")) /* query atom */
           molstat.n_QA++;
         if (!strcmp (elem, "X ")) /* query atom */
           molstat.n_QA++;
         if (!strcmp (elem, "S "))
           molstat.n_S++;
         if (!strcmp (elem, "SE"))
           molstat.n_SeTe++;
         if (!strcmp (elem, "TE"))
           molstat.n_SeTe++;
         if (!strcmp (elem, "F "))
           molstat.n_F++;
         if (!strcmp (elem, "CL"))
           molstat.n_Cl++;
         if (!strcmp (elem, "BR"))
           molstat.n_Br++;
         if (!strcmp (elem, "I "))
           molstat.n_I++;
         if (!strcmp (elem, "P "))
           molstat.n_P++;
         if (!strcmp (elem, "B "))
           molstat.n_B++;
         /* check for known metals */
         if (atom[i].metal) /* v0.3l */
           molstat.n_Met++;
         /* still missing: unknown elements */

         /* check number of heteroatom bonds per C atom */
         if (!strcmp (elem, "C "))
           {
             hbc = raw_hetbond_count (i + 1);
             /* new in v0.2j (replaces hetbond_count) */
             if (hbc >= 1)
              molstat.n_CHB1p++;
             if (hbc >= 2)
              molstat.n_CHB2p++;
             if (hbc >= 3)
              molstat.n_CHB3p++;
             if (hbc == 4)
              molstat.n_CHB4++;
           }
         if (atom[i].formal_charge != 0)
           {
             molstat.n_chg++;
             //n_charges++;
           }
         if (atom[i].nucleon_number != 0)
           {
             molstat.n_iso++;
           }
         if (atom[i].radical_type != 0)
           {
             molstat.n_rad++;
           }
         /* check for "other" elements;  v0.3l */
         if (!atom[i].metal && strcmp (elem, "C ") && strcmp (elem, "N ")
             && strcmp (elem, "O ") && strcmp (elem, "S ")
             && strcmp (elem, "SE") && strcmp (elem, "TE")
             && strcmp (elem, "P ") && strcmp (elem, "B ")
             && strcmp (elem, "A ") && strcmp (elem, "Q "))
           molstat.n_X++;
         /*(elem = 'F ') or (elem = 'CL') or (elem = 'BR') or (elem = 'I ') or  (* leave halogens as type X, v0.3m */
/* p2c: checkmol.pas, line 8353:
 * Note: Turbo Pascal conditional compilation directive was ignored [218] */
         /*$IFDEF extended_molstat */
         if (!strcmp (elem, "LI") || !strcmp (elem, "NA")
             || !strcmp (elem, "K ") || !strcmp (elem, "RB")
             || !strcmp (elem, "CS") || !strcmp (elem, "FR"))
           molstat.n_psg01++;
         if (!strcmp (elem, "BE") || !strcmp (elem, "MG")
             || !strcmp (elem, "CA") || !strcmp (elem, "SR")
             || !strcmp (elem, "BA") || !strcmp (elem, "RA"))
           molstat.n_psg02++;
         if (!strcmp (elem, "B ") || !strcmp (elem, "AL")
             || !strcmp (elem, "GA") || !strcmp (elem, "IN")
             || !strcmp (elem, "TL"))
           molstat.n_psg13++;
         if (!strcmp (elem, "C ") || !strcmp (elem, "SI")
             || !strcmp (elem, "GE") || !strcmp (elem, "SN")
             || !strcmp (elem, "PB"))
           molstat.n_psg14++;
         if (!strcmp (elem, "N ") || !strcmp (elem, "P ")
             || !strcmp (elem, "AS") || !strcmp (elem, "SB")
             || !strcmp (elem, "BI"))
           molstat.n_psg15++;
         if (!strcmp (elem, "O ") || !strcmp (elem, "S ")
             || !strcmp (elem, "SE") || !strcmp (elem, "TE")
             || !strcmp (elem, "PO"))
           molstat.n_psg16++;
         if (!strcmp (elem, "F ") || !strcmp (elem, "CL")
             || !strcmp (elem, "BR") || !strcmp (elem, "I ")
             || !strcmp (elem, "AT"))
           molstat.n_psg17++;
         if (!strcmp (elem, "HE") || !strcmp (elem, "NE")
             || !strcmp (elem, "AR") || !strcmp (elem, "KR")
             || !strcmp (elem, "XE") || !strcmp (elem, "RN"))
           molstat.n_psg18++;
         if (!strcmp (elem, "SC") || !strcmp (elem, "Y ")
             || !strcmp (elem, "LU") || !strcmp (elem, "LR")
             || !strcmp (elem, "TI") || !strcmp (elem, "ZR")
             || !strcmp (elem, "HF") || !strcmp (elem, "RF")
             || !strcmp (elem, "V ") || !strcmp (elem, "NB")
             || !strcmp (elem, "TA") || !strcmp (elem, "DB")
             || !strcmp (elem, "CR") || !strcmp (elem, "MO")
             || !strcmp (elem, "W ") || !strcmp (elem, "SG")
             || !strcmp (elem, "MN") || !strcmp (elem, "TC")
             || !strcmp (elem, "RE") || !strcmp (elem, "BH")
             || !strcmp (elem, "FE") || !strcmp (elem, "RU")
             || !strcmp (elem, "OS") || !strcmp (elem, "HS")
             || !strcmp (elem, "CO") || !strcmp (elem, "RH")
             || !strcmp (elem, "IR") || !strcmp (elem, "MT")
             || !strcmp (elem, "NI") || !strcmp (elem, "PD")
             || !strcmp (elem, "PT") || !strcmp (elem, "DS")
             || !strcmp (elem, "CU") || !strcmp (elem, "AG")
             || !strcmp (elem, "AU") || !strcmp (elem, "RG")
             || !strcmp (elem, "ZN") || !strcmp (elem, "CD")
             || !strcmp (elem, "HG"))
/* p2c: checkmol.pas, line 8439: 
 * Note: Line breaker spent 0.0 seconds, 5000 tries on line 10035 [251] */
           molstat.n_pstm++;
         if (!strcmp (elem, "LA") || !strcmp (elem, "CE")
             || !strcmp (elem, "PR") || !strcmp (elem, "ND")
             || !strcmp (elem, "PM") || !strcmp (elem, "SM")
             || !strcmp (elem, "EU") || !strcmp (elem, "GD")
             || !strcmp (elem, "TB") || !strcmp (elem, "DY")
             || !strcmp (elem, "HO") || !strcmp (elem, "ER")
             || !strcmp (elem, "TM") || !strcmp (elem, "YB")
             || !strcmp (elem, "AC") || !strcmp (elem, "TH")
             || !strcmp (elem, "PA") || !strcmp (elem, "U ")
             || !strcmp (elem, "NP") || !strcmp (elem, "PU")
             || !strcmp (elem, "AM") || !strcmp (elem, "CM")
             || !strcmp (elem, "BK") || !strcmp (elem, "CF")
             || !strcmp (elem, "ES") || !strcmp (elem, "FM&