> 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. 

You definitely want to use Open Babel 3.0, e.g.

        success = ff.Setup(mol.OBMol)
        if not success:
            ff = pybel._forcefields["uff"]
            success = ff.Setup(mol.OBMol)
            if not success:
                sys.exit("Cannot set up forcefield")

        ff.ConjugateGradients(100, 1.0e-3)

        ff.GetCoordinates(mol.OBMol)
        gradients = ff.GetGradientPtr()
        print(type(gradients))

        for atom in mol.atoms:
            grad = ff.GetGradient(atom.OBAtom)
            print(grad.GetX(), grad.GetY(), grad.GetZ())

Hope that helps,
-Geoff
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to