setElectronProp()

User 870ab5b546

02-09-2008 14:36:59

Marvin 5.1 has a new MolAtom method, setElectronProp():





Code:
setElectronProp





public void setElectronProp(int eProp)


     Sets the number of lone pairs or radical state.


Parameters:


     eProp - the number of lone pairs or radical state to set.


See Also:


     ExtraAtomProperties.LP_NOT_SET, ExtraAtomProperties.RD_NOT_SET, ExtraAtomProperties.UNDEFINED






How does one designate whether setElectronProp() sets the number of lone pairs or the radical state? Or do you mean "and", and, if the value of eProp is odd, the radical state is set to monovalent, and if it is even, the radical state is set to off?





Also, the API also needs a MolAtom method for automatically setting the lone pair count to a number calculated by Marvin, and a Molecule method that does it for all atoms in the Molecule. Currently, the programmer has to calculate the lone pair count himself and set it for every individual atom. I know there’s already a method in Marvin for doing the calculation, because one can automatically display lone pairs in Marvin, but it doesn’t appear to be accessible from the API.

ChemAxon e500b51457

03-09-2008 14:00:09

Dear Bob,





setElectronProp()/getElectronProp() sets and gets some electron related information stored as extra atom property in MolAtom.





The meaning of possible values:


ExtraAtomProperties.RD_NOT_SET is used when radicals are not set to an exact value (that’s why it is a state and not count). For example in editing steps after choosing “Switch Radical” button there is a special atom in your hand where no exact radical value is set, the molecule joining step has to solve the problem and sets the number of radicals depending on the context.





ExtraAtomProperties.LP_NOT_SET is similar to ExtraAtomProperties.RD_NOT_SET for the special atom that is in your hand after pressing “Increase Lone Pairs” button: no exact lone pair value is set.





These values are related to a very special usage in Marvin during editing. What you probably need is setting the electron properties to a value between 0 and 4. This has the meaning that the atom has this number of lone pairs. For example: after calling setElectronProperty(3), 3 lone pairs will belong to the atom. We will add the missing information to the API documentation.


The number of radicals can be set / get with the MolAtom.setRadical() / getRadical() methods.





MoleculeGraph.getLonePairCount(int i) is already available for getting the automatically calculated lone pair count of an atom (this is called when Marvin displays the automatically calculated lone pairs). Then the calculated lone pair value can be stored in MolAtom by MolAtom.setElectronProperty().





I hope this helps, let me know if you need more information.





Best Regards,


Erika.

User 870ab5b546

03-09-2008 17:12:14

It helps a great deal. I wasn't looking in MoleculeGraph() for the method that calculates the number of unshared electrons on an atom. May I suggest you add a method to MolAtom() that calls the MoleculeGraph() method? It can throw an error or return a negative value if the MolAtom is not part of a MoleculeGraph.





Again, I suggest you consider merging lone pairs and radicals into a single value, unshared electrons, in future versions of Marvin. You can retain the radical flag, but it would be mutually interdependent with the number of unshared electrons.

ChemAxon e500b51457

05-09-2008 12:31:29

Dear Bob,





Thank you for your suggestions. Handling lone pairs and radicals in a single value is not possible at the moment, because the recent implementation was an extension of the already existing radical /lone pair representation. We will consider your request before refactoring some parts of the code.





Would you like a method that returns the same value as MoleculeGraph().getLonePairCount(int i) or the number of unshared electrons (lone pairs + radicals)?





Best Regards,


Erika.

User 870ab5b546

05-09-2008 12:38:07

I think it is best to be consistent, so have MolAtom.getLonePairCount(). I can always compute the number of unshared electrons from the lone pair count and the radical state.

ChemAxon e500b51457

08-09-2008 10:04:19

Dear Bob,





Thank you for your suggestion. We will add this method.


We will notify you as soon as the implementation is out.





Best regards,


Erika.

ChemAxon e500b51457

12-01-2009 09:58:13

Dear Bob,


The new MolAtom.getLonePairCount() method is going to be ready in Marvin 5.1.5.


Best regards,


Erika.