Computing force fields using Open Babel I am trying to use Open Babel (OB) to compute universal force field (UFF) given an xyz file. I read each xyz file and turn it into a pybel molecule. Here is the code I have so far

def xyz_to_smiles(fname: str) -&gt; str:
    mol = next(pybel.readfile("xyz", fname))
    smi = mol.write(format="smi")

    return smi.split()[0].strip(), mol

def get_qm9_OB(target_index=np.arange(0, 133884)):

    smiles = []
    molecule = []
    for i in target_index:
        mol_idx = f"{i+1:06d}"

        tmp_smiles, tmp_molecule = xyz_to_smiles('../dsgdb9nsd.xyz/dsgdb9nsd_' + mol_idx + '.xyz')

        smiles.append(tmp_smiles)
        molecule.append(tmp_molecule)

    return molecule, smiles

molecules, smiles = get_qm9_OB(target_index=np.arange(100,200))

for i in range(len(smiles)):
    mol = molecules[i].OBMol

    ff = ob.OBForceField.FindForceField('UFF')
    ff.Setup(mol)

    ff.GetAtomTypes(mol)
    ff.GetCoordinates(mol)
    for at in ob.OBMolAtomIter(mol):
        type = at.GetData("FFAtomType") # an OBPairData object
        print(type.GetValue())


Now, I am trying to compute bond stretching interactions. My questions are:


How can I get the UFF constants for bond stretching? (IOW, is there an OB equivalent for RDKit function GetUFFBondStretchParams?)
Is there a function to calculate bond stretching interactions for each bond? (IOW, is there an OB implementation of either harmonic oscillator or the Morse function?)
How can I get coordinates from OBAtom object? I found GetCoordinate() but the output is 

&lt;Swig Object of type 'double *' at 0x1a1eb4a9f0&gt;


Alternatively, GetVector() outputs 

&lt;openbabel.vector3; proxy of &lt;Swig Object of type 'OpenBabel::vector3 *' at 0x1a1fbddbd0&gt; &gt;


How can I get the actual values?


P.S. I posted the problem on OB mailing list, with no answers.
Coordinates can be accessed using 

[OBAtom.GetX(),OBAtom.GetY(),OBAtom.GetZ()]


look at this Github discussion.


If you have a better answer please don't hesitate to answer the question.