├── .gitignore ├── queries ├── O_alkyl_hydroxylamine.qry ├── ccl3.qry ├── f2_c_o2.qry ├── nitrone.qry ├── nitroxyl.qry ├── oxiridine.qry ├── nitrosamine.qry ├── amino_ester.qry ├── diamidine.qry ├── imino_oxime.qry ├── nitrous_ester.qry ├── alkyl_sulfite.qry ├── alkyne_michael.qry ├── michael_thione.qry ├── perimidine.qry ├── rhodanine.qry ├── acyl_oxime.qry ├── halogen_to_oxygen.qry ├── metanitro.qry ├── tropolone.qry ├── azapteridine.qry ├── iminal.qry ├── 8_hydroxyquinoline.qry ├── benzocyclopentenone.qry ├── dihydro_pyrrolidone.qry ├── enamine_2.qry ├── halomethyl_ketone.qry ├── pyrrole_vinylidene.qry ├── scf3.qry ├── acyl_thiohydroxamate.qry ├── anthra_ketone.qry ├── aziridine.qry ├── biguanide.qry ├── bis_aryl_maleimide.qry ├── cyano_methyl_amine.qry ├── cyanohydrin.qry ├── nitromethyl_sulfone.qry ├── thioester.qry ├── acyl_enol.qry ├── acyl_hydroxamate_2.qry ├── acyl_hydroxamate_3.qry ├── dihydro_124_triazine.qry ├── fused_tetrahydroquinoline.qry ├── imine_aromatic.qry ├── isothiourea_sulfonamide.qry ├── sulfimine.qry ├── 4_valent_sulphur_2_connections.qry ├── isothiourea.qry ├── thioaminal_C_cyclic.qry ├── acylurea.qry ├── halo_imine.qry ├── isodithiocarbamate.qry ├── isothiazole_carbonyl.qry ├── phenolic_ester_or_carbamate.qry ├── thiomethyl_ketone.qry ├── thiourea.qry ├── acetal_1_in_ring.qry ├── acyl_isoamide_aromatic.qry ├── cplus.qry ├── dicyanomethylene.qry ├── isothioamide_cyclicS.qry ├── non_ring_ketal.qry ├── thioaminal_n_unsub_cyclic_2.qry ├── thiocarbonyl_aromatic.qry ├── alkylthio_N_aromatic.qry ├── divinyl_carbonyl.qry ├── sulfonamide_methylene_sulfone.qry ├── sulfoxide_imine.qry ├── thioaminal_n_sub_cyclic_2.qry ├── 3_valent_iodine.qry ├── 6_membered_aromatic_sulfur.qry ├── acetal_both_in_ring.qry ├── furan.qry ├── ring_system_too_large.qry ├── sulfonyl_hydrazone.qry ├── dihalo_vinyl_1_2_dicarbonyl.qry ├── o_or_s_plus.qry ├── vinyl_thioether.qry ├── diacylhydrazide.qry ├── pyridazine_dione.qry ├── 3_valent_halogen.qry ├── charged_halide.qry ├── five_connected_n_or_p.qry ├── halogenated_aromatic.qry ├── n_double_s_double_n_ring.qry ├── no_rings.qry ├── sulfonyl_imine.qry ├── enol_or_vinyl_ether.qry ├── quinone_para.qry ├── alkyl_iodide.qry ├── quaternary_aryl.qry ├── s_4_single_bonds.qry ├── keto_carbonyl.qry ├── ss.qry ├── sulfonyl_urea.qry ├── too_many_aromatic_rings_in_ring_system.qry ├── trivalent_phosphorus.qry ├── four_valent_s_h.qry ├── strongly_fused_ring_system.qry ├── ring_system_too_large_with_aromatic.qry ├── bromine.qry ├── fluorine.qry ├── too_many_sulfonate.qry ├── so.qry ├── peroxide.qry ├── quat_n_heteroatom.qry ├── thioester_cyclic.qry ├── thiol.qry ├── 8_aminoquinoline.qry ├── 9_aminoacridine.qry ├── aminomethyl_ketone_peptide.qry ├── chlorine.qry ├── michael_demerited.qry ├── allene.qry ├── n_hydroxy.qry ├── n_s_acyclic.qry ├── ester.qry ├── halogen_nps.qry ├── pyrrole.qry ├── biotin.qry ├── acyl_sulfonamide.qry ├── lucifer_yellow.qry ├── unsat_n_plus.qry ├── quat_schiff_base.qry ├── n_oxide.qry ├── thiophene_furan_n_acyl.qry ├── thiophene_furan_nh.qry ├── aromatic_iodide.qry ├── phenolate.qry ├── four_valent_sulphur.qry ├── melamine.qry ├── acetylene_heteroatom.qry ├── aldehyde.qry ├── thione.qry ├── diphosphate.qry ├── naphthalene_sulfonate.qry ├── cyano.qry ├── isocyano.qry ├── thione_oxide.qry ├── oxime.qry ├── sulfonyl_n_aromatic_nedg.qry ├── cyano_amine.qry ├── half_sulfur_peroxide.qry ├── het_3mem_ring.qry ├── quaternary_amine.qry ├── amino_naphthalene.qry ├── het_3mem_ring_fused.qry ├── acetylene.qry ├── anthracene_phenanthrene.qry ├── n_o_acyclic.qry ├── michael_rejected.qry ├── nitroso.qry ├── hydrazone.qry ├── schiff_base.qry ├── acid_halide.qry ├── formylated.qry ├── ncn.qry ├── nso_2.qry ├── thio_ester_thione_acyclic.qry ├── sulfonium.qry ├── thioacetal_acyclic.qry ├── acyl_arom_n.qry ├── dithio_olefin.qry ├── thiocyanate.qry ├── alkyl_fluoride_activated.qry ├── ester_thione.qry ├── aminal_acyclic.qry ├── diazo_cyclic.qry ├── sch2s.qry ├── thio_ester_thione_cyclic.qry ├── dna_intercalator_1.qry ├── vinyl_sulphide.qry ├── vinyl_halide_2_halogens.qry ├── acetal_acyclic.qry ├── five_valent_nitrogen.qry ├── isoamide_acyclic.qry ├── isothioamide_cyclic.qry ├── thioester_acyclic.qry ├── trifluoroborate.qry ├── enamine.qry ├── vinyl_halide_3_halogens.qry ├── vinyl_nitro.qry ├── nitroxide.qry ├── thio_oxime.qry ├── thioester_acyclic_aromatic.qry ├── thio_aminal_acyclic.qry ├── di_thio_acetal_acyclic.qry ├── diaminal_acyclic.qry ├── sulfonyl_halide.qry ├── hemiacetal_acyclic.qry ├── po4.qry ├── phosphoric_acid.qry ├── steve1.qry ├── vinyl_ether.qry ├── cf3.qry ├── hydrazide_acyclic.qry ├── vinyl_disulfide.qry ├── hydrazide_cyclic.qry ├── activated_ester.qry ├── acetate_ester.qry ├── scscs.qry ├── thiocarbonyl_diester.qry ├── fluoro_methyl_ketone.qry ├── hydrazide.qry ├── cyano_methyl_sulfide.qry ├── phenol_phosphate_ester.qry ├── nitro_alpha_hetero.qry ├── vinyl_cyano_2.qry ├── vinyl_sulfoxide.qry ├── vinyl_ether_thioate_isoamide.qry ├── acyl_amide_acyclic.qry ├── acyl_amide_cyclic.qry ├── vinyl_disulfur.qry ├── anhydride.qry ├── vinyl_cyano_het.qry ├── alkynylsulfone.qry ├── multiple_nitro.qry ├── thiohydrazide.qry ├── sulfonylmichael.qry ├── dialkylsulfate_cyclic.qry ├── nitro.qry ├── nitro_alpha_to_halogen.qry ├── sulfonic_acid.qry ├── acylated_enol.qry ├── phosphate_ester.qry ├── tbutyl.qry ├── cyclobutadiene.qry ├── vinyl_sulfone_3.qry ├── perchlorate.qry ├── sulfonyl_ester.qry ├── orthonitropyridine.qry ├── beta_lactone.qry ├── phosphate_ester_ian.qry ├── acyl_hydrazone_cyclic.qry ├── vinyl_sulfone_2.qry ├── conjugated_triene_acyclic_2.qry ├── acyl_aromatic_nn.qry ├── quinone_methide.qry ├── dienone.qry ├── penicillin_cephalosporin.qry ├── ketoamide_cyclic.qry ├── reverse_michael_quat.qry ├── vinyl_disulfone.qry ├── cyanine_dye.qry ├── phthalimide.qry ├── trifluoroacetate_ester.qry ├── methylene_bis_sulfone_diaryl.qry ├── nitro_phenol_or_aniline.qry ├── boc.qry ├── crown_2_2.qry ├── halo_phthalazine.qry ├── phosphate_ester_ian_echo.qry ├── triflate.qry ├── crown_2_3.qry ├── halo_next_to_aryl_n_w_ewg.qry ├── phenylenediamine.qry ├── acyl_hydroxamate.qry ├── catechol.qry ├── crown_3_3.qry ├── aminophenol.qry ├── isolated_aromatic.qry ├── methylene_bis_sulfone.qry ├── reverse_michael_demerit.qry ├── crown_2_2_cyclic.qry ├── reverse_michael.qry ├── crown_2_3_cyclic.qry ├── aniline_h_ewd.qry ├── sulfonyl_n_aromatic_edg.qry ├── crown_3_3_cyclic.qry ├── aniline_h_newd.qry └── cyclohexane.qry ├── README.md ├── supporting_libraries ├── _extending_resizable_array_int.cc ├── new_int.cc ├── should_match.h ├── int_comparator.cc ├── write_space_suppressed_string.cc ├── iwbits_support.h ├── KahanSum.cc ├── iwwrite.cc ├── iwwrite_block.cc ├── dash_f.cc ├── dy_fingerprint.h └── Makefile ├── charge_assigner ├── positive ├── negative ├── queries ├── acid.qry ├── sulfonic_acid.qry ├── carboxylic_acid.qry ├── phosphonate.qry ├── N_acylsulfonamide.qry ├── tetrazole.qry ├── pyrazolidinone.qry ├── phenolate.qry ├── thiazolidinedione.qry ├── N_acylpyrazolidinone.qry ├── guanidine.qry ├── amidine.qry └── imidazole_basic.qry ├── Molecule ├── coordinates.cc ├── molecule_marvin.h ├── careful_frag.h ├── rwmolecule.h ├── moleculeh.h ├── is_actually_chiral.h ├── molecule_tripos.h ├── atom_alias.h ├── charge_calculation.h ├── collection_template.h ├── qry_and_demerit.h ├── tokenise_atomic_smarts.h ├── molecule_smarts.h ├── coordinates.h ├── substructure_demerits.h ├── parse_smarts_tmp.cc ├── misc2.h ├── moleculed.h ├── ostream_and_type.h ├── numass.h ├── iwrcb.h ├── parse_smarts_tmp.h └── molecule_main.h ├── include ├── new_array_.h ├── kahan_sum.h ├── iwhash.h ├── iw_stl_hash_multimap.h ├── iw_stl_hash_set.h └── string_data_source.h ├── LICENSE ├── Makefile ├── preamble └── test └── dotest.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.log 3 | *.a 4 | -------------------------------------------------------------------------------- /queries/O_alkyl_hydroxylamine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I version 2) 3 | (A C smarts "[NR0G0]-O-[CX4]") 4 | ) 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Lilly-Medchem-Rules 2 | =================== 3 | 4 | Implementation of Lilly Medchem Rules - J Med Chem 2012 -------------------------------------------------------------------------------- /queries/ccl3.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "ccl3") 3 | (A I Version 2) 4 | (A C smarts "Cl-C(-Cl)-Cl") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/f2_c_o2.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "f2_c_o2") 4 | (A C smarts "FC(F)(O)O") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/nitrone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "nitrone") 4 | (A C smarts "[N0G1D4]") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/nitroxyl.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "nitroxyl") 3 | (A I version 2) 4 | (A C smarts "N(=O)(-O)") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/oxiridine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "oxiridine") 3 | (A I version 2) 4 | (A C smarts "N1-C-O1") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/nitrosamine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "nitrosamine") 3 | (A I version 2) 4 | (A C smarts "[#7]-N=O") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/amino_ester.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "amino_ester") 3 | (A I version 2) 4 | (A C smarts "N-O-C(=O)") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/diamidine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "diamidine") 3 | (A I version 2) 4 | (A C smarts "N=C(-N)-C(=N)-N") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/imino_oxime.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "imino_oxime") 3 | (A I version 2) 4 | (A C smarts "O-N=C-C=N") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/nitrous_ester.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "nitrous_ester") 3 | (A I version 2) 4 | (A C smarts "C-O-N=O") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/alkyl_sulfite.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "alkyl_sulfite") 4 | (A C smarts "O=[SD3]-[OD2]") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/alkyne_michael.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "alkyne_michael") 3 | (A I Version 2) 4 | (A C smarts "[OD1]=C-C#C") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/michael_thione.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "michael_thione") 3 | (A I version 2) 4 | (A C smarts "[SD1]=C-C=C") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/perimidine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "perimidine") 4 | (A C smarts "c1ccc3ncnc2cccc1c23") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/rhodanine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "rhodanine") 4 | (A C smarts "C(=C)1SC(=S)NC(=O)1") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/acyl_oxime.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acyl_oxime") 3 | (A I version 2) 4 | (A C smarts "[#6]=,:[#7][#8][#6](=O)") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/halogen_to_oxygen.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I version 2) 3 | (A C Comment "halogen-oxygen") 4 | (A C smarts "[F,Cl,Br,I]-O") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/metanitro.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "metanitro") 3 | (A I Version 2) 4 | (A C smarts "[OD1]=N(=O)-c:a:c-N(=O)=O") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/tropolone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "tropolone") 3 | (A I Version 2) 4 | (A C smarts "[OD1]=c1[/IWfss1c]ccccc1") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/azapteridine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "azapteridine") 3 | (A I Version 2) 4 | (A C smarts "n1c(=O)nc(=O)c2ncnnc12") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/iminal.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "iminal") 3 | (A I version 2) 4 | (A C smarts "C=N-C(-O)") 5 | (A C smarts "O-C-N=C") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/8_hydroxyquinoline.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "8_hydroxyquinoline") 4 | (A C smarts "[OD1]c1cccc2cccnc12") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/benzocyclopentenone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "benzocyclopentenone") 4 | (A C smarts "c12ccccc1C=CC2=O") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/dihydro_pyrrolidone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "dihydro_pyrrolidone") 4 | (A C smarts "N1[C,N]=CCC(=O)1") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/enamine_2.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "enamine_2") 3 | (A I version 2) 4 | (A D numeric_value 25) 5 | (A C smarts "N-C=C") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/halomethyl_ketone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I version 2) 3 | (A C Comment "halomethyl_ketone") 4 | (A C smarts "O=[CT1]C[F,Cl,Br,I]") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/pyrrole_vinylidene.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "pyrrole_vinylidene") 4 | (A C smarts "[N;r5]1=C-C=C-C1=*") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/scf3.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "scf3") 3 | (A I Version 2) 4 | (A D numeric_value 50) 5 | (A C smarts "[SD2]-C(-F)(-F)-F") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/acyl_thiohydroxamate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acyl_thiohydroxamate") 3 | (A I version 2) 4 | (A C smarts "O=[#6][#7](-S)[#6]=O") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/anthra_ketone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "anthra_ketone") 4 | (A C smarts "c12ccccc1cc3c(=*)cccc3C2=[O,N,S]") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/aziridine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "aziridine") 3 | (A I version 2) 4 | # (A C smarts "C1-N=N1") 5 | (A C smarts "[Nr3]1=N-C1") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/biguanide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "biguanide") 3 | (A I Version 2) 4 | (A C smarts "[NG0R0]-C(=[ND1])-[NR0]-C(=[ND1])-[G0]") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/bis_aryl_maleimide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "bis_aryl_maleimide") 4 | (A C smarts "N1C(=O)C(c)=C(c)C1(=O)") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/cyano_methyl_amine.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "cyano_methyl_amine") 3 | 4 | (A I Version 2) 5 | (A C smarts "[ND1]#C-[CG0]-[NG0]") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/cyanohydrin.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "cyanohydrin") 3 | 4 | (A I Version 2) 5 | (A C smarts "[ND1]#C-[CG0]-[$([OD1]),$(O-C=O)]") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/nitromethyl_sulfone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "nitromethyl_sulfone") 3 | (A I version 2) 4 | (A C smarts "S(=O)(=O)-C-N(=O)(=O)") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/thioester.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "thioester") 3 | (A I version 2) 4 | # (A C smarts "C(=O)-S") 5 | (A C smarts "[SD2]-C=O") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/acyl_enol.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acyl_enol") 3 | (A I version 2) 4 | # (A C smarts "C=C-O-C(=O)") 5 | (A C smarts "O=[CR0]-O-C=C") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/acyl_hydroxamate_2.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acyl_hydroxamate_2") 3 | (A I version 2) 4 | (A C smarts "[#6](=O)-[#7]-[#8]-[#6](=O)") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/acyl_hydroxamate_3.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acyl_hydroxamate_3") 3 | (A I version 2) 4 | (A C smarts "[#6](=O)-[#7](-[#8])-[#6](=O)") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/dihydro_124_triazine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "dihydro_[1,2,4]triazine") 4 | (A C smarts "N1N=CN[#6G1][#6G1]1") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/fused_tetrahydroquinoline.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "fused_tetrahydroquinoline") 4 | (A C smarts "C12ccNCC1CC=C2") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/imine_aromatic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "imine_aromatic") 3 | (A I version 2) 4 | (A D numeric_value 30) 5 | (A C smarts "c=[NR0]") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/isothiourea_sulfonamide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "isothiourea_sulfonamide") 3 | (A I version 2) 4 | (A C smarts "N-C(-S)=N-[C,S](=O)") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/sulfimine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "sulfimine") 3 | (A C Comment "sulfimine") 4 | (A I Version 2) 5 | (A C smarts "S(=N)(=O)-N") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/4_valent_sulphur_2_connections.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "4_valent_sulphur_2_connections") 4 | (A C smarts "[SD2v4]") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/isothiourea.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "isothiourea") 3 | (A D numeric_value 60) 4 | (A I Version 2) 5 | (A C smarts "[SD2]-[CR0](=N)-N") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/thioaminal_C_cyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I version 2) 3 | (A C Comment "thioaminal_C_cyclic") 4 | (A C smarts "[SD2R0]-[CR1X4]-[/IWVy0NR0G0T0]") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/acylurea.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acylurea") 3 | (A D numeric_value 35) 4 | (A I Version 2) 5 | (A C smarts "[N;G0]-C(=[O,S])-N-C=[O,S]") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/halo_imine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "halo_imine") 3 | (A I version 2) 4 | # (A C smarts "C([F,Br,I,Cl])=N") 5 | (A C smarts "[F,Br,I,Cl]-C=N") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/isodithiocarbamate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "isodithiocarbamate") 3 | (A I version 2) 4 | (A D numeric_value 50) 5 | (A C smarts "S-C(=N)-S") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/isothiazole_carbonyl.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "isothiazole_carbonyl") 4 | (A C smarts "[OD1]=c1[nD3][o,s]:[#6]=,:[#6]1") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/phenolic_ester_or_carbamate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "phenolic_ester_or_carbamate") 4 | (A C smarts "[OD1]=C(-*)-[OD2]-a") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/thiomethyl_ketone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "thiomethyl_ketone") 3 | (A I Version 2) 4 | (A C smarts "S-[CD2]-C(=[O,S,N])[#6] thiomethyl_ketone") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/thiourea.qry: -------------------------------------------------------------------------------- 1 | # RuleClass 2 | # SubClass 3 | 4 | (0 Query 5 | (A C Comment "thiourea") 6 | (A I Version 2) 7 | (A C smarts "[NR0G0]-C(=S)-[NG0R0]") 8 | ) 9 | -------------------------------------------------------------------------------- /queries/acetal_1_in_ring.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A D numeric_value 30) 4 | (A C Comment "acetal_1_in_ring") 5 | (A C smarts "C[O,S;R1]C[O,S;R0]C") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/acyl_isoamide_aromatic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acyl_isoamide_aromatic") 3 | (A I version 2) 4 | (A D numeric_value 60) 5 | (A C smarts "O=cocn") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/cplus.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "cplus") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 6) 6 | (A I formal_charge 1) 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /queries/dicyanomethylene.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "dicyanomethylene") 3 | (A I version 2) 4 | # (A C smarts "C(-C#N)(-C#N)") 5 | (A C smarts "[ND1]#C-C-C#N") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/isothioamide_cyclicS.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "isothioamide_cyclicS") 3 | (A I version 2) 4 | (A D numeric_value 50) 5 | (A C smarts "[SR]-C=N") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/non_ring_ketal.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "non_ring_ketal") 4 | (A C smarts "[O,N,S;!$(S~O)]!@[C;H0;X4](!@[O,N,S;!$(S~O)])(C)") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/thioaminal_n_unsub_cyclic_2.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "thioaminal_n_unsub_cyclic_2") 4 | (A C smarts "[SD2][CX4][NR1D2][CX4]C") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/thiocarbonyl_aromatic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "thiocarbonyl_aromatic") 3 | (A I version 2) 4 | (A D numeric_value 30) 5 | (A C smarts "[SD1]=c") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/alkylthio_N_aromatic.qry: -------------------------------------------------------------------------------- 1 | (0 query 2 | (A I Version 2) 3 | (A D numeric_value 20) 4 | (A C Comment "alkylthio_N_aromatic") 5 | (A C smarts "[SD2R0T0]-c:n") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/divinyl_carbonyl.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "divinyl_carbonyl") 3 | (A I version 2) 4 | # (A C smarts "C=C-C(=O)-C=C") 5 | (A C smarts "[OD1]=C(-C=C)-C=C") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/sulfonamide_methylene_sulfone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "sulfonamide_methylene_sulfone") 3 | (A I Version 2) 4 | (A C smarts "NS(=O)(=O)CS(=O)(=O)[#6]") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/sulfoxide_imine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "sulfoxide_imine") 3 | (A C Comment "sulfoxide_imine") 4 | (A I Version 2) 5 | (A C smarts "[ASG1]=&!@[N]") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/thioaminal_n_sub_cyclic_2.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "thioaminal_n_sub_cyclic_2") 4 | (A C smarts "[SD2][CX4][NR1D3]([CX4])[CX4][#6]") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/3_valent_iodine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "3_valent_iodine") 4 | (0 Query_Atom 5 | (A I atomic_number 53) 6 | (A I nbonds 3) 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /queries/6_membered_aromatic_sulfur.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A D numeric_value 50) 4 | (A C Comment "6_membered_aromatic_sulfur") 5 | (A C smarts "s1aaaaa1") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/acetal_both_in_ring.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A D numeric_value 30) 4 | (A C Comment "acetal_both_in_ring") 5 | (A C smarts "C[O,S;R1]C[O,S;R1]C") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/furan.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "furan") 4 | (A D numeric_value 50) 5 | (A I one_embedding_per_start_atom 1) 6 | (A C smarts "o1cccc1") 7 | ) 8 | -------------------------------------------------------------------------------- /queries/ring_system_too_large.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "ring_system_too_large") 4 | (0 Ring_System_Specifier 5 | (A I min_nrings 6) 6 | ) 7 | ) 8 | -------------------------------------------------------------------------------- /queries/sulfonyl_hydrazone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "sulfonyl_hydrazone") 3 | (A I version 2) 4 | # (A C smarts "C=N-N-S(=O)(=O)") 5 | (A C smarts "S(=O)(=O)-N-N=C") 6 | ) 7 | -------------------------------------------------------------------------------- /supporting_libraries/_extending_resizable_array_int.cc: -------------------------------------------------------------------------------- 1 | #define EXTENDING_RESIZABLE_ARRAY_IMPLEMENTATION 2 | #include "iwaray.h" 3 | 4 | template class extending_resizable_array; 5 | -------------------------------------------------------------------------------- /queries/dihalo_vinyl_1_2_dicarbonyl.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "dihalo_vinyl_1_2_dicarbonyl") 3 | (A I version 2) 4 | (A C smarts "O=C-C([F,Br,I,Cl])=C([F,Br,I,Cl])-C=O") 5 | ) 6 | -------------------------------------------------------------------------------- /queries/o_or_s_plus.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "o_or_s_plus") 4 | (0 Query_Atom 5 | (A I atomic_number (8 16)) 6 | (A I formal_charge 1) 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /queries/vinyl_thioether.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "vinyl_thioether") 3 | (A I version 2) 4 | # (A C smarts "[C;!R]=[C;!R]-[S;!R]") 5 | (A C smarts "[SR0D2]-[CR0]=[CR0]") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/diacylhydrazide.qry: -------------------------------------------------------------------------------- 1 | # RuleClass acylating 2 | # SubClass acyl-QQ 3 | 4 | (0 Query 5 | (A C Comment "diacylhydrazide") 6 | (A I Version 2) 7 | (A C smarts "O=C-N-N-C(=O)") 8 | ) 9 | -------------------------------------------------------------------------------- /queries/pyridazine_dione.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "pyridazine_dione") 3 | (A I Version 2) 4 | (A C smarts "[OD1]=[cR1]1:n:n:[cD3](=[OD1]):[cR1]:c1") 5 | (A I min_nrings 1) 6 | ) 7 | -------------------------------------------------------------------------------- /queries/3_valent_halogen.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "3_valent_halogen") 4 | (0 Query_Atom 5 | (A I atomic_number (9 17 35 53)) 6 | (A I nbonds 3) 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /queries/charged_halide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "charged_halide") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number (9 17 35 53)) 6 | (A I formal_charge 1) 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /queries/five_connected_n_or_p.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "five_valent_n_or_p") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number (7 15)) 6 | (A I min_ncon 5) 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /queries/halogenated_aromatic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "halogenated_aromatic") 3 | (A I Version 2) 4 | (0 Ring_System_Specifier 5 | (A C environment ">4a-[F,Cl,Br,I]") 6 | ) 7 | ) 8 | -------------------------------------------------------------------------------- /queries/n_double_s_double_n_ring.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "n_double_s_double_n_ring") 4 | # (A C smarts "[#6]1~[#6]N=S=N1") 5 | (A C smarts "N1=S=N[#6]~[#6]1") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/no_rings.qry: -------------------------------------------------------------------------------- 1 | # RuleClass rings 2 | # SubClass count 3 | 4 | (0 Query 5 | (A C Comment "no_rings") 6 | (A I Version 2) 7 | (A I nrings 0) 8 | (A D numeric_value 30) 9 | ) 10 | -------------------------------------------------------------------------------- /queries/sulfonyl_imine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "sulfonyl_imine") 3 | (A I version 2) 4 | (A D numeric_value 25) 5 | # (A C smarts "C=N-S(=O)(=O)") 6 | (A C smarts "S(=O)(=O)-N=C") 7 | ) 8 | -------------------------------------------------------------------------------- /queries/enol_or_vinyl_ether.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "enol_or_vinyl_ether") 3 | (A I version 2) 4 | (A D numeric_value 50) 5 | (A I embeddings_do_not_overlap 1) 6 | (A C smarts "C=C-O") 7 | ) 8 | -------------------------------------------------------------------------------- /queries/quinone_para.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "quinone_para") 3 | (A I Version 2) 4 | (A I one_embedding_per_start_atom 1) 5 | (A C smarts "[O,N,S]=C1-[#6]=,:[#6]-C(=[O,N,S])-[#6]~[#6]1") 6 | ) 7 | -------------------------------------------------------------------------------- /queries/alkyl_iodide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "alkyl_iodide") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 53) 6 | (A I min_ncon 1) 7 | (A I aryl 0) 8 | ) 9 | ) 10 | -------------------------------------------------------------------------------- /queries/quaternary_aryl.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "quaternary_aryl") 4 | (0 Query_Atom 5 | (A I aromatic 1) 6 | (A I formal_charge 1) 7 | (A I hcount 0) 8 | ) 9 | ) 10 | -------------------------------------------------------------------------------- /queries/s_4_single_bonds.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "s_4_single_bonds") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon 4) 7 | (A I nbonds 4) 8 | ) 9 | ) 10 | -------------------------------------------------------------------------------- /queries/keto_carbonyl.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "keto_carbonyl") 4 | 5 | # One of the C=O must be a ketone, so T1 for 1st carbon 6 | 7 | (A C smarts "[O,N,SD1]=[#6;T1]~[#6]=[O,N,SD1]") 8 | ) 9 | -------------------------------------------------------------------------------- /queries/ss.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "ss") 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | ) 7 | (1 Query_Atom 8 | (A I atomic_number 16) 9 | (A I bond 0) 10 | ) 11 | ) 12 | -------------------------------------------------------------------------------- /queries/sulfonyl_urea.qry: -------------------------------------------------------------------------------- 1 | # RuleClass 2 | # SubClass 3 | 4 | (0 Query 5 | (A C Comment "sulfonyl_urea") 6 | (A I Version 2) 7 | (A D numeric_value 35) 8 | (A C smarts "N[CR0](=[O,S])-N-[S;R0]=[O,S]") 9 | ) 10 | -------------------------------------------------------------------------------- /queries/too_many_aromatic_rings_in_ring_system.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "too_many_aromatic_rings_in_ring_system") 3 | (A I Version 2) 4 | (0 Ring_System_Specifier 5 | (A I min_aromatic_ring_count 4) 6 | ) 7 | ) 8 | -------------------------------------------------------------------------------- /queries/trivalent_phosphorus.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "trivalent_phosphorus") 4 | (0 Query_Atom 5 | (A I atomic_number 15) 6 | (A I ncon 3) 7 | (A I nbonds 3) 8 | ) 9 | ) 10 | -------------------------------------------------------------------------------- /queries/four_valent_s_h.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "four_valent_s_h") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon 2) 7 | (A I nbonds 3) 8 | (A I hcount 1) 9 | ) 10 | ) 11 | -------------------------------------------------------------------------------- /queries/strongly_fused_ring_system.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "strongly_fused_ring_system") 4 | (0 Ring_System_Specifier 5 | (A I min_strongly_fused_ring_count 3) 6 | (A I min_nrings 4) 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /charge_assigner/positive: -------------------------------------------------------------------------------- 1 | #hydrazine.qry 2 | aliphatic_amine_restricted.qry 3 | 4_amino_pyridine.qry 4 | imidazole_basic.qry 5 | amidine.qry 6 | #2_amino_pyridine.qry 7 | guanidine.qry 8 | imine.qry 9 | imide.qry 10 | amino_terminal.qry 11 | -------------------------------------------------------------------------------- /queries/ring_system_too_large_with_aromatic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "ring_system_too_large_with_aromatic") 4 | (0 Ring_System_Specifier 5 | (A I min_nrings 5) 6 | (A I min_aromatic_ring_count 2) 7 | ) 8 | ) 9 | -------------------------------------------------------------------------------- /queries/bromine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "bromine") 3 | (A I Version 2) 4 | (A D numeric_value 34) 5 | (A I only_match_largest_fragment 1) 6 | (0 Query_Atom 7 | (A I atomic_number 35) 8 | (A I min_ncon 1) 9 | ) 10 | ) 11 | -------------------------------------------------------------------------------- /queries/fluorine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "fluorine") 4 | (A I subtract_from_rc 4) 5 | (A D numeric_value 20) 6 | (A I only_match_largest_fragment 1) 7 | (0 Query_Atom 8 | (A I atomic_number 9) 9 | ) 10 | ) 11 | -------------------------------------------------------------------------------- /queries/too_many_sulfonate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "too_many_sulfonate") 3 | (A I one_embedding_per_start_atom 1) 4 | (A I all_hits_in_same_fragment 1) 5 | (A C smarts "[SD4](=O)(=O)-O") 6 | (A I Version 2) 7 | (A I min_hits_needed 2) 8 | ) 9 | -------------------------------------------------------------------------------- /queries/so.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "SO") 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I unsaturation 0) 7 | ) 8 | (1 Query_Atom 9 | (A I atomic_number 8) 10 | (A I single_bond 0) 11 | ) 12 | ) 13 | -------------------------------------------------------------------------------- /queries/peroxide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "peroxide") 4 | (0 Query_Atom 5 | (A I atomic_number 8) 6 | (A I min_ncon 2) 7 | ) 8 | (1 Query_Atom 9 | (A I atomic_number 8) 10 | (A I single_bond 0) 11 | ) 12 | ) 13 | -------------------------------------------------------------------------------- /queries/quat_n_heteroatom.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "quat_n_heteroatom") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A C atomic_symbol N) 6 | (A I ncon 4) 7 | (A I formal_charge 1) 8 | (A I min_attached_heteroatom_count 1) 9 | ) 10 | ) 11 | -------------------------------------------------------------------------------- /queries/thioester_cyclic.qry: -------------------------------------------------------------------------------- 1 | # RuleClass acylating 2 | # SubClass acyl-thio 3 | 4 | (0 Query 5 | (A C Comment "thioester_cyclic") 6 | (A C Comment "thioester_cyclic") 7 | (A I Version 2) 8 | (A D numeric_value 60) 9 | (A C smarts "[OD1]=[CD3R]-[SD2]") 10 | ) 11 | -------------------------------------------------------------------------------- /queries/thiol.qry: -------------------------------------------------------------------------------- 1 | # RuleClass sulfur 2 | # SubClass misc 3 | 4 | (0 Query 5 | (A I Version 2) 6 | (A C Comment "thiol") 7 | (A D numeric_value 70) 8 | (0 Query_Atom 9 | (A I atomic_number 16) 10 | (A I ncon 1) 11 | (A I nbonds 1) 12 | ) 13 | ) 14 | -------------------------------------------------------------------------------- /queries/8_aminoquinoline.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "8_aminoquinoline") 3 | (A I min_nrings 2) 4 | (A I Version 2) 5 | (0 ring_system_specifier 6 | (A I nrings 2) 7 | (A I aromatic_ring_count 2) 8 | ) 9 | (A C smarts "[nD2H0]1c2c(-[ND2H])cccc2ccc1") 10 | ) 11 | -------------------------------------------------------------------------------- /queries/9_aminoacridine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "9_aminoacridine") 3 | (A I Version 2) 4 | (A I min_nrings 3) 5 | (0 ring_system_specifier 6 | (A I nrings 3) 7 | (A I aromatic_ring_count 3) 8 | ) 9 | (A C smarts "N-c1c2c([nH0]c3c1cccc3)cccc2") 10 | ) 11 | -------------------------------------------------------------------------------- /queries/aminomethyl_ketone_peptide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "aminomethyl_ketone_peptide") 3 | (A I Version 2) 4 | (A C smarts "[NG0]-[CD2]-C(=[O,S,N])[CD3H]-NC=O") 5 | (0 Environment_no_Match 6 | (A I single_bond 0) 7 | (A C smarts "[G>0,a]") 8 | ) 9 | ) 10 | -------------------------------------------------------------------------------- /queries/chlorine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "chlorine") 3 | (A I Version 2) 4 | (A D numeric_value 34) 5 | (A I min_hits_needed 3) 6 | (A I subtract_from_rc 2) 7 | (A I only_match_largest_fragment 1) 8 | (0 Query_Atom 9 | (A I atomic_number 17) 10 | ) 11 | ) 12 | -------------------------------------------------------------------------------- /queries/michael_demerited.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "michael_demerited") 3 | (A I Version 2) 4 | (A D numeric_value 50) 5 | # (A C smarts "[$(C);$([!D3])]=C[$(C);$(C[#6,#7,S,O]);!$(C[O;D1])]=[OD1]") 6 | (A C smarts "[OD1]=[$(C);$(C[#6,#7,S,O]);!$(C[O;D1])]C=[$(C);$([!D3])]") 7 | ) 8 | -------------------------------------------------------------------------------- /queries/allene.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "allene") 4 | (A I one_embedding_per_start_atom 1) 5 | (0 Query_Atom 6 | (A I atomic_number 6) 7 | (A I ncon 2) 8 | (A I nbonds 4) 9 | ) 10 | (1 Query_Atom 11 | (A I double_bond 0) 12 | ) 13 | ) 14 | -------------------------------------------------------------------------------- /queries/n_hydroxy.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "n_hydroxy") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 8) 6 | (A I ncon 1) 7 | ) 8 | (1 Query_Atom 9 | (A I atomic_number 7) 10 | (A I unsaturation 0) 11 | (A I single_bond 0) 12 | ) 13 | ) 14 | -------------------------------------------------------------------------------- /queries/n_s_acyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "n_s_acyclic") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon 2) 7 | (A I nrings 0) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 7) 11 | (A I single_bond 0) 12 | ) 13 | ) 14 | -------------------------------------------------------------------------------- /supporting_libraries/new_int.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "new_array_.h" 4 | 5 | int * 6 | new_int (int size, int initial_value) 7 | { 8 | assert (size > 0); 9 | 10 | return iw_new_array (size, initial_value); 11 | } 12 | 13 | template int * iw_new_array (int, int); 14 | -------------------------------------------------------------------------------- /charge_assigner/negative: -------------------------------------------------------------------------------- 1 | thiazolidinedione.qry 2 | N_acylpyrazolidinone.qry 3 | acid.qry 4 | tetrazole.qry 5 | phosphonate.qry 6 | N_acylsulfonamide.qry 7 | phenolate.qry 8 | carboxylic_acid.qry 9 | sulfonic_acid.qry 10 | #pyrazolidinone.qry 11 | #imidazolidinone.qry 12 | #hydroxamic_acid.qry 13 | -------------------------------------------------------------------------------- /queries/ester.qry: -------------------------------------------------------------------------------- 1 | # RuleClass 2 | # SubClass ester 3 | 4 | (0 Query 5 | (A C Comment "ester") 6 | (A I Version 2) 7 | (A D numeric_value 35) 8 | (A C smarts "[OD1]=[CD3R0T2]-[OD2]") 9 | (1 Environment_no_Match 10 | (A I single_bond 2) 11 | (A C smarts "c") 12 | ) 13 | ) 14 | -------------------------------------------------------------------------------- /queries/halogen_nps.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "halogen_nps") 4 | (A C Comment "halogen_nps") 5 | (0 Query_Atom 6 | (A I atomic_number (9 17 35 53)) 7 | ) 8 | (1 Query_Atom 9 | (A I atomic_number (7 15 16)) 10 | (A I single_bond 0) 11 | ) 12 | ) 13 | -------------------------------------------------------------------------------- /queries/pyrrole.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "pyrrole") 3 | (A D numeric_value 50) 4 | (A I Version 2) 5 | (0 Ring_Specifier 6 | (A I aromatic 1) 7 | (A I ring_size 5) 8 | (A C environment "1[nH]") 9 | (A I heteroatom_count 1) 10 | (A I fused 0) 11 | ) 12 | ) 13 | -------------------------------------------------------------------------------- /queries/biotin.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "biotin") 3 | (A I min_nrings 2) 4 | (A I Version 2) 5 | (0 Ring_System_Specifier 6 | (A I nrings 2) 7 | (A I non_aromatic_ring_count 2) 8 | (A I ring_size 5) 9 | ) 10 | (A C smarts "[SD2r5]1-C-[C;R2]2-N-C(=O)-N-C2-C1") 11 | ) 12 | -------------------------------------------------------------------------------- /queries/acyl_sulfonamide.qry: -------------------------------------------------------------------------------- 1 | # RuleClass 2 | # SubClass 3 | 4 | (0 Query 5 | (A C Comment "acyl_sulfonamide") 6 | (A D numeric_value 30) 7 | (A I Version 2) 8 | 9 | # Last atom is !#7 to differentiate this from sulfonylurea 10 | 11 | (A C smarts "[O,S]=[S;R0]-N-[C;R0](=[O,S])-[!#7]") 12 | ) 13 | -------------------------------------------------------------------------------- /queries/lucifer_yellow.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | # RuleClass colour 3 | # SubClass misc 4 | 5 | (A C Comment "lucifer_yellow") 6 | (A I Version 2) 7 | (0 Ring_System_Specifier 8 | (A I min_nrings 3) 9 | (A I aromatic_ring_count 2) 10 | ) 11 | (A C smarts "O=C1NC(=O)c2cccc3cccc1c23") 12 | ) 13 | -------------------------------------------------------------------------------- /queries/unsat_n_plus.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "unsat_n_plus") 3 | (A I Version 2) 4 | (A D numeric_value 70) 5 | (0 Query_Atom 6 | (A I atomic_number 7) 7 | (A I ncon 3) 8 | (A I nbonds 4) 9 | (A I formal_charge 1) 10 | (A I attached_heteroatom_count 0) 11 | ) 12 | ) 13 | -------------------------------------------------------------------------------- /queries/quat_schiff_base.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "quat_schiff_base") 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | (A I formal_charge 1) 7 | (A I ncon 3) 8 | (A I nbonds 4) 9 | (A I aromatic 0) 10 | (A I attached_heteroatom_count 0) 11 | ) 12 | ) 13 | -------------------------------------------------------------------------------- /queries/n_oxide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "n_oxide") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 8) 6 | (A I ncon 1) 7 | (A I nbonds 2) 8 | ) 9 | 10 | (1 Query_Atom 11 | (A I atomic_number 7) 12 | (A I aromatic 1) 13 | (A I double_bond 0) 14 | ) 15 | ) 16 | -------------------------------------------------------------------------------- /Molecule/coordinates.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "coordinates.h" 4 | #include "atom.h" 5 | 6 | Coordinates::Coordinates (const Atom & a) : Space_Vector (a._x, a._y, a._z) 7 | { 8 | } 9 | 10 | Coordinates::Coordinates (const Space_Vector & a) : Space_Vector (a) 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /queries/thiophene_furan_n_acyl.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "thiophene_furan_n_acyl") 3 | (A I Version 2) 4 | (A D numeric_value 25) 5 | (A I min_aromatic_ring_count 1) 6 | (A C smarts "[/IWfss1o,s]1:c:c:c:c1") 7 | (1 Environment 8 | (A I single_bond (1 2 3 4)) 9 | (A C smarts "N-C=O") 10 | ) 11 | ) 12 | -------------------------------------------------------------------------------- /queries/thiophene_furan_nh.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "thiophene_furan_nh") 3 | (A I Version 2) 4 | (A D numeric_value 70) 5 | (A I min_aromatic_ring_count 1) 6 | (A C smarts "[/IWfss1o,s]1:c:c:c:c1") 7 | (1 Environment 8 | (A I single_bond (1 2 3 4)) 9 | (A C smarts "[/IWVy0NH>0]") 10 | ) 11 | ) 12 | -------------------------------------------------------------------------------- /queries/aromatic_iodide.qry: -------------------------------------------------------------------------------- 1 | # RuleClass halogen 2 | # SubClass misc 3 | 4 | (0 Query 5 | (A C Comment "aromatic_iodide") 6 | (A D numeric_value 60) 7 | (A I min_aromatic_ring_count 1) 8 | (A I Version 2) 9 | (0 Query_Atom 10 | (A I atomic_number 53) 11 | (A I min_ncon 1) 12 | (A I aryl 1) 13 | ) 14 | ) 15 | 16 | -------------------------------------------------------------------------------- /queries/phenolate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "phenolate") 4 | (A C smarts "[OD1H]-c1ccccc1") 5 | (A I one_embedding_per_start_atom 1) 6 | (0 Environment 7 | (A I single_bond (2 4)) 8 | (A I min_hits_needed 2) 9 | (A C smarts "[$(N(=O)=O),$(C#N),$([C,S]=O),$([F,Cl,Br,I])]") 10 | ) 11 | ) 12 | -------------------------------------------------------------------------------- /supporting_libraries/should_match.h: -------------------------------------------------------------------------------- 1 | #ifndef IW_SHOULD_MATCH_H 2 | #define IW_SHOULD_MATCH_H 3 | 4 | extern int should_match (const IWString &, const char *, const char *); 5 | extern int should_match (const const_IWSubstring &, const char *, const char *); 6 | extern int should_match (const char *, const char *, const char *); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /queries/four_valent_sulphur.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "four_valent_sulphur") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon 3) 7 | (A I nbonds 4) 8 | ) 9 | 10 | # We don't want S=O to hit 11 | 12 | (1 Query_Atom 13 | (A I min_ncon 2) 14 | (A I double_bond 0) 15 | ) 16 | ) 17 | -------------------------------------------------------------------------------- /queries/melamine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "melamine") 4 | (A C Comment "melamine") 5 | (A I min_nrings 1) 6 | (0 Elements_Needed 7 | (A I atomic_number 7) 8 | (A I min_hits_needed 3) 9 | ) 10 | (A I one_embedding_per_start_atom 1) 11 | (A C smarts "[Nr6]1-[CG0]-[NG0]-[CG0]-[NG0]-[CG0]1") 12 | ) 13 | -------------------------------------------------------------------------------- /queries/acetylene_heteroatom.qry: -------------------------------------------------------------------------------- 1 | (4 Query 2 | (A C Comment "acetylene_heteroatom") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 6) 6 | (A I ncon 2) 7 | (A I nbonds 4) 8 | (A I attached_heteroatom_count 1) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I triple_bond 0) 13 | ) 14 | ) 15 | -------------------------------------------------------------------------------- /queries/aldehyde.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "aldehyde") 4 | (0 Query_Atom 5 | (A I atomic_number (8 16)) 6 | (A I ncon 1) 7 | (A I nbonds 2) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 6) 11 | (A I ncon 2) 12 | (A I attached_heteroatom_count 1) 13 | (A I double_bond 0) 14 | ) 15 | ) 16 | -------------------------------------------------------------------------------- /charge_assigner/queries: -------------------------------------------------------------------------------- 1 | carboxylic_acid.qry 2 | sulfonic_acid.qry 3 | phosphonate.qry 4 | tetrazole.qry 5 | N_acylsulfonamide.qry 6 | thiazolidinedione.qry 7 | N_acylpyrazolidinone.qry 8 | phenolate.qry 9 | guanidine.qry 10 | amidine.qry 11 | 4_amino_pyridine.qry 12 | amino_terminal_restricted.qry 13 | aliphatic_amine_restricted.qry 14 | imidazole_basic.qry 15 | -------------------------------------------------------------------------------- /queries/thione.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | 3 | (A C Comment "thione") 4 | (A D numeric_value 40) 5 | (A I Version 2) 6 | (0 Query_Atom 7 | (A I atomic_number 16) 8 | (A I ncon 1) 9 | (A I nbonds 2) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I attached_heteroatom_count 1) 14 | (A I double_bond 0) 15 | ) 16 | ) 17 | -------------------------------------------------------------------------------- /queries/diphosphate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "P-O-P") 3 | (A C Comment "diphosphate") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 15) 7 | ) 8 | (1 Query_Atom 9 | (A I atomic_number 8) 10 | (A I single_bond 0) 11 | ) 12 | (2 Query_Atom 13 | (A I atomic_number 15) 14 | (A I single_bond 1) 15 | ) 16 | ) 17 | -------------------------------------------------------------------------------- /queries/naphthalene_sulfonate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "naphthalene_sulfonate") 3 | (A I Version 2) 4 | (0 Ring_System_Specifier 5 | (A I min_aromatic_ring_count 2) 6 | ) 7 | (A C smarts "[cD3R2r6]12~c~c~c~c~c~1~c~c~c~c~2") 8 | (0 Environment 9 | (A I single_bond (1 2 3 4 6 7 8 9)) 10 | (A C smarts "[SD4](=O)(=O)-O") 11 | ) 12 | ) 13 | -------------------------------------------------------------------------------- /queries/cyano.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "cyano") 3 | (A D numeric_value 50) 4 | (A I Version 2) 5 | (A I subtract_from_rc 1) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I ncon 1) 9 | (A I nbonds 3) 10 | (A I formal_charge 0) 11 | ) 12 | (1 Query_Atom 13 | (A I atomic_number 6) 14 | (A I triple_bond 0) 15 | ) 16 | ) 17 | -------------------------------------------------------------------------------- /queries/isocyano.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "isocyano") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 6) 6 | (A I ncon 1) 7 | (A I formal_charge -1) 8 | (A I nbonds 3) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 7) 12 | (A I formal_charge 1) 13 | (A I ncon 2) 14 | (A I triple_bond 0) 15 | ) 16 | ) 17 | -------------------------------------------------------------------------------- /queries/thione_oxide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "thione_oxide") 3 | (A C Comment "thione_oxide") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I ncon 2) 8 | (A I nbonds 4) 9 | (A I attached_heteroatom_count 1) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 8) 13 | (A I double_bond 0) 14 | ) 15 | ) 16 | -------------------------------------------------------------------------------- /queries/oxime.qry: -------------------------------------------------------------------------------- 1 | (2 Query 2 | (A C Comment "oxime") 3 | (A C Comment "oxime") 4 | (A D numeric_value 20) 5 | (A I Version 2) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I unsaturation 1) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I nrings 0) 13 | (A I formal_charge 0) 14 | (A I single_bond 0) 15 | ) 16 | ) 17 | -------------------------------------------------------------------------------- /queries/sulfonyl_n_aromatic_nedg.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "sulfonyl_n_aromatic_nedg") 3 | (A C Comment "sulfonyl_n_aromatic_nedg") 4 | (A I Version 2) 5 | (A I min_aromatic_ring_count 1) 6 | 7 | (0 Ring_Specifier 8 | (A I aromatic 1) 9 | (A I min_heteroatom_count 1) 10 | (A C environment "[nD3]-S(=O)(=O)&&0[aD3]-[G0;CH>0,O,N]") 11 | ) 12 | ) 13 | -------------------------------------------------------------------------------- /queries/cyano_amine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "cyano_amine") 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | (A I ncon 1) 7 | (A I nbonds 3) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 6) 11 | (A I triple_bond 0) 12 | ) 13 | (2 Query_Atom 14 | (A I atomic_number 7) 15 | (A I single_bond 1) 16 | ) 17 | ) 18 | -------------------------------------------------------------------------------- /queries/half_sulfur_peroxide.qry: -------------------------------------------------------------------------------- 1 | (0 Composite_Query 2 | (A I Version 2) 3 | (A C Comment "half_sulfur_peroxide") 4 | (0 Query 5 | (A I version 2) 6 | (A C smarts "[SD2]-[OD2]") 7 | ) 8 | (1 Query 9 | (A I version 2) 10 | (A C smarts "[SD1]-[OD2]") 11 | ) 12 | (2 Query 13 | (A I version 2) 14 | (A C smarts "[SD2]-[OD1]") 15 | ) 16 | ) 17 | -------------------------------------------------------------------------------- /queries/het_3mem_ring.qry: -------------------------------------------------------------------------------- 1 | # RuleClass alkylating 2 | # SubClass misc 3 | 4 | (0 Query 5 | (A I Version 2) 6 | (A I min_nrings 1) 7 | (A C Comment "het_3mem_ring") 8 | (A C Comment "het_3mem_ring") 9 | (1 Ring_Specifier 10 | (A I ring_size 3) 11 | (A I fused 0) 12 | (A I min_heteroatom_count 1) 13 | ) 14 | # (A C smarts "[!#6;r3;D2]1-[R1]-[R1]1") 15 | ) 16 | -------------------------------------------------------------------------------- /queries/quaternary_amine.qry: -------------------------------------------------------------------------------- 1 | # RuleClass quat 2 | # SubClass misc 3 | 4 | (3 Query 5 | (A C Comment "quaternary_amine") 6 | (A I Version 2) 7 | (A D numeric_value 50) 8 | (0 Query_Atom 9 | (A I atomic_number 7) 10 | (A I ncon 4) 11 | (A I nbonds 4) 12 | (A I formal_charge 1) 13 | (A I nrings 0) 14 | (A I attached_heteroatom_count 0) 15 | ) 16 | ) 17 | -------------------------------------------------------------------------------- /queries/amino_naphthalene.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "amino_naphthalene") 3 | (A C Comment "amino_naphthalene") 4 | (A I Version 2) 5 | (0 Ring_System_Specifier 6 | (A I min_aromatic_ring_count 2) 7 | ) 8 | (A C smarts "[cD3R2r6]12~c~c~c~c~c~1~c~c~c~c~2") 9 | (0 Environment 10 | (A I single_bond (1 2 3 4 6 7 8 9)) 11 | (A C smarts "[NH>0]") 12 | ) 13 | ) 14 | -------------------------------------------------------------------------------- /queries/het_3mem_ring_fused.qry: -------------------------------------------------------------------------------- 1 | # RuleClass alkylating 2 | # SubClass misc 3 | 4 | (0 Query 5 | (A I Version 2) 6 | (A I min_nrings 1) 7 | (A C Comment "het_3mem_ring_fused") 8 | (A D numeric_value 50) 9 | (1 Ring_Specifier 10 | (A I ring_size 3) 11 | (A I fused 1) 12 | (A I min_heteroatom_count 1) 13 | ) 14 | # (A C smarts "[!#6;r3;D2]1-[R>1]-[R>1]1") 15 | ) 16 | -------------------------------------------------------------------------------- /include/new_array_.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Implementation used by the various new_ functions 4 | */ 5 | 6 | #ifndef IW_NEW_ARRAY_H 7 | #define IW_NEW_ARRAY_H 8 | 9 | #include "misc.h" 10 | 11 | template 12 | T * 13 | iw_new_array (int size, T initial_value) 14 | { 15 | T * rc = new T[size]; 16 | 17 | set_vector (rc, size, initial_value); 18 | 19 | return rc; 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /queries/acetylene.qry: -------------------------------------------------------------------------------- 1 | (3 Query 2 | (A C Comment "acetylene") 3 | (A I Version 2) 4 | (A I unique_embeddings_only 1) 5 | (A D numeric_value 50) 6 | (0 Query_Atom 7 | (A I atomic_number 6) 8 | (A I min_nbonds 3) 9 | (A I nrings 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I min_ncon 2) 14 | (A I nrings 0) 15 | (A I triple_bond 0) 16 | ) 17 | ) 18 | -------------------------------------------------------------------------------- /queries/anthracene_phenanthrene.qry: -------------------------------------------------------------------------------- 1 | # RuleClass rings 2 | # SubClass polyaromatic 3 | 4 | (0 Query 5 | (A I Version 2) 6 | (A C Comment "anthracene_phenanthrene") 7 | (A C Comment "anthracene_phenanthrene") 8 | (A I min_nrings 3) 9 | (1 Ring_System_Specifier 10 | (A I nrings 3) 11 | (A I ring_size 6) 12 | (A I aromatic_ring_count 3) 13 | (A I heteroatom_count 0) 14 | ) 15 | ) 16 | -------------------------------------------------------------------------------- /queries/n_o_acyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "n_o_acyclic") 4 | (A D numeric_value 50) 5 | (0 Query_Atom 6 | (A I atomic_number 8) 7 | (A I ncon 2) 8 | (A I nbonds 2) 9 | (A I ring_id 1) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 7) 13 | (A I ncon 2) 14 | (A I nbonds 2) 15 | (A I ring_id 2) 16 | (A I single_bond 0) 17 | ) 18 | ) 19 | -------------------------------------------------------------------------------- /queries/michael_rejected.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "michael_rejected") 4 | # (A C smarts "[$(C);$([!D3]);!$(C[N,S,O])]=[$(C);!$(C[N,S,O])][$(C);$(C[#6,#7,S,O]);!$(C[O;D1])]=[OD1]") 5 | (A C smarts "[OD1]=[$(C);$(C[#6,#7,S,O]);!$(C[OD1])][$(C);!$(C[N,S,O])]=[$(C);$([!D3]);!$(C[N,S,O])]") 6 | # (A C smarts "[OD1]=[$(C);$(C[#6,#7,S,O]);!$(C[OD1])][$(C);!$(C[N,S,O])]=[$([C;D1,D2]);!$(C[N,S,O])]") 7 | ) 8 | -------------------------------------------------------------------------------- /queries/nitroso.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "nitroso") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 8) 6 | (A I ncon 1) 7 | (A I nbonds 2) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 7) 11 | (A I ncon 2) 12 | (A I nrings 0) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number (6 7)) 17 | (A C bond_smarts "1 -,#") 18 | ) 19 | ) 20 | -------------------------------------------------------------------------------- /queries/hydrazone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "hydrazone") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | ) 7 | (1 Query_Atom 8 | (A I atomic_number 7) 9 | (A I ncon 2) 10 | (A I ring_id 1) 11 | (A I unsaturation 1) 12 | (A I single_bond 0) 13 | ) 14 | (2 Query_Atom 15 | (A I atomic_number 6) 16 | (A I ring_id 2) 17 | (A I double_bond 1) 18 | ) 19 | ) 20 | -------------------------------------------------------------------------------- /Molecule/molecule_marvin.h: -------------------------------------------------------------------------------- 1 | int _write_molecule_mrv (std::ostream & os) const; 2 | int _write_atoms_mrv (std::ostream & os) const; 3 | int _write_bonds_mrv (std::ostream & os) const; 4 | 5 | int read_molecule_mrv_mchemical (XMLNode & cml); 6 | int _read_atom_array_mrv (XMLNode & cml); 7 | int _read_bond_array_mrv (XMLNode & cml, int *); 8 | int _read_atom_array_mrv_individual_attributes (const XMLNode & xml); 9 | -------------------------------------------------------------------------------- /queries/schiff_base.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "schiff_base") 3 | (A C Comment "schiff_base") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 7) 7 | (A I unsaturation 1) 8 | (A I attached_heteroatom_count 0) 9 | (A I ring_id 1) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I attached_heteroatom_count 1) 14 | (A I double_bond 0) 15 | (A I ring_id 2) 16 | ) 17 | ) 18 | -------------------------------------------------------------------------------- /Molecule/careful_frag.h: -------------------------------------------------------------------------------- 1 | /* 2 | Some extra private functions needed by careful_frag 3 | */ 4 | 5 | #ifndef CAREFUL_FRAG_H 6 | #define CAREFUL_FRAG_H 7 | 8 | int _reduce_to_largest_fragment_carefully (Fragment_Data * fc, int * already_counted); 9 | int _is_nitro (atom_number_t, int *) const; 10 | int _is_sulphate_like (atom_number_t, int *) const; 11 | int _identify_fragment_undesirable_groups (int * exclude) const; 12 | #endif 13 | -------------------------------------------------------------------------------- /include/kahan_sum.h: -------------------------------------------------------------------------------- 1 | #ifndef KAHANSUM_J 2 | #define KAHANSUM_J 3 | 4 | class KahanSum 5 | { 6 | private: 7 | double _sum; 8 | double _c; 9 | 10 | public: 11 | KahanSum (); 12 | 13 | KahanSum & operator += (double); 14 | KahanSum & operator += (const KahanSum &); 15 | KahanSum & operator = (double); 16 | 17 | operator double () const {return _sum;} 18 | 19 | double sum() const { return _sum;} 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /include/iwhash.h: -------------------------------------------------------------------------------- 1 | #ifndef IW_HASH_H 2 | #define IW_HASH_H 3 | 4 | #include "iwconfig.h" 5 | 6 | class IWStringHash 7 | { 8 | private: 9 | public: 10 | 11 | #if defined (IW_INTEL_COMPILER) 12 | 13 | static const size_t bucket_size = 4; 14 | static const size_t min_buckets = 8; 15 | bool operator () (const IWString &, const IWString &) const; 16 | 17 | #endif 18 | 19 | size_t operator () (const IWString &) const; 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /queries/acid_halide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "acid_halide") 4 | (A I one_embedding_per_start_atom 1) 5 | (0 Query_Atom 6 | (A I atomic_number (9 17 35 53)) 7 | (A I ncon 1) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 6) 11 | (A I ncon 3) 12 | (A I nbonds 4) 13 | (A I single_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 8) 17 | (A I ncon 1) 18 | (A I double_bond 1) 19 | ) 20 | ) 21 | -------------------------------------------------------------------------------- /queries/formylated.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "formylated") 3 | (A I Version 2) 4 | 5 | # O=[CH]-N 6 | 7 | (0 Query_Atom 8 | (A I atomic_number 6) 9 | (A I ncon 2) 10 | (A I hcount 1) 11 | (A I nrings 0) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 8) 15 | (A I ncon 1) 16 | (A I double_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 7) 20 | (A I unsaturation 0) 21 | (A I single_bond 0) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /supporting_libraries/int_comparator.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "misc.h" 4 | 5 | int 6 | Int_Comparator_Larger::operator() (int i1, int i2) const 7 | { 8 | if (i1 < i2) 9 | return -1; 10 | 11 | if (i1 > i2) 12 | return 1; 13 | 14 | return 0; 15 | } 16 | 17 | int 18 | Int_Comparator_Smaller::operator() (int i1, int i2) const 19 | { 20 | if (i1 < i2) 21 | return 1; 22 | 23 | if (i1 > i2) 24 | return -1; 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /queries/ncn.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "ncn") 4 | (A C Comment "ncn") 5 | (A I unique_embeddings_only 1) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I ring_id 1) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ring_id 2) 13 | (A I unsaturation 0) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 7) 18 | (A I ring_id 3) 19 | (A I single_bond 1) 20 | ) 21 | ) 22 | -------------------------------------------------------------------------------- /queries/nso_2.qry: -------------------------------------------------------------------------------- 1 | (3 Query 2 | (A C Comment "nso_2") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I ncon 1) 6 | (A I nbonds 2) 7 | (A I atomic_number 16) 8 | ) 9 | (1 Query_Atom 10 | (A I ncon 3) 11 | (A I nbonds 5) 12 | (A I nrings 0) 13 | (A I double_bond 0) 14 | (A I atomic_number 7) 15 | ) 16 | (2 Query_Atom 17 | (A I ncon 1) 18 | (A I nbonds 2) 19 | (A I double_bond 1) 20 | (A I atomic_number 8) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /queries/thio_ester_thione_acyclic.qry: -------------------------------------------------------------------------------- 1 | # RuleClass acylating 2 | # SubClass thio 3 | 4 | (0 Query 5 | (A C Comment "thio_ester_thione_acyclic") 6 | (A I Version 2) 7 | (0 Query_Atom 8 | (A I atomic_number 16) 9 | (A I ncon 1) 10 | (A I nbonds 2) 11 | ) 12 | (1 Query_Atom 13 | (A I atomic_number 6) 14 | (A I nrings 0) 15 | (A I double_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 16) 19 | (A I single_bond 1) 20 | ) 21 | ) 22 | -------------------------------------------------------------------------------- /queries/sulfonium.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "sulfonium") 3 | (A I Version 2) 4 | (A I one_embedding_per_start_atom 1) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I min_ncon 3) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 6) 11 | (A I single_bond 0) 12 | ) 13 | (2 Query_Atom 14 | (A I atomic_number 6) 15 | (A I single_bond 0) 16 | ) 17 | (3 Query_Atom 18 | (A I atomic_number 6) 19 | (A I single_bond 0) 20 | ) 21 | ) 22 | -------------------------------------------------------------------------------- /queries/thioacetal_acyclic.qry: -------------------------------------------------------------------------------- 1 | (4 Query 2 | (A C Comment "thioacetal_acyclic") 3 | (A I Version 2) 4 | (A I unique_embeddings_only 1) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I nrings 0) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 6) 11 | (A I min_ncon 2) 12 | (A I min_hcount 1) 13 | (A I single_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 16) 17 | (A I nrings 0) 18 | (A I single_bond 1) 19 | ) 20 | ) 21 | -------------------------------------------------------------------------------- /queries/acyl_arom_n.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acyl_arom_n") 3 | (A I Version 2) 4 | (A I min_aromatic_ring_count 1) 5 | (0 Query_Atom 6 | (A I atomic_number 7) 7 | (A I aromatic 1) 8 | ) 9 | (1 Query_Atom 10 | (A I nrings 0) 11 | (A I atomic_number 6) 12 | (A I ncon 3) 13 | (A I nbonds 4) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number (8 16)) 18 | (A I ncon 1) 19 | (A I double_bond 1) 20 | ) 21 | ) 22 | -------------------------------------------------------------------------------- /queries/dithio_olefin.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "dithio_olefin") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | ) 7 | (1 Query_Atom 8 | (A I atomic_number 6) 9 | (A I ncon 3) 10 | (A I nbonds 4) 11 | (A I single_bond 0) 12 | ) 13 | (2 Query_Atom 14 | (A I atomic_number 6) 15 | (A I aromatic 0) 16 | (A I double_bond 1) 17 | ) 18 | (3 Query_Atom 19 | (A I atomic_number 16) 20 | (A I single_bond 1) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /queries/thiocyanate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "thiocyanate") 3 | (A C Comment "thiocyanate") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 7) 7 | (A I ncon 1) 8 | (A I nbonds 3) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ncon 2) 13 | (A I nbonds 4) 14 | (A I triple_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 16) 18 | (A I ncon 2) 19 | (A I nbonds 2) 20 | (A I single_bond 1) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /queries/alkyl_fluoride_activated.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "alkyl_fluoride_activated") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 9) 6 | (A I ncon 1) 7 | ) 8 | (1 Query_Atom 9 | (A I atomic_number 6) 10 | (A I ncon 2) 11 | (A I single_bond 0) 12 | ) 13 | (2 Query_Atom 14 | (A I atomic_number 6) 15 | (A I ncon 3) 16 | (A I single_bond 1) 17 | ) 18 | (3 Query_Atom 19 | (A I aromatic 1) 20 | (A I single_bond 2) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /queries/ester_thione.qry: -------------------------------------------------------------------------------- 1 | (3 Query 2 | (A C Comment "ester_thione") 3 | (A C Comment "ester_thione") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I ncon 1) 8 | (A I nbonds 2) 9 | (A I nrings 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I ncon 3) 14 | (A I nrings 0) 15 | (A I double_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 8) 19 | (A I single_bond 1) 20 | (A I nrings 0) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /queries/aminal_acyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "aminal_acyclic") 4 | (0 Query_Atom 5 | (A I atomic_number 8) 6 | (A I ring_id 1) 7 | ) 8 | (1 Query_Atom 9 | (A I atomic_number 6) 10 | (A I nrings 0) 11 | (A I min_attached_heteroatom_count 2) 12 | (A I unsaturation 0) 13 | (A I ring_id 2) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 7) 18 | (A I ring_id 3) 19 | (A I single_bond 1) 20 | ) 21 | ) 22 | -------------------------------------------------------------------------------- /queries/diazo_cyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "diazo_cyclic") 3 | (A C Comment "diazo_cyclic") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 7) 7 | (A I ncon 2) 8 | (A I aromatic 0) 9 | (A I min_nrings 1) 10 | (A I nbonds 3) 11 | (A I attached_heteroatom_count 1) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 7) 15 | (A I ncon 2) 16 | (A I attached_heteroatom_count 1) 17 | (A I min_nrings 1) 18 | (A I double_bond 0) 19 | ) 20 | ) 21 | -------------------------------------------------------------------------------- /queries/sch2s.qry: -------------------------------------------------------------------------------- 1 | (4 Query 2 | (A C Comment "sch2s") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon (1 2)) 7 | (A I nrings 0) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 6) 11 | (A I ncon 2) 12 | (A I hcount 2) 13 | (A I nbonds 2) 14 | (A I nrings 0) 15 | (A I single_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 16) 19 | (A I ncon (1 2)) 20 | (A I nrings 0) 21 | (A I single_bond 1) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /queries/thio_ester_thione_cyclic.qry: -------------------------------------------------------------------------------- 1 | # RuleClass acylating 2 | # SubClass thio 3 | 4 | (0 Query 5 | (A C Comment "thio_ester_thione_cyclic") 6 | (A I Version 2) 7 | (A D numeric_value 60) 8 | (0 Query_Atom 9 | (A I atomic_number 16) 10 | (A I ncon 1) 11 | (A I nbonds 2) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I nrings 1) 16 | (A I double_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 16) 20 | (A I single_bond 1) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /supporting_libraries/write_space_suppressed_string.cc: -------------------------------------------------------------------------------- 1 | #include "misc.h" 2 | #include "iwstring.h" 3 | 4 | std::ostream & 5 | write_space_suppressed_string (const IWString & zstring, 6 | std::ostream & os, 7 | char fill_char) 8 | { 9 | if (zstring.contains (' ')) 10 | { 11 | IWString tmp (zstring); 12 | tmp.gsub (' ', fill_char); 13 | 14 | os << tmp; 15 | } 16 | else 17 | os << zstring; 18 | 19 | return os; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /queries/dna_intercalator_1.qry: -------------------------------------------------------------------------------- 1 | # RuleClass other 2 | # SubClass DNA 3 | 4 | (0 Query 5 | (A I Version 2) 6 | (A D numeric_value 40) 7 | (A C Comment "dna_intercalator_1") 8 | (A C Comment "dna_intercalator_1") 9 | (A I min_nrings 4) 10 | (A I min_natoms 23) 11 | (A I min_aromatic_ring_count 4) 12 | (0 ring_system_specifier 13 | (A I nrings 4) 14 | # (A I aromatic_ring_count 4) // doesn't work for some reason 15 | ) 16 | (A C smarts "N-C-C-N-c1c2c(=O)c3c(n4anc(cc1)c24)cccc3") 17 | ) 18 | -------------------------------------------------------------------------------- /queries/vinyl_sulphide.qry: -------------------------------------------------------------------------------- 1 | (2 Query 2 | (A C Comment "vinyl_sulphide") 3 | (A C Comment "vinyl_sulphide") 4 | (A I max_ring_atoms_matched 1) 5 | (A I Version 2) 6 | (0 Query_Atom 7 | (A I atomic_number 16) 8 | (A I nrings 0) 9 | (A I ncon 2) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I unsaturation 1) 14 | (A I aromatic 0) 15 | (A I single_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 6) 19 | (A I double_bond 1) 20 | ) 21 | ) 22 | -------------------------------------------------------------------------------- /charge_assigner/acid.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I one_embedding_per_start_atom 1) 3 | (A I Version 2) 4 | (A C Comment "Acid_P_S") 5 | (0 Query_Atom 6 | (A I atomic_number (15 16)) 7 | (A I min_unsaturation 1) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 8) 11 | (A I ncon 1) 12 | (A I formal_charge 0) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 8) 17 | (A I ncon 1) 18 | (A D numeric_value -1.1) 19 | (A I single_bond 0) 20 | ) 21 | ) 22 | -------------------------------------------------------------------------------- /queries/vinyl_halide_2_halogens.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "vinyl_halide_2_halogens") 4 | (0 Query_Atom 5 | (A I atomic_number 6) 6 | (A I aromatic 0) 7 | (A I min_unsaturation 1) 8 | # (A I vinyl 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I aromatic 0) 13 | (A I double_bond 0) 14 | # (A I vinyl 0) 15 | ) 16 | 17 | (0 Environment 18 | (A C smarts "[Cl,Br,I]") 19 | (A I hits_needed 2) 20 | (A I single_bond (0 1)) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /queries/acetal_acyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acetal_acyclic") 3 | (A C Comment "acetal_acyclic") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number (7 8 16)) 7 | (A I ncon 2) 8 | (A I nrings 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I unsaturation 0) 13 | (A I nrings 0) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number (7 8 16)) 18 | (A I ncon 2) 19 | (A I nrings 0) 20 | (A I single_bond 1) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /queries/five_valent_nitrogen.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "five_valent_nitrogen") 4 | (A I one_embedding_per_start_atom 1) 5 | (A I embeddings_do_not_overlap 1) 6 | (0 Element_Hits_Needed 7 | (A I atomic_number 8) 8 | (A I max_hits_needed 1) 9 | ) 10 | (0 Query_Atom 11 | (A I atomic_number 7) 12 | (A I ncon 3) 13 | (A I nbonds 5) 14 | (A I aromatic 0) 15 | ) 16 | (1 Query_Atom 17 | (A I double_bond 0) 18 | ) 19 | (2 Query_Atom 20 | (A I double_bond 0) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /queries/isoamide_acyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "isoamide_acyclic") 3 | (A C Comment "isoamide_acyclic") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 7) 7 | (A I ncon 2) 8 | (A I nrings 0) 9 | (A I unsaturation 1) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I ncon 3) 14 | (A I nrings 0) 15 | (A I double_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 8) 19 | (A I ncon 2) 20 | (A I nrings 0) 21 | (A I single_bond 1) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /queries/isothioamide_cyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "isothioamide_cyclic") 4 | (A I min_nrings 1) 5 | (A D numeric_value 50) 6 | (0 Query_Atom 7 | (A I atomic_number 16) 8 | (A I ncon 2) 9 | (A I nrings 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I ncon 3) 14 | (A I nbonds 4) 15 | (A I nrings 1) 16 | (A I aromatic 0) 17 | (A I single_bond 0) 18 | ) 19 | (2 Query_Atom 20 | (A I atomic_number 7) 21 | (A I double_bond 1) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /supporting_libraries/iwbits_support.h: -------------------------------------------------------------------------------- 1 | #ifndef IWBITS_SUPPORT_H 2 | #define IWBITS_SUPPORT_H 3 | extern void 4 | word_string_form (IWString & buffer, const unsigned int zword, 5 | int bits_to_print, 6 | const char t, const char f, 7 | int include_space); 8 | extern void 9 | byte_string_form (IWString & buffer, const unsigned char zword, 10 | int bits_to_print, 11 | const char t, const char f, 12 | int include_space); 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /queries/thioester_acyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "thioester_acyclic") 3 | (A C Comment "thioester_acyclic") 4 | (A D numeric_value 50) 5 | (A I Version 2) 6 | (0 Query_Atom 7 | (A I atomic_number 16) 8 | (A I ncon 2) 9 | (A I nbonds 2) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I ncon 3) 14 | (A I nbonds 4) 15 | (A I nrings 0) 16 | (A I single_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 8) 20 | (A I ncon 1) 21 | (A I double_bond 1) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /queries/trifluoroborate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "trifluoroborate") 3 | (A C Comment "trifluoroborate") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 5) 7 | (A I min_ncon 3) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 9) 11 | (A I ncon 1) 12 | (A I single_bond 0) 13 | ) 14 | (2 Query_Atom 15 | (A I atomic_number 9) 16 | (A I ncon 1) 17 | (A I single_bond 0) 18 | ) 19 | (3 Query_Atom 20 | (A I atomic_number 9) 21 | (A I ncon 1) 22 | (A I single_bond 0) 23 | ) 24 | ) 25 | -------------------------------------------------------------------------------- /queries/enamine.qry: -------------------------------------------------------------------------------- 1 | (6 Query 2 | (A C Comment "enamine") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | (A I formal_charge 0) 7 | (A I nrings 0) 8 | (A I attached_heteroatom_count 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I min_ncon 2) 13 | (A I nrings 0) 14 | (A I attached_heteroatom_count 1) 15 | (A I single_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 6) 19 | (A I max_attached_heteroatom_count 1) 20 | (A I double_bond 1) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /queries/vinyl_halide_3_halogens.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "vinyl_halide_3_halogens") 4 | (A D numeric_value 50) 5 | (0 Query_Atom 6 | (A I atomic_number 6) 7 | (A I aromatic 0) 8 | (A I min_unsaturation 1) 9 | # (A I vinyl 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I aromatic 0) 14 | (A I double_bond 0) 15 | # (A I vinyl 0) 16 | ) 17 | 18 | (0 Environment 19 | (A C smarts "[Cl,Br,I]") 20 | (A I min_hits_needed 3) 21 | (A I single_bond (0 1)) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /Molecule/rwmolecule.h: -------------------------------------------------------------------------------- 1 | #ifndef RWMOLECULE_H 2 | #define RWMOLECULE_H 3 | 4 | #define EXTRA_STRING_RECORD(ds, b, c) \ 5 | if (! (ds).next_record ((b)))\ 6 | {\ 7 | cerr << (c) << " eof\n";\ 8 | return 0;\ 9 | } 10 | 11 | template int rwmolecule_error (const char *, T &); 12 | 13 | extern int write_coordinates (std::ostream &, const Atom * a, int = 0); 14 | 15 | extern int append_sybyl_atom_type (std::ostream & os, int atype, const IWString & asymbol); 16 | 17 | extern void reset_rwmolecule_file_scope_variables (); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /queries/vinyl_nitro.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A I one_embedding_per_start_atom 1) 4 | (A C Comment "vinyl_nitro") 5 | (A C Comment "vinyl_nitro") 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I ncon 3) 9 | (A I nbonds 5) 10 | (A I attached_heteroatom_count 2) 11 | (A I vinyl 1) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 8) 15 | (A I ncon 1) 16 | (A I double_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 8) 20 | (A I ncon 1) 21 | (A I double_bond 0) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /Molecule/moleculeh.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPILING_MOLECULEH_H 2 | BARF, NOT COMPILING MOLECULEH.CC 3 | #else 4 | 5 | int _place_1_hydrogen (const Make_Implicit_Hydrogens_Explicit &); 6 | int _place_2_hydrogens (const Make_Implicit_Hydrogens_Explicit &); 7 | int _place_3_hydrogens (const Make_Implicit_Hydrogens_Explicit &); 8 | int _place_4_hydrogens (const Make_Implicit_Hydrogens_Explicit &); 9 | int _place_lots_of_hydrogens (const Make_Implicit_Hydrogens_Explicit &, int); 10 | int _place_chiral_h_atom (Chiral_Centre *, Atom *, atom_number_t); 11 | #endif 12 | -------------------------------------------------------------------------------- /queries/nitroxide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "nitroxide") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | (A I ncon 3) 7 | (A I nbonds 5) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 8) 11 | (A I ncon 1) 12 | (A I nbonds 2) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 6) 17 | (A I ncon 3) 18 | (A I nbonds 4) 19 | (A I nrings 0) 20 | (A I double_bond 0) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 6) 24 | (A I single_bond 0) 25 | ) 26 | ) 27 | -------------------------------------------------------------------------------- /queries/thio_oxime.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "thio_oxime") 4 | (A C Comment "thio_oxime") 5 | (A D numeric_value 50) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I ncon 2) 9 | (A I unsaturation 1) 10 | (A I ring_id 1) 11 | ) 12 | (1 Query_Atom 13 | (A I atomic_number 6) 14 | (A I attached_heteroatom_count 1) 15 | (A I ring_id 2) 16 | (A I double_bond 0) 17 | ) 18 | (1 Environment 19 | (A I single_bond (0 1)) 20 | (3 Query_Atom 21 | (A I atomic_number 16) 22 | ) 23 | ) 24 | ) 25 | -------------------------------------------------------------------------------- /charge_assigner/sulfonic_acid.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I one_embedding_per_start_atom 1) 3 | (A I Version 2) 4 | (A C Comment "sulfonic_acid") 5 | # clogD offset 6 | (A D numeric_value 1.03) 7 | (0 Query_Atom 8 | (A I atomic_number 16) 9 | (A I min_unsaturation 1) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 8) 13 | (A I ncon 1) 14 | (A I formal_charge 0) 15 | (A I double_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 8) 19 | (A I ncon 1) 20 | (A D numeric_value -1.1) 21 | (A I single_bond 0) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /queries/thioester_acyclic_aromatic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "thioester_acyclic_aromatic") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon 2) 7 | (A I nbonds 2) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 6) 11 | (A I ncon 3) 12 | (A I nbonds 4) 13 | (A I nrings 0) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 8) 18 | (A I ncon 1) 19 | (A I double_bond 1) 20 | ) 21 | (3 Query_Atom 22 | (A I aromatic 1) 23 | (A I single_bond 0) 24 | ) 25 | ) 26 | -------------------------------------------------------------------------------- /queries/thio_aminal_acyclic.qry: -------------------------------------------------------------------------------- 1 | (4 Query 2 | (A C Comment "thio_aminal_acyclic") 3 | (A C Comment "thio_aminal_acyclic") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I max_ncon 2) 8 | (A I nrings 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ncon 2) 13 | (A I nbonds 2) 14 | (A I nrings 0) 15 | (A I single_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 7) 19 | (A I min_hcount 1) 20 | (A I nrings 0) 21 | (A I aromatic 0) 22 | (A I single_bond 1) 23 | ) 24 | ) 25 | -------------------------------------------------------------------------------- /queries/di_thio_acetal_acyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "di_thio_acetal_acyclic") 3 | (A D numeric_value 25) 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I ncon 2) 8 | (A I nbonds 2) 9 | (A I nrings 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I ncon 3) 14 | (A I nbonds 3) 15 | (A I nrings 0) 16 | (A I single_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 16) 20 | (A I ncon 2) 21 | (A I nbonds 2) 22 | (A I nrings 0) 23 | (A I single_bond 1) 24 | ) 25 | ) 26 | -------------------------------------------------------------------------------- /queries/diaminal_acyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "diaminal_acyclic") 3 | (A C Comment "diaminal_acyclic") 4 | (A I unique_embeddings_only 1) 5 | (A I Version 2) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I ncon 3) 9 | (A I attached_heteroatom_count 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I nrings 0) 14 | (A I unsaturation 0) 15 | (A I single_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 7) 19 | (A I ncon 3) 20 | (A I attached_heteroatom_count 0) 21 | (A I single_bond 1) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /queries/sulfonyl_halide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "sulfonyl_halide") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon 4) 7 | (A I nbonds 6) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 8) 11 | (A I ncon 1) 12 | (A I nbonds 2) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 8) 17 | (A I ncon 1) 18 | (A I nbonds 2) 19 | (A I double_bond 0) 20 | ) 21 | (3 Query_Atom 22 | (A I atomic_number (9 17 35 53)) 23 | (A I nrings 0) 24 | (A I single_bond 0) 25 | ) 26 | ) 27 | -------------------------------------------------------------------------------- /charge_assigner/carboxylic_acid.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I one_embedding_per_start_atom 1) 3 | (A I Version 2) 4 | # clogD offset 5 | (A D numeric_value 2.76) 6 | (A C Comment "carboxylic_acid") 7 | (0 Query_Atom 8 | (A I atomic_number 6) 9 | (A I min_unsaturation 1) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 8) 13 | (A I ncon 1) 14 | (A I formal_charge 0) 15 | (A I hcount 0) 16 | (A I double_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 8) 20 | (A I ncon 1) 21 | (A D numeric_value -1.1) 22 | (A I single_bond 0) 23 | ) 24 | ) 25 | -------------------------------------------------------------------------------- /charge_assigner/phosphonate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A I one_embedding_per_start_atom 1) 4 | (A C Comment "phosphonate") 5 | # clogD offset 6 | (A D numeric_value 3.53) 7 | (0 Query_Atom 8 | (A I atomic_number 15) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number (8 16)) 12 | (A I double_bond 0) 13 | ) 14 | (2 Query_Atom 15 | (A I atomic_number 8) 16 | # (A I ncon 1) 17 | (A I single_bond 0) 18 | ) 19 | (3 Query_Atom 20 | (A I atomic_number 8) 21 | (A I ncon 1) 22 | (A I single_bond 0) 23 | (A D numeric_value -1.1) 24 | ) 25 | ) 26 | -------------------------------------------------------------------------------- /queries/hemiacetal_acyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "hemiacetal_acyclic") 4 | (A C Comment "hemiacetal_acyclic") 5 | (0 Query_Atom 6 | (A I atomic_number (7 8 16)) 7 | (A I ncon 1) 8 | (A I nrings 0) 9 | (A I unsaturation 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I min_ncon 2) 14 | (A I nrings 0) 15 | (A I unsaturation 0) 16 | (A I single_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number (7 8 16)) 20 | (A I nrings 0) 21 | (A I unsaturation 0) 22 | (A I single_bond 1) 23 | ) 24 | ) 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2017 Eli Lilly and Company 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /Molecule/is_actually_chiral.h: -------------------------------------------------------------------------------- 1 | #ifndef IS_ACTUALLY_CHIRAL_H 2 | #define IS_ACTUALLY_CHIRAL_H 3 | 4 | #include "iwmtypes.h" 5 | #include "path_scoring.h" 6 | 7 | class Molecule; 8 | 9 | extern int is_actually_chiral (Molecule & m, atom_number_t); 10 | extern int is_actually_chiral (Molecule & m, atom_number_t, resizable_array_p &); 11 | 12 | // Returns the number of invalid chiral centres removed 13 | 14 | extern int do_remove_invalid_chiral_centres (Molecule & m); 15 | 16 | extern void set_allow_unsaturated_atoms_to_be_chiral (int s); 17 | 18 | extern void set_max_iterations (int m); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /queries/po4.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "po4") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 15) 6 | (A I ncon 4) 7 | (A I nbonds 4) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 8) 11 | (A I ncon 2) 12 | (A I single_bond 0) 13 | ) 14 | (2 Query_Atom 15 | (A I atomic_number 8) 16 | (A I ncon 2) 17 | (A I single_bond 0) 18 | ) 19 | (3 Query_Atom 20 | (A I atomic_number 8) 21 | (A I ncon 2) 22 | (A I single_bond 0) 23 | ) 24 | (4 Query_Atom 25 | (A I atomic_number 8) 26 | (A I ncon 2) 27 | (A I single_bond 0) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /queries/phosphoric_acid.qry: -------------------------------------------------------------------------------- 1 | # RuleClass Phosphorus 2 | # SubClass phospho 3 | 4 | (0 Query 5 | (A C Comment "phosphoric_acid") 6 | (A I Version 2) 7 | (A D numeric_value 20) 8 | (0 Query_Atom 9 | (A I atomic_number 15) 10 | (A I ncon 4) 11 | (A I nbonds 5) 12 | (A I min_attached_heteroatom_count 3) 13 | ) 14 | (1 Query_Atom 15 | (A I atomic_number 8) 16 | (A I double_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 8) 20 | (A I single_bond 0) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 8) 24 | (A I ncon 1) 25 | (A I single_bond 0) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /queries/steve1.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "steve1") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | (A I ncon 2) 7 | (A I nbonds 3) 8 | (A I formal_charge 1) 9 | (A I nrings 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I ncon 3) 14 | (A I aromatic 1) 15 | (A I double_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 16) 19 | (A I aromatic 1) 20 | (A I single_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 7) 24 | (A I ncon 3) 25 | (A I aromatic 1) 26 | (A I single_bond 1) 27 | ) 28 | ) 29 | -------------------------------------------------------------------------------- /queries/vinyl_ether.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "vinyl_ether") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 8) 6 | (A I ncon 2) 7 | (A I nbonds 2) 8 | (A I formal_charge 0) 9 | (A I nrings 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I nrings 0) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 6) 18 | (A I ncon 2) 19 | (A I nbonds 3) 20 | (A I nrings 0) 21 | (A I single_bond 0) 22 | ) 23 | (3 Query_Atom 24 | (A I atomic_number 6) 25 | (A I nrings 0) 26 | (A I double_bond 2) 27 | ) 28 | ) 29 | -------------------------------------------------------------------------------- /queries/cf3.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I one_embedding_per_start_atom 1) 3 | (A I unique_embeddings_only 1) 4 | (A C Comment "cf3") 5 | (A I Version 2) 6 | 7 | (A D numeric_value 60) 8 | 9 | (A I subtract_from_rc 1) 10 | (0 Query_Atom 11 | (A I atomic_number 9) 12 | (A I ncon 1) 13 | ) 14 | (1 Query_Atom 15 | (A I atomic_number 6) 16 | (A I ncon 4) 17 | (A I single_bond 0) 18 | ) 19 | (2 Query_Atom 20 | (A I atomic_number 9) 21 | (A I ncon 1) 22 | (A I single_bond 1) 23 | ) 24 | (3 Query_Atom 25 | (A I atomic_number 9) 26 | (A I ncon 1) 27 | (A I single_bond 1) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /queries/hydrazide_acyclic.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "hydrazide_acyclic") 3 | (A C Comment "hydrazide_acyclic") 4 | (A D numeric_value 50) 5 | (A I Version 2) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I nrings 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 7) 12 | (A I ncon 2) 13 | (A I nbonds 2) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 6) 18 | (A I min_ncon 2) 19 | (A I min_nbonds 3) 20 | (A I single_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 8) 24 | (A I ncon 1) 25 | (A I double_bond 2) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /queries/vinyl_disulfide.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "vinyl_disulfide") 3 | (A C Comment "vinyl_disulfide") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I ncon 2) 8 | (A I ring_size (5 6)) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ncon 3) 13 | (A I nbonds 4) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 16) 18 | (A I ncon 2) 19 | (A I ring_size (5 6)) 20 | (A I single_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 6) 24 | (A I nrings 0) 25 | (A I double_bond 1) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /queries/hydrazide_cyclic.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "hydrazide_cyclic") 3 | (A C Comment "hydrazide_cyclic") 4 | (A D numeric_value 20) 5 | (A I Version 2) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I min_nrings 1) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 7) 12 | (A I ncon 2) 13 | (A I nbonds 2) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 6) 18 | (A I min_ncon 2) 19 | (A I min_nbonds 3) 20 | (A I single_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 8) 24 | (A I ncon 1) 25 | (A I double_bond 2) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /queries/activated_ester.qry: -------------------------------------------------------------------------------- 1 | # RuleClass acylating 2 | # SubClass acyl-QQ 3 | 4 | (0 Query 5 | (A I Version 2) 6 | (A C Comment "activated_ester") 7 | (A I unique_embeddings_only 1) 8 | (0 Query_Atom 9 | (A I atomic_number 8) 10 | (A I ncon 1) 11 | (A I nbonds 2) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number (6 16 15)) 15 | (A I min_ncon 3) 16 | (A I nrings 0) 17 | (A I double_bond 0) 18 | ) 19 | (2 Query_Atom 20 | (A I atomic_number 8) 21 | (A I ncon 2) 22 | (A I single_bond 1) 23 | ) 24 | (3 Query_Atom 25 | (A I atomic_number (7 16 15)) 26 | (A I single_bond 2) 27 | ) 28 | ) 29 | -------------------------------------------------------------------------------- /queries/acetate_ester.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acetate_ester") 3 | (A I Version 2) 4 | (A I min_hits_needed 3) 5 | (0 Query_Atom 6 | (A I atomic_number 8) 7 | (A I ncon 2) 8 | (A I attached_heteroatom_count 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ncon 3) 13 | (A I nbonds 4) 14 | (A I attached_heteroatom_count 2) 15 | (A I single_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 8) 19 | (A I double_bond 1) 20 | ) 21 | (3 Query_Atom 22 | (A I atomic_number 6) 23 | (A I ncon 1) 24 | (A I unsaturation 0) 25 | (A I single_bond 1) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /queries/scscs.qry: -------------------------------------------------------------------------------- 1 | (6 Query 2 | (A C Comment "scscs") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon 1) 7 | (A I nbonds 2) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 6) 11 | (A I min_ncon 2) 12 | (A I double_bond 0) 13 | ) 14 | (2 Query_Atom 15 | (A I atomic_number 16) 16 | (A I ncon 2) 17 | (A I nbonds 2) 18 | (A I single_bond 1) 19 | ) 20 | (3 Query_Atom 21 | (A I atomic_number 6) 22 | (A I min_ncon 2) 23 | (A I single_bond 2) 24 | ) 25 | (4 Query_Atom 26 | (A I atomic_number 16) 27 | (A I ncon 1) 28 | (A I double_bond 3) 29 | ) 30 | ) 31 | -------------------------------------------------------------------------------- /queries/thiocarbonyl_diester.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "thiocarbonyl_diester") 3 | (9 Element_Hits_Needed 4 | (A I atomic_number 16) 5 | (A I min_hits_needed 1) 6 | ) 7 | (A I Version 2) 8 | (A I one_embedding_per_start_atom 1) 9 | (0 Query_Atom 10 | (A I atomic_number (8 16)) 11 | (A I ncon 1) 12 | (A I nbonds 2) 13 | ) 14 | (1 Query_Atom 15 | (A I atomic_number 6) 16 | (A I ncon 3) 17 | (A I double_bond 0) 18 | ) 19 | (2 Query_Atom 20 | (A I atomic_number (8 16)) 21 | (A I single_bond 1) 22 | ) 23 | (3 Query_Atom 24 | (A I atomic_number (8 16)) 25 | (A I single_bond 1) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /queries/fluoro_methyl_ketone.qry: -------------------------------------------------------------------------------- 1 | (0 Composite_Query 2 | (A C Comment "fluoro_methyl_ketone") 3 | (A C Comment "fluoro_methyl_ketone") 4 | (A I Version 2) 5 | (0 Query 6 | (A I Version 2) 7 | (0 Query_Atom 8 | (A I atomic_number 9) 9 | (A I ncon 1) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I ncon 2) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 6) 18 | (A I aromatic 0) 19 | (A I single_bond 1) 20 | ) 21 | (3 Query_Atom 22 | (A I atomic_number 8) 23 | (A I ncon 1) 24 | (A I double_bond 2) 25 | ) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /queries/hydrazide.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "hydrazide") 3 | (A C Comment "hydrazide") 4 | (A I Version 2) 5 | (A D numeric_value 50) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I nrings 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 7) 12 | (A I ncon 2) 13 | (A I nbonds 2) 14 | (A I nrings 0) 15 | (A I single_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 6) 19 | (A I min_ncon 2) 20 | (A I min_nbonds 3) 21 | (A I nrings 0) 22 | (A I single_bond 1) 23 | ) 24 | (3 Query_Atom 25 | (A I atomic_number 8) 26 | (A I ncon 1) 27 | (A I double_bond 2) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /supporting_libraries/KahanSum.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "accumulator.h" 4 | 5 | 6 | KahanSum::KahanSum () 7 | { 8 | _c = 0.0; 9 | _sum = 0.0; 10 | 11 | return; 12 | } 13 | 14 | KahanSum & 15 | KahanSum::operator = (double d) 16 | { 17 | _sum = d; 18 | _c = 0.0; 19 | 20 | return *this; 21 | } 22 | 23 | KahanSum & 24 | KahanSum::operator += (double d) 25 | { 26 | double y = d - _c; 27 | double t = _sum + y; 28 | _c = (t - _sum) - y; 29 | _sum = t; 30 | 31 | return *this; 32 | } 33 | 34 | KahanSum & 35 | KahanSum::operator += (const KahanSum & rhs) 36 | { 37 | _c += rhs._c; 38 | 39 | return this->operator+=(rhs._sum); 40 | } 41 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Location for the installation 2 | 3 | .PHONY: supporting_libraries 4 | .PHONY: Molecule 5 | .PHONY: test 6 | .PHONY: all 7 | 8 | all: supporting_libraries Molecule 9 | 10 | supporting_libraries: 11 | cd supporting_libraries && make install 12 | 13 | Molecule: 14 | cd Molecule && make install 15 | 16 | install: supporting_libraries Molecule 17 | @echo "No separate installation required" >&2 18 | 19 | test: supporting_libraries Molecule 20 | cd test && ./dotest.sh 21 | 22 | clean: 23 | cd supporting_libraries && make clean 24 | cd Molecule && make clean 25 | 26 | uninstall: 27 | cd supporting_libraries && make uninstall 28 | cd Molecule && make uninstall 29 | -------------------------------------------------------------------------------- /queries/cyano_methyl_sulfide.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "cyano_methyl_sulfide") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | (A I ncon 1) 7 | (A I nbonds 3) 8 | (A I nrings 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ncon 2) 13 | (A I nbonds 4) 14 | (A I nrings 0) 15 | (A I triple_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 6) 19 | (A I unsaturation 0) 20 | (A I nrings 0) 21 | (A I single_bond 1) 22 | ) 23 | (3 Query_Atom 24 | (A I atomic_number 16) 25 | (A I unsaturation 0) 26 | (A I nrings 0) 27 | (A I single_bond 2) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /queries/phenol_phosphate_ester.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "phenol_phosphate_ester") 3 | (A I Version 2) 4 | (A I min_aromatic_ring_count 1) 5 | (0 Query_Atom 6 | (A I atomic_number 8) 7 | (A I ncon 2) 8 | (A I attached_heteroatom_count 1) 9 | (A I vinyl 1) 10 | (A I aryl 1) 11 | ) 12 | (1 Query_Atom 13 | (A I atomic_number 15) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 8) 18 | (A I double_bond 1) 19 | ) 20 | (3 Query_Atom 21 | (A I atomic_number 6) 22 | (A I aromatic 1) 23 | (A I aromatic_ring_size 6) 24 | (A I isolated_ring 1) 25 | (A I single_bond 0) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /queries/nitro_alpha_hetero.qry: -------------------------------------------------------------------------------- 1 | (6 Query 2 | (A C Comment "nitro_alpha_hetero") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | (A I ncon 3) 7 | (A I nbonds 5) 8 | (A I nrings 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I ncon 1) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 8) 17 | (A I ncon 1) 18 | (A I double_bond 0) 19 | ) 20 | (3 Query_Atom 21 | (A I atomic_number 6) 22 | (A I ncon 4) 23 | (A I single_bond 0) 24 | ) 25 | (4 Query_Atom 26 | (A I atomic_number (7 8 16)) 27 | (A I nrings 0) 28 | (A I single_bond 3) 29 | ) 30 | ) 31 | -------------------------------------------------------------------------------- /queries/vinyl_cyano_2.qry: -------------------------------------------------------------------------------- 1 | (4 Query 2 | (A C Comment "vinyl_cyano_2") 3 | (A I Version 2) 4 | (A I one_embedding_per_start_atom 1) 5 | (0 Query_Atom 6 | (A I atomic_number 7) 7 | (A I ncon 1) 8 | (A I nbonds 3) 9 | (A I formal_charge 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I ncon 2) 14 | (A I nbonds 4) 15 | (A I formal_charge 0) 16 | (A I triple_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 6) 20 | (A I formal_charge 0) 21 | (A I aromatic 0) 22 | (A I single_bond 1) 23 | (A I unsaturation 1) 24 | (A I attached_heteroatom_count 0) 25 | 26 | (A I nrings 0) 27 | ) 28 | ) 29 | -------------------------------------------------------------------------------- /queries/vinyl_sulfoxide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "vinyl_sulfoxide") 3 | (A C Comment "vinyl_sulfoxide") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I ncon 3) 8 | (A I nbonds 4) 9 | (A I aromatic 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 8) 13 | (A I ncon 1) 14 | (A I nbonds 2) 15 | (A I double_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 6) 19 | (A I ncon 3) 20 | (A I nbonds 4) 21 | (A I aromatic 0) 22 | (A I single_bond 0) 23 | ) 24 | (3 Query_Atom 25 | (A I ncon 1) 26 | (A I nbonds 2) 27 | (A I nrings 0) 28 | (A I double_bond 2) 29 | ) 30 | ) 31 | -------------------------------------------------------------------------------- /queries/vinyl_ether_thioate_isoamide.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "vinyl_ether_thioate_isoamide") 3 | (A I Version 2) 4 | (A I max_ring_atoms_matched 2) 5 | (0 Query_Atom 6 | (A I atomic_number 8) 7 | (A I ncon 2) 8 | (A I nbonds 2) 9 | (A I attached_heteroatom_count 0) 10 | (A I vinyl 1) 11 | (A I formal_charge 0) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I unsaturation 1) 16 | (A I aromatic 0) 17 | (A I single_bond 0) 18 | ) 19 | (2 Query_Atom 20 | (A I double_bond 1) 21 | (3 Query_Atom_Specifier 22 | (A I Rejection 1) 23 | (A I atomic_number 8) 24 | (A I ncon 1) 25 | ) 26 | ) 27 | ) 28 | -------------------------------------------------------------------------------- /queries/acyl_amide_acyclic.qry: -------------------------------------------------------------------------------- 1 | # RuleClass 2 | # SubClass 3 | 4 | (0 Query 5 | (A C Comment "acyl_amide_acyclic") 6 | (A I Version 2) 7 | (A D numeric_value 40) 8 | (0 Query_Atom 9 | (A I atomic_number (8 16)) 10 | (A I ncon 1) 11 | (A I nbonds 2) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I nrings 0) 16 | (A I double_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 7) 20 | (A I single_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 6) 24 | (A I nrings 0) 25 | (A I single_bond 2) 26 | ) 27 | (4 Query_Atom 28 | (A I atomic_number (8 16)) 29 | (A I ncon 1) 30 | (A I double_bond 3) 31 | ) 32 | ) 33 | -------------------------------------------------------------------------------- /queries/acyl_amide_cyclic.qry: -------------------------------------------------------------------------------- 1 | # RuleClass 2 | # SubClass 3 | 4 | (0 Query 5 | (A C Comment "acyl_amide_cyclic") 6 | (A I Version 2) 7 | (A D numeric_value 60) 8 | (0 Query_Atom 9 | (A I atomic_number (8 16)) 10 | (A I ncon 1) 11 | (A I nbonds 2) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I min_nrings 1) 16 | (A I double_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 7) 20 | (A I single_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 6) 24 | (A I nrings 0) 25 | (A I single_bond 2) 26 | ) 27 | (4 Query_Atom 28 | (A I atomic_number (8 16)) 29 | (A I ncon 1) 30 | (A I double_bond 3) 31 | ) 32 | ) 33 | -------------------------------------------------------------------------------- /queries/vinyl_disulfur.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "vinyl_disulfur") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon 2) 7 | (A I nbonds 2) 8 | (A I nrings 1) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ncon 3) 13 | (A I nbonds 4) 14 | (A I formal_charge 0) 15 | (A I nrings 1) 16 | (A I single_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 16) 20 | (A I ncon 2) 21 | (A I nbonds 2) 22 | (A I nrings 1) 23 | (A I single_bond 1) 24 | ) 25 | (3 Query_Atom 26 | (A I atomic_number 6) 27 | (A I min_nbonds 2) 28 | (A I nrings 0) 29 | (A I double_bond 1) 30 | ) 31 | ) 32 | -------------------------------------------------------------------------------- /queries/anhydride.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "anhydride") 3 | (A I Version 2) 4 | (A I unique_embeddings_only 1) 5 | (0 Query_Atom 6 | (A I ncon 1) 7 | (A I nbonds 2) 8 | (A I atomic_number 8) 9 | ) 10 | (1 Query_Atom 11 | (A I ncon 3) 12 | (A I double_bond 0) 13 | (A I atomic_number 6) 14 | ) 15 | (2 Query_Atom 16 | (A I ncon 2) 17 | (A I nbonds 2) 18 | (A I single_bond 1) 19 | (A I atomic_number 8) 20 | ) 21 | (3 Query_Atom 22 | (A I ncon 3) 23 | (A I nbonds 4) 24 | (A I single_bond 2) 25 | (A I atomic_number 6) 26 | ) 27 | (4 Query_Atom 28 | (A I ncon 1) 29 | (A I double_bond 3) 30 | (A I atomic_number 8) 31 | ) 32 | ) 33 | -------------------------------------------------------------------------------- /queries/vinyl_cyano_het.qry: -------------------------------------------------------------------------------- 1 | (4 Query 2 | (A C Comment "vinyl_cyano_het") 3 | (A C Comment "vinyl_cyano_het") 4 | (A I Version 2) 5 | (A I one_embedding_per_start_atom 1) 6 | (A D numeric_value 50) 7 | (0 Query_Atom 8 | (A I atomic_number 7) 9 | (A I ncon 1) 10 | (A I nbonds 3) 11 | (A I formal_charge 0) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I ncon 2) 16 | (A I nbonds 4) 17 | (A I formal_charge 0) 18 | (A I triple_bond 0) 19 | ) 20 | (2 Query_Atom 21 | (A I atomic_number 6) 22 | (A I formal_charge 0) 23 | (A I aromatic 0) 24 | (A I single_bond 1) 25 | (A I unsaturation 1) 26 | (A I min_attached_heteroatom_count 1) 27 | ) 28 | ) 29 | -------------------------------------------------------------------------------- /Molecule/molecule_tripos.h: -------------------------------------------------------------------------------- 1 | int _read_molecule_mol2_ds (iwstring_data_source & input); 2 | int _read_molecule_mol2_ds (iwstring_data_source & input, int na, int nb, int * aromatic_atom, int * aromatic_bonds, Tripos_Residue_Information * tri); 3 | 4 | int _parse_tripos_atom_record (const const_IWSubstring & buffer, atom_number_t, int &, Tripos_Residue_Information * tri); 5 | int _parse_tripos_bond_record (const const_IWSubstring & buffer, int * aromatic_atoms, int, int * aromatic_bond); 6 | int _mol2_assign_default_formal_charges (); 7 | int _doubly_bonded_to_oxygen (atom_number_t zatom) const; 8 | int _tripos_atom_type_from_string (atom_number_t, const const_IWSubstring &); 9 | int _place_formal_charges_on_quat_n_from_mol2 (); 10 | -------------------------------------------------------------------------------- /queries/alkynylsulfone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "alkynylsulfone") 3 | (A C Comment "alkynylsulfone") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I ncon 4) 8 | (A I nbonds 6) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I ncon 1) 13 | (A I nbonds 2) 14 | (A I double_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 8) 18 | (A I ncon 1) 19 | (A I nbonds 2) 20 | (A I double_bond 0) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 6) 24 | (A I ncon 2) 25 | (A I nbonds 4) 26 | (A I single_bond 0) 27 | ) 28 | (4 Query_Atom 29 | (A I atomic_number 6) 30 | (A I min_nbonds 3) 31 | (A I triple_bond 3) 32 | ) 33 | ) 34 | -------------------------------------------------------------------------------- /queries/multiple_nitro.qry: -------------------------------------------------------------------------------- 1 | # RuleClass nitrogen 2 | # SubClass nitro 3 | 4 | # Two nitro's are always bad 5 | 6 | (0 Query 7 | (A I Version 2) 8 | (A C Comment "multiple_nitro") 9 | (A I one_embedding_per_start_atom 1) 10 | (A I min_hits_needed 2) 11 | (0 Query_Atom 12 | (A I atomic_number 7) 13 | (A I ncon 3) 14 | (A I nbonds 5) 15 | (A I nrings 0) 16 | ) 17 | (1 Query_Atom 18 | (A I atomic_number 8) 19 | (A I ncon 1) 20 | (A I nbonds 2) 21 | (A I double_bond 0) 22 | ) 23 | (2 Query_Atom 24 | (A I atomic_number 8) 25 | (A I ncon 1) 26 | (A I nbonds 2) 27 | (A I double_bond 0) 28 | ) 29 | (4 Environment_no_Match 30 | (A I single_bond 0) 31 | (A C smarts "[OD1]") 32 | ) 33 | ) 34 | -------------------------------------------------------------------------------- /queries/thiohydrazide.qry: -------------------------------------------------------------------------------- 1 | # RuleClass acylating 2 | # SubClass acyl-QQ 3 | 4 | (7 Query 5 | (A C Comment "thiohydrazide") 6 | (A C Comment "thiohydrazide") 7 | (A I Version 2) 8 | (0 Query_Atom 9 | (A I atomic_number 16) 10 | (A I ncon 1) 11 | (A I nbonds 2) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I ncon 3) 16 | (A I double_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 7) 20 | (A I single_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 7) 24 | (A I single_bond 2) 25 | ) 26 | (4 Query_Atom 27 | (A I atomic_number 7) 28 | (A I single_bond 1) 29 | ) 30 | (5 Query_Atom 31 | (A I atomic_number 7) 32 | (A I single_bond 4) 33 | ) 34 | ) 35 | -------------------------------------------------------------------------------- /queries/sulfonylmichael.qry: -------------------------------------------------------------------------------- 1 | (6 Query 2 | (A C Comment "sulfonylmichael") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I min_ncon 3) 7 | (A I min_nbonds 5) 8 | (A I aromatic 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I ncon 1) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 8) 17 | (A I ncon 1) 18 | (A I double_bond 0) 19 | ) 20 | (3 Query_Atom 21 | (A I atomic_number 6) 22 | (A I min_ncon 2) 23 | (A I aromatic 0) 24 | (A I single_bond 0) 25 | ) 26 | (4 Query_Atom 27 | (A I atomic_number 6) 28 | (A I attached_heteroatom_count 0) 29 | (A I aromatic 0) 30 | (A I double_bond 3) 31 | (A I min_hcount 1) 32 | ) 33 | ) 34 | -------------------------------------------------------------------------------- /queries/dialkylsulfate_cyclic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "dialkylsulfate_cyclic") 4 | (A C Comment "dialkylsulfate_cyclic") 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I ncon 4) 8 | (A I nbonds 6) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I ncon 2) 13 | (A I attached_heteroatom_count 1) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 8) 18 | (A I ncon 2) 19 | (A I attached_heteroatom_count 1) 20 | (A I single_bond 0) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 8) 24 | (A I ncon 1) 25 | (A I double_bond 0) 26 | ) 27 | (4 Query_Atom 28 | (A I atomic_number 8) 29 | (A I ncon 1) 30 | (A I double_bond 0) 31 | ) 32 | ) 33 | -------------------------------------------------------------------------------- /queries/nitro.qry: -------------------------------------------------------------------------------- 1 | # RuleClass nitrogen 2 | # SubClass nitro 3 | 4 | (0 Query 5 | (A I Version 2) 6 | (A C Comment "nitro") 7 | (A D numeric_value 60) 8 | (A I one_embedding_per_start_atom 1) 9 | (0 Query_Atom 10 | (A I atomic_number 7) 11 | (A I ncon 3) 12 | (A I nbonds 5) 13 | (A I nrings 0) 14 | ) 15 | (1 Query_Atom 16 | (A I atomic_number 8) 17 | (A I ncon 1) 18 | (A I nbonds 2) 19 | (A I double_bond 0) 20 | ) 21 | (2 Query_Atom 22 | (A I atomic_number 8) 23 | (A I ncon 1) 24 | (A I nbonds 2) 25 | (A I double_bond 0) 26 | ) 27 | (3 Query_Atom 28 | (A I aromatic 1) 29 | (A I single_bond 0) 30 | ) 31 | 32 | (4 Environment_no_Match 33 | (A I single_bond 0) 34 | (A C smarts "[OD1]") 35 | ) 36 | ) 37 | -------------------------------------------------------------------------------- /queries/nitro_alpha_to_halogen.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "nitro_alpha_to_halogen") 3 | (A C Comment "nitro_alpha_to_halogen") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number (9 17 35 53)) 7 | (A I ncon 1) 8 | (A I nbonds 1) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I min_ncon 2) 13 | (A I single_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 7) 17 | (A I ncon 3) 18 | (A I nbonds 5) 19 | (A I single_bond 1) 20 | ) 21 | (3 Query_Atom 22 | (A I atomic_number 8) 23 | (A I ncon 1) 24 | (A I nbonds 2) 25 | (A I double_bond 2) 26 | ) 27 | (4 Query_Atom 28 | (A I atomic_number 8) 29 | (A I ncon 1) 30 | (A I nbonds 2) 31 | (A I double_bond 2) 32 | ) 33 | ) 34 | -------------------------------------------------------------------------------- /queries/sulfonic_acid.qry: -------------------------------------------------------------------------------- 1 | # RuleClass 2 | # SubClass 3 | 4 | (0 Query 5 | (A C Comment "sulfonic_acid") 6 | (A D numeric_value 40) 7 | (A I Version 2) 8 | (A I only_match_largest_fragment 1) 9 | (0 Query_Atom 10 | (A I atomic_number 16) 11 | (A I ncon 4) 12 | (A I nbonds 6) 13 | (A I min_attached_heteroatom_count 3) 14 | ) 15 | (1 Query_Atom 16 | (A I atomic_number 8) 17 | (A I double_bond 0) 18 | ) 19 | (2 Query_Atom 20 | (A I atomic_number 8) 21 | (A I double_bond 0) 22 | ) 23 | (3 Query_Atom 24 | (A I atomic_number 8) 25 | (A I ncon 1) 26 | (A I single_bond 0) 27 | ) 28 | 29 | # Make sure we don't match sulfates 30 | 31 | (0 Environment_no_Match 32 | (A C smarts "[D1]") 33 | (A I single_bond 0) 34 | ) 35 | ) 36 | -------------------------------------------------------------------------------- /queries/acylated_enol.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "acylated_enol") 3 | (A C Comment "acylated_enol") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 8) 7 | (A I ncon 2) 8 | (A I vinyl 2) 9 | (A I attached_heteroatom_count 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I attached_heteroatom_count 2) 14 | (A I ncon 3) 15 | (A I nbonds 4) 16 | (A I single_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 8) 20 | (A I double_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 6) 24 | (A I unsaturation 1) 25 | (A I ring_id 1) 26 | (A I single_bond 0) 27 | ) 28 | (4 Query_Atom 29 | (A I atomic_number 6) 30 | (A I ring_id 2) 31 | (A I double_bond 3) 32 | ) 33 | ) 34 | -------------------------------------------------------------------------------- /queries/phosphate_ester.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "phosphate_ester") 3 | (A I one_embedding_per_start_atom 1) 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 15) 7 | (A I ncon 4) 8 | (A I nbonds 5) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8 16) 12 | (A I double_bond 0) 13 | ) 14 | (2 Query_Atom 15 | (A I atomic_number 8 16) 16 | (A I ncon 2) 17 | (A I attached_heteroatom_count 1) 18 | (A I single_bond 0) 19 | ) 20 | (3 Query_Atom 21 | (A I atomic_number 8 16) 22 | (A I ncon 2) 23 | (A I attached_heteroatom_count 1) 24 | (A I single_bond 0) 25 | ) 26 | (4 Query_Atom 27 | (A I atomic_number 6 7 8 16) 28 | (A I ncon 2 3 4) 29 | (A I attached_heteroatom_count 1) 30 | (A I single_bond 0) 31 | ) 32 | ) 33 | -------------------------------------------------------------------------------- /queries/tbutyl.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "tbutyl") 3 | (A I Version 2) 4 | (A D numeric_value 45) 5 | (A I subtract_from_rc 2) 6 | 7 | (A I min_hits_needed 3) 8 | 9 | (A I one_embedding_per_start_atom 1) 10 | (0 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ncon 4) 13 | (A I nbonds 4) 14 | ) 15 | (1 Query_Atom 16 | (A I atomic_number 6) 17 | (A I ncon 1) 18 | (A I nbonds 1) 19 | (A I single_bond 0) 20 | ) 21 | (2 Query_Atom 22 | (A I atomic_number 6) 23 | (A I ncon 1) 24 | (A I nbonds 1) 25 | (A I single_bond 0) 26 | ) 27 | (3 Query_Atom 28 | (A I atomic_number 6) 29 | (A I ncon 1) 30 | (A I nbonds 1) 31 | (A I single_bond 0) 32 | ) 33 | (4 Query_Atom 34 | (A I atomic_number 6) 35 | (A I single_bond 0) 36 | ) 37 | ) 38 | -------------------------------------------------------------------------------- /queries/cyclobutadiene.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "cyclobutadiene") 3 | (A I Version 2) 4 | (A I min_nrings 1) 5 | (0 Ring_Specifier 6 | (A I ring_size 4) 7 | ) 8 | (0 Query_Atom 9 | (A I min_ncon 2) 10 | (A I min_nbonds 3) 11 | (A I nrings 1) 12 | (A I ring_size 4) 13 | ) 14 | (1 Query_Atom 15 | (A I min_ncon 2) 16 | (A I min_nbonds 3) 17 | (A I nrings 1) 18 | (A I ring_size 4) 19 | (A I double_bond 0) 20 | ) 21 | (2 Query_Atom 22 | (A I min_ncon 2) 23 | (A I min_nbonds 3) 24 | (A I nrings 1) 25 | (A I ring_size 4) 26 | (A I single_bond 1) 27 | ) 28 | (3 Query_Atom 29 | (A I min_ncon 2) 30 | (A I min_nbonds 3) 31 | (A I nrings 1) 32 | (A I ring_size 4) 33 | (A I double_bond 2) 34 | (A I single_bond 0) 35 | ) 36 | ) 37 | -------------------------------------------------------------------------------- /queries/vinyl_sulfone_3.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "vinyl_sulfone_3") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon 4) 7 | (A I nbonds 6) 8 | ) 9 | (1 Query_Atom 10 | (A I atomic_number 8) 11 | (A I ncon 1) 12 | (A I nbonds 2) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 8) 17 | (A I ncon 1) 18 | (A I nbonds 2) 19 | (A I double_bond 0) 20 | ) 21 | (3 Query_Atom 22 | (A I atomic_number 6) 23 | (A I ncon 3) 24 | (A I nbonds 4) 25 | (A I formal_charge 0) 26 | (A I nrings 0) 27 | (A I single_bond 0) 28 | ) 29 | (4 Query_Atom 30 | (A I atomic_number 6) 31 | (A I ncon 3) 32 | (A I nbonds 4) 33 | (A I formal_charge 0) 34 | (A I nrings 0) 35 | (A I single_bond 3) 36 | ) 37 | ) 38 | -------------------------------------------------------------------------------- /queries/perchlorate.qry: -------------------------------------------------------------------------------- 1 | (6 Query 2 | (A C Comment "perchlorate") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 17) 6 | (A I ncon 4) 7 | (A I nbonds 7) 8 | (A I nrings 0) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I ncon 1) 13 | (A I nbonds 2) 14 | (A I nrings 0) 15 | (A I double_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 8) 19 | (A I ncon 1) 20 | (A I nbonds 2) 21 | (A I nrings 0) 22 | (A I double_bond 0) 23 | ) 24 | (3 Query_Atom 25 | (A I atomic_number 8) 26 | (A I ncon 1) 27 | (A I nbonds 2) 28 | (A I nrings 0) 29 | (A I double_bond 0) 30 | ) 31 | (4 Query_Atom 32 | (A I atomic_number 8) 33 | (A I ncon 1) 34 | (A I nbonds 1) 35 | (A I nrings 0) 36 | (A I single_bond 0) 37 | ) 38 | ) 39 | -------------------------------------------------------------------------------- /supporting_libraries/iwwrite.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef _WIN32 3 | #else 4 | #include 5 | #endif 6 | #include 7 | #include 8 | using namespace std; 9 | 10 | #include "iwstring.h" 11 | 12 | static int 13 | common_write (int fd, const char * s, int nchars) 14 | { 15 | assert (fd >= 0); 16 | 17 | if (0 == nchars) 18 | return 1; 19 | 20 | int rc = IW_FD_WRITE (fd, s, nchars); 21 | 22 | if (rc == nchars) 23 | return 1; 24 | 25 | cerr << "iwstring::common_write: cannot write " << nchars << " bytes to fd " << fd << endl; 26 | 27 | return 0; 28 | } 29 | 30 | int 31 | const_IWSubstring::write (int fd) const 32 | { 33 | return common_write (fd, _data, _nchars); 34 | } 35 | 36 | int 37 | IWString::write (int fd) const 38 | { 39 | return common_write (fd, _things, _number_elements); 40 | } 41 | -------------------------------------------------------------------------------- /Molecule/atom_alias.h: -------------------------------------------------------------------------------- 1 | #ifndef ATOM_ALIAS_H 2 | #define ATOM_ALIAS_H 3 | 4 | /* 5 | From an ISIS reaction file we may have an atom alias 6 | */ 7 | 8 | #include "iwmtypes.h" 9 | #include "iwstring.h" 10 | #include "iwstring_data_source.h" 11 | 12 | class Atom_Alias 13 | { 14 | private: 15 | atom_number_t _atom; 16 | IWString _alias; 17 | 18 | // private functions 19 | 20 | void _copy (const Atom_Alias &); 21 | 22 | public: 23 | Atom_Alias (); 24 | Atom_Alias (const Atom_Alias &); 25 | 26 | Atom_Alias & operator= (const Atom_Alias &); 27 | 28 | template int build (const const_IWSubstring &, T &); 29 | 30 | atom_number_t atom_number () const { return _atom;} 31 | void set_atom_number (atom_number_t s) { _atom = s;} 32 | const IWString & alias () const { return _alias;} 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /queries/sulfonyl_ester.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "sulfonyl_ester") 3 | (A C Comment "sulfonyl_ester") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I ncon 4) 8 | (A I nbonds 6) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I ncon 1) 13 | (A I nbonds 2) 14 | (A I double_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 8) 18 | (A I ncon 1) 19 | (A I nbonds 2) 20 | (A I double_bond 0) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 8) 24 | (A I ncon 2) 25 | (A I nbonds 2) 26 | # (A I nrings 0) 27 | (A I single_bond 0) 28 | ) 29 | (4 Query_Atom 30 | (A I atomic_number 6) 31 | # (A I unsaturation 0) 32 | (A I single_bond 3) 33 | ) 34 | (5 Query_Atom 35 | (A I atomic_number 6) 36 | (A I single_bond 0) 37 | ) 38 | ) 39 | -------------------------------------------------------------------------------- /charge_assigner/N_acylsulfonamide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "N_acylsulfonamide") 3 | (A I unique_embeddings_only 1) 4 | (A I Version 2) 5 | # logD offset 6 | (A D numeric_value 2.51) 7 | (0 Query_Atom 8 | (A I atomic_number 16) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I ncon 1) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 7) 17 | (A I ncon 2) 18 | (A I hcount 1) 19 | (A I single_bond 0) 20 | (A D numeric_value -1.1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number (6 15 16)) 24 | (A I single_bond 2) 25 | ) 26 | (4 Query_Atom 27 | (A I atomic_number 8) 28 | (A I double_bond 3) 29 | ) 30 | (5 Environment_No_Match 31 | (A I single_bond (0 3)) 32 | (A C smarts "[N-]") 33 | (A C smarts "[O-]") 34 | (A C smarts "[OH]") 35 | ) 36 | ) 37 | -------------------------------------------------------------------------------- /Molecule/charge_calculation.h: -------------------------------------------------------------------------------- 1 | 2 | #define NUMBER_OF_ATOM_TYPE 25 3 | #define UNDEFINED_TRIPOS_ATOM_TYPE 99 4 | #define ATOM_TYPE_H 0 5 | #define ATOM_TYPE_C3 1 6 | #define ATOM_TYPE_C2 2 7 | #define ATOM_TYPE_CAR 3 8 | #define ATOM_TYPE_C1 4 9 | #define ATOM_TYPE_N4 5 10 | #define ATOM_TYPE_N3 6 11 | #define ATOM_TYPE_N2 7 12 | #define ATOM_TYPE_N1 8 13 | #define ATOM_TYPE_NAR 9 14 | #define ATOM_TYPE_NPL3 10 15 | #define ATOM_TYPE_NAM 11 16 | #define ATOM_TYPE_O3 12 17 | #define ATOM_TYPE_O2 13 18 | #define ATOM_TYPE_S3 14 19 | #define ATOM_TYPE_S2 15 20 | #define ATOM_TYPE_P3 16 21 | #define ATOM_TYPE_BR 17 22 | #define ATOM_TYPE_CL 18 23 | #define ATOM_TYPE_F 19 24 | #define ATOM_TYPE_I 20 25 | #define ATOM_TYPE_SO 21 26 | #define ATOM_TYPE_SO2 22 27 | #define ATOM_TYPE_OCO2 23 28 | #define ATOM_TYPE_CCAT 24 29 | #define OUT_OF_RANGE 100 30 | -------------------------------------------------------------------------------- /queries/orthonitropyridine.qry: -------------------------------------------------------------------------------- 1 | (14 Query 2 | (A C Comment "orthonitropyridine") 3 | (A I Version 2) 4 | (A I min_aromatic_ring_count 1) 5 | (0 Query_Atom 6 | (A I atomic_number 8) 7 | (A I ncon 1) 8 | (A I nbonds 2) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 7) 12 | (A I ncon 3) 13 | (A I nbonds 5) 14 | (A I nrings 0) 15 | (A I double_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 8) 19 | (A I ncon 1) 20 | (A I double_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 6) 24 | (A I ncon 3) 25 | (A I nrings 1) 26 | (A I aromatic 1) 27 | (A I ring_size 6) 28 | (A I single_bond 1) 29 | ) 30 | (4 Query_Atom 31 | (A I atomic_number 7) 32 | (A I ncon 2) 33 | (A I nrings 1) 34 | (A I ring_size 6) 35 | (A I aromatic 1) 36 | (A I aromatic_bond 3) 37 | ) 38 | ) 39 | -------------------------------------------------------------------------------- /queries/beta_lactone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "beta_lactone") 3 | (A I Version 2) 4 | (A I min_nrings 1) 5 | (0 Ring_Specifier 6 | (A I ring_size 4) 7 | ) 8 | (0 Query_Atom 9 | (A I atomic_number 8) 10 | (A I ncon 2) 11 | (A I nrings 1) 12 | (A I ring_size 4) 13 | ) 14 | (1 Query_Atom 15 | (A I atomic_number 6) 16 | (A I ncon 3) 17 | (A I nbonds 4) 18 | (A I nrings 1) 19 | (A I ring_size 4) 20 | (A I single_bond 0) 21 | ) 22 | (2 Query_Atom 23 | (A I atomic_number 8) 24 | (A I double_bond 1) 25 | ) 26 | (3 Query_Atom 27 | (A I atomic_number 6) 28 | (A I min_nrings 1) 29 | (A I ring_size 4) 30 | (A I single_bond 1) 31 | ) 32 | (4 Query_Atom 33 | (A I atomic_number 6) 34 | (A I min_nrings 1) 35 | (A I ring_size 4) 36 | (A I single_bond 3) 37 | (A I single_bond 0) 38 | ) 39 | ) 40 | -------------------------------------------------------------------------------- /charge_assigner/tetrazole.qry: -------------------------------------------------------------------------------- 1 | (6 Query 2 | (A C Comment "tetrazole") 3 | (A I Version 2) 4 | # clogD offset 5 | (A D numeric_value 1.12) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I ncon 2) 9 | (A I nbonds 3) 10 | (A I nrings 1) 11 | (A I ring_size 5) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 7) 15 | (A I min_ncon 2) 16 | (A I min_nrings 1) 17 | (A I bond 0) 18 | ) 19 | (2 Query_Atom 20 | (A I atomic_number 7) 21 | (A I min_ncon 2) 22 | (A I single_bond 1) 23 | ) 24 | (3 Query_Atom 25 | (A I atomic_number 6) 26 | (A I min_ncon 2) 27 | (A I min_nrings 1) 28 | (A I double_bond 2) 29 | ) 30 | (4 Query_Atom 31 | (A I atomic_number 7) 32 | (A I ncon 2) 33 | (A I hcount 1) 34 | (A I nrings 1) 35 | (A D numeric_value -1.1) 36 | (A I single_bond 3) 37 | (A I bond 0) 38 | ) 39 | ) 40 | -------------------------------------------------------------------------------- /queries/phosphate_ester_ian.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "phosphate_ester") 3 | (A I one_embedding_per_start_atom 1) 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 15) 7 | (A I ncon 4) 8 | (A I nbonds 5) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I double_bond 0) 13 | ) 14 | (2 Query_Atom 15 | (A I atomic_number 8) 16 | (A I ncon 2) 17 | (A I attached_heteroatom_count 1) 18 | (A I single_bond 0) 19 | ) 20 | (3 Query_Atom 21 | (A I atomic_number 8) 22 | (A I ncon 1) 23 | (A I single_bond 0) 24 | ) 25 | (4 Query_Atom 26 | (0 Query_Atom_Specifier 27 | (A I atomic_number 8) 28 | (A I ncon 2) 29 | ) 30 | (1 Query_Atom_Specifier 31 | (A I atomic_number 6) 32 | ) 33 | (2 Query_Atom_Specifier 34 | (A I atomic_number 7) 35 | ) 36 | (A I single_bond 0) 37 | ) 38 | ) 39 | -------------------------------------------------------------------------------- /charge_assigner/pyrazolidinone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | # (A C smarts "[OD1]=c1[nH]:[n,o,s]:c:c1") 3 | (A I Version 2) 4 | (A C Comment "pyrazolidinone") 5 | (0 Query_Atom 6 | (A I atomic_number 8) 7 | (A I ncon 1) 8 | (A I nbonds 2) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I aromatic 1) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 7) 17 | (A I ncon 2) 18 | (A I aromatic 1) 19 | (A I hcount 1) 20 | (A I aromatic_bond 1) 21 | (A D numeric_value -1.1) 22 | ) 23 | (3 Query_Atom 24 | (A I atomic_number (7 8 16)) 25 | # (A I ncon 2) 26 | (A I aromatic 1) 27 | (A I aromatic_bond 2) 28 | ) 29 | (4 Query_Atom 30 | (A I atomic_number 6) 31 | (A I aromatic_bond 3) 32 | ) 33 | (5 Query_Atom 34 | (A I atomic_number 6) 35 | (A I aromatic_bond 4) 36 | (A I aromatic_bond 1) 37 | ) 38 | ) 39 | -------------------------------------------------------------------------------- /Molecule/collection_template.h: -------------------------------------------------------------------------------- 1 | #ifndef COLLECTION_TEMPLATE_H 2 | #define COLLECTION_TEMPLATE_H 3 | 4 | /* 5 | There are a couple of instances where we need a collection of 6 | objects as well as a text description of what the items are. 7 | The first two examples are partial charges, and atom types 8 | */ 9 | 10 | #include "iwstring.h" 11 | 12 | template 13 | class Collection_Template : public resizable_array 14 | { 15 | private: 16 | IWString _type; 17 | 18 | public: 19 | 20 | Collection_Template & operator = (const Collection_Template & rhs) 21 | { 22 | resizable_array::operator= (rhs); 23 | _type = rhs._type; 24 | 25 | return *this; 26 | } 27 | 28 | IWString & ztype () { return _type;} 29 | const IWString & ztype () const { return _type;} 30 | 31 | void set_type (const IWString & t) { _type = t;} 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /preamble: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | 3 | Copyright (C) 2012 Eli Lilly and Company 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | **************************************************************************/ 19 | -------------------------------------------------------------------------------- /queries/acyl_hydrazone_cyclic.qry: -------------------------------------------------------------------------------- 1 | # RuleClass acylating 2 | # SubClass acyl-QQ 3 | 4 | (0 Query 5 | (A C Comment "acyl_hydrazone_cyclic") 6 | (A C Comment "acyl_hydrazone_cyclic") 7 | (A D numeric_value 40) 8 | (A I Version 2) 9 | (0 Query_Atom 10 | (A I atomic_number 8) 11 | (A I ncon 1) 12 | (A I nbonds 2) 13 | ) 14 | (1 Query_Atom 15 | (A I atomic_number 6) 16 | (A I min_ncon 2) 17 | (A I min_nbonds 3) 18 | (A I nrings 0) 19 | (A I double_bond 0) 20 | ) 21 | (2 Query_Atom 22 | (A I atomic_number 7) 23 | (A I ncon 3) 24 | (A I nbonds 3) 25 | (A I nrings 1) 26 | (A I aromatic 0) 27 | (A I ring_size 5) 28 | (A I single_bond 1) 29 | ) 30 | (3 Query_Atom 31 | (A I atomic_number 7) 32 | (A I ncon 2) 33 | (A I nbonds 3) 34 | (A I nrings 1) 35 | (A I aromatic 0) 36 | (A I ring_size 5) 37 | (A I single_bond 2) 38 | ) 39 | ) 40 | -------------------------------------------------------------------------------- /queries/vinyl_sulfone_2.qry: -------------------------------------------------------------------------------- 1 | (5 Query 2 | (A C Comment "vinyl_sulfone_2") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 16) 6 | (A I ncon 4) 7 | (A I nbonds 6) 8 | (A I nrings 0) 9 | (A I aromatic 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 8) 13 | (A I ncon 1) 14 | (A I double_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 8) 18 | (A I ncon 1) 19 | (A I formal_charge 0) 20 | (A I double_bond 0) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 6) 24 | (A I min_ncon 2) 25 | (A I min_nbonds 3) 26 | (A I formal_charge 0) 27 | (A I aromatic 0) 28 | (A I attached_heteroatom_count 1) 29 | (A I single_bond 0) 30 | ) 31 | (4 Query_Atom 32 | (A I atomic_number 6) 33 | (A I min_nbonds 2) 34 | (A I aromatic 0) 35 | (A I attached_heteroatom_count 0) 36 | (A I double_bond 3) 37 | ) 38 | ) 39 | -------------------------------------------------------------------------------- /Molecule/qry_and_demerit.h: -------------------------------------------------------------------------------- 1 | #ifndef QRY_AND_DEMERIT_H 2 | #define QRY_AND_DEMERIT_H 3 | 4 | #include "iwaray.h" 5 | 6 | #include "substructure.h" 7 | 8 | class IWString; 9 | class Demerit; 10 | class Molecule_to_Match; 11 | 12 | class Query_and_Demerit_Value: public Substructure_Query 13 | { 14 | private: 15 | IWString _description; 16 | int _reject; 17 | int _demerit; 18 | int _demerit_each_occurrence; 19 | 20 | int _molecules_examined; 21 | int _molecules_demerited; 22 | 23 | // private functions 24 | 25 | void _default_values (); 26 | 27 | public: 28 | Query_and_Demerit_Value (); 29 | Query_and_Demerit_Value (const const_IWSubstring &); 30 | 31 | int debug_print (std::ostream &) const; 32 | int ok () const; 33 | 34 | int set_rejection (int); 35 | int determine_action (const IWString &); 36 | 37 | int evaluate (Molecule_to_Match &, Demerit &); 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /Molecule/tokenise_atomic_smarts.h: -------------------------------------------------------------------------------- 1 | #ifndef ASMARTS_COMPONENT_H 2 | #define ASMARTS_COMPONENT_H 3 | 4 | #include "iwstring.h" 5 | 6 | class Atomic_Smarts_Component : public const_IWSubstring 7 | { 8 | private: 9 | int _unary_operator; 10 | int _op; // the operator following the token 11 | Atomic_Smarts_Component * _next; 12 | 13 | // private functions 14 | 15 | int _parse (const_IWSubstring &); 16 | 17 | public: 18 | Atomic_Smarts_Component (); 19 | ~Atomic_Smarts_Component (); 20 | 21 | int ok () const; 22 | int debug_print (std::ostream &) const; 23 | 24 | Atomic_Smarts_Component * next () const { return _next;} 25 | 26 | int op () const { return _op;} 27 | int unary_operator () const { return _unary_operator;} 28 | 29 | int parse (const_IWSubstring); 30 | }; 31 | 32 | std::ostream & operator << (std::ostream &, const Atomic_Smarts_Component &); 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /queries/conjugated_triene_acyclic_2.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "conjugated_triene_acyclic_2") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 6) 6 | (A I nrings 0) 7 | ) 8 | (1 Query_Atom 9 | (A I atomic_number 6) 10 | (A I ncon 2) 11 | (A I nbonds 3) 12 | (A I nrings 0) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 6) 17 | (A I ncon 2) 18 | (A I nbonds 3) 19 | (A I nrings 0) 20 | (A I single_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 6) 24 | (A I ncon 2) 25 | (A I nbonds 3) 26 | (A I nrings 0) 27 | (A I double_bond 2) 28 | ) 29 | (4 Query_Atom 30 | (A I atomic_number 6) 31 | (A I ncon 2) 32 | (A I nbonds 3) 33 | (A I nrings 0) 34 | (A I single_bond 3) 35 | ) 36 | (5 Query_Atom 37 | (A I atomic_number 6) 38 | (A I nrings 0) 39 | (A I double_bond 4) 40 | ) 41 | ) 42 | -------------------------------------------------------------------------------- /queries/acyl_aromatic_nn.qry: -------------------------------------------------------------------------------- 1 | # RuleClass acylating 2 | # SubClass aromatic 3 | 4 | (0 Query 5 | (A C Comment "acyl_aromatic_nn") 6 | (A C Comment "acyl_aromatic_nn") 7 | (A I Version 2) 8 | (A I min_nrings 1) 9 | (A I min_aromatic_ring_count 1) 10 | (0 Query_Atom 11 | (A I atomic_number (8 16)) 12 | (A I ncon 1) 13 | (A I nbonds 2) 14 | ) 15 | (1 Query_Atom 16 | (A I atomic_number 6) 17 | (A I min_ncon 2) 18 | (A I min_nbonds 3) 19 | (A I nrings 0) 20 | (A I double_bond 0) 21 | ) 22 | (2 Query_Atom 23 | (A I atomic_number 7) 24 | (A I ncon 3) 25 | (A I aromatic 1) 26 | (A I nbonds 3) 27 | (A I nrings 1) 28 | (A I ring_size 5) 29 | (A I single_bond 1) 30 | ) 31 | (3 Query_Atom 32 | (A I atomic_number 7) 33 | (A I ncon 2) 34 | (A I nbonds 3) 35 | (A I aromatic 1) 36 | (A I nrings 1) 37 | (A I ring_size 5) 38 | (A I single_bond 2) 39 | ) 40 | ) 41 | -------------------------------------------------------------------------------- /queries/quinone_methide.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I version 2) 3 | (A C Comment "quinone_methide") 4 | (0 Query_Atom 5 | (A I atomic_number 6) 6 | (A I min_nrings 1) 7 | ) 8 | (1 Query_Atom 9 | (A I atomic_number 6) 10 | (A I double_bond 0) 11 | ) 12 | (2 Query_Atom 13 | (A I atomic_number 6) 14 | (A I ncon 3) 15 | (A I single_bond 1) 16 | ) 17 | (3 Query_Atom 18 | (A I atomic_number 6) 19 | (A I double_bond 2) 20 | ) 21 | (4 Query_Atom 22 | (A I atomic_number 6) 23 | (A I single_bond 2) 24 | ) 25 | (5 Query_Atom 26 | (A I atomic_number 6) 27 | (A I double_bond 4) 28 | ) 29 | (6 Query_Atom 30 | (A I atomic_number 6) 31 | (A I single_bond 5) 32 | (A I single_bond 0) 33 | ) 34 | (7 Query_Atom 35 | (A I atomic_number (7 8 16)) 36 | (A I double_bond 6) 37 | ) 38 | (0 Environment_no_Match 39 | (A C smarts "[O,N,S]") 40 | (A I single_bond (0 1 4 5)) 41 | ) 42 | ) 43 | -------------------------------------------------------------------------------- /queries/dienone.qry: -------------------------------------------------------------------------------- 1 | (7 Query 2 | (A C Comment "dienone") 3 | (A I one_embedding_per_start_atom 1) 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 8) 7 | (A I ncon 1) 8 | (A I nbonds 2) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ncon 3) 13 | (A I nrings 1) 14 | (A I double_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 6) 18 | (A I nrings 1) 19 | (A I single_bond 1) 20 | ) 21 | (3 Query_Atom 22 | (A I atomic_number 6) 23 | (A I nrings 1) 24 | (A I double_bond 2) 25 | ) 26 | (4 Query_Atom 27 | (A I atomic_number 6) 28 | (A I ncon 4) 29 | (A I nrings 1) 30 | (A I single_bond 3) 31 | ) 32 | (5 Query_Atom 33 | (A I atomic_number 6) 34 | (A I nrings 1) 35 | (A I single_bond 4) 36 | ) 37 | (6 Query_Atom 38 | (A I atomic_number 6) 39 | (A I nrings 1) 40 | (A I double_bond 5) 41 | (A I single_bond 1) 42 | ) 43 | ) 44 | -------------------------------------------------------------------------------- /queries/penicillin_cephalosporin.qry: -------------------------------------------------------------------------------- 1 | # Hit both Pennicillin and cephalosporin 2 | (0 Query 3 | (A C Comment "penicillin_cephalosporin") 4 | (A I Version 2) 5 | (A I min_nrings 2) 6 | (0 Ring_Specifier 7 | (A I ring_size 4) 8 | ) 9 | (0 Ring_System_Specifier 10 | (A I min_nrings 2) 11 | (A I min_rings_that_must_match_ring_size 2) 12 | (A I ring_size (4 5 6)) 13 | ) 14 | (0 Query_Atom 15 | (A I atomic_number 8) 16 | (A I ncon 1) 17 | (A I nbonds 2) 18 | ) 19 | (1 Query_Atom 20 | (A I atomic_number 6) 21 | (A I double_bond 0) 22 | (A I nrings 1) 23 | (A I ring_size 4) 24 | ) 25 | (2 Query_Atom 26 | (A I atomic_number 7) 27 | (A I nrings 2) 28 | (A I ring_size (4 5 6)) 29 | (A I single_bond 1) 30 | (A I aromatic 0) 31 | ) 32 | (3 Query_Atom 33 | (A I atomic_number 6) 34 | (A I single_bond 2) 35 | ) 36 | (4 Query_Atom 37 | (A I atomic_number 6) 38 | (A I single_bond 3) 39 | (A I single_bond 1) 40 | ) 41 | ) 42 | -------------------------------------------------------------------------------- /queries/ketoamide_cyclic.qry: -------------------------------------------------------------------------------- 1 | (4 Query 2 | (A C Comment "ketoamide_cyclic") 3 | (A C Comment "ketoamide_cyclic") 4 | (A I Version 2) 5 | (A I min_nrings 1) 6 | (A D numeric_value 50) 7 | (0 Query_Atom 8 | (A I atomic_number 8) 9 | (A I ncon 1) 10 | (A I nbonds 2) 11 | ) 12 | (1 Query_Atom 13 | (A I atomic_number 6) 14 | (A I min_ncon 3) 15 | (A I nbonds 4) 16 | (A I formal_charge 0) 17 | (A I nrings 1) 18 | (A I double_bond 0) 19 | ) 20 | (2 Query_Atom 21 | (A I atomic_number 6) 22 | (A I min_ncon 3) 23 | (A I nbonds 4) 24 | (A I formal_charge 0) 25 | (A I nrings 1) 26 | (A I single_bond 1) 27 | ) 28 | (3 Query_Atom 29 | (A I atomic_number 8) 30 | (A I ncon 1) 31 | (A I nbonds 2) 32 | (A I formal_charge 0) 33 | (A I double_bond 2) 34 | ) 35 | (4 Query_Atom 36 | (A I atomic_number 6) 37 | (A I single_bond 1) 38 | ) 39 | (5 Query_Atom 40 | (A I atomic_number 7) 41 | (A I single_bond 2) 42 | ) 43 | ) 44 | -------------------------------------------------------------------------------- /queries/reverse_michael_quat.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "reverse_michael_quat") 4 | (A C Comment "reverse_michael_quat") 5 | (0 Query_Atom 6 | (A I atomic_number 8) 7 | (A I ncon 1) 8 | (A I nbonds 2) 9 | ) 10 | (1 Query_Atom 11 | (A I nrings 0) 12 | (5 Query_Atom_Specifier 13 | (A I atomic_number 6) 14 | ) 15 | (6 Query_Atom_Specifier 16 | (A I atomic_number 16) 17 | (A I unsaturation 2) 18 | (A I min_nbonds 5) 19 | (A I min_attached_heteroatom_count 2) 20 | ) 21 | (A I double_bond 0) 22 | ) 23 | (2 Query_Atom 24 | (A I atomic_number 6) 25 | (A I unsaturation 0) 26 | (A I ring_id 1) 27 | (A I single_bond 1) 28 | ) 29 | (3 Query_Atom 30 | (A I atomic_number 6) 31 | (A I unsaturation 0) 32 | (A I ring_id 2) 33 | (A I single_bond 2) 34 | ) 35 | (4 Query_Atom 36 | (A I atomic_number 7) 37 | (A I formal_charge 1) 38 | (A I ring_id 3) 39 | (A I single_bond 3) 40 | ) 41 | ) 42 | -------------------------------------------------------------------------------- /include/iw_stl_hash_multimap.h: -------------------------------------------------------------------------------- 1 | #ifndef IW_STL_HASH_MAP_H 2 | #define IW_STL_HASH_MAP_H 3 | 4 | #include 5 | 6 | #if (GCC_VERSION >= 40405) 7 | #include 8 | #define IW_Hash_Multimap std::unordered_multimap 9 | #elif (__GNUC__ >= 3) 10 | #include 11 | using namespace __gnu_cxx; 12 | #define IW_Hash_Multimap hash_map 13 | #else 14 | #include 15 | using namespace stdext; 16 | #define IW_Hash_Multimap hash_map 17 | #endif 18 | 19 | #include "iwstring.h" 20 | #include "iwhash.h" 21 | 22 | template 23 | class IW_STL_Hash_Multimap : public IW_Hash_Multimap 24 | { 25 | private: 26 | public: 27 | }; 28 | 29 | typedef IW_STL_Hash_Multimap IW_STL_Hash_Multimap_int; 30 | typedef IW_STL_Hash_Multimap IW_STL_Hash_Multimap_float; 31 | typedef IW_STL_Hash_Multimap IW_STL_Hash_Multimap_double; 32 | typedef IW_STL_Hash_Multimap IW_STL_Hash_Multimap_IWString; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /queries/vinyl_disulfone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "vinyl_disulfone") 3 | (A C Comment "vinyl_disulfone") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I ncon 4) 8 | (A I nbonds 6) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I ncon 1) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 8) 17 | (A I ncon 1) 18 | (A I double_bond 0) 19 | ) 20 | (3 Query_Atom 21 | (A I atomic_number 6) 22 | (A I ncon 3) 23 | (A I nbonds 4) 24 | (A I nrings 0) 25 | (A I single_bond 0) 26 | ) 27 | (4 Query_Atom 28 | (A I atomic_number 16) 29 | (A I ncon 4) 30 | (A I nbonds 6) 31 | (A I single_bond 3) 32 | ) 33 | (5 Query_Atom 34 | (A I atomic_number 8) 35 | (A I ncon 1) 36 | (A I double_bond 4) 37 | ) 38 | (6 Query_Atom 39 | (A I atomic_number 8) 40 | (A I ncon 1) 41 | (A I double_bond 4) 42 | ) 43 | (7 Query_Atom 44 | (A I double_bond 3) 45 | ) 46 | ) 47 | -------------------------------------------------------------------------------- /Molecule/molecule_smarts.h: -------------------------------------------------------------------------------- 1 | #ifndef MOLECULE_SMARTS_H 2 | #define MOLECULE_SMARTS_H 3 | 4 | private: 5 | int _smarts (atom_number_t astart, 6 | int * include_atom, 7 | int flag, 8 | IWString & s); 9 | 10 | void _compute_ncon_and_explicit_hydrogens (atom_number_t zatom, 11 | int & ncon, 12 | int & eh, 13 | const int * include_atom) const; 14 | void _append_isotope_and_atomic_symbol (atom_number_t zatom, 15 | IWString & smiles); 16 | int _append_smarts_equivalent_for_atom (atom_number_t zatom, 17 | int ncon, 18 | int rm, 19 | IWString & s) const; 20 | 21 | 22 | #endif 23 | 24 | /* arch-tag: 12f3775a-c3d9-4d19-a884-b63de1606b98 25 | 26 | */ 27 | -------------------------------------------------------------------------------- /supporting_libraries/iwwrite_block.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #ifdef _WIN32 4 | #else 5 | #include 6 | #endif 7 | 8 | #include 9 | 10 | using std::cerr; 11 | using std::endl; 12 | 13 | #include "iwconfig.h" 14 | #include "iwstring.h" 15 | 16 | #define IWWRITE_BLKSIZE 4096 17 | 18 | int 19 | IWString::write_whole_blocks_shift_unwritten (int fd) 20 | { 21 | if (_number_elements < IWWRITE_BLKSIZE) 22 | return 1; 23 | 24 | 25 | int blocks_to_write = _number_elements / IWWRITE_BLKSIZE; 26 | 27 | int chars_written = IW_FD_WRITE (fd, _things, blocks_to_write * IWWRITE_BLKSIZE); 28 | 29 | if (chars_written != blocks_to_write * IWWRITE_BLKSIZE) 30 | { 31 | cerr << "IWString::write_whole_blocks_shift_unwritten:cannot write " << blocks_to_write << " blocks to " << fd << endl; 32 | return 0; 33 | } 34 | 35 | ::memcpy (_things, _things + chars_written, _number_elements - chars_written); 36 | 37 | _number_elements -= chars_written; 38 | 39 | return chars_written; 40 | } 41 | -------------------------------------------------------------------------------- /queries/cyanine_dye.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "cyanine_dye") 3 | (A I Version 2) 4 | (A I min_nrings 2) 5 | (A I min_aromatic_ring_count 1) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I ncon 3) 9 | (A I nbonds 4) 10 | (A I formal_charge 1) 11 | (A I nrings 1) 12 | (A I attached_heteroatom_count 0) 13 | (A I ring_size 5) 14 | ) 15 | (1 Query_Atom 16 | (A I atomic_number 6) 17 | (A I ncon 3) 18 | (A I nbonds 4) 19 | (A I nrings 1) 20 | (A I ring_size 5) 21 | (A I double_bond 0) 22 | ) 23 | (2 Query_Atom 24 | (A I atomic_number 6) 25 | (A I ncon 2) 26 | (A I nbonds 3) 27 | (A I nrings 0) 28 | (A I single_bond 1) 29 | ) 30 | (3 Query_Atom 31 | (A I atomic_number 6) 32 | (A I min_ncon 2) 33 | (A I nrings 0) 34 | (A I double_bond 2) 35 | ) 36 | (4 Query_Atom 37 | (A I atomic_number 6) 38 | (A I ncon 3) 39 | (A I nrings 2) 40 | (A I ring_size (5 6)) 41 | (A I aromatic 1) 42 | (A I single_bond 0) 43 | ) 44 | ) 45 | -------------------------------------------------------------------------------- /queries/phthalimide.qry: -------------------------------------------------------------------------------- 1 | (6 Query 2 | (A C Comment "phthalimide") 3 | (A C Comment "phthalimide") 4 | (A I Version 2) 5 | (A I unique_embeddings_only 1) 6 | (A I max_matches_to_find 1) 7 | (A I min_nrings 1) 8 | (A D numeric_value 50) 9 | (0 Query_Atom 10 | (A I atomic_number (8 16)) 11 | (A I ncon 1) 12 | (A I formal_charge 0) 13 | (A I nrings 0) 14 | ) 15 | (1 Query_Atom 16 | (A I atomic_number 6) 17 | (A I ncon 3) 18 | (A I nrings 1) 19 | (A I ring_size 5) 20 | (A I attached_heteroatom_count 2) 21 | (A I double_bond 0) 22 | ) 23 | (2 Query_Atom 24 | (A I atomic_number 7) 25 | (A I nrings 1) 26 | (A I ncon 3) 27 | (A I single_bond 1) 28 | ) 29 | (3 Query_Atom 30 | (A I atomic_number 6) 31 | (A I ncon 3) 32 | (A I nrings 1) 33 | (A I attached_heteroatom_count 2) 34 | (A I single_bond 2) 35 | ) 36 | (4 Query_Atom 37 | (A I atomic_number (8 16)) 38 | (A I formal_charge 0) 39 | (A I nrings 0) 40 | (A I double_bond 3) 41 | ) 42 | ) 43 | -------------------------------------------------------------------------------- /Molecule/coordinates.h: -------------------------------------------------------------------------------- 1 | #ifndef ATOM_COORDINATES_H 2 | #define ATOM_COORDINATES_H 3 | 4 | #include "space_vector.h" 5 | #include "iwmtypes.h" 6 | 7 | class Atom; 8 | 9 | class Coordinates : public Space_Vector 10 | { 11 | private: 12 | 13 | public: 14 | Coordinates () {}; 15 | Coordinates (const Space_Vector &); 16 | 17 | Coordinates (coord_t cx, coord_t cy, coord_t cz) : Space_Vector (cx, cy, cz) {}; 18 | Coordinates (const Coordinates & r) : Space_Vector (r.x (), r.y (), r.z ()) {}; 19 | Coordinates (const Atom & a); 20 | }; 21 | 22 | class Coordinates_double : public Space_Vector 23 | { 24 | private: 25 | 26 | public: 27 | Coordinates_double () {}; 28 | Coordinates_double (const Space_Vector &); 29 | 30 | Coordinates_double (double cx, double cy, double cz) : Space_Vector (cx, cy, cz) {}; 31 | Coordinates_double (const Coordinates & r) : Space_Vector (r.x (), r.y (), r.z ()) {}; 32 | Coordinates_double (const Atom & a); 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /queries/trifluoroacetate_ester.qry: -------------------------------------------------------------------------------- 1 | # RuleClass acylating 2 | # SubClass misc 3 | 4 | (9 Query 5 | (A C Comment "trifluoroacetate_ester") 6 | (A I Version 2) 7 | (0 Query_Atom 8 | (A I atomic_number 9) 9 | (A I ncon 1) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I ncon 4) 14 | (A I nrings 0) 15 | (A I single_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 9) 19 | (A I ncon 1) 20 | (A I single_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 9) 24 | (A I ncon 1) 25 | (A I single_bond 1) 26 | ) 27 | (4 Query_Atom 28 | (A I atomic_number 6) 29 | (A I ncon 3) 30 | (A I nrings 0) 31 | (A I single_bond 1) 32 | ) 33 | (5 Query_Atom 34 | (A I atomic_number 8) 35 | (A I ncon 1) 36 | (A I nrings 0) 37 | (A I double_bond 4) 38 | ) 39 | (6 Query_Atom 40 | (A I atomic_number 8) 41 | (A I ncon 2) 42 | (A I nbonds 2) 43 | (A I nrings 0) 44 | (A I single_bond 4) 45 | ) 46 | (7 Query_Atom 47 | (A I single_bond 6) 48 | ) 49 | ) 50 | -------------------------------------------------------------------------------- /queries/methylene_bis_sulfone_diaryl.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "methylene_bis_sulfone_diaryl") 3 | (A C Comment "methylene_bis_sulfone_diaryl") 4 | (A D numeric_value 75) 5 | (A I Version 2) 6 | (A I unique_embeddings_only 1) 7 | (0 Query_Atom 8 | (A I atomic_number 16) 9 | (A I min_ncon 3) 10 | (A I min_nbonds 5) 11 | (A I nrings 0) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 8) 15 | (A I ncon 1) 16 | (A I double_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 8) 20 | (A I ncon 1) 21 | (A I double_bond 0) 22 | ) 23 | (3 Query_Atom 24 | (A I atomic_number 6) 25 | (A I min_ncon 2) 26 | (A I single_bond 0) 27 | ) 28 | (4 Query_Atom 29 | (A I atomic_number 16) 30 | (A I min_ncon 3) 31 | (A I min_nbonds 5) 32 | (A I nrings 0) 33 | (A I single_bond 3) 34 | ) 35 | (5 Query_Atom 36 | (A I atomic_number 8) 37 | (A I ncon 1) 38 | (A I double_bond 4) 39 | ) 40 | (6 Query_Atom 41 | (A I atomic_number 8) 42 | (A I ncon 1) 43 | (A I double_bond 4) 44 | ) 45 | ) 46 | -------------------------------------------------------------------------------- /queries/nitro_phenol_or_aniline.qry: -------------------------------------------------------------------------------- 1 | (8 Query 2 | (A C Comment "nitro_phenol_or_aniline") 3 | (A I Version 2) 4 | (A I unique_embeddings_only 1) 5 | (A I one_embedding_per_start_atom 1) 6 | (A I min_nrings 1) 7 | (A I min_aromatic_ring_count 1) 8 | (0 Query_Atom 9 | (A I atomic_number (7 8)) 10 | (A I min_hcount 1) 11 | (A I nrings 0) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I ncon 3) 16 | (A I nrings 1) 17 | (A I ring_size 6) 18 | (A I aromatic 1) 19 | (A I single_bond 0) 20 | ) 21 | (2 Query_Atom 22 | (A I aromatic 1) 23 | (A I aromatic_bond 1) 24 | ) 25 | (3 Query_Atom 26 | (A I aromatic 1) 27 | (A I aromatic_bond 2) 28 | ) 29 | (4 Query_Atom 30 | (A I aromatic 1) 31 | (A I aromatic_bond 3) 32 | ) 33 | (5 Query_Atom 34 | (A I aromatic 1) 35 | (A I aromatic_bond 4) 36 | ) 37 | (6 Query_Atom 38 | (A I aromatic 1) 39 | (A I aromatic_bond 5) 40 | (A I aromatic_bond 1) 41 | ) 42 | (9 Environment 43 | (A I single_bond (2 4)) 44 | (A C smiles "N(=O)=O") 45 | ) 46 | ) 47 | -------------------------------------------------------------------------------- /test/dotest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Launching test, this may take a while, processing 30k molecules..." 4 | 5 | time ../Lilly_Medchem_Rules.rb example_molecules.smi > okmedchem.smi 6 | 7 | if [ ! -s okmedchem.smi ] 8 | then 9 | echo "Invocation failed, no output, check build" >&2 10 | exit 1 11 | fi 12 | 13 | failures=0 14 | 15 | for stem in bad0 bad1 bad2 bad3 okmedchem 16 | do 17 | computed="${stem}.smi" 18 | correct="${stem}.correct.smi" 19 | 20 | if [ ! -s "$correct" ] 21 | then 22 | echo "Correct file '${correct} missing or empty, incomplete package" >&2 23 | exit 2 24 | fi 25 | 26 | if [ ! -s "$computed" ] 27 | then 28 | echo "Computation failed, did not produce '${computed}'" >&2 29 | exit 3 30 | fi 31 | 32 | diff -w $correct $computed 33 | 34 | if [ $? -ne 0 ] 35 | then 36 | echo "Failure on '${stem}'" >&2 37 | let failures++ 38 | fi 39 | done 40 | 41 | if [ $failures -gt 0 ] 42 | then 43 | echo "${failures} failed tests" >&2 44 | else 45 | echo "All tests successful" >&2 46 | rm okmedchem.smi 47 | rm ok?.log 48 | rm bad?.smi 49 | fi 50 | -------------------------------------------------------------------------------- /include/iw_stl_hash_set.h: -------------------------------------------------------------------------------- 1 | #ifndef IW_STL_HASH_SET_H 2 | #define IW_STL_HASH_SET_H 3 | 4 | #include 5 | #include 6 | 7 | #include "iwconfig.h" 8 | 9 | #if (GCC_VERSION >= 40405) 10 | #include 11 | #define IW_Hash_Set std::unordered_set 12 | #elif defined(__clang__) 13 | #include 14 | #define IW_Hash_Set std::unordered_set 15 | #elif (__GNUC__ >= 3) 16 | #include 17 | using namespace __gnu_cxx; 18 | #define IW_Hash_Set std::hash_set 19 | #else 20 | #include 21 | using namespace stdext; 22 | #define IW_Hash_Set hash_set 23 | #endif 24 | 25 | using std::cerr; 26 | using std::endl; 27 | 28 | #include "iwstring.h" 29 | 30 | #include "iwhash.h" 31 | 32 | class IWString_STL_Hash_Set : public IW_Hash_Set 33 | { 34 | private: 35 | public: 36 | int contains (const IWString & t) const 37 | { 38 | IW_Hash_Set::const_iterator f = find (t); 39 | 40 | return f != IW_Hash_Set::end (); 41 | } 42 | }; 43 | 44 | typedef IWString_STL_Hash_Set IW_STL_Hash_Set; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /queries/boc.qry: -------------------------------------------------------------------------------- 1 | # RuleClass protecting group 2 | # SubClass count 3 | 4 | (0 Query 5 | (A C Comment "boc") 6 | (A I Version 2) 7 | (A D numeric_value 30) 8 | (A I min_hits_needed 2) 9 | 10 | (0 Query_Atom 11 | (A I atomic_number 7) 12 | (A I nrings 0) 13 | (A I hcount 1) 14 | ) 15 | (1 Query_Atom 16 | (A I atomic_number 6) 17 | (A I ncon 3) 18 | (A I nbonds 4) 19 | (A I single_bond 0) 20 | ) 21 | (2 Query_Atom 22 | (A I atomic_number 8) 23 | (A I ncon 1) 24 | (A I double_bond 1) 25 | ) 26 | (3 Query_Atom 27 | (A I atomic_number 8) 28 | (A I ncon 2) 29 | (A I single_bond 1) 30 | ) 31 | (4 Query_Atom 32 | (A I atomic_number 6) 33 | (A I ncon 4) 34 | (A I single_bond 3) 35 | (A I attached_heteroatom_count 1) 36 | ) 37 | (5 Query_Atom 38 | (A I atomic_number 6) 39 | (A I ncon 1) 40 | (A I single_bond 4) 41 | ) 42 | (6 Query_Atom 43 | (A I atomic_number 6) 44 | (A I ncon 1) 45 | (A I single_bond 4) 46 | ) 47 | (7 Query_Atom 48 | (A I atomic_number 6) 49 | (A I ncon 1) 50 | (A I single_bond 4) 51 | ) 52 | ) 53 | -------------------------------------------------------------------------------- /queries/crown_2_2.qry: -------------------------------------------------------------------------------- 1 | # RuleClass chelator 2 | # SubClass crown 3 | 4 | # Crowns in rings of size 8 or larger are rejected. Make sure 5 | # that rejection is run before this, as this does not detect 6 | # rings 7 | (0 Query 8 | (A C Comment "crown_2_2") 9 | (A D numeric_value 50) 10 | (A I Version 2) 11 | (0 Query_Atom 12 | (A I atomic_number (7 8 16)) 13 | ) 14 | (1 Query_Atom 15 | (A I atomic_number 6) 16 | (A I ncon 2) 17 | (A I nbonds 2) 18 | (A I single_bond 0) 19 | ) 20 | (2 Query_Atom 21 | (A I atomic_number 6) 22 | (A I ncon 2) 23 | (A I nbonds 2) 24 | (A I single_bond 1) 25 | ) 26 | (3 Query_Atom 27 | (A I atomic_number (7 8 16)) 28 | (A I ncon 2) 29 | (A I nbonds 2) 30 | (A I single_bond 2) 31 | ) 32 | (4 Query_Atom 33 | (A I atomic_number 6) 34 | (A I ncon 2) 35 | (A I nbonds 2) 36 | (A I single_bond 3) 37 | ) 38 | (5 Query_Atom 39 | (A I atomic_number 6) 40 | (A I ncon 2) 41 | (A I nbonds 2) 42 | (A I single_bond 4) 43 | ) 44 | (6 Query_Atom 45 | (A I atomic_number (7 8 16)) 46 | (A I single_bond 5) 47 | ) 48 | ) 49 | -------------------------------------------------------------------------------- /supporting_libraries/dash_f.cc: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | 3 | Copyright (C) 2011 Eli Lilly and Company 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | **************************************************************************/ 19 | #include 20 | 21 | #include "misc.h" 22 | 23 | int 24 | dash_f (const char * fname) 25 | { 26 | struct stat stbuf; 27 | 28 | if (0 == stat (fname, &stbuf)) 29 | return 1; 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /queries/halo_phthalazine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "halo_phthalazine") 3 | (A I min_aromatic_ring_count 1) 4 | (A D numeric_value 20) 5 | (A I Version 2) 6 | (0 Query_Atom 7 | (A I atomic_number (17 35 53)) 8 | (A I ncon 1) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ncon 3) 13 | (A I aromatic 1) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 7) 18 | (A I aromatic 1) 19 | (A I aromatic_bond 1) 20 | ) 21 | (3 Query_Atom 22 | (A I atomic_number 7) 23 | (A I aromatic 1) 24 | (A I aromatic_bond 2) 25 | ) 26 | (4 Query_Atom 27 | (A I aromatic 1) 28 | (A I aromatic_bond 3) 29 | ) 30 | (5 Query_Atom 31 | (A I aromatic 1) 32 | (A I aromatic_bond 4) 33 | ) 34 | (6 Query_Atom 35 | (A I aromatic 1) 36 | (A I aromatic_bond 5) 37 | (A I aromatic_bond 1) 38 | ) 39 | 40 | # Question? Are these needed for phthalazine? 41 | 42 | (0 Environment_no_Match 43 | (A C smarts "C#N") 44 | (A C smarts "N(=O)=O") 45 | (A C smarts "C(F)(F)F") 46 | (A C smarts "[F,Cl,Br,I]") 47 | (A I single_bond (4 6)) 48 | ) 49 | ) 50 | -------------------------------------------------------------------------------- /queries/phosphate_ester_ian_echo.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I version 2) 3 | (A C comment "phosphate_ester") 4 | (A I one_embedding_per_start_atom 1) 5 | (0 query_atom 6 | (A I initial_atom_number 0) 7 | (A I atomic_number 15) 8 | (A I ncon 4) 9 | (A I nbonds 5) 10 | ) 11 | (1 query_atom 12 | (A I initial_atom_number 1) 13 | (A I atomic_number 8) 14 | (A I double_bond 0) 15 | ) 16 | (2 query_atom 17 | (A I initial_atom_number 2) 18 | (A I atomic_number 8) 19 | (A I ncon 2) 20 | (A I attached_heteroatom_count 1) 21 | (A I single_bond 0) 22 | ) 23 | (3 query_atom 24 | (A I initial_atom_number 3) 25 | (A I atomic_number 8) 26 | (A I ncon 2) 27 | (A I attached_heteroatom_count 1) 28 | (A I single_bond 0) 29 | ) 30 | (4 query_atom 31 | (A I initial_atom_number 4) 32 | (1 Query_Atom_Specifier 33 | (A I atomic_number 8) 34 | (A I ncon 2) 35 | ) 36 | (2 Query_Atom_Specifier 37 | (A C operator "or") 38 | (A I atomic_number 6) 39 | ) 40 | (3 Query_Atom_Specifier 41 | (A C operator "or") 42 | (A I atomic_number 7) 43 | ) 44 | (A I single_bond 0) 45 | ) 46 | ) 47 | -------------------------------------------------------------------------------- /queries/triflate.qry: -------------------------------------------------------------------------------- 1 | (8 Query 2 | (A C Comment "triflate") 3 | (A C Comment "triflate") 4 | (A I Version 2) 5 | (A I max_matches_to_find 1) 6 | (0 Query_Atom 7 | (A I atomic_number 9) 8 | (A I ncon 1) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 6) 12 | (A I ncon 4) 13 | (A I nbonds 4) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 9) 18 | (A I ncon 1) 19 | (A I single_bond 1) 20 | ) 21 | (3 Query_Atom 22 | (A I atomic_number 9) 23 | (A I ncon 1) 24 | (A I single_bond 1) 25 | ) 26 | (4 Query_Atom 27 | (A I atomic_number 16) 28 | (A I ncon 4) 29 | (A I nbonds 6) 30 | (A I single_bond 1) 31 | ) 32 | (5 Query_Atom 33 | (A I atomic_number 8) 34 | (A I ncon 1) 35 | (A I nbonds 2) 36 | (A I double_bond 4) 37 | ) 38 | (6 Query_Atom 39 | (A I atomic_number 8) 40 | (A I ncon 1) 41 | (A I nbonds 2) 42 | (A I double_bond 4) 43 | ) 44 | (7 Query_Atom 45 | (A I atomic_number 8) 46 | (A I ncon 2) 47 | (A I nbonds 2) 48 | (A I single_bond 4) 49 | ) 50 | (8 Query_Atom 51 | (A I atomic_number 6) 52 | (A I single_bond 7) 53 | ) 54 | ) 55 | -------------------------------------------------------------------------------- /Molecule/substructure_demerits.h: -------------------------------------------------------------------------------- 1 | #ifndef SUBSTRUCTURE_DEMERIT_H 2 | #define SUBSTRUCTURE_DEMERIT_H 3 | 4 | class Molecule; 5 | class Demerit; 6 | class Charge_Assigner; 7 | 8 | namespace substructure_demerits 9 | { 10 | void set_verbose (int); 11 | 12 | void set_keep_going_after_rejection (int); 13 | 14 | /* 15 | Feb 2005. People want to be able to apply just the rejections from here 16 | */ 17 | 18 | void set_only_apply_rejection_rules (); 19 | 20 | int hard_coded_queries_statistics (std::ostream &); 21 | int initialise_hard_coded_queries_to_do (IWString &); 22 | 23 | int hard_coded_queries (Molecule &, Demerit &); 24 | 25 | /* 26 | We need a means of passing the charge assigner in substructure_demerits.cc back 27 | to the calling programme so it can be initialised from the command line. Awful! 28 | 29 | Or you can pass a string 30 | */ 31 | 32 | Charge_Assigner & charge_assigner (); 33 | int initialise_charge_assigner(const char *); 34 | 35 | void set_substructure_demerits_too_many_rings (int s); 36 | void set_substructure_demerits_ring_size_too_large (int s); 37 | 38 | 39 | void set_cx_chain_rejection_length(int s); 40 | void set_all_numeric_demerit_values (int s); 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /queries/crown_2_3.qry: -------------------------------------------------------------------------------- 1 | # RuleClass chelator 2 | # SubClass crown 3 | 4 | # Make sure the rejection of large ring crowns is run before this 5 | 6 | (0 Query 7 | (A C Comment "crown_2_3") 8 | (A I Version 2) 9 | (A D numeric_value 50) 10 | (0 Query_Atom 11 | (A I atomic_number (7 8 16)) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I ncon 2) 16 | (A I nbonds 2) 17 | (A I single_bond 0) 18 | ) 19 | (2 Query_Atom 20 | (A I atomic_number 6) 21 | (A I ncon 2) 22 | (A I nbonds 2) 23 | (A I single_bond 1) 24 | ) 25 | (3 Query_Atom 26 | (A I atomic_number (7 8 16)) 27 | (A I ncon 2) 28 | (A I nbonds 2) 29 | (A I single_bond 2) 30 | ) 31 | (4 Query_Atom 32 | (A I atomic_number 6) 33 | (A I ncon 2) 34 | (A I nbonds 2) 35 | (A I single_bond 3) 36 | ) 37 | (5 Query_Atom 38 | (A I atomic_number 6) 39 | (A I ncon 2) 40 | (A I nbonds 2) 41 | (A I single_bond 4) 42 | ) 43 | (6 Query_Atom 44 | (A I atomic_number 6) 45 | (A I ncon 2) 46 | (A I nbonds 2) 47 | (A I single_bond 5) 48 | ) 49 | (7 Query_Atom 50 | (A I atomic_number (7 8 16)) 51 | (A I single_bond 6) 52 | ) 53 | ) 54 | -------------------------------------------------------------------------------- /queries/halo_next_to_aryl_n_w_ewg.qry: -------------------------------------------------------------------------------- 1 | # Only reject these when there is an ortho or para electron withdrawing group 2 | 3 | (0 Query 4 | (A C Comment "halo_next_to_aryl_n_w_ewg") 5 | (A I min_aromatic_ring_count 1) 6 | (A D numeric_value 20) 7 | (A I Version 2) 8 | (0 Query_Atom 9 | (A I atomic_number (17 35 53)) 10 | (A I ncon 1) 11 | ) 12 | (1 Query_Atom 13 | (A I atomic_number 6) 14 | (A I ncon 3) 15 | (A I aromatic 1) 16 | (A I single_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 7) 20 | (A I aromatic 1) 21 | (A I aromatic_bond 1) 22 | ) 23 | (3 Query_Atom 24 | (A I aromatic 1) 25 | (A I aromatic_bond 2) 26 | ) 27 | (4 Query_Atom 28 | (A I aromatic 1) 29 | (A I aromatic_bond 3) 30 | ) 31 | (5 Query_Atom 32 | (A I aromatic 1) 33 | (A I aromatic_bond 4) 34 | ) 35 | (6 Query_Atom 36 | (A I aromatic 1) 37 | (A I aromatic_bond 5) 38 | (A I aromatic_bond 1) 39 | ) 40 | (0 Environment 41 | (A C smarts "C#N") 42 | (A C smarts "N(=O)=O") 43 | (A C smarts "C(F)(F)F") 44 | # (A C smarts "[F,Cl,Br,I]") 45 | (A C smarts "[CD3](=O)-[OD2]") 46 | (A I single_bond (4 6)) 47 | ) 48 | ) 49 | -------------------------------------------------------------------------------- /Molecule/parse_smarts_tmp.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef PARSE_SMARTS_TMP_MALLOC_CHECK 4 | #include "iwmalloc.h" 5 | #endif 6 | 7 | #include "substructure.h" 8 | #include "parse_smarts_tmp.h" 9 | 10 | Parse_Smarts_Tmp::Parse_Smarts_Tmp () 11 | { 12 | _last_query_atom_created = -1; 13 | 14 | return; 15 | } 16 | 17 | Parse_Smarts_Tmp::~Parse_Smarts_Tmp () 18 | { 19 | #ifdef PARSE_SMARTS_TMP_MALLOC_CHECK 20 | check_malloc_magic (); 21 | #endif 22 | 23 | return; 24 | } 25 | 26 | int 27 | Parse_Smarts_Tmp::set_natoms (int n) 28 | { 29 | assert (n > 0); 30 | 31 | //cerr << "Parse_Smarts_Tmp:set_natoms: natoms " << n << endl; 32 | 33 | return 1; 34 | } 35 | 36 | #ifdef PARSE_SMARTS_TMP_MALLOC_CHECK 37 | 38 | int 39 | Parse_Smarts_Tmp::check_malloc_magic () const 40 | { 41 | if (_root.number_elements ()) 42 | iwmalloc_check_malloc_magic (_root.rawdata ()); 43 | if (_no_matched_atoms_between.number_elements ()) 44 | iwmalloc_check_malloc_magic (_no_matched_atoms_between.rawdata ()); 45 | if (_link_atom.number_elements ()) 46 | iwmalloc_check_malloc_magic (_link_atom.rawdata ()); 47 | 48 | return 1; 49 | } 50 | 51 | #endif 52 | 53 | // arch-tag: 3fa138c0-8e33-4af1-b8fa-4074ffbc7818 54 | -------------------------------------------------------------------------------- /queries/phenylenediamine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "phenylenediamine") 3 | (A C Comment "phenylenediamine") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 7) 7 | (A I nrings 0) 8 | (A I vinyl 0) 9 | (A I unsaturation 0) 10 | ) 11 | (1 Query_Atom 12 | (A I atomic_number 6) 13 | (A I aromatic 1) 14 | (A I single_bond 0) 15 | ) 16 | (2 Query_Atom 17 | (A I atomic_number 6) 18 | (A I aromatic 1) 19 | (A I aromatic_bond 1) 20 | ) 21 | (3 Query_Atom 22 | (A I atomic_number 6) 23 | (A I aromatic 1) 24 | (A I aromatic_bond 2) 25 | ) 26 | (4 Query_Atom 27 | (A I atomic_number 6) 28 | (A I aromatic 1) 29 | (A I aromatic_bond 3) 30 | ) 31 | (5 Query_Atom 32 | (A I atomic_number 6) 33 | (A I aromatic 1) 34 | (A I aromatic_bond 4) 35 | ) 36 | (6 Query_Atom 37 | (A I atomic_number 6) 38 | (A I aromatic 1) 39 | (A I aromatic_bond 5) 40 | (A I aromatic_bond 1) 41 | ) 42 | 43 | (0 Environment 44 | (A I single_bond (2 3 4 5 6)) 45 | (7 Query_Atom 46 | (A I atomic_number 7) 47 | (A I nrings 0) 48 | (A I vinyl 0) 49 | (A I unsaturation 0) 50 | ) 51 | ) 52 | ) 53 | -------------------------------------------------------------------------------- /Molecule/misc2.h: -------------------------------------------------------------------------------- 1 | #ifndef IW_MISC2_H 2 | #define IW_MISC2_H 3 | 4 | #include "iwmtypes.h" 5 | 6 | extern void iwabort (); 7 | 8 | extern int iw_rename (const char *, const char *); 9 | 10 | extern int iw_getpid (); 11 | 12 | extern int int_comparitor_larger (const int *, const int *); 13 | 14 | extern int uint64_comparitor_smaller (const iw_uint64_t *, const iw_uint64_t *); 15 | 16 | extern void iwxor (const int *, int *, int); 17 | 18 | class const_IWSubstring; 19 | 20 | extern int fetch_numeric (const const_IWSubstring & string, int & value, int max_chars = 0); 21 | extern int fetch_numeric_char (const char * string, int & value, int max_chars); 22 | 23 | /* 24 | Sometimes we need to compute combinatorial permutations and we 25 | may be dealing with numbers larger than can be held in an int 26 | */ 27 | 28 | extern iw_uint64_t iw_combinatorial_combinations (int n, int k); 29 | 30 | template int skip_to_string (T & input, const char * target, int report_discard); 31 | 32 | // identify the + characters in a reaction smiles. Complicated by the presence of + signs inside square brackets 33 | 34 | extern int identify_plus_positions (const const_IWSubstring & buffer, resizable_array & pos); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /queries/acyl_hydroxamate.qry: -------------------------------------------------------------------------------- 1 | # RuleClass acylating 2 | # SubClass acyl-QQ 3 | 4 | (0 Query 5 | (A C Comment "acyl_hydroxamate") 6 | (A I Version 2) 7 | (0 Query_Atom 8 | (A I atomic_number 8) 9 | (A I ncon 1) 10 | (A I nbonds 2) 11 | ) 12 | (1 Query_Atom 13 | (A I atomic_number 6) 14 | (A I min_ncon 2) 15 | (A I min_nbonds 3) 16 | (A I double_bond 0) 17 | ) 18 | (2 Query_Atom 19 | (A I atomic_number 8) 20 | (A I ncon 2) 21 | (A I nbonds 2) 22 | (A I nrings 0) 23 | (A I single_bond 1) 24 | ) 25 | (3 Query_Atom 26 | (A I atomic_number 7) 27 | (A I ncon 3) 28 | (A I nbonds 3) 29 | (A I single_bond 2) 30 | ) 31 | (4 Query_Atom 32 | (A I atomic_number 6) 33 | (A I min_ncon 3) 34 | (A I min_nbonds 3) 35 | (A I single_bond 3) 36 | ) 37 | (5 Query_Atom 38 | (A I atomic_number 8) 39 | (A I ncon 1) 40 | (A I nbonds 2) 41 | (A I double_bond 4) 42 | ) 43 | (6 Query_Atom 44 | (A I atomic_number 6) 45 | (A I min_ncon 3) 46 | (A I min_nbonds 3) 47 | (A I single_bond 3) 48 | ) 49 | (7 Query_Atom 50 | (A I atomic_number 8) 51 | (A I ncon 1) 52 | (A I nbonds 2) 53 | (A I double_bond 6) 54 | ) 55 | ) 56 | -------------------------------------------------------------------------------- /charge_assigner/phenolate.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "phenolate") 4 | (A I one_embedding_per_start_atom 1) 5 | # clogD offset 6 | (A D numeric_value 2.07) 7 | (0 query_atom 8 | (A I atomic_number (8 16)) 9 | (A I hcount 1) 10 | (A I ncon 1) 11 | (A D numeric_value -1.1) 12 | ) 13 | (1 query_atom 14 | (A I atomic_number 6) 15 | (A I aromatic 1) 16 | (A I single_bond 0) 17 | ) 18 | (2 query_atom 19 | (A I atomic_number 6) 20 | (A I aromatic 1) 21 | (A I aromatic_bond 1) 22 | ) 23 | (3 query_atom 24 | (A I atomic_number 6) 25 | (A I aromatic 1) 26 | (A I aromatic_bond 2) 27 | ) 28 | (4 query_atom 29 | (A I atomic_number 6) 30 | (A I aromatic 1) 31 | (A I aromatic_bond 3) 32 | ) 33 | (5 query_atom 34 | (A I atomic_number 6) 35 | (A I aromatic 1) 36 | (A I aromatic_bond 4) 37 | ) 38 | (6 query_atom 39 | (A I atomic_number 6) 40 | (A I aromatic 1) 41 | (A I aromatic_bond 5) 42 | (A I aromatic_bond 1) 43 | ) 44 | (0 Environment 45 | (A I single_bond 2 4 6) 46 | (A I min_hits_needed 2) 47 | (A C smarts "N(=O)=O") 48 | (A C smarts "[Cl,F,Br,I]") 49 | (A C smarts "C#N") 50 | ) 51 | ) 52 | -------------------------------------------------------------------------------- /charge_assigner/thiazolidinedione.qry: -------------------------------------------------------------------------------- 1 | (8 Query 2 | (A C Comment "thiazolidinedione") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | (A I ncon 2) 7 | (A I nbonds 2) 8 | (A I nrings 1) 9 | (A I hcount 1) 10 | (A I ring_size 5) 11 | (A D numeric_value -1.1) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I ncon 3) 16 | (A I nbonds 4) 17 | (A I nrings 1) 18 | (A I ring_size 5) 19 | (A I single_bond 0) 20 | ) 21 | (2 Query_Atom 22 | (A I atomic_number (8 16)) 23 | (A I ncon 1) 24 | (A I double_bond 1) 25 | ) 26 | (3 Query_Atom 27 | (A I atomic_number 16) 28 | (A I ncon 2) 29 | (A I nbonds 2) 30 | (A I nrings 1) 31 | (A I ring_size 5) 32 | (A I single_bond 1) 33 | ) 34 | (4 Query_Atom 35 | (A I atomic_number 6) 36 | (A I min_ncon 2) 37 | (A I single_bond 3) 38 | ) 39 | (5 Query_Atom 40 | (A I atomic_number 6) 41 | (A I ncon 3) 42 | (A I nbonds 4) 43 | (A I nrings 1) 44 | (A I ring_size 5) 45 | (A I single_bond 4) 46 | (A I single_bond 0) 47 | ) 48 | (6 Query_Atom 49 | (A I atomic_number (8 16)) 50 | (A I ncon 1) 51 | (A I double_bond 5) 52 | ) 53 | ) 54 | -------------------------------------------------------------------------------- /supporting_libraries/dy_fingerprint.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | 3 | Copyright (C) 2011 Eli Lilly and Company 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | 18 | **************************************************************************/ 19 | #ifndef IW_DAYLIGHT_FINGERPRINT_H 20 | #define IW_DAYLIGHT_FINGERPRINT_H 21 | 22 | extern int du_ascii2bin(const char *ascii, int nchars, 23 | unsigned char * binary, unsigned int & nbytes); 24 | 25 | extern char * du_bin2ascii (int *palen, int blen, char *b); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /charge_assigner/N_acylpyrazolidinone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "N_acylpyrazolidinone") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | (A I ncon 2) 7 | (A I nbonds 2) 8 | (A I hcount 1) 9 | (A I nrings 1) 10 | (A I ring_size 5) 11 | (A D numeric_value -1.1) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I ncon 3) 16 | (A I nbonds 4) 17 | (A I nrings 1) 18 | (A I ring_size 5) 19 | (A I single_bond 0) 20 | ) 21 | (2 Query_Atom 22 | (A I atomic_number 8) 23 | (A I ncon 1) 24 | (A I double_bond 1) 25 | ) 26 | (3 Query_Atom 27 | (A I atomic_number 6) 28 | (A I min_ncon 2) 29 | (A I single_bond 1) 30 | ) 31 | (4 Query_Atom 32 | (A I atomic_number 6) 33 | (A I min_ncon 2) 34 | (A I bond 3) 35 | ) 36 | (5 Query_Atom 37 | (A I atomic_number 7) 38 | (A I ncon 3) 39 | (A I nbonds 3) 40 | (A I nrings 1) 41 | (A I ring_size 5) 42 | (A I single_bond 4) 43 | (A I single_bond 0) 44 | ) 45 | (6 Query_Atom 46 | (A I atomic_number 6) 47 | (A I min_ncon 2) 48 | (A I single_bond 5) 49 | ) 50 | (7 Query_Atom 51 | (A I atomic_number (8 16)) 52 | (A I ncon 1) 53 | (A I double_bond 6) 54 | ) 55 | ) 56 | -------------------------------------------------------------------------------- /queries/catechol.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "catechol") 3 | (A I Version 2) 4 | (A D numeric_value 90) 5 | (A I min_aromatic_ring_count 1) 6 | (A I one_embedding_per_start_atom 1) 7 | (A I embeddings_do_not_overlap 1) 8 | (0 Query_Atom 9 | (A I atomic_number 8) 10 | (A I ncon 1) 11 | ) 12 | (1 Query_Atom 13 | (A I atomic_number 6) 14 | (A I ncon 3) 15 | (A I aromatic 1) 16 | (A I single_bond 0) 17 | (A I ring_id 1) 18 | ) 19 | (2 Query_Atom 20 | (A I atomic_number 6) 21 | (A I aromatic 1) 22 | (A I bond 1) 23 | (A I ring_id 1) 24 | ) 25 | (3 Query_Atom 26 | (A I atomic_number 6) 27 | (A I aromatic 1) 28 | (A I ring_id 1) 29 | (A I bond 2) 30 | ) 31 | (4 Query_Atom 32 | (A I atomic_number 6) 33 | (A I aromatic 1) 34 | (A I ring_id 1) 35 | (A I bond 3) 36 | ) 37 | (5 Query_Atom 38 | (A I atomic_number 6) 39 | (A I aromatic 1) 40 | (A I ring_id 1) 41 | (A I bond 4) 42 | ) 43 | (6 Query_Atom 44 | (A I atomic_number 6) 45 | (A I aromatic 1) 46 | (A I ring_id 1) 47 | (A I bond 5) 48 | (A I bond 1) 49 | ) 50 | (0 Environment 51 | (A I single_bond (2 3 4 5 6)) 52 | (7 Query_Atom 53 | (A I atomic_number 8) 54 | (A I ncon 1) 55 | ) 56 | ) 57 | ) 58 | -------------------------------------------------------------------------------- /Molecule/moleculed.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPILING_MOLECULED 2 | THIS FILE SHOULD ONLY BE INCLUDED IN MOLECULED.CC 3 | #else 4 | 5 | void _compute_distance_matrix (); 6 | int _initialise_distance_matrix (); 7 | int _bonds_between (atom_number_t, atom_number_t); 8 | int _recompute_distance_matrix (int (Molecule::*identify_first_atom) (const int *, atom_number_t &), 9 | int (Molecule::*identify_next_atom) (const int *, atom_number_t, atom_number_t &)); 10 | void _compute_row_of_distance_matrix (int * row_of_distance_matrix, 11 | atom_number_t current_atom, 12 | int distance); 13 | void _compute_row_of_distance_matrix (CRDM_args & crdm, 14 | int (Molecule::*identify_next_atom) (const int *, atom_number_t, atom_number_t &)); 15 | void _compute_row_of_distance_matrix (int * row_of_distance_matrix, 16 | int & distance, 17 | int * atom_stack, 18 | int stack_ptr, 19 | int * ring_atom); 20 | 21 | int _atoms_between (atom_number_t a1, 22 | atom_number_t a2, 23 | int d, 24 | Set_of_Atoms & s); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /queries/crown_3_3.qry: -------------------------------------------------------------------------------- 1 | # RuleClass chelator 2 | # SubClass crown 3 | 4 | # Make sure the rejection for crowns in large rings is run first 5 | 6 | (0 Query 7 | (A C Comment "crown_3_3") 8 | (A I Version 2) 9 | (A D numeric_value 50) 10 | (0 Query_Atom 11 | (A I atomic_number (7 8 16)) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I ncon 2) 16 | (A I nbonds 2) 17 | (A I single_bond 0) 18 | ) 19 | (2 Query_Atom 20 | (A I atomic_number 6) 21 | (A I ncon 2) 22 | (A I nbonds 2) 23 | (A I single_bond 1) 24 | ) 25 | (3 Query_Atom 26 | (A I atomic_number 6) 27 | (A I ncon 2) 28 | (A I nbonds 2) 29 | (A I single_bond 2) 30 | ) 31 | (4 Query_Atom 32 | (A I atomic_number (7 8 16)) 33 | (A I ncon 2) 34 | (A I nbonds 2) 35 | (A I single_bond 3) 36 | ) 37 | (5 Query_Atom 38 | (A I atomic_number 6) 39 | (A I ncon 2) 40 | (A I nbonds 2) 41 | (A I single_bond 4) 42 | ) 43 | (6 Query_Atom 44 | (A I atomic_number 6) 45 | (A I ncon 2) 46 | (A I nbonds 2) 47 | (A I single_bond 5) 48 | ) 49 | (7 Query_Atom 50 | (A I atomic_number 6) 51 | (A I ncon 2) 52 | (A I nbonds 2) 53 | (A I single_bond 6) 54 | ) 55 | (8 Query_Atom 56 | (A I atomic_number (7 8 16)) 57 | (A I single_bond 7) 58 | ) 59 | ) 60 | -------------------------------------------------------------------------------- /queries/aminophenol.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "aminophenol") 3 | (A C Comment "aminophenol") 4 | (A I Version 2) 5 | (A D numeric_value 90) 6 | (A I min_aromatic_ring_count 1) 7 | (A I one_embedding_per_start_atom 1) 8 | (A I embeddings_do_not_overlap 1) 9 | (0 Query_Atom 10 | (A I atomic_number 7) 11 | (A I ncon 1) 12 | ) 13 | (1 Query_Atom 14 | (A I atomic_number 6) 15 | (A I ncon 3) 16 | (A I aromatic 1) 17 | (A I single_bond 0) 18 | (A I ring_id 1) 19 | ) 20 | (2 Query_Atom 21 | (A I atomic_number 6) 22 | (A I aromatic 1) 23 | (A I bond 1) 24 | (A I ring_id 1) 25 | ) 26 | (3 Query_Atom 27 | (A I atomic_number 6) 28 | (A I aromatic 1) 29 | (A I ring_id 1) 30 | (A I bond 2) 31 | ) 32 | (4 Query_Atom 33 | (A I atomic_number 6) 34 | (A I aromatic 1) 35 | (A I ring_id 1) 36 | (A I bond 3) 37 | ) 38 | (5 Query_Atom 39 | (A I atomic_number 6) 40 | (A I aromatic 1) 41 | (A I ring_id 1) 42 | (A I bond 4) 43 | ) 44 | (6 Query_Atom 45 | (A I atomic_number 6) 46 | (A I aromatic 1) 47 | (A I ring_id 1) 48 | (A I bond 5) 49 | (A I bond 1) 50 | ) 51 | (0 Environment 52 | (A I single_bond (2 3 4 5 6)) 53 | (7 Query_Atom 54 | (A I atomic_number 8) 55 | (A I ncon 1) 56 | ) 57 | ) 58 | ) 59 | -------------------------------------------------------------------------------- /charge_assigner/guanidine.qry: -------------------------------------------------------------------------------- 1 | # this was added because some guanidine molecules were not hit 2 | # by the amidine query, 374535 for example. 3 | # We make this very restrictive so that hopefully it will only 4 | # hit molecules otherwise missed by the amidine query 5 | 6 | (0 Query 7 | (A C Comment "guanidine") 8 | (A I Version 2) 9 | (A I unique_embeddings_only 1) 10 | (A I one_embedding_per_start_atom 1) 11 | # clogD offset 12 | (A D numeric_value 2.70) 13 | (1 Element_Hits_Needed 14 | (A I atomic_number 7) 15 | (A I min_hits_needed 3) 16 | ) 17 | (0 Query_Atom 18 | (A I atomic_number 7) 19 | (A I unsaturation 0) 20 | (A I aromatic 0) 21 | ) 22 | (1 Query_Atom 23 | (A I atomic_number 6) 24 | (A I ncon 3) 25 | (A I nbonds 4) 26 | (A I aromatic 0) 27 | (A I single_bond 0) 28 | ) 29 | (2 Query_Atom 30 | (A I atomic_number 7) 31 | (A I min_ncon 2) 32 | (A I single_bond 1) 33 | (A I unsaturation 0) 34 | (A I aromatic 0) 35 | ) 36 | (3 Query_Atom 37 | (A I atomic_number 7) 38 | (A I double_bond 1) 39 | (A D numeric_value 1.1) 40 | ) 41 | 42 | (5 Environment_No_Match 43 | (A I single_bond (0 2 3)) 44 | (A C smarts "N(=O)=O") 45 | (A C smarts "S=O") 46 | (A C smarts "C#N") 47 | (A C smarts "C=[O,S]") 48 | (A C smarts "[OH,SH]") 49 | ) 50 | ) 51 | -------------------------------------------------------------------------------- /Molecule/ostream_and_type.h: -------------------------------------------------------------------------------- 1 | #ifndef IW_STREAMTYPE_H 2 | #define IW_STREAMTYPE_H 3 | 4 | #include 5 | 6 | #include "iwstring.h" 7 | 8 | class Molecule; 9 | 10 | #include "iwaray.h" 11 | 12 | /* 13 | This class consists of an ofstream which knows which kind of 14 | structure file to write. 15 | */ 16 | 17 | class ofstream_and_type : public std::ofstream 18 | { 19 | private: 20 | int _output_type; 21 | IWString _fname; 22 | int _valid; 23 | int _molecules_written; 24 | int _verbose; 25 | 26 | // private functions 27 | 28 | int _default_values (); 29 | 30 | public: 31 | ofstream_and_type (); 32 | ofstream_and_type (int); 33 | ofstream_and_type (int, const char *); 34 | ofstream_and_type (int, IWString &); 35 | ~ofstream_and_type (); 36 | 37 | int ok () const; 38 | int debug_print (std::ostream &) const; 39 | 40 | int valid () const { return _valid;} 41 | 42 | int open (const char *); 43 | int open (IWString &); 44 | 45 | int set_type (int); 46 | void set_verbose (int verbose) {_verbose = verbose;} 47 | 48 | const IWString & fname () const { return _fname;} 49 | 50 | int molecules_written () const { return _molecules_written;} 51 | 52 | int write_molecule (Molecule *); 53 | int write_molecules (const resizable_array_p &); 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /queries/isolated_aromatic.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A D numeric_value 40) 4 | (A I subtract_from_rc 3) 5 | (A C Comment "isolated_aromatic") 6 | (A I one_embedding_per_start_atom 1) 7 | (A I min_nrings 3) 8 | (1 Ring_Specifier 9 | (A I aromatic 1) 10 | (A I min_hits_needed 3) 11 | (A I ring_size 6) 12 | (A I ncon 1) 13 | (A I fused 0) 14 | (A I heteroatoms 0) 15 | ) 16 | 17 | # Note that RING_SPECIFIER does not determine the count, we must do that the long way 18 | 19 | (0 Query_Atom 20 | (A I atomic_number 6) 21 | (A I ncon 3) 22 | (A I isolated_ring 1) 23 | (A I nrings 1) 24 | (A I ring_size 6) 25 | (A I aromatic 1) 26 | ) 27 | (1 Query_Atom 28 | (A I atomic_number 6) 29 | (A I ncon 2) 30 | (A I aromatic 1) 31 | (A I bond 0) 32 | ) 33 | (2 Query_Atom 34 | (A I atomic_number 6) 35 | (A I ncon 2) 36 | (A I aromatic 1) 37 | (A I bond 1) 38 | ) 39 | (3 Query_Atom 40 | (A I atomic_number 6) 41 | (A I ncon 2) 42 | (A I aromatic 1) 43 | (A I bond 2) 44 | ) 45 | (4 Query_Atom 46 | (A I atomic_number 6) 47 | (A I ncon 2) 48 | (A I aromatic 1) 49 | (A I bond 3) 50 | ) 51 | (5 Query_Atom 52 | (A I atomic_number 6) 53 | (A I ncon 2) 54 | (A I aromatic 1) 55 | (A I bond 4) 56 | (A I bond 0) 57 | ) 58 | ) 59 | -------------------------------------------------------------------------------- /queries/methylene_bis_sulfone.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "methylene_bis_sulfone") 3 | (A C Comment "methylene_bis_sulfone") 4 | (A I Version 2) 5 | (0 Query_Atom 6 | (A I atomic_number 16) 7 | (A I ncon 4) 8 | (A I nbonds 6) 9 | ) 10 | (1 Query_Atom 11 | (A I atomic_number 8) 12 | (A I ncon 1) 13 | (A I double_bond 0) 14 | ) 15 | (2 Query_Atom 16 | (A I atomic_number 8) 17 | (A I ncon 1) 18 | (A I double_bond 0) 19 | ) 20 | (3 Query_Atom 21 | (A I atomic_number 8) 22 | (A I ncon 2) 23 | (A I single_bond 0) 24 | ) 25 | (4 Query_Atom 26 | (A I aromatic 1) 27 | (A I single_bond 3) 28 | ) 29 | (5 Query_Atom 30 | (A I atomic_number 6) 31 | (A I single_bond 0) 32 | ) 33 | (6 Query_Atom 34 | (A I atomic_number 16) 35 | (A I ncon 4) 36 | (A I nbonds 6) 37 | (A I single_bond 5) 38 | ) 39 | (7 Query_Atom 40 | (A I atomic_number 8) 41 | (A I ncon 1) 42 | (A I nbonds 2) 43 | (A I double_bond 6) 44 | ) 45 | (8 Query_Atom 46 | (A I atomic_number 8) 47 | (A I ncon 1) 48 | (A I nbonds 2) 49 | (A I double_bond 6) 50 | ) 51 | (9 Query_Atom 52 | (A I atomic_number 8) 53 | (A I ncon 2) 54 | (A I nbonds 2) 55 | (A I single_bond 6) 56 | ) 57 | (10 Query_Atom 58 | (A I aromatic 1) 59 | (A I single_bond 9) 60 | ) 61 | ) 62 | -------------------------------------------------------------------------------- /queries/reverse_michael_demerit.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "reverse_michael") 4 | (A D numeric_value 50) 5 | (A I unique_embeddings_only 1) 6 | (0 Query_Atom 7 | (A I atomic_number 8) 8 | (A I ncon 1) 9 | (A I nbonds 2) 10 | ) 11 | (1 Query_Atom 12 | (A I nrings 0) 13 | (5 Query_Atom_Specifier 14 | (A I atomic_number 6) 15 | (A I aromatic 0) 16 | ) 17 | (6 Query_Atom_Specifier 18 | (A I atomic_number 16) 19 | (A I aromatic 0) 20 | (A I unsaturation 2) 21 | (A I min_nbonds 5) 22 | ) 23 | (A I double_bond 0) 24 | ) 25 | (2 Query_Atom 26 | (A I atomic_number 6) 27 | (A I unsaturation 0) 28 | (A I aromatic 0) 29 | (A I ring_id 1) 30 | (A I min_hcount 1) 31 | (A I single_bond 1) 32 | ) 33 | (3 Query_Atom 34 | (A I atomic_number 6) 35 | (A I unsaturation 0) 36 | (A I ring_id 2) 37 | (A I min_hcount 1) 38 | (A I aromatic 0) 39 | (A I single_bond 2) 40 | ) 41 | (4 Query_Atom 42 | (A I atomic_number 7) 43 | (A I ring_id 3) 44 | (A I attached_heteroatom_count 0) 45 | (A I unsaturation 0) 46 | (A I aromatic 0) 47 | (A I vinyl 0) 48 | (A I aryl 0) 49 | (A I single_bond 3) 50 | ) 51 | (6 Query_Atom 52 | (A I atomic_number 8) 53 | (A I ncon 1) 54 | (A I single_bond 1) 55 | ) 56 | ) 57 | -------------------------------------------------------------------------------- /queries/crown_2_2_cyclic.qry: -------------------------------------------------------------------------------- 1 | # RuleClass chelator 2 | # SubClass crown 3 | 4 | # Our rules for crowns are to reject if in a ring of size 8 or larger 5 | # Therefore it is important that the rejection be run before the demerit 6 | # for other environments 7 | 8 | (0 Query 9 | (A C Comment "crown_2_2_cyclic") 10 | (A I Version 2) 11 | (0 Query_Atom 12 | (A I atomic_number (7 8 16)) 13 | (A I min_ring_size 8) 14 | ) 15 | (1 Query_Atom 16 | (A I atomic_number 6) 17 | (A I ncon 2) 18 | (A I nbonds 2) 19 | (A I min_ring_size 8) 20 | (A I single_bond 0) 21 | ) 22 | (2 Query_Atom 23 | (A I atomic_number 6) 24 | (A I ncon 2) 25 | (A I nbonds 2) 26 | (A I min_ring_size 8) 27 | (A I single_bond 1) 28 | ) 29 | (3 Query_Atom 30 | (A I atomic_number (7 8 16)) 31 | (A I ncon 2) 32 | (A I nbonds 2) 33 | (A I min_ring_size 8) 34 | (A I single_bond 2) 35 | ) 36 | (4 Query_Atom 37 | (A I atomic_number 6) 38 | (A I ncon 2) 39 | (A I nbonds 2) 40 | (A I min_ring_size 8) 41 | (A I single_bond 3) 42 | ) 43 | (5 Query_Atom 44 | (A I atomic_number 6) 45 | (A I ncon 2) 46 | (A I nbonds 2) 47 | (A I min_ring_size 8) 48 | (A I single_bond 4) 49 | ) 50 | (6 Query_Atom 51 | (A I atomic_number (7 8 16)) 52 | (A I min_ring_size 8) 53 | (A I single_bond 5) 54 | ) 55 | ) 56 | -------------------------------------------------------------------------------- /charge_assigner/amidine.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "amidine") 4 | # clogD offset 5 | (A D numeric_value 1.55) 6 | (0 Query_Atom 7 | (A I atomic_number 7) 8 | (A I unsaturation 1) 9 | (A I aromatic 0) 10 | (A D numeric_value 1.1) 11 | ) 12 | (1 Query_Atom 13 | (A I atomic_number 6) 14 | (A I aromatic 0) 15 | (A I double_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 7) 19 | (A I unsaturation 0) 20 | (A I aromatic 0) 21 | (A I single_bond 1) 22 | ) 23 | 24 | # Don't match guanidines 25 | 26 | (6 Environment_No_Match 27 | (A I single_bond 1) 28 | (A C smarts "N") 29 | (A C smarts "C=O") 30 | ) 31 | 32 | (3 Environment_No_Match 33 | (A I single_bond (0 2)) 34 | (A C smarts "C#N") 35 | (A C smarts "O") 36 | (A C smarts "N") 37 | (A C smarts "N~O") 38 | (A C smarts "S=O") 39 | (A C smarts "C=O") 40 | (A C smarts "C=S") 41 | ) 42 | (4 Environment_No_Match 43 | (A I single_bond 0) 44 | (A C smarts "*~N~O") 45 | (A C smarts "*-S~O") 46 | 47 | # (6 Query_Atom 48 | # (A I min_unsaturation 1) 49 | # (A I aromatic 0) 50 | # ) 51 | ) 52 | (5 Environment_No_Match 53 | (A I single_bond 1) 54 | (A C smarts "a") 55 | (A I and 1) 56 | ) 57 | (6 Environment_No_Match 58 | (A I single_bond 2) 59 | (A C smarts "a") 60 | (A I and 1) 61 | ) 62 | ) 63 | -------------------------------------------------------------------------------- /queries/reverse_michael.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A I Version 2) 3 | (A C Comment "reverse_michael") 4 | (A I unique_embeddings_only 1) 5 | (0 Query_Atom 6 | (A I atomic_number 8) 7 | (A I ncon 1) 8 | (A I nbonds 2) 9 | ) 10 | (1 Query_Atom 11 | (A I nrings 0) 12 | (5 Query_Atom_Specifier 13 | (A I atomic_number 6) 14 | (A I aromatic 0) 15 | # (A I attached_heteroatom_count 2) 16 | ) 17 | (6 Query_Atom_Specifier 18 | (A I atomic_number 16) 19 | (A I aromatic 0) 20 | (A I unsaturation 2) 21 | (A I min_nbonds 5) 22 | # (A I attached_heteroatom_count 3) 23 | ) 24 | (A I double_bond 0) 25 | ) 26 | (2 Query_Atom 27 | (A I atomic_number 6) 28 | (A I unsaturation 0) 29 | (A I aromatic 0) 30 | (A I ring_id 1) 31 | (A I min_hcount 1) 32 | (A I single_bond 1) 33 | ) 34 | (3 Query_Atom 35 | (A I atomic_number 6) 36 | (A I unsaturation 0) 37 | (A I ring_id 2) 38 | (A I min_hcount 1) 39 | # (A I hcount 2) 40 | (A I aromatic 0) 41 | (A I single_bond 2) 42 | ) 43 | (4 Query_Atom 44 | (A I atomic_number 7) 45 | (A I ring_id 3) 46 | (A I attached_heteroatom_count 0) 47 | (A I unsaturation 0) 48 | (A I aromatic 0) 49 | (A I vinyl 0) 50 | (A I aryl 0) 51 | (A I single_bond 3) 52 | ) 53 | (6 Environment_no_Match 54 | (A C smarts "[OD1]") 55 | (A I single_bond 1) 56 | ) 57 | ) 58 | -------------------------------------------------------------------------------- /supporting_libraries/Makefile: -------------------------------------------------------------------------------- 1 | #CXX = icpc 2 | #CC = icc 3 | #CXXFLAGS = -O2 -I . -I ../include -Wall -ffast-math -DLINUX -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 4 | 5 | CXX = g++ 6 | CC = gcc 7 | 8 | # Some new gcc compilers need the std= directive 9 | 10 | CXXFLAGS = -O2 -I . -I ../include -Wall -ffast-math -DLINUX -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DIW_IMPLEMENTATIONS_EXPOSED 11 | # Auto check gcc version from Raj Guha 12 | GCCVERSIONGTEQ4 := $(shell expr `gcc -dumpversion | cut -f1,2 -d.` \>= 4.3) 13 | ifeq "$(GCCVERSIONGTEQ4)" "1" 14 | CXXFLAGS += -std=c++11 15 | endif 16 | 17 | 18 | AR = ar 19 | CP = cp 20 | RM = rm 21 | 22 | 23 | CFLAGS = -O2 -I . -I ../include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 24 | 25 | LIBRARY_OBJECTS = IWString_class.o cmdline.o iwstring_data_source.o string_data_source.o logical_expression.o msi_object.o new_int.o\ 26 | iwzlib.o iwgrep-2.5.o grep-2.5.regex.o iwstring_and_file_descriptor.o iwrandom.o mtrand.o iwwrite.o iwstring.o iwbits.o\ 27 | du_bin2ascii.o bits_in_common.o iwstrncasecmp.o int_comparator.o write_space_suppressed_string.o\ 28 | dash_f.o iw_stl_hash_map.o _extending_resizable_array_int.o iwwrite_block.o KahanSum.o 29 | 30 | all:libiwsupport.a 31 | 32 | libiwsupport.a: $(LIBRARY_OBJECTS) 33 | $(AR) cr $@ $(LIBRARY_OBJECTS) 34 | 35 | install: libiwsupport.a 36 | $(CP) $< ../lib 37 | 38 | clean: 39 | -$(RM) $(LIBRARY_OBJECTS) libiwsupport.a 40 | 41 | uninstall: 42 | -$(RM) ../lib/libiwsupport.a 43 | -------------------------------------------------------------------------------- /charge_assigner/imidazole_basic.qry: -------------------------------------------------------------------------------- 1 | (6 Query 2 | (A C Comment "imidazole_basic") 3 | (A I Version 2) 4 | (0 Query_Atom 5 | (A I atomic_number 7) 6 | (A I ncon 2) 7 | (A I hcount 0) 8 | (A I ring_size 5) 9 | (A I nrings 1) 10 | (A D numeric_value 1.1) 11 | ) 12 | (1 Query_Atom 13 | (A I atomic_number 6) 14 | (A I max_nrings 1) 15 | (A I single_bond 0) 16 | ) 17 | (2 Query_Atom 18 | (A I atomic_number 6) 19 | (A I max_nrings 1) 20 | (A I double_bond 1) 21 | ) 22 | (3 Query_Atom 23 | (A I atomic_number 7) 24 | (A I min_nrings 1) 25 | (A I single_bond 2) 26 | ) 27 | (4 Query_Atom 28 | (A I atomic_number 6) 29 | (A I max_nrings 1) 30 | (A I single_bond 3) 31 | (A I double_bond 0) 32 | ) 33 | (5 Environment_No_Match 34 | (A I single_bond (1 2 4)) 35 | 36 | (A C smarts "C#N") 37 | (A C smarts "C=C") 38 | (A C smarts "a") 39 | 40 | # Free acids will be charged, but not esters 41 | 42 | (A C smarts "C(=[O,S])-[D>1]") 43 | (A C smarts "S(=O)(=O)-[D>1]") 44 | 45 | (A C smarts "[NG>0]") 46 | 47 | (A C smarts "[F,Cl,Br,I]") 48 | (A C smarts "[#8,#16;D1]") 49 | ) 50 | 51 | # Jan 2005. Must have an electron donating group on the ring 52 | 53 | (7 Environment 54 | (A I single_bond (1 2 4)) 55 | (A C smarts "[ND1H2]") 56 | (A C smarts "[ND2H]-[CG0]") 57 | (A C smarts "[ND3](-[CG0])-[CG0]") 58 | (A C smarts "[OD2]-[CG0]") 59 | ) 60 | ) 61 | -------------------------------------------------------------------------------- /include/string_data_source.h: -------------------------------------------------------------------------------- 1 | #ifndef STRING_DATA_SOURCE_H 2 | #define STRING_DATA_SOURCE_H 3 | 4 | #include "iwstring.h" 5 | #include "iwcrex.h" 6 | 7 | /* 8 | We want to read data from a string rather than a file descriptor 9 | */ 10 | 11 | class String_Data_Source 12 | { 13 | private: 14 | const char * _src; 15 | 16 | int _iptr; 17 | 18 | int _lines_read; 19 | 20 | int _strip_trailing_blanks; 21 | 22 | int _dos; 23 | 24 | // private functions 25 | 26 | void _default_values(); 27 | 28 | public: 29 | String_Data_Source(const char *); 30 | String_Data_Source(const char *, int); 31 | 32 | template int next_record(T &); 33 | 34 | int lines_read() const { return _lines_read;} 35 | 36 | off_t tellg() const { return _iptr;} 37 | int seekg (off_t s); 38 | int records_remaining (int = 0); 39 | off_t file_size () const { return strlen(_src);} 40 | 41 | int push_record(); 42 | int record_buffered() const; 43 | 44 | int skip_records(); 45 | int skip_records (IW_Regular_Expression & rx, int nskip); 46 | 47 | void set_strip_trailing_blanks (int s) { _strip_trailing_blanks = s;} 48 | void set_dos (int s); 49 | 50 | int good () const; 51 | int ok () const; 52 | int eof () const { return '\0' == _src[_iptr];} 53 | int at_eof () const { return '\0' == _src[_iptr];} // backwards compatability 54 | 55 | int most_recent_record (IWString &) const; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /queries/crown_2_3_cyclic.qry: -------------------------------------------------------------------------------- 1 | # RuleClass chelator 2 | # SubClass crown 3 | 4 | # Crowns in large rings are rejected. Make sure this is run before 5 | # demeriting occurrences in other environments 6 | 7 | (0 Query 8 | (A C Comment "crown_2_3_cyclic") 9 | (A I Version 2) 10 | (0 Query_Atom 11 | (A I atomic_number (7 8 16)) 12 | (A I min_ring_size 8) 13 | ) 14 | (1 Query_Atom 15 | (A I atomic_number 6) 16 | (A I ncon 2) 17 | (A I nbonds 2) 18 | (A I min_ring_size 8) 19 | (A I single_bond 0) 20 | ) 21 | (2 Query_Atom 22 | (A I atomic_number 6) 23 | (A I ncon 2) 24 | (A I nbonds 2) 25 | (A I min_ring_size 8) 26 | (A I single_bond 1) 27 | ) 28 | (3 Query_Atom 29 | (A I atomic_number (7 8 16)) 30 | (A I ncon 2) 31 | (A I nbonds 2) 32 | (A I min_ring_size 8) 33 | (A I single_bond 2) 34 | ) 35 | (4 Query_Atom 36 | (A I atomic_number 6) 37 | (A I ncon 2) 38 | (A I nbonds 2) 39 | (A I min_ring_size 8) 40 | (A I single_bond 3) 41 | ) 42 | (5 Query_Atom 43 | (A I atomic_number 6) 44 | (A I ncon 2) 45 | (A I nbonds 2) 46 | (A I min_ring_size 8) 47 | (A I single_bond 4) 48 | ) 49 | (6 Query_Atom 50 | (A I atomic_number 6) 51 | (A I ncon 2) 52 | (A I nbonds 2) 53 | (A I min_ring_size 8) 54 | (A I single_bond 5) 55 | ) 56 | (7 Query_Atom 57 | (A I atomic_number (7 8 16)) 58 | (A I min_ring_size 8) 59 | (A I single_bond 6) 60 | ) 61 | ) 62 | -------------------------------------------------------------------------------- /queries/aniline_h_ewd.qry: -------------------------------------------------------------------------------- 1 | # RuleClass nitrogen 2 | # SubClass aniline 3 | 4 | (8 Query 5 | (A C Comment "aniline_h_ewd") 6 | (A I Version 2) 7 | (A I one_embedding_per_start_atom 1) 8 | (A I min_aromatic_ring_count 1) 9 | (A D numeric_value 10) 10 | (0 Query_Atom 11 | (A I atomic_number 7) 12 | (A I aromatic 0) 13 | (A I min_hcount 1) 14 | ) 15 | (1 Query_Atom 16 | (A I atomic_number 6) 17 | (A I ncon 3) 18 | (A I ring_size 6) 19 | (A I aromatic 1) 20 | (A I fused_system_size 1) 21 | (A I carbocycle 1) 22 | (A I single_bond 0) 23 | ) 24 | (2 Query_Atom 25 | (A I atomic_number 6) 26 | (A I aromatic_bond 1) 27 | ) 28 | (3 Query_Atom 29 | (A I atomic_number 6) 30 | (A I aromatic_bond 2) 31 | ) 32 | (4 Query_Atom 33 | (A I atomic_number 6) 34 | (A I aromatic_bond 3) 35 | ) 36 | (5 Query_Atom 37 | (A I atomic_number 6) 38 | (A I aromatic_bond 4) 39 | ) 40 | (6 Query_Atom 41 | (A I atomic_number 6) 42 | (A I aromatic_bond 5) 43 | (A I aromatic_bond 1) 44 | ) 45 | 46 | (0 Environment_no_Match 47 | (A I single_bond 0) 48 | (A C smarts "[C,S]=[O,S,N]") 49 | ) 50 | (0 Environment_no_Match 51 | (A I single_bond 0) 52 | (A C smarts "cn") 53 | ) 54 | 55 | # Ortho or para electron withdrawing group 56 | 57 | (1 Environment 58 | (A I single_bond (2 4)) 59 | (A C smarts "C#N") 60 | (A C smarts "N(=O)=O") 61 | (A C smarts "[F,Cl,Br,I]") 62 | (A C smarts "C=O") 63 | ) 64 | ) 65 | -------------------------------------------------------------------------------- /queries/sulfonyl_n_aromatic_edg.qry: -------------------------------------------------------------------------------- 1 | (0 Query 2 | (A C Comment "sulfonyl_n_aromatic_edg") 3 | (A C Comment "sulfonyl_n_aromatic_edg") 4 | (A I Version 2) 5 | (A D numeric_value 50) 6 | (A I min_aromatic_ring_count 1) 7 | (A I one_embedding_per_start_atom 1) 8 | 9 | # We need at least two connections to matched atoms to ensure that we have at least one 10 | # substituent off the ring. Also accomplished with the min_hits_needed directive in the environment 11 | 12 | (A I min_ncon 2) 13 | 14 | (0 Query_Atom 15 | (A I atomic_number 16) 16 | (A I ncon 4) 17 | (A I nbonds 6) 18 | ) 19 | (1 Query_Atom 20 | (A I atomic_number 8) 21 | (A I ncon 1) 22 | (A I double_bond 0) 23 | ) 24 | (2 Query_Atom 25 | (A I atomic_number 8) 26 | (A I ncon 1) 27 | (A I double_bond 0) 28 | ) 29 | (3 Query_Atom 30 | (A I atomic_number 7) 31 | (A I ncon 3) 32 | (A I nbonds 3) 33 | (A I formal_charge 0) 34 | (A I aromatic 1) 35 | (A I single_bond 0) 36 | ) 37 | (4 Query_Atom 38 | (A I aromatic 1) 39 | (A I ring_id 1) 40 | (A I aromatic_bond 3) 41 | ) 42 | (5 Query_Atom 43 | (A I aromatic 1) 44 | (A I ring_id 1) 45 | (A I aromatic_bond 4) 46 | ) 47 | (6 Query_Atom 48 | (A I aromatic 1) 49 | (A I ring_id 1) 50 | (A I aromatic_bond 5) 51 | ) 52 | (0 Environment 53 | (A C smarts "[CG0H>0]") 54 | (A C smarts "O") 55 | (A C smarts "[NG0]") 56 | (A I single_bond (4 5 6)) 57 | # (A I no_other_substituents_allowed 1) 58 | ) 59 | ) 60 | -------------------------------------------------------------------------------- /Molecule/numass.h: -------------------------------------------------------------------------------- 1 | #ifndef IW_NUMBER_ASSIGNER_H 2 | #define IW_NUMBER_ASSIGNER_H 3 | 4 | #include 5 | #include 6 | 7 | class Molecule; 8 | class Command_Line; 9 | 10 | class Number_Assigner 11 | { 12 | private: 13 | IWString _prefix_string; 14 | int _next_number_to_assign; 15 | 16 | // Some people don't want parentheses 17 | 18 | int _include_parentheses; 19 | 20 | // We can make fixed width names 21 | 22 | int _number_digits; 23 | 24 | // Optionally we can just replace the name with our unique form 25 | 26 | int _replace_name; 27 | 28 | // or we might want to replace just the first token of an existing name 29 | 30 | int _replace_first_token; 31 | 32 | // Aug 2014. We might want to merge with the name R(2)_existing_name 33 | 34 | IWString _separator_to_existing; 35 | 36 | // Often it is useful to create a cross reference file 37 | 38 | std::ofstream _cross_reference_file; 39 | 40 | int _only_apply_if_existing_name_is_empty; 41 | 42 | public: 43 | Number_Assigner (); 44 | 45 | int ok () const; 46 | int debug_print (std::ostream &) const; 47 | 48 | int initialise (Command_Line &, char = 'n', int = 0); 49 | int initialise (int); 50 | 51 | int active () const { return _next_number_to_assign >= 0;} 52 | 53 | void deactivate() { _next_number_to_assign = -5;} 54 | 55 | int process (Molecule &); 56 | 57 | int process (IWString &); 58 | }; 59 | 60 | int display_standard_number_assigner_options (std::ostream &, char = 'n'); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /Molecule/iwrcb.h: -------------------------------------------------------------------------------- 1 | #ifndef IW_RING_CLOSURE_BONDS_H 2 | #define IW_RING_CLOSURE_BONDS_H 3 | 4 | #include "bond.h" 5 | #include "iwaray.h" 6 | 7 | /* 8 | We need to keep track of whether or not given pairs of atoms are 9 | stored. Some trickery with the _present array does that if both 10 | atoms are hit just once. Otherwise, we store integers 11 | (a1 * _atoms_in_molecule + a2) in the resizable_array 12 | */ 13 | 14 | class Ring_Closure_Bonds : public resizable_array 15 | { 16 | private: 17 | int _atoms_in_molecule; 18 | 19 | int * _present; 20 | 21 | // private functions 22 | 23 | int _form_corresponding_integer (atom_number_t a1, atom_number_t a2) const; 24 | 25 | public: 26 | Ring_Closure_Bonds (); 27 | Ring_Closure_Bonds (const Ring_Closure_Bonds &); 28 | ~Ring_Closure_Bonds (); 29 | 30 | Ring_Closure_Bonds & operator= (const Ring_Closure_Bonds &); 31 | 32 | int ok () const; 33 | 34 | int write_bonds (std::ostream & output) const; 35 | 36 | int reset (); 37 | 38 | void invalidate (); 39 | 40 | int activate (int); 41 | 42 | int add (atom_number_t, atom_number_t); 43 | int contains (atom_number_t, atom_number_t) const; 44 | 45 | // I didn't call this operator== because it the order of the integers in the resizable_array may be different 46 | 47 | int is_the_same (const Ring_Closure_Bonds &) const; 48 | 49 | int report_differences (const Ring_Closure_Bonds &, std::ostream &) const; 50 | 51 | int is_subset_of (const Ring_Closure_Bonds &) const; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /queries/crown_3_3_cyclic.qry: -------------------------------------------------------------------------------- 1 | # RuleClass chelator 2 | # SubClass crown 3 | 4 | #Make sure this is run before crown33.qry demerit 5 | 6 | (0 Query 7 | (A C Comment "crown_3_3_cyclic") 8 | (A C Comment "crown_3_3_cyclic") 9 | (A I Version 2) 10 | (0 Query_Atom 11 | (A I atomic_number (7 8 16)) 12 | (A I min_ring_size 8) 13 | ) 14 | (1 Query_Atom 15 | (A I atomic_number 6) 16 | (A I ncon 2) 17 | (A I nbonds 2) 18 | (A I min_ring_size 8) 19 | (A I single_bond 0) 20 | ) 21 | (2 Query_Atom 22 | (A I atomic_number 6) 23 | (A I ncon 2) 24 | (A I nbonds 2) 25 | (A I min_ring_size 8) 26 | (A I single_bond 1) 27 | ) 28 | (3 Query_Atom 29 | (A I atomic_number 6) 30 | (A I ncon 2) 31 | (A I nbonds 2) 32 | (A I min_ring_size 8) 33 | (A I single_bond 2) 34 | ) 35 | (4 Query_Atom 36 | (A I atomic_number (7 8 16)) 37 | (A I ncon 2) 38 | (A I nbonds 2) 39 | (A I min_ring_size 8) 40 | (A I single_bond 3) 41 | ) 42 | (5 Query_Atom 43 | (A I atomic_number 6) 44 | (A I ncon 2) 45 | (A I nbonds 2) 46 | (A I min_ring_size 8) 47 | (A I single_bond 4) 48 | ) 49 | (6 Query_Atom 50 | (A I atomic_number 6) 51 | (A I ncon 2) 52 | (A I nbonds 2) 53 | (A I min_ring_size 8) 54 | (A I single_bond 5) 55 | ) 56 | (7 Query_Atom 57 | (A I atomic_number 6) 58 | (A I ncon 2) 59 | (A I nbonds 2) 60 | (A I min_ring_size 8) 61 | (A I single_bond 6) 62 | ) 63 | (8 Query_Atom 64 | (A I atomic_number (7 8 16)) 65 | (A I min_ring_size 8) 66 | (A I single_bond 7) 67 | ) 68 | ) 69 | -------------------------------------------------------------------------------- /Molecule/parse_smarts_tmp.h: -------------------------------------------------------------------------------- 1 | #ifndef PARSE_SMARTS_TMP_H 2 | #define PARSE_SMARTS_TMP_H 3 | 4 | /* 5 | When parsing a smarts, we need a lot of things passed around, 6 | so rather than having functions with way too many arguments 7 | we stick things into an object 8 | */ 9 | 10 | class Parse_Smarts_Tmp 11 | { 12 | private: 13 | int _last_query_atom_created; 14 | 15 | resizable_array _root; 16 | resizable_array _no_matched_atoms_between; 17 | resizable_array _link_atom; 18 | 19 | extending_resizable_array _completed; 20 | 21 | public: 22 | Parse_Smarts_Tmp (); 23 | ~Parse_Smarts_Tmp (); 24 | 25 | int set_natoms (int); 26 | 27 | #ifdef PARSE_SMARTS_TMP_MALLOC_CHECK 28 | int check_malloc_magic () const; 29 | #endif 30 | 31 | void add_root_atom (Substructure_Atom * r) { _root.add (r);} 32 | void add_no_matched_atoms_between (Bond * r) { _no_matched_atoms_between.add (r);} 33 | void add_link_atom (Link_Atom * r) { _link_atom.add (r);} 34 | 35 | extending_resizable_array & completed () { return _completed;} 36 | 37 | void set_last_query_atom_created (int s) { _last_query_atom_created = s;} 38 | int last_query_atom_created () const { return _last_query_atom_created;} 39 | 40 | const resizable_array & root_atoms () const { return _root;} 41 | const resizable_array & no_matched_atoms_between () const { return _no_matched_atoms_between;} 42 | const resizable_array & link_atoms () const { return _link_atom;} 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /queries/aniline_h_newd.qry: -------------------------------------------------------------------------------- 1 | # RuleClass nitrogen 2 | # SubClass aniline 3 | 4 | (8 Query 5 | (A C Comment "aniline_h_newd") 6 | (A I Version 2) 7 | (A I one_embedding_per_start_atom 1) 8 | (A I min_aromatic_ring_count 1) 9 | (A D numeric_value 50) 10 | (0 Query_Atom 11 | (A I atomic_number 7) 12 | (A I aromatic 0) 13 | (A I min_hcount 1) 14 | ) 15 | (1 Query_Atom 16 | (A I atomic_number 6) 17 | (A I ncon 3) 18 | (A I ring_size 6) 19 | (A I aromatic 1) 20 | (A I fused_system_size 1) 21 | (A I carbocycle 1) 22 | (A I single_bond 0) 23 | ) 24 | (2 Query_Atom 25 | (A I atomic_number 6) 26 | (A I aromatic_bond 1) 27 | ) 28 | (3 Query_Atom 29 | (A I atomic_number 6) 30 | (A I aromatic_bond 2) 31 | ) 32 | (4 Query_Atom 33 | (A I atomic_number 6) 34 | (A I aromatic_bond 3) 35 | ) 36 | (5 Query_Atom 37 | (A I atomic_number 6) 38 | (A I aromatic_bond 4) 39 | ) 40 | (6 Query_Atom 41 | (A I atomic_number 6) 42 | (A I aromatic_bond 5) 43 | (A I aromatic_bond 1) 44 | ) 45 | 46 | (0 Environment_no_Match 47 | (A I single_bond 0) 48 | (A C smarts "[C,S]=[O,S,N]") 49 | ) 50 | (0 Environment_no_Match 51 | (A I single_bond 0) 52 | (A C smarts "[C,S]=[O,S,N]") 53 | ) 54 | (0 Environment_no_Match 55 | (A I single_bond 0) 56 | (A C smarts "cn") 57 | ) 58 | 59 | # Cannot have ortho or para electron withdrawing group 60 | 61 | (1 Environment_no_Match 62 | (A I single_bond (2 4)) 63 | (A C smarts "C#N") 64 | (A C smarts "N(=O)=O") 65 | (A C smarts "[F,Cl,Br,I]") 66 | (A C smarts "C=O") 67 | ) 68 | ) 69 | -------------------------------------------------------------------------------- /Molecule/molecule_main.h: -------------------------------------------------------------------------------- 1 | #ifndef MOLECULE_MAIN_H 2 | #define MOLECULE_MAIN_H 3 | 4 | private: 5 | int _convert_set_of_atoms_to_bond_numbers (const Set_of_Atoms & s, int * barray) const; 6 | 7 | int _ok_ring_info () const; 8 | int _invalidate_ring_info (); 9 | int _invalidate_ring_aromaticity_info (); 10 | 11 | void _compute_element_count (int * element_count, int & highest_atomic_number, int & isotopes_present, int & non_periodic_table_elements_present) const; 12 | void _compute_element_count (int * element_count, const int * include_atom, int & highest_atomic_number, int & isotopes_present, int & non_periodic_table_elements_present) const; 13 | void _compute_element_count (int * element_count, const int * atom_flag, int flag, int & highest_atomic_number, int & isotopes_present, int & non_periodic_table_elements_present) const; 14 | 15 | int _remove_atom (atom_number_t); 16 | 17 | void remove_atom_from_charge_arrays (const atom_number_t atom_to_remove); 18 | 19 | int _invalidate_for_changed_isotope (); 20 | int _exact_mass (const int * element_count, int highest_atomic_number, 21 | int non_periodic_table_elements_present, 22 | exact_mass_t & result) const; 23 | 24 | int _set_bond_length (atom_number_t a1, atom_number_t a2, 25 | distance_t d, int * either_side); 26 | 27 | int _set_isotope_zero(atom_number_t zatom); 28 | 29 | int _all_connections_saturated (const atom_number_t zatom, const atom_number_t ignore) const; 30 | int _double_bond_needs_changing_for_graph_form (const Bond & b, const Mol2Graph & mol2graph) const; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /queries/cyclohexane.qry: -------------------------------------------------------------------------------- 1 | # RuleClass rings 2 | # SubClass cycloalkyl 3 | 4 | (7 Query 5 | (A C Comment "cyclohexane") 6 | (A I Version 2) 7 | (A I unique_embeddings_only 1) 8 | (A I one_embedding_per_start_atom 1) 9 | (A D numeric_value 40) 10 | (A I min_hits_needed 3) 11 | (A I embeddings_do_not_overlap 1) 12 | # We are interested in three or more cyclohexanes 13 | (A I subtract_from_rc 2) 14 | (0 Query_Atom 15 | (A I atomic_number 6) 16 | (A I min_ncon 3) 17 | (A I nrings 1) 18 | (A I unsaturation 0) 19 | (A I ring_size 6) 20 | (A I isolated_ring 1) 21 | ) 22 | (1 Query_Atom 23 | (A I atomic_number 6) 24 | (A I ncon 2) 25 | (A I nbonds 2) 26 | (A I nrings 1) 27 | (A I ring_size 6) 28 | (A I aromatic 0) 29 | (A I single_bond 0) 30 | ) 31 | (2 Query_Atom 32 | (A I atomic_number 6) 33 | (A I ncon 2) 34 | (A I nbonds 2) 35 | (A I nrings 1) 36 | (A I ring_size 6) 37 | (A I aromatic 0) 38 | (A I single_bond 1) 39 | ) 40 | (3 Query_Atom 41 | (A I atomic_number 6) 42 | (A I ncon 2) 43 | (A I nbonds 2) 44 | (A I nrings 1) 45 | (A I ring_size 6) 46 | (A I aromatic 0) 47 | (A I single_bond 2) 48 | ) 49 | (4 Query_Atom 50 | (A I atomic_number 6) 51 | (A I ncon 2) 52 | (A I nbonds 2) 53 | (A I nrings 1) 54 | (A I ring_size 6) 55 | (A I aromatic 0) 56 | (A I single_bond 3) 57 | ) 58 | (5 Query_Atom 59 | (A I atomic_number 6) 60 | (A I ncon 2) 61 | (A I nbonds 2) 62 | (A I nrings 1) 63 | (A I ring_size 6) 64 | (A I aromatic 0) 65 | (A I single_bond 4) 66 | (A I single_bond 0) 67 | ) 68 | ) 69 | --------------------------------------------------------------------------------