Pymol-Scripts / Pymol-script-repo

Collected scripts for Pymol
http://www.pymolwiki.org/index.php/Git_intro
435 stars 257 forks source link

Optimize works poorly on small molecules - have been able to fix #116

Closed Polo-Zecc closed 1 year ago

Polo-Zecc commented 3 years ago

Optimize plugin gives and takes the data to and from OpenBabel as a PDB file, which for small molecules doesn't work very will due to bonding information not being taken into account well - eg for a nucleotide the output was dearomatized, for a short oligopeptide a tyrosine had been split into a phenylalanine and water molecule and an arginine lost its guanidine as ammonia and a carbodiimide.

This is fixable by changing the input/output file type to MOL: Line 250 -> mol_string = cmd.get_str('mol',selection) 253 -> obconversion.SetInAndOutFormats('mol', 'mol') 255 -> obconversion.ReadString(mol, mol_string) 256 -> removed 269 -> mol_string = obconversion.WriteString(mol) 273 -> cmd.read_molstr(mol_string, name,state=0,finish=1,discrete=1) 280 -> mol_string = cmd.get_str('mol',selection) 283 -> obconversion.SetInAndOutFormats('mol', 'mol') 285 -> obconversion.ReadString(mol, mol_string) 286 -> removed 320 -> mol_string = obconversion.WriteString(mol) 321 -> cmd.read_molstr(mol_string, name_n,state=0,finish=1,discrete=1) 329 -> mol_string = obconversion.WriteString(mol) 331 -> cmd.read_molstr(mol_string, name,state=0,finish=1,discrete=1)

I am very inexperienced with coding so this may not be formatted particularly clearly, and may not be the optimal way of fixing this, but seems to work for me thus far.

pslacerda commented 3 years ago

Hi, thank you. I'll try to review your code on Monday.

pslacerda commented 3 years ago

I understand your issue. Please edit the file using the Github "edit" button (a pencil). Or use this link. https://github.com/Pymol-Scripts/Pymol-script-repo/edit/master/plugins/optimize.py

If you can't please upload the modified file.

pslacerda commented 3 years ago

Ping @Polo-Zecc , whats up?

Polo-Zecc commented 3 years ago

Have forked it and opened a pull request for edited code

JarrettSJohnson commented 1 year ago

Merged from #117