Closed v-shaoningli closed 1 year ago
Thanks for the PR!
Just to confirm; this does not change the identity of the molecule, right? It just changes the ordering.
Right. Since we need the order
value in ReorderAtoms
function to re-index the position in .sdf, it should return this.
For instance:
i = 0
mol = suppl[i]
mol, order = ReorderAtoms(mol)
order = torch.tensor(order).long()
N = mol.GetNumAtoms()
pos = suppl.GetItemText(i).split('\n')[4:4 + N]
pos = [[float(x) for x in line.split()[:3]] for line in pos]
pos = torch.tensor(pos)[order]
I would create a new PR to fix this.
Add
reorder atom
function to achieve atom-to-atom correspondence in PCQM4Mv2 when dealing with sdf. The code is originally from ViSNet. We can test the order byand