selectivity again

User 870ab5b546

30-07-2007 20:10:36

Now I'm trying to write a reaction that simply deprotonates the most acidic atom in a compound.





I figured out that I could write this selectivity rule that works most of the time:





Code:
-pKa(ratom(1), "acidic")






However, the reaction fails for a simple terminal alkyne, which your plugin doesn't recognize as acidic (something I've been bugging you about for a long time...). So, I'm now trying to modify the rule so that if there is a terminal alkyne, and there is no other atom with pKa < 25, it deprotonates the alkyne. I tried these:





Code:
(match(ratom(1), "[C:1]#[C]", 1) && pKa(reactant(0), "acidic", 1) > 25) || -pKa(ratom(1), "acidic")






but it then just returns all deprotonation products. If I change the || to ;, it goes back to the previous behavior. Any help?





-- Bob





P.S. Is there any reason why you couldn't make these rules resemble simple Java grammar more closely? Like,





Code:
MolAtom[] ratom1 = match(ratom(1), "[C:1]#[C]", 1);


MolAtom ratom2 = -largestpKa(reactant(0));


if (pKa(reactant(0), "acidic", 1) > 25 && ratom1 != null) ratom(1) = ratom1;


else ratom(1)[0] = ratom2;

ChemAxon e08c317633

06-08-2007 10:56:10

bobgr wrote:
Now I'm trying to write a reaction that simply deprotonates the most acidic atom in a compound.





I figured out that I could write this selectivity rule that works most of the time:





Code:
-pKa(ratom(1), "acidic")






However, the reaction fails for a simple terminal alkyne, which your plugin doesn't recognize as acidic (something I've been bugging you about for a long time...). So, I'm now trying to modify the rule so that if there is a terminal alkyne, and there is no other atom with pKa < 25, it deprotonates the alkyne. I tried these:





Code:
(match(ratom(1), "[C:1]#[C]", 1) && pKa(reactant(0), "acidic", 1) > 25) || -pKa(ratom(1), "acidic")






but it then just returns all deprotonation products. If I change the || to ;, it goes back to the previous behavior. Any help?





-- Bob
The rule you used is not a valid selectivity rule because it does not return a number: it is a "boolean && boolean || number" logical expression. (In fact technically it returns a number, because the evaluator engine returns "true" as "1.0" and "false" as "0.0".)





Please use a reactivity rule instead of selectivity, because it returns booleans, or use a selectivity rule something like this:


Code:
(match(ratom(1), "[C:1]#[C]", 1)) * 25



(this will return 25 if "match(...)" returns "true").





Note: returning "1.0"/"0.0" values as "true"/"false" may change in the future.
Quote:
P.S. Is there any reason why you couldn't make these rules resemble simple Java grammar more closely? Like,





Code:
MolAtom[] ratom1 = match(ratom(1), "[C:1]#[C]", 1);


MolAtom ratom2 = -largestpKa(reactant(0));


if (pKa(reactant(0), "acidic", 1) > 25 && ratom1 != null) ratom(1) = ratom1;


else ratom(1)[0] = ratom2;
Yes, there is a reason: for most of the chemists it is hard to design a Chemical Terms expression, so we want to keep the syntax of Chemical Terms as simple as we can.





Zsolt