{
  "id": 499861,
  "title": "ViSNet setup",
  "url": "/competitions/leash-BELKA/discussion/499861",
  "author_name": "Giorgio Micaletto",
  "post_date": "2024-05-03T09:54:29.851000",
  "votes": 5,
  "comment_count": 0,
  "views": 0,
  "content": "<p>Hi everyone! This is just a couple of things I wasted my time on, so you don't have to! Let's begin:<br>\nViSNet, as per documentation, requires the atomic number of each atom within the module and its coordinates. To find it I recommend doing</p>\n<pre><code>mol = Chem.MolFromSmiles(smiles)\nmol = Chem.AddHs(mol)\n  mol.GetNumConformers():\n        AllChem.EmbedMolecule(mol)\n         AllChem.EmbedMolecule(mol) == -:\n            AllChem.EmbedMolecule(mol, use_random_coords=)\n             AllChem.EmbedMolecule(mol, use_random_coords=) == -:\n                 ValueError()\n    atomic_numbers = []\n    coordinates = []\n    conf = mol.GetConformer()\n     atom  mol.GetAtoms():\n        atomic_numbers.append(atom.GetAtomicNum())\n        pos = conf.GetAtomPosition(atom.GetIdx())\n        coordinates.append((pos.x, pos.y, pos.z))\n</code></pre>\n<p>Then when converting to tensor, z must be of <code>long</code> type and pos must be float <code>float</code>. </p>\n<p><strong>Additional note</strong>: ViSNet requires <code>torch_cluster</code>, so be sure to have that installed!</p>",
  "messages": [
    {
      "id": 2790699,
      "postDate": "2024-05-03T09:54:29.850Z",
      "content": "<p>Hi everyone! This is just a couple of things I wasted my time on, so you don't have to! Let's begin:<br>\nViSNet, as per documentation, requires the atomic number of each atom within the module and its coordinates. To find it I recommend doing</p>\n<pre><code>mol = Chem.MolFromSmiles(smiles)\nmol = Chem.AddHs(mol)\n  mol.GetNumConformers():\n        AllChem.EmbedMolecule(mol)\n         AllChem.EmbedMolecule(mol) == -:\n            AllChem.EmbedMolecule(mol, use_random_coords=)\n             AllChem.EmbedMolecule(mol, use_random_coords=) == -:\n                 ValueError()\n    atomic_numbers = []\n    coordinates = []\n    conf = mol.GetConformer()\n     atom  mol.GetAtoms():\n        atomic_numbers.append(atom.GetAtomicNum())\n        pos = conf.GetAtomPosition(atom.GetIdx())\n        coordinates.append((pos.x, pos.y, pos.z))\n</code></pre>\n<p>Then when converting to tensor, z must be of <code>long</code> type and pos must be float <code>float</code>. </p>\n<p><strong>Additional note</strong>: ViSNet requires <code>torch_cluster</code>, so be sure to have that installed!</p>",
      "rawMarkdown": "Hi everyone! This is just a couple of things I wasted my time on, so you don't have to! Let's begin:\nViSNet, as per documentation, requires the atomic number of each atom within the module and its coordinates. To find it I recommend doing\n```python\nmol = Chem.MolFromSmiles(smiles)\nmol = Chem.AddHs(mol)\nif not mol.GetNumConformers():\n        AllChem.EmbedMolecule(mol)\n        if AllChem.EmbedMolecule(mol) == -1:\n            AllChem.EmbedMolecule(mol, use_random_coords=True)\n            if AllChem.EmbedMolecule(mol, use_random_coords=True) == -1:\n                raise ValueError(\"Failed to embed molecule\")\n    atomic_numbers = []\n    coordinates = []\n    conf = mol.GetConformer()\n    for atom in mol.GetAtoms():\n        atomic_numbers.append(atom.GetAtomicNum())\n        pos = conf.GetAtomPosition(atom.GetIdx())\n        coordinates.append((pos.x, pos.y, pos.z))\n```\nThen when converting to tensor, z must be of `long` type and pos must be float `float`. \n\n**Additional note**: ViSNet requires `torch_cluster`, so be sure to have that installed!",
      "votes": 5
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "2790699": "Hi everyone! This is just a couple of things I wasted my time on, so you don't have to! Let's begin:\nViSNet, as per documentation, requires the atomic number of each atom within the module and its coordinates. To find it I recommend doing\n```python\nmol = Chem.MolFromSmiles(smiles)\nmol = Chem.AddHs(mol)\nif not mol.GetNumConformers():\n        AllChem.EmbedMolecule(mol)\n        if AllChem.EmbedMolecule(mol) == -1:\n            AllChem.EmbedMolecule(mol, use_random_coords=True)\n            if AllChem.EmbedMolecule(mol, use_random_coords=True) == -1:\n                raise ValueError(\"Failed to embed molecule\")\n    atomic_numbers = []\n    coordinates = []\n    conf = mol.GetConformer()\n    for atom in mol.GetAtoms():\n        atomic_numbers.append(atom.GetAtomicNum())\n        pos = conf.GetAtomPosition(atom.GetIdx())\n        coordinates.append((pos.x, pos.y, pos.z))\n```\nThen when converting to tensor, z must be of `long` type and pos must be float `float`. \n\n**Additional note**: ViSNet requires `torch_cluster`, so be sure to have that installed!"
  }
}