--=-etb16AVkC/wSBTvBCpFs Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Le mar 29/06/2004 =C3=A0 12:51, Tommi Hassinen a =C3=A9crit : > On Tue, 29 Jun 2004, Jean Br=C3=A9fort wrote: >=20 > > Hi, > > > > I am currently implementing the export of a molecule from GChemPaint to > > Ghemical (using a temporary gpr file written with OpenBabel). I would > > like that the molecule appears centered in Ghemical's view but I don't >=20 > Hello, >=20 > the molecule should appear centered when the sum (or average) of all x, y > and z coordinates are zero. You can do this by calculating first averages > of x, y and z coordinates and then translating like this: >=20 > new_x =3D old_x - average_x; > new_y =3D old_y - average_y; > new_z =3D old_z - average_z; >=20 > > understand the coordinate system used in Ghemical. I can easily > > translate the molecule but the question is where? >=20 > The graphics code work so that actually the atom coordinates are always > the same, but instead the "camera" coordinates are changed. That is more > complicated but perhaps you can look at camera.cpp and tools.cpp to see > how the translations/rotations work in the mouse tools. >=20 > But averaging the coordinates should do the centering trick. >=20 Thanks, it works. I must now try to transfer as far as possible the stereochemistry (not so simple). At the moment, when I transfer a molecule such as cholesterol with all z coordinates set at 0., I cannot optimize the geometry (nan values everywhere). More simple molecules work. Have a nice summer. Regards, Jean --=-etb16AVkC/wSBTvBCpFs Content-Type: application/pgp-signature; name=signature.asc Content-Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?= -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQBA4WQfUkVLHK5zOkcRAlAZAJ94lCrEM5D/eUfyyYWLMuU5+nYxYwCgoN2O P7BPq/9zDC3D8OMBCwZIWOw= =ueDq -----END PGP SIGNATURE----- --=-etb16AVkC/wSBTvBCpFs--