Quoting Miguel <[EMAIL PROTECTED]>: > Egon wrote: > > when doing the crystal stuff, I noticed that Atom's only > > have an 'int' field for charge... but atoms also often have > > 'partial atomic charges' which is an estimate of the electron > > density on that atom... but this is a float... > > can I add this? > > Yes, go ahead and change the charge in the ModelAdapter API to a float ... > I realize that you want/need it for CDK. > > However, I do have a little reluctance and I would like to understand > something. > > None of the file types that I have seen to date have fractional charges. > And that includes CML. I understood Peter to say that CML only defines > formalCharge ... an integer value. > > Why is this? Because there is no clear definition for partial atomic charges... if you check jmol/samples/cml/estron.cml you'll see that the partial charge is therefore in a <scalar> with a @dictRef to jmol:charge... I have yet to create the 'jmol' dictionary, but will do that next week... By using such a dictionary, we can explicitely state what kind of charge the 'jmol:charge' is... BTW, 'charge' is different from formal charge... and both can co-exist... So therefore I would like to add a partialCharge field instead of changing the formal charge field into a float... > > Including coloring by partial charge, with option in menu? > > This part will be a little more difficult to do. There are several issues > involved. > > The charge value defined by the ModelAdapter is an int. But by the time it > gets into the Jmol code, that int gets packed in with some other things > into a byte value called 'chargeAndFlags'. > > Since most models (particularly the large ones) don't have float charges I > would rather not add a float to the Jmol Atom data structure. --- > Actually, that is not a big deal ... you could add the float and I could > *optimize* it later. > > The other issue is this ... Jmol supports covalent radii. But that is all > based upon integer formal charges. We need to figure out what to use for a > covalent radius when presented with a fractional charge. Do you do a > linear interpolation between the two formal charge radii? The covalent radii is indeed depending on the formal charge, but we should not start adapting based on the partial charge... another reason to keep those separate fields.. > The color interpolation should be straightforward. There is currently a > table of RGB values in JmolConstants for looking up integer charge values > between -4 and +7 inclusive. CDK partial atom charge colors make the most negative charge red, and the most positive blue, neutral white, and everything else an interpolation between red and white, or blue and white... > I would do it in a few stages: > > Stage 1 - ModelAdapter changes > * go ahead and change the model adapter API to return a float > * change the smarter.Model.charge field to be a float > * to keep the Jmol code running, cast the float to be an int > in viewer.datamodel.FrameBuilder.java > * test everything and check it in Not relevant, as I would like to add a field... > Stage 2 - jmol.viewer.datamodel.Atom changes > * add a float charge field to the datamodel.atom data structure > * pass the float through the FrameBuilder and store it > * cast the float to an int in Atom.getAtomicCharge() > * test everything and check it in > > Stages 3-? - broader impact within Jmol > * introduce a new method which returns a float ... Atom.getCharge() > * find everyone who is calling the int getAtomicCharge() and > change them one-by-one > * I would test and check in after each caller was changed > * Finally, delete the existing getAtomicCharge() method > > > Not sure if I can do this tomorrow, as it is an official day off friday... > > Queen's Day... (birthday of queen mum). > > With all due respect ... didn't the Dutch queen mum pass away recently? Yes, she did... difficult story. Will explain some other time. Egon
------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ Jmol-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jmol-developers
