Hi,
I encounter unexpected behaviour of Avogadro when working on an
extension plugin. I observe an inconsistency in how Avogadro
handles atomic coordinates depending on the origin of the data.
This is what I do in my plugin:
================================
-
"Download step: I copy the atomic positions from Avogadro to the plugin.
(By first creating an instance OpenBabel::OBMol from an
Avogadro::Molecule, and then using the access functions of
OpenBabel::OBMol and OpenBabel::OBAtom.) -
In the plugin, I modify the coordinates of the atoms (MD, minimisation)
-
Upload step:
I copy back the -modified- coordinates of the molecule into Avogadro.
(By using the Avogadro::Molecule access function setAtomPos:avMol->setAtomPos( i, vec3d );
where i runs over all atoms, and vec3d is an instance of
Eigen::Vector3d containing the modified coordinates of atom i.
When the coordinates are copied over, I do a avmol->update().
=================================
TO check if things are working as expected I output the atomic
coordinates in the plugin to the screen, where I compare them to the
coordinates as displayed in the build->Cartesian Editor. It turns out
that the download step always copies the coordinates correctly from the
Avogadro host to the plugin. The upload step, howver, fails in certain
situations.
Here is my problem: depending on how I have created the molecule (in
Avogadro, the procudure above succeeds or fails.
-
When I have obtained the molecule in Avogadro by loading it from a
file (in my case, a Sybyl mol2 file) there is no problem.
the coordinates in the plugin are always identical to the ones in
Avogadro via the above mechanism. -
When I create a molecule interactively, the above procedure shows in
the upload step large differences.
There is a subtlety here which may point to the a clue:If I create ethane (C2H6) by first making CH4 and the augmenting to
form C2H6, the upload step goes wrong.
However, If I create C2H6 in one go by pressing the mouse down, drag
the mouse and then release the mouse, the upload step is ok again.
Is there someone who can explain me what cold be going on here? Is there
a difference (in Avogadro) between a molecule that is created
interactively and one that is loaded from file?
Kind Regards,
Bertwim