Count explicit Hydrogens and Lone Pairs

User 1abb86c231

30-08-2011 21:51:11

Hi MarvinSketch People,

 


I want to examine a MarvinSketch drawing using JChem Java methods and determine if the drawing has a chemically correct number of explicit Hydrogens drawn. For example, if this MRV is created with MarvinSketch configured as shown here: http://www.chemaxon.com/marvin/examples/applets/sketch/studentexam/index.html

 



 


<?xml version="1.0" ?>

 


<cml>

 



<MDocument>

 



  <MChemicalStruct>

 



     <molecule molID="m1">


       <atomArray


           atomID="a1 a2 a3"


           elementType="C H H" 


          x2="-27.334999084472656 -25.847473311987493 -26.246054641445372"






 


          y2="26.6612491607666 27.059830490224485 25.572304717739318"


 


/>


 


      <bondArray>

         <bond atomRefs2="a1 a2" order="1" />


         <bond atomRefs2="a1 a3" order="1" />


       </bondArray>


     </molecule>


   </MChemicalStruct>


 </MDocument>


 </cml>


 What JChem Java methods would I call to determine that the drawing is missing two explcit Hydrogens?


The same for Lone Pairs and Free Radicals. If an "incorrect" number are shown and they are not autocalculated, how do we use JChem to identify the error?


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


Let me know if that is not clear or you need more information.


Thanks,


Greg S


 








































ChemAxon d26931946c

31-08-2011 11:33:37

Hi Greg,


If you call MoleculeGraph.valenceCheck() on the molecule it will check if the atom is chemically correct and add implicit Hydrogens if they needed. It takes charge and radicals into account. You can check the implicit Hydrogen count with MolAtom.getImplicitHcount().


If the atom has no valence error and 0 implicit H-s then it has the correct number of explicit H-s. The display of the valence error and the implicit Hydrogens can be disabled.


In the exam program the student sets the lone pair count with the MolAtom.setElectronProp() function. The number of explicitly set lone pair can be read with the MolAtom.getElectronProp() method.


The calculated number of lone pairs can be read using MolAtom.getLonePairCount().


Best regards,


Peter