All,

I am having trouble with forcefield constraints in OpenBabel regardless of the 
potential selected or size of the factor the angle always converges to an 
unconstrained minima. See the minimal example with carbon dioxide below:

from openbabel import openbabel

obConversion = openbabel.OBConversion()
obConversion.SetInFormat("smi")
mol = openbabel.OBMol()

obConversion.ReadString(mol, "C(=O)=O")

builder = openbabel.OBBuilder()
builder.Build(mol)

constraints = openbabel.OBFFConstraints()
constraints.AddAngleConstraint(2,1,3,float(178.0))
constraints.SetFactor(1e10)

ff = openbabel.OBForceField.FindForceField("gaff")
ff.Setup(mol, constraints)

ff.ConjugateGradients(10000, 1.0e-6)
ff.GetCoordinates(mol)

print(mol.GetAngle(mol.GetAtom(2),mol.GetAtom(1),mol.GetAtom(3)))

This always converges to:

$ python angle_demo.py
179.9743765482302

Any help would be appreciated. I am running Open Babel 3.1.0

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

Reply via email to