//copyright 2001 Robert M. Hanson, St. Olaf College, Northfield, MN 55057

//10:34 AM 03/19/2001

//group numbers set below 
imethyl=-1
iamino=-1
initro=-1
isulfonic=-1 
ialcoh=-1

//only one of these allowed
rootnames=";;;NH2:;NHMe:;NMe2::|aniline;"
rootnames+="NH3:;NH2Me:;NHMe2:;NMe3::|anilinium ion;"
rootnames+="NHC(=O)CH3::N-(#-|phenyl)acetamide;OC(=O)CH3::|phenyl acetate;C(=O)CH3::|acetophenone;"
rootnames+="CHO::|benzaldehyde;C(=O)Cl::|benzoyl chloride;CO2H::|benzoic acid;CO2Me::methyl |benzoate;"
rootnames+="CN::|benzonitrile;N2::|benzenediazonium ion;SO3H::|benzenesulfonic acid;"
//allow pure multiroots:
multirootnames=";;;NH2::#@benzene#-|amine;CHO::#@benzene#-|carbaldehyde;CO2H::#@benzene#-|carboxylic acid;"
multirootnames+="CN::#@benzene#-|carbonitrile;SO3H::#@benzene#-|sulfonic acid;"

//root if no other root only
ambinames=";;;OH::hydroxy/|phenol;OCH3::methoxy/|anisole;CH3::methyl/|toluene;"
//prefix if not ambiroot
groupnames=";;;Br::bromo;Cl::chloro;CH2CH3::ethyl;F::fluoro;OH::hydroxy;I::iodo;OCH3::methoxy;CH3::methyl;NO2::nitro;"
aminenames=";;;NMe3::N,N,N,;NMe2:;NHMe2::N,N,;NH2Me:;NHMe::N,;"

Group=new Array(["H|H",0,0,0,0]
//right|left,charge,o,m,p
//5th parameter will be an array of reagents
//+ is ACTIVATING
//o,p activating:  +++,0,+++
//o,p deactivating: --,---,-  (deactivates meta especially)
//m deactivating:  ---,-,--- (deactivates o/p especially)
,["__o,p strongly activating____"]
,["____amines"]
,["NH2|H2N",0,600,100,800]
,["NHMe|HN",0,60,10,80]
,["NMe2|Me2N",0,60,10,80]
,["____alcohols and ethers"]
,["OH|HO",0,60,10,80]
,["OCH3|CH3O",0,60,10,80]
//
,["__o,p moderately activating____"]
,["____N-acyl and O-acyl groups"]
,["NHC(=O)CH3|CH3C(=O)HN",0,35,0,40]
,["OC(=O)CH3|CH3C(=O)O",0,35,0,40]
//
,["__o,p weakly activating"]
,["____alkyl groups"]
,["CH3|CH3",0,15,0,20]
,["CH2CH3|CH3CH2",0,15,0,20]
//
,["__o,p weakly deactivating____"]
,["____halides"]
,["F|F",0,9,-3,11]
,["Cl|Cl",0,9,-3,11]
,["Br|Br",0,9,-3,11]
,["I|I",0,9,-3,11]
//
,["__meta moderately deactivating____"]
,["____carbonyl groups"]
,["CHO|HCO",0,-5,-1,-4]
,["C(=O)CH3|CH3C(=O)",0,-5,-1,-4]
//
,["____acids, esters, and acid chlorides"]
,["CO2H|HOC(=O)",0,-5,-1,-4]
,["CO2Me|MeOC(=O)",0,-5,-1,-4]
,["C(=O)Cl|ClC(=O)",0,-5,-1,-4]
//
,["__meta strongly deactivating____"]
,["____ammonium salts"]
,["NH3|H3N",1,-9,-1,-8]
,["NH2Me|MeH2N",1,-9,-1,-8]
,["NHMe2|Me2HN",1,-9,-1,-8]
,["NMe3|Me3N",1,-9,-1,-8]
//benzamides are out
//,["__amides"]
//,["NHAc|AcNH",0,0.12,-0.07,-0.28]
//,["N(Me)Ac|AcN(Me)",0,-0.16,0.05,-0.02]
//
,["____other N-containing groups"]
,["CN|NC",0,-9,-1,-8]
,["NO2|O2N",0,-9,-1,-8]
,["N2|N2",1,-9,0,-8]
//
,["____sulfonic acids"]
,["SO3H|HO3S",0,-9,-1,-8]
)


isulfonic=findsub(Group,"SO3H")
initro=findsub(Group,"NO2")
imethyl=findsub(Group,"CH3")
iamino=findsub(Group,"NH2")
ialcoh=findsub(Group,"OH")


Reagent=new Array("|xxxxxxx" 
//name[0]|from[2]-->to[3]
// s=required in SM (because there is no way to make it!)
// o= m= p= ortho/meta/para required in I as NO2 for SNAr (or'ed)
// x=exclusion list (incompatibilities)
//IN THAT ORDER
,"Br2/FeBr3|Br x=N2"
,"CH3Cl/AlCl3|CH3 x=OH,NH2,NHMe,METADEACTIVATORS"
,"CH3C(=O)Cl/AlCl3|C(=O)CH3 x=NH2,NHMe,METADEACTIVATORS"
,"CH3C(=O)Cl|NH2-->NHC(=O)CH3,OH-->OC(=O)CH3"
,"CH3I|OH-->OCH3,CO2H-->CO2Me x=NH2,NHMe,NMe2,SO3H"
,"Cl2/FeCl3|Cl x=N2"
,"CuBr|N2-->Br"
,"CuCl|N2-->Cl"
,"CuI or KI|N2-->I"
,"CuCN|N2-->CN" 
,"H2/Ni|CO2H-->CH3 x=NO2,SO3H,CN,C(=O)CH3"
,"H2O|N2-->OH"
,"H3PO2|N2-->H"
,"H2SO4|SO3H x=N2,NH2"
,"HBF4|N2-->F"
,"HNO3|NO2 x=N2,NH2,OH"
,"KMnO4 or Na2Cr2O7, H+|CH3-->CO2H x=N2,NH2,NHMe,OH"
,"(a) Mg (b) H2O|Br-->H,Cl-->H x=I,N2,CHO,C(=O)CH3,NO2,CN,CO2Me"
,"NaNH2|Br-->NH2 o=NO2 p=NO2 x=N2,SO3H,OH,NH2"
,"NaNO2,HCl (HNO2)|NH2-->N2 x=NHMe"
,"NaOCH3|F-->OCH3,Cl-->OCH3,Br-->OCH3 o=NO2 p=NO2 x=N2,SO3H,OH,NH2"
,"NaOH|NHC(=O)CH3-->NH2,OC(=O)CH3-->OH,NH3-->NH2"
,"(a) Sn, HCl (b) NaOH|NO2-->NH2"
,"Zn(Hg)/HCl|CHO-->CH3,C(=O)CH3-->CH2CH3 x=N2"
,"heat|SO3H-->H x=N2"
)

//arosyn
defaultreactant=3
Cmpd0=new Array("|xxxxxxxx"
,"aniline|NH2"
,"anisole|OCH3"
,"benzene|H"
,"benzoic acid|CO2H"
,"bromobenzene|Br"
,"p-ethylaniline|NH2,H,H,CH2CH3"
,"nitrobenzene|NO2"
,"phenol|OH"
,"toluene|CH3"
,"p-toluenesulfonic acid|CH3,H,H,SO3H"
)

//arosyn
defaultproduct=12
Cmpd1=new Array("|xxxxxxxx"
,"aniline|NH2"
,"anisole|OCH3"
,"benzene|H"
,"benzenesulfonic acid|SO3H"
,"benzoic acid|CO2H"
,"o-bromoaniline|NH2,Br"
,"m-bromoaniline|NH2,H,Br"
,"p-bromoaniline|NH2,H,H,Br"
,"o-bromoanisole|OCH3,Br"
,"m-bromoanisole|OCH3,H,Br"
,"p-bromoanisole|OCH3,H,H,Br"
,"bromobenzene|Br"
,"o-bromobenzenesulfonic acid|Br,SO3H"
,"m-bromobenzenesulfonic acid|Br,H,SO3H"
,"p-bromobenzenesulfonic acid|Br,H,H,SO3H"
,"2-bromo-1-ethyl-4-nitrobenzene|CH2CH3,Br,H,NO2"
,"o-bromonitrobenzene|NO2,Br"
,"m-bromonitrobenzene|NO2,H,Br"
,"p-bromonitrobenzene|NO2,H,H,Br"
,"o-chlorobenzoic acid|Cl,CO2H"
,"m-chlorobenzoic acid|Cl,H,CO2H"
,"p-chlorobenzoic acid|Cl,H,H,CO2H"
,"p-chloroethylbenzene|Cl,H,H,CH2CH3"
,"o-dibromobenzene|Br,Br"
,"m-dibromobenzene|Br,H,Br"
,"p-dibromobenzene|Br,H,H,Br"
,"p-ethylbenzenesulfonic acid|CH2CH3,H,H,SO3H"
,"m-nitroacetophenone|NO2,H,C(=O)CH3"
,"p-nitroaniline|NH2,H,H,NO2"
,"o-nitroanisole|OCH3,NO2"
,"m-nitroanisole|OCH3,H,NO2"
,"p-nitroanisole|OCH3,H,H,NO2"
,"p-nitrotoluene|CH3,H,H,NO2"
,"toluene|CH3"
,"p-toluenesulfonic acid|CH3,H,H,SO3H"
)

cmpd2keepset="-"
//arosel and aroname
Cmpd2=new Array("          |"
// "|-" here indicates not to be used by arosel
,"aniline|NH2"
,"anisole|OCH3"
,"benzenesulfonic acid|SO3H"
,"benzoic acid|CO2H"
,"benzonitrile|CN"
,"bromobenzene|Br"
,"o-bromoanisole|OCH3,Br"
,"1-bromo-4-chloro-2-nitrobenzene|-Br,NO2,H,Cl"
,"2-bromo-1-chloro-4-nitrobenzene|-Cl,Br,H,NO2"
,"2-bromo-4-chloro-1-nitrobenzene|-NO2,Br,H,Cl"
,"4-bromo-2-chloro-1-nitrobenzene|-NO2,Cl,H,Br"
,"3-bromo-4-chlorophenol|-OH,H,Br,Cl"
,"4-bromo-3-chlorophenol|-OH,H,Cl,Br"
,"o-bromonitrobenzene|NO2,Br"
,"m-bromonitrobenzene|-NO2,H,Br"
,"p-bromonitrobenzene|NO2,H,H,Br"
,"4-bromo-3-nitrotoluene|-CH3,H,NO2,Br"
,"5-bromo-2-nitrotoluene|CH3,NO2,H,H,Br"
,"chlorobenzene|Cl"
,"o-chlorotoluene|-Cl,CH3"
,"m-chlorotoluene|-Cl,H,CH3"
,"p-chlorotoluene|-Cl,H,H,CH3"
,"m-chloroiodobenzene|-Cl,I"
,"o-cresol|CH3,OH"
,"m-cresol|CH3,H,OH"
,"p-cresol|CH3,H,H,OH"
,"m-dibromobenzene|-Br,H,Br"
,"2-iodo-4-methylaniline|NH2,I,H,CH3"
,"4-iodo-2-methylaniline|NH2,CH3,H,I"
,"p-nitroaniline|NH2,H,H,NO2"
,"nitrobenzene|NO2"
,"phenol|OH"
,"toluene|CH3"
,"p-toluenesulfonic acid|CH3,H,H,SO3H"
,"o-toluidine|CH3,NH2"
,"m-toluidine|CH3,H,NH2"
,"p-toluidine|CH3,H,H,NH2"
,"o-xylene|CH3,CH3"
,"m-xylene|CH3,H,CH3"
,"p-xylene|CH3,H,H,CH3"
)

