I want to try convolutional neural networks for drugs classification. I use PyTorch for 3D CNN implementation. Is there a way to obtain 3D tensors from SMILES or SDF/PDB structures?

  • $\begingroup$ PDB is already a 3D representation, but SMILES is not. $\endgroup$
    – Mithoron
    Commented Nov 4, 2022 at 15:58
  • $\begingroup$ This seems like a much better fit for Matter Modeling $\endgroup$ Commented Nov 4, 2022 at 16:13

1 Answer 1


I've seen the conversion of SMILES into 1D and 2D representations. Is there any reason you specifically wish to use 3D tensors? I haven't seen 3D tensors in literature, but that isn't to say that it doesn't exist.

torchdrug converts SMILES molecules graphs based on NetworkX. You can install it using: pip install torchdrug Be aware that it only works for python 3.6-3.9.

pysmilesutils converts SMILES into a vector. You can install it using the following commands: python -m pip install git+https://github.com/MolecularAI/pysmilesutils.git

PyTorch Geometric converts SMILES into a matrix constructed of property vectors of each atom in the molecule.

  • $\begingroup$ Thank you! The three-dimensional structures that can be obtained from molecular docking provide useful information about the geometry of the molecule within the binding pocket. But PyTorch CNN cannot work with SDF or PDB files, it requires tensors. In the case of three-dimensional structures - three-dimensional tensors. This link can give you more information about this approach - $\endgroup$
    – sigma
    Commented Nov 6, 2022 at 17:12
  • $\begingroup$ I know a computational chemist who specialises in ML for drug-target interaction, I'll ask them about this and get back to you! $\endgroup$ Commented Nov 6, 2022 at 21:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.