I tried to generate a .xyz file from a SMILES string. The molecule I chose was dichloromethane, with a straightforward SMILES string (ClCCl). The code was:
import numpy as np
import pandas as pd
from rdkit import Chem
from rdkit.Chem import AllChem
mol = Chem.MolFromSmiles('ClCCl')
mol = Chem.AddHs(mol)
AllChem.EmbedMolecule(mol)
AllChem.MMFFOptimizeMolecule(mol)
Chem.MolToXYZFile(mol)
The error message was:
Boost.Python.ArgumentError: Python argument types in
rdkit.Chem.rdmolfiles.MolToXYZFile(Mol)
did not match C++ signature:
MolToXYZFile(RDKit::ROMol mol, std::\__cxx11::basic_string\<char, std::char_traits\<char\>, std::allocator\<char\> \> filename, int confId=-1)
My configuration: Python 3.10, boost 1.78.0, and RDKit 2022.09.3. I ran it in Linux.
I tried another version of Boost (1.74.0), but the MolToXYZFile() command didn't work either.
Any advice would be appreciated!
Thank you a lot!
According to the docs,
MolToXYZFile
expects an additional string parameter filename.