Hi all,


I’m writing a Python script to screen a bunch of molecules, and for part of 
that I would like to read in and optimize a geometry using OpenBabel’s 
ForceField methods subjected to a couple constraints. I would like to obtain 
the resulting forces for each atom from the optimization to use as an initial 
cut off. Avagadro will print out force arrows during an optimization and I see 
in the API documentation that functions exist to obtain the forces, however, I 
keep getting an error when I try to implement this. For reference, I am using 
OpenBabel 2.4.1 installed through conda.



Using the openbabel module with

--

    conv = openbabel.OBConversion()

    conv.SetInAndOutFormats('xyz','xyz')



    mol = openbabel.OBMol()

    conv.ReadFile(mol,'my_molecule.xyz’)



    constraints = openbabel.OBFFConstraints()

    constraints.AddAtomConstraint(1)

    constraints.AddAtomConstraint(2)



    forcefield = openbabel.OBForceField.FindForceField("UFF")

    forcefield.Setup(mol, constraints)

    forcefield.SetConstraints(constraints)



    forcefield.ConjugateGradients(500)

    forcefield.GetCoordinates(mol)



    data = openbabel.toConformerData(mol.GetData(1))

    f = data.GetForces()



--



I get this error:

--

terminate called after throwing an instance of 'std::bad_alloc'

  what():  std::bad_alloc

Aborted

--



Can anyone shed any light on this and possibly point me in the right direction?



Thanks for your time,


Stephen


_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to