Get the atom xyz file coordinates
-
Hello,
When a xyz is imported, are the coordinates of the atoms saved somewhere? I don't find the proper element in SBAtom, getX is not the one...
Thanks
Laëtitia
-
Dear @Laëtitia ,
Yes, they are saved as well as other properties of an atom and you can access them as follows (see e.g. documentation on SBMStructuralModelNodeParticle class - a parent class to the SBAtom class):
SBAtom* atom = new SBAtom(element, SBQuantity::angstrom(x), SBQuantity::angstrom(y), SBQuantity::angstrom(z)); SBQuantity::length x = atom->getX(); SBPosition3 pos = atom->getPosition();
-
Tnaks for your answer.
I indeed used the getX, getY, getZ functions but somehow I have completly different value that in my xyz. I'll dig in ASAP.
-
If they differ by some order of magnitude, then it might be due to use of different quantities. e.g.
SBQuantity::length
(which isSBQuantity::picometer
) orSBQuantity::angstrom
. -
oh you're right there is a 100 coefficient, it's giving me the coordinate in pm. Didn't think about that.
thank you very much.