User 6ef33138f9
22-12-2005 20:34:24
Hello,
I have some code that changes a MolAtom from one atom to another (i.e. it changes the atomic number). I've noticed that calling setAtNo alone does not seem to be enough; in particular, the MolAtom seems to retain some information about its valency.
First let's look at the starting molecule, before changing any atoms. The following code will display something like "1 CH3--Pb (v1) 2". That's what I expect: the (v1) indicates the "unusual" valency of Pb in this (contrived) example.
Now let's add a few lines to change Pb to Cl. Note that the "(v1)" is still displayed next to the Cl, even though it has one bond as usual.
Is there something else I need to call to "reset" the MolAtom? I tried valenceCheck() and various other things to no avail.
Also, a related question: What are the exact rules for when "(v1)", "(v2)", etc. are displayed, versus some number of dots? For example, replacing [Pb:1] with [Tl:1] in the first example above will show the Tl atom with two dots (as placeholders for the missing hydrogens, I guess).
Thanks,
Chris
I have some code that changes a MolAtom from one atom to another (i.e. it changes the atomic number). I've noticed that calling setAtNo alone does not seem to be enough; in particular, the MolAtom seems to retain some information about its valency.
First let's look at the starting molecule, before changing any atoms. The following code will display something like "1 CH3--Pb (v1) 2". That's what I expect: the (v1) indicates the "unusual" valency of Pb in this (contrived) example.
Code: |
String smiles = "[CH3:1][Pb:2]"; Molecule mol = MolImporter.importMol(smiles.toString()); JFrame frame = new JFrame(); MViewPane pane = new MViewPane(); pane.setM(0, mol); frame.getContentPane().add(pane); frame.pack(); frame.setVisible(true); |
Now let's add a few lines to change Pb to Cl. Note that the "(v1)" is still displayed next to the Cl, even though it has one bond as usual.
Code: |
String smiles = "[CH3:1][Pb:2]"; Molecule mol = MolImporter.importMol(smiles.toString()); MolAtom atom = mol.getAtom(1); atom.setAtno(17); JFrame frame = new JFrame(); MViewPane pane = new MViewPane(); pane.setM(0, mol); frame.getContentPane().add(pane); frame.pack(); frame.setVisible(true); |
Is there something else I need to call to "reset" the MolAtom? I tried valenceCheck() and various other things to no avail.
Also, a related question: What are the exact rules for when "(v1)", "(v2)", etc. are displayed, versus some number of dots? For example, replacing [Pb:1] with [Tl:1] in the first example above will show the Tl atom with two dots (as placeholders for the missing hydrogens, I guess).
Thanks,
Chris