jensengroup / xyz2mol

Converts an xyz file to an RDKit mol object
MIT License
250 stars 70 forks source link

Boost.Python.ArgumentError in SetFormalCharge function #1

Closed qjornet closed 6 years ago

qjornet commented 6 years ago

Dear Developer,

My name is Joaquim Jornet-Somoza (quim), postdoctoral researcher on theoretical and computational chemistry. I have a set of xyz files (in fact, one file with concatenated xyz blocks), that I would like to pass to RD-Kit as mol. I looked to your code and I found it interesting for my purpose. Howevere, when I tryed the test examples it fails for the acetate xyz file (not for the ethane.xyz) saying:

$python xyz2mol.py acetate.xyz Traceback (most recent call last): File "xyz2mol.py", line 362, in mol = xyz2mol(atomicNumList,charge,xyz_coordinates,charged_fragments) File "xyz2mol.py", line 346, in xyz2mol new_mol = AC2mol(mol,AC,atomicNumList,charge,charged_fragments) File "xyz2mol.py", line 251, in AC2mol mol = BO2mol(mol,BO, atomicNumList,atomic_valence_electrons,charge,charged_fragments) File "xyz2mol.py", line 141, in BO2mol mol = set_atomic_charges(mol,atomicNumList,atomic_valence_electrons,BO_valences,BO_matrix,mol_charge) File "xyz2mol.py", line 163, in set_atomic_charges a.SetFormalCharge(charge) Boost.Python.ArgumentError: Python argument types in Atom.SetFormalCharge(Atom, numpy.int64) did not match C++ signature: SetFormalCharge(RDKit::Atom {lvalue}, int)

Could you tell me where does this errors come from ? Sincerely quim

jhjensen2 commented 6 years ago

I can't reproduce this using my version of the code.

What version of RDKit are you using? I am using 2016.09.2 You can find out by

from rdkit import rdBase print(rdBase.rdkitVersion)

Also, are you using Python 3? I've only tested this for Python 2.7.

qjornet commented 6 years ago

I am using Python 3, with RDKit version 2017.03.1. I have modified the your printing calls to the Python 3 compatible form , i.e. print().

jhjensen2 commented 6 years ago

Ah, OK. It's fixed now.