Dear all,
First off: sorry if you receive this email twice. I was unsure about the exact
list address to sent it to.
I seem to have a strange problem. I try to determine the partial charges of a
molecule using the different force fields (code below, [1]) using the python
interface. However, I always seem to get the exact same partial charges
irrespective of the force field in use. Now I am wondering whether that was to
be expected. I would think that different force fields yield different partial
charges. The energies I get are vastly diferent, though.
I appreciate any hints about what I am doing wrong here. It does not matter
which molecule I choose, the result is always the same.
Thanks in advance,
Torsten
[1]:
import pybel as pb
import openbabel as op
import sys
def get_partial_charges(mol,nr_atoms):
"""
Return a list of all partial charges of the atoms
according to the current force field. List has the
same order as the atoms in the molecule.
"""
a=op.OBAtom()
partialcharges=[0.0]*nr_atoms
for idx in range(1,nr_atoms+1):
a = mol.GetAtom(idx)
partialcharges[idx-1] = a.GetPartialCharge()
return partialcharges
for forcefield in pb.forcefields:
mol = pb.readfile("xyz","test.xyz").next().OBMol
ff = op.OBForceField.FindForceField(forcefield)
if ff.Setup(mol) == 0:
print >> sys.stderr, "Force field "+ff.Description()+" could not be
set-up correctly."
else:
print get_partial_charges(mol,mol.NumAtoms())
------------------------------------------------------------------------------
_______________________________________________
OpenBabel-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss