On 05/19/2011 04:32 PM, Geoffrey Hutchison wrote:
> On May 19, 2011, at 8:54 AM, Archambault Fabien wrote:
>
>>      None.None(Atom, numpy.ndarray)
>> did not match C++ signature:
>>      None(Avogadro::Atom {lvalue}, Eigen::Matrix<double, 3, 1, 2, 3, 1>)
> The problem seems to be that the conversion between numpy and the vector 
> library Eigen isn't working. I'm not sure if there's a good solution to that 
> directly.
>
> OTOH, you can always use mol.OBMol to get an OBMol, use the Open Babel or 
> Pybel libraries to change the coordinates, and then update the Avogadro 
> molecule.
>
> http://openbabel.org/docs/dev/UseTheLibrary/Python_PybelAPI.html
> http://openbabel.org/docs/dev/UseTheLibrary/PythonExamples.html
>
> I can't say I've used the Avogadro python integration much, but I'll see what 
> I can do with the Eigen bindings.
>
> Hope that helps,
> -Geoff

Hi again,

thanks for the tip about the openbabel but I was not yet able to use it 
correctly but I am now able to modify the position of the atoms as I 
need so I believe I will be soon able to rotate as I need (just a matter 
of matrices).

Here is the trick I was using array but in fact it is a ndarray from 
numpy. So:
 >>> import Avogadro as a
 >>> import numpy as np
 >>> mol = a.MoleculeFile.readMolecule('h2o.xyz')
 >>> zero = np.ndarray((3,), buffer=np.array([0.,0.,0.]), dtype=float)
 >>> for atom in  mol.atoms:
...     print atom.pos
...
[ 0.00369  2.73505  2.63908]
[-0.88715  2.29885  2.66616]
[-0.14964  3.67132  2.43027]
 >>> for atom in  mol.atoms:
...     atom.pos = zero
...
 >>> for atom in  mol.atoms:
...     print atom.pos
...
[ 0.  0.  0.]
[ 0.  0.  0.]
[ 0.  0.  0.]
 >>>

This was not that hard! I should have thought at those ndarrays...

Thanks for the help again!

Fabien

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Avogadro-Discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/avogadro-discuss

Reply via email to