Layne-Huang / PMDM

101 stars 22 forks source link

OverflowError: can't convert negative value to unsigned int #38

Open Kartinaa opened 2 weeks ago

Kartinaa commented 2 weeks ago

Dear author,

Thanks for sharing your wonderful code! Recently when I try to reproduce the ligand generation mentioned in paper for SARS-CoV-2 main protease, I encountered error OverflowError: can't convert negative value to unsigned int when I try to generate 1000 molecules with 20 atoms using following command:

python -u sample_for_pdb.py --ckpt 500.pt --pdb_path ./data/7l11cut20/7l11cut20_pocket.pdb --num_atom 20 --num_samples 1000 --sampling_type generalized --batch_size 10

I'm not sure how to aviod this error, I tried other protein before and it works well. Really appreciate it if you could give me some suggestions on this.

Best, Bo

Layne-Huang commented 1 week ago

Hi,

I just ran your code and did not meet any issues that you proposed here. Could you please try to change the num_atom and try it again? image

Kartinaa commented 1 week ago

Hi Layne,

Thanks for the reply! I may not explain it clearly, I could generate several molecules successfully, but I couldn't generate 1000 molecules at a time. I tried several atom numbers (19, 20, 21, 31, 30, etc) but in the best situation, I could generate 18 molecules in sdf format. I suspect I could just pass the problem-rising atom to continue the generation by adding error handling code to atom.SetNumRadicalElectrons(num_radical) in utils/reconstruct.py, but I'm not sure if it will influence the performance of the generative model.

Previously: atom.SetNumRadicalElectrons(num_radical) Now: if num_radical < 0:; print(f"Negative radical electron count: {num_radical}. Setting to 0."); num_radical = 0; atom.SetNumRadicalElectrons(num_radical)

How do you think about it?

Best, Bo