You forgot to cast it:

dp = toVectorData(mol.GetData('Dipole Moment'))
result = dp.GetData() # vector3 object
print result.GetX(), result.GetY(), result.GetZ()

- Noel

On 15 July 2011 12:28, kzfm ohkw <kerol...@gmail.com> wrote:
> Hi,
>
> I'm writing a gamess wrapper for python using openbabel, and
> I have a problem for getting a Dipole Moment.
>
> code snipet is bellow, my gamess output is
> http://www.kzfmix.com/pub/dimethylamine.out
>
> and my openbabel version is 2.3 (Mac OS 10.5, python2.7.1)
>
> ------------------------------------------------
> import openbabel as ob
> obc = ob.OBConversion()
> obc.SetInFormat("gamout")
>
> mol = ob.OBMol()
> obc.ReadFile(mol, "dimethylamine.out")
>
> dp = mol.GetData('Dipole Moment')
>
> print dp.GetAttribute(), dp.GetValue()
> -------------------------------------------------
>
> >From API doc, OBVectorData has a GetData method, but
> dp object seems not have such method.
>
> anything wrong?
>
> Help will be really appreciate. Thank you.
>
> kzfm
>
> ---
> pygamess: https://github.com/kzfm/pygamess
>
> ------------------------------------------------------------------------------
> AppSumo Presents a FREE Video for the SourceForge Community by Eric
> Ries, the creator of the Lean Startup Methodology on "Lean Startup
> Secrets Revealed." This video shows you how to validate your ideas,
> optimize your ideas and identify your business strategy.
> http://p.sf.net/sfu/appsumosfdev2dev
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>

------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to