openbabel / openbabel

Open Babel is a chemical toolbox designed to speak the many languages of chemical data.
http://openbabel.org/
GNU General Public License v2.0
1.08k stars 416 forks source link

obminimize: could not setup force field. #2719

Closed nilanjana1996 closed 2 months ago

nilanjana1996 commented 2 months ago

I have a sdf file containing 31000 ligands from a database called CMNPD Screenshot 2024-08-22 115041 . I want to perform energy minimization of the ligands before proceeding for virtual screening. I am using Open babel on linux terminal to do so. The command I used is, obminimize -ff MMFF94 -sd CMNPD-export.sdf > target.sdf

Which ran successfully a while, but exited once an error was encountered,

"**S E T T I N G U P C A L C U L A T I O N S

SETTING UP BOND CALCULATIONS... COULD NOT FIND PARAMETERS FOR BOND 1-4 (IDX)... obminimize: could not setup force field**.".

Can you please guide me how to solve the issue? Or what could've gone wrong? Is there any way to skip the problematic molecules for which force field cannot be generated? Also, how can I determine up to which molecule the command ran successfully?

Thanks in advance.

welcome[bot] commented 2 months ago

Thanks for opening your first issue here! Be sure to follow the issue template!

fredrikw commented 2 months ago

I haven't tested and I don't do minimizations that often but you could try with obabel CMNPD-export.sdf -O target.sdf --minimize --sd -ff MMFF94 -e with the -e part telling obabel to continue on error. In general, I think that the "specialized" commands are less supported and maintained so if you manage to do something through the obabel interface it will be better.

nbehrnd commented 2 months ago

The force fields openbabel uses differ in their scope. Maybe one of your entries contains an atom/an ion the authors of the force field did not consider / did not consider yet. Boron, for example, is not known to MMFF94.

I presume the reason you want to submit your structure models to obminimize is in the sdf file, their third column about the z coordinate (just prior to the element symbol) is equal to 0.0000 for every atom. If so, could the generation of conformers with UFF represent a suitable alternative for your work, because this one covers the whole periodic table?

nilanjana1996 commented 2 months ago

I haven't tested and I don't do minimizations that often but you could try with obabel CMNPD-export.sdf -O target.sdf --minimize --sd -ff MMFF94 -e with the -e part telling obabel to continue on error. In general, I think that the "specialized" commands are less supported and maintained so if you manage to do something through the obabel interface it will be better.

This seems to be working fine. Thank you!

fredrikw commented 2 months ago

This seems to be working fine. Thank you!

Great! Please close the issue if you are satisfied with the solution.

nilanjana1996 commented 2 months ago

Maybe one of your entries contains an atom/an ion the authors of the force field did not consider / did not consider yet.

Hi @fredrikw The command ran successfully and 31473 molecules were converted into into energy minimized structure. Now when I'm trying to split the target.sdf file into separate sdf files using the following command, *obabel -isdf target.sdf -osdf -O .sdf -m**, I'm getting error. Screenshot 2024-08-22 171231

I've also attached another screenshot showing where the last command stopped to cross verify if the energy minimization was done correctly Screenshot 2024-08-22 171504 .

fredrikw commented 2 months ago

Difficult to say what may be the problem there without the files. Some questions:

nilanjana1996 commented 2 months ago

Hi @fredrikw Sorry for the late response.

I tried with first 10 molecule, as you suggested.

The step-by-step process I followed is,

  1. Split the combined SDF file (containing all molecules) into separate SDF file using this command, obabel -isdf CMNPD-export.sdf -osdf -O target_split.sdf -m
  2. Combined 10 molecules into a SDF file, obabel target_split{81..90}.sdf -O combined.sdf
  3. Minimized the resulting SDF file, and generating individual SDF file for each minimized ligand, obabel -isdf combined.sdf -O em.sdf --minimize --sd -ff MMFF94 -e -m
  4. Converting each SDF to PDBQT obabel em.sdf -O em.pdbqt

Upto step3, all the molecules retained their geometry, but upon converting into respective PDBQT structure, the structure is getting distorted.

I have attached a google drive link containing all the files. Please find the link below, [https://drive.google.com/drive/folders/19tDdzlWhIfmRpBGNMW1mINjm9RF0LBR3?usp=sharing] Nomenclatures of the files in Google Drive: combined.sdf : SDF file containing 10 ligands (before minimization) em.sdf : SDF file generated after minimization emem.pdbqt : PDBQT file generated after conversion from SDF to PDBQT.

nbehrnd commented 2 months ago

@nilanjana1996 By "distorted", do you refer to assigned stereochemistry? This is based, downloading your files and processing with openbabel 3.1.1 as packaged for Linux Debian 13/trixie, on two warnings issued:

$ for file in emem*.pdbqt
> do
> echo "work on $file"
> obabel "$file" -O "$file".sdf
> done
work on emem10.pdbqt
==============================
*** Open Babel Error  in TetStereoToWedgeHash
  Failed to set stereochemistry as unable to find an available bond
1 molecule converted
work on emem11.pdbqt
==============================
*** Open Babel Error  in TetStereoToWedgeHash
  Failed to set stereochemistry as unable to find an available bond
1 molecule converted
work on emem1.pdbqt
1 molecule converted
work on emem2.pdbqt
1 molecule converted
work on emem3.pdbqt
1 molecule converted
work on emem4.pdbqt
1 molecule converted
work on emem5.pdbqt
1 molecule converted
work on emem6.pdbqt
1 molecule converted
work on emem7.pdbqt
1 molecule converted
work on emem8.pdbqt
1 molecule converted
work on emem9.pdbqt
1 molecule converted

Else, does "distorted" refer to altered atomic positions/coordinates while comparing the .sdf (of the force field optimized conformer geometry) and the .pdbqt of one and the same structure? There may be some small changes, e.g. by the number of decimals to express the atomic coordinates. On the other hand, if the .pdbqt is used as a starting geometry in the docking experiment, are these differences significant? If so, can you indicate which atom(s) in which file(s) are most representative for the change you observe?

nbehrnd commented 2 months ago

@nilanjana1996 The thought passed my mind to superimpose two data files about one structure in Jmol. In its own input (file -> console), I entered

load files "emem1.pdbqt" "em1.sdf"
select 1.1
color lightgreen
model 0

Differences in atomic positions appear to be small:

superposition


With select 1.1, the first model of the first input file is selected to eventual alter its coloring (color cpk would revert it to the original scheme). Subsequent model 0 displays both models simultaneously; since there are two models in the working memory, one can toggle to one or the other by model 1 and model 2, too.

fredrikw commented 2 months ago

Hi, I would need you to be a bit more specific. Are you experiencing a different problem now? You did not find the molecules responsible for the "could not setup force field" error? It is a lot better if you keep the different problems in different issues, if nothing else to help people arriving to the issues in the future. So, using the "-e" flag, could you find out which molecules gave the original error? Regarding the "distortion", please create a new issue, and be specific as to how you notice the distortion, be clear on what is the problem.