When I calculate a formula from a MOL file, JChem automatically includes in the formula the implicit H atoms. Is there a method that will include in the formula only the explicit atoms in the MOL file?
Also, what's the difference between the molecular formula composition (getComposition()) and the molecular formula (getFormula())? The API for Class ElementalAnalyserPlugin uses these terms but doesn't define them. It should.
It does not matter for a molecule, whether a hydrogen is drawn as explicit or implicit, the hydrogen is there. Therefore I see not reason to leave out implicit hydrogens from the molcular formula (though you can easily implement a function for it using the API).
Why would you like to have this functionality?
I added a bit more detailed explanation to the composition method of the ElementalAnalysis class.
Oops, just recognized, that you mean the apidoc of the getComposition method of ElementalAnalysisPlugin class. You are right, it is too simple, we will make it more understandable. Thanks!
Well, I wouldn't have asked for it if we didn't need it!
We want students to draw structures in which all atoms are shown explicitly, and we don't want JChem adding implicit H atoms into the formula if the students haven't drawn them explicitly.
I understand now why you need this function, but I am afraid, that it is a quite special case. I think, that it would not take long for you to write this custom formula calculation function yourself using the API.
(You can even embed it into a custom plugin, which is integrated into the JChem system.)
We'll just write our own Java code that counts the number of H atoms in the MOL file and then modifies the JChem formula accordingly.