On 11 March 2010 11:07, Troels Kofoed Jacobsen <tkjacob...@gmail.com> wrote:
> Hi all
>
> I'm trying to design a calculator for use with ASE (Atomic Simulation
> Environment: https://wiki.fysik.dtu.dk/ase/) which uses openbabel to get
> energies using UFF and ghemical (for now). For this, I have a couple of
> questions.
>
> Is it possible to automatically add bonds. In our code, we do not
> represent bonds as we usually just perform DFT calculations. I know
> that avogadro/openbabel adds bonds automatically when reading an .xyz
> file with openbable, so this should be possible.

OBMol.ConnectTheDots() followed by OBMol.PerceiveBondOrders(). See API
at http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBMol.shtml

> When I set up the force field, I can get the energy with FF.Energy(). Is
> it possible to get the gradient with respect to nuclear/atomic
> coordinates. Something like this must be available for use in
> openbabels internal structure optimizers.

I will leave this to the others. Also I think you have a separate
email on this topic.

> And lastly: When doing an optimization, how do I get the new
> coordinates? My calculation is like:
>
> """
> import openbabel as ob
>
> FF = ob.OBForceField.FindForceField("UFF")
>
> mol = ob.OBMol()
> a = mol.NewAtom()
> a.SetAtomicNum(1)
> a.SetVector(0,0,0)
>
> b = mol.NewAtom()
> b.SetAtomicNum(1)
> b.SetVector(0,0,1)
> mol.AddBond(1, 2, 1)   # atoms indexed from 1
>
> FF.Setup(mol)
> print FF.Energy(), FF.GetUnit()
>
> FF.ConjugateGradients(1000)
> print FF.Energy(), FF.GetUnit()
>
> print FF.GetCoordinates(mol)
> """
> The last line just returns "True"

True means success. This is always good. If you check the coordinates
of the atoms, e.g. mol.GetAtom(1).GetVector() you will see new values.

>
> Thanks for your time reading this.

You've made my day. After a quick google, I see that you are a fellow
open source developer - who else can understand the effort required?
:-)

> Best regards
> Troels Kofoed Jacobsen
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to