MarvinSketch Example - Molecular property calculations with Chemical Terms
Select a Chemical Terms expression from the list, enter one, or modify the molecule (delete some atoms or bonds, draw new ones), and watch how the calculated field changes.
<!-- Important! --> <body onUnLoad="document.MSketch=null" > <script type="text/javascript"> <!--function evaluateChemicalTerms(expression) { document.CTForm.Expression.value = expression; if(document.MSketch != null) { var result = document.MSketch.evaluateChemicalTerms(expression); if (document.MSketch.isChemicalTermsExpressionSyntaxError()) { document.CTForm.Result.style.color = '#F00'; document.CTForm.Result.value = "Syntax error."; } else { document.CTForm.Result.style.color = '#000'; document.CTForm.Result.value = result; } } else { alert("Cannot evaluate expression on molecule:\n"+ "no JavaScript to Java communication in your browser.\n"); } } function setResultMessage(message) { document.CTForm.Result.style.color = '#000'; document.CTForm.Result.value = message; } function propertyChange(prop) { if (prop.indexOf('mol=') !=-1) { evaluateChemicalTerms(document.CTForm.Expression.value); } } msketch_name = "MSketch"; msketch_mayscript = true; msketch_begin("../../..", 540, 480); msketch_param("mol", "../../../mols-2d/psilocybin.csmol"); msketch_param("listenpropertychange","true"); msketch_end();//--> </script> <p> <form NAME="CTForm"> <table BORDER=0> <tr> <td><a href="../../../help/chemicalterms/ChemicalTerms.html">Chemical Terms</a> expression:</td> <td ALIGN="right"> <select NAME="ExpressionSelector" onChange="setResultMessage('Calculating...')" onClick="evaluateChemicalTerms(this.value)"> <option VALUE=""> --- Select expression --- </option> <option VALUE="mass()">Molecular weight</option> <option VALUE="atomCount()">Atom count</option> <option VALUE="bondCount()">Bond count</option> <option VALUE="rotatableBondCount()">Rotatable bond count</option> <option VALUE="ringCount()">Ring count</option> <option VALUE="pKa('acidic', '1')">Strongest acidic pKa</option> <option VALUE="pKa('basic', '1')">Strongest basic pKa</option> <option VALUE="logP()">logP</option> <option VALUE="topologicalPolarSurfaceArea()">Polar surface area</option> <option VALUE="acceptorCount()">H bond acceptor count</option> <option VALUE="donorCount()">H bond donor count</option> <option VALUE="mostStableTautomer()">Most stable tautomer</option> <option VALUE="tautomers()">Tautomers</option> <option VALUE="name()">IUPAC name</option> <option VALUE="molString('smiles')">SMILES</option> <option VALUE= "(mass() <= 500) && (logP() <= 5) && (donorCount() <= 5) && (acceptorCount() <= 10)">Lipinski rule of 5</option> <option VALUE= "(mass() <= 300) && (logP() <= 3) && (donorCount() <= 3) && (acceptorCount() <= 3) && (rotatableBondCount() <= 3) && (topologicalPolarSurfaceArea() <= 60)">Rule of 3</option> </select> </td> </tr> <tr> <td COLSPAN=2><textarea NAME="Expression" ROWS=5 COLS=75 onKeyDown="setResultMessage('Calculating...')" onFocus="editing=true" onBlur="editing=false" onKeyUp="if (editing) { evaluateChemicalTerms(document.CTForm.Expression.value) }"></textarea></td> </tr> </table> <table> <tr> <td>Result:</td> </tr> <tr> <td><textarea NAME="Result" ROWS=5 COLS=75></textarea></td> </tr> </table> </form> </body>
In the next example more than one property calculation is performed each time the molecule is altered.
Do you have a question? Would you like to learn more? Please browse among the related topics on our support forum or search the website. If you want to suggest modifications or improvements to our documentation email our support directly!


