Hi All,

 

In the context of developing a tutorial site I need to compare user generated (JSME) SMILES strings with the “correct” SMARTS strings without loading the structure into JSmol (the intention is that the user can subsequently opt to use JSmol to view the structure if they wish).  The powerful SMILES and SMARTS features of JSmol seemed ideal for this purpose, but I have run into some difficulties, as listed below. 

 

Searching an atom expression (when a structure is present in JSmol) for a SMARTS string works, e.g.

X  = Jmol.evaluate(myJSmol, '{*}.find("SMARTS","[#6]")');    //Works as expected

 

However, searching a string for a SMARTS string does not work, e.g.

X  = Jmol.evaluate(myJSmol, '"CCCC".find("SMARTS","[#6]")');    // X is ERROR

 

On the other hand, calculating a molecular formula from a SMARTS string (or an atom expression) does work, e.g.

X  = Jmol.evaluate(myJSmol, '"CCCC".find("SMARTS","MF")');  //X is C 4  Correct!!!

 

I would be very grateful if anyone can identify what I am doing wrong, or suggest an alternative approach.

 

Mike

 

Dr Mike Casey
School of Chemistry & Chemical Biology
University College Dublin
Dublin 4
Ireland