User 870ab5b546
28-04-2006 17:33:20
Consider this MRV file representing CH3CO2Et:
Code: |
<?xml version="1.0" ?>
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<atomArray
atomID="a1 a2 a3 a4 a5"
elementType="C C O O R"
sgroupRef="0 0 0 0 sg1"
x2="-6.066666603088379 -4.732987481260343 -4.732987481260343 -3.3993083594323075 -2.0656292376042718"
y2="0.11666666716337204 0.886666667163372 2.426666667163372 0.11666666716337193 0.8866666671633722"
/>
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
<bond atomRefs2="a2 a4" order="1" />
<bond atomRefs2="a4 a5" order="1" />
<bond atomRefs2="a2 a3" order="2" />
</bondArray>
<molecule id="sg1" role="SuperatomSgroup" title="Et" molID="m2">
<atomArray
atomID="a6 a7"
elementType="C C"
attachmentPoint="1 0"
x2="0.6183332777023316 -0.9216667222976684"
y2="0.699999988079071 0.699999988079071"
/>
<bondArray>
<bond atomRefs2="a7 a6" order="1" />
</bondArray>
</molecule>
</molecule>
</MChemicalStruct>
</MDocument>
|
Why are the coordinates of the shortcut group R, (-2.06, 0.89), different from the coordinates of R's attachment point, a6, (0.62, 0.70)? If I expand the shortcut group, the coordinates of a6 correctly change to (-2.06, 0.89). Is there any purpose at all to the coordinates given to the atoms hidden inside the shortcut group?
User 870ab5b546
28-04-2006 17:39:38
P.S. Does getX() operating on an SgroupAtom give the coordinates of the Sgroup as listed in the first set of coordinates, or does it give the coordinates of the attachment point as listed in the second set of coordinates?
User 953c0d67b0
18-05-2006 12:38:49
I am EXTREMELY interested in the answer to this question!!! Here's
another way to put it:
In the <ATOM ARRAY>, the coordinates for the SG are:
x=-2.0656292376042718
y=0.8866666671633722
Yet when this MolAtom (also an instanceof SgroupAtom) is imported into
a Molecule:
Molecule m = << this Molecule imported >>
MolAtom a = <<<this SG atom from m >>>
a.getLocation().x = 0.6183332777023316
a.getLocation().y = 0.699999988079071
a.getSymbol() = "SG"
I also tried getVisibleCoordinates:
double vc[] = m.getVisibleCoordinates(a);
vc[0] = 0.6183332777023316
vc[1] = 0.699999988079071
(same results as getLocation())
What JChem methods of class MolAtom/SgroupAtom/etc?? can be used to
obtain the coordinates in the original ATOM ARRAY?
x=-2.0656292376042718
y=0.8866666671633722
Thanks,
Kevin
ChemAxon 7c2d26e5cf
19-05-2006 17:09:40
Sorry for the delay. For some reason we didn't notice your post in time.
Now, I have posted your question to the right person.
User 953c0d67b0
19-05-2006 17:36:25
Important Note:
Molecule m, in the example above, has CONTRACTED SGROUPS:
m.contractSgroups(); // before looking at atoms
Thanks,
Kevin
ChemAxon a3d59b832c
19-05-2006 21:49:43
Bob, Kevin,
Sorry for the delay. Our colleague who works on this type of S-groups is not available, and it seems that he will not be for some time. So I try to dive into this question....
...After some experiments I think the solution for you is to use
Code: |
m.setGUIContracted(true); |
instead of contractSgroups().
The explanation for this may not be complete from me, but it is something to do with the GUI or back-end usage of S-groups.
For GUI usage (inside Marvin), the main concern is the look of the molecule, so coordinates always must have a sensible meaning, even on the expense of moving some of the groups around during expansion/contraction.
For back-end usage, for example structure searching or calculations, however, it is usually more important to- Handle the whole molecule (S-groups expanded), and also
- Keep original coordinates as were defined in the file in case they need to be exported unchanged again.
This latter (importing in a back-end program) leaves the molecule in a funny state called "not GUI contracted". In this state the S-groups are expanded, but all coordinates keep their original values. I guess contraction is not safe for this state apart from the above method. (On safe I mean coordinates keeping/getting sensible values.)
I hope this helps.
Best regards,
Szabolcs
User 953c0d67b0
23-05-2006 04:41:26
YES, this worked!!
By using setGUIContracted(true) instead of contractSgroups(),
the coordinates of the SG atom (atom.getLocation()) gets the coordinates
of the SG atom from the main ATOMARRAY.
Thanks very much!
Kevin
User 870ab5b546
11-10-2006 15:59:37
Here's interesting behavior: If a setGUIcontracted(true) on two molecules, then do a MolSearch with one as the target and the other as the query, and there is a match, I get an array of integers that includes the atom numbers of not just the Sgroup atoms, but also the atoms within each Sgroup. So, if I then do getAtomArray() on both the target and the query, and compare a property of each target atom to a property of each query atom for each element of the search array, I get an ArrayOutOfBoundsException. The problem is fixed by a try statement, but I thought someone might want to know. Seems to me if you go to the trouble of setGUIcontracted(true), then the search array should not include the atoms in the Sgroups.
ChemAxon a3d59b832c
12-10-2006 08:14:15
MolSearch always uses the expanded state of S-groups to grab the real chemical meaning of the molecule. So accordingly, if you want to correctly use the results, your molecule has to be expanded as well. I am sorry that this information was not present in the documentation, I will amend that.