Hey,
I have a question regarding the valency property of Atom.
Consider this example in which methyl radical is constructed with a
SingleElectron at the carbon position. Then a hydrogen is added, bonded to
the carbon, the SingleElectron is removed, making the methylradical a
methane molecule. The carbon of the former methyl radical returns 3 as its
valency, which is correct imo. However, the valency of the carbon in methane
also returns 3, which should be 4.
Should I run some other method that updates the valency property of all
atoms, is this just a bug, or am I overlooking something about the intrinsic
meaning of valency?
The code I ran:
Molecule mol = new Molecule();
mol.addAtom(new Atom("C"));//0
mol.addAtom(new Atom("H"));//1
mol.addAtom(new Atom("H"));//2
mol.addAtom(new Atom("H"));//3
mol.addBond(0, 1, IBond.Order.SINGLE);//1
mol.addBond(0, 2, IBond.Order.SINGLE);//2
mol.addBond(0, 3, IBond.Order.SINGLE);//3
mol.addSingleElectron(0);
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
System.out.println("Valency of carbon in methylradical:
"+mol.getAtom(0).getValency());//returns 3
mol.addAtom(new Atom("H"));//4
mol.addBond(0, 4, IBond.Order.SINGLE);
mol.removeSingleElectron(0);
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
System.out.println("Valency of carbon in methane:
"+mol.getAtom(0).getValency());//returns 3!
Thanks in advance,
Nick VANDEWIELE
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user