diff --git a/host/src/getparameters.cpp b/host/src/getparameters.cpp index b3bb92cf..f0603180 100644 --- a/host/src/getparameters.cpp +++ b/host/src/getparameters.cpp @@ -706,6 +706,7 @@ int initial_commandpars( mypars->fldfile=NULL; mypars->ligandfile=NULL; mypars->flexresfile=NULL; + mypars->free_roaming_ligand = false; // load_xml is the xml file from which the other parameters will be set mypars->load_xml = strdup(xml_files[i].c_str()); read_xml_filenames(mypars->load_xml, @@ -715,6 +716,7 @@ int initial_commandpars( mypars->flexresfile, mypars->list_nr, mypars->seed); + mypars->free_roaming_ligand = (mypars->ligandfile != NULL); // Filling mygrid according to the specified fld file if (get_gridinfo(mypars->fldfile, mygrid) != 0) @@ -745,7 +747,7 @@ int initial_commandpars( filelist.preload_maps=false; // Add the ligand filename in the xml to the filelist - filelist.ligand_files.push_back(mypars->ligandfile); + if(mypars->free_roaming_ligand) filelist.ligand_files.push_back(mypars->ligandfile); filelist.mypars.push_back(*mypars); } if(mypars->xml_files>100) printf("\n\n"); @@ -2188,7 +2190,7 @@ void read_xml_filenames( } int error=0; bool grid_found=false; - bool ligand_found=false; + bool lig_or_flex_found=false; std::string line; char tmpstr[256]; size_t line_nr=0; @@ -2221,7 +2223,7 @@ void read_xml_filenames( break; } if(ligand_filename==NULL) ligand_filename=strdup(tmpstr); - ligand_found = true; + lig_or_flex_found = true; } if(line.find("")==0){ if(!sscanf(line.c_str(),"%255[^<]/flexres>",tmpstr)){ @@ -2229,6 +2231,7 @@ void read_xml_filenames( break; } if(flexres_filename==NULL) flexres_filename=strdup(tmpstr); + lig_or_flex_found = true; } if(line.find("")==0){ if(!sscanf(line.c_str(),"%d %d %d",&seed[0],&seed[1],&seed[2])){ @@ -2243,7 +2246,7 @@ void read_xml_filenames( } } } - if(!grid_found || !ligand_found) error |= 16; + if(!grid_found || !lig_or_flex_found) error |= 16; if(error){ printf("Error: XML file is not in AutoDock-GPU format (error #%d in line %lu).\n",error,line_nr); exit(error); diff --git a/host/src/processligand.cpp b/host/src/processligand.cpp index 58fb7503..3b0c1d01 100644 --- a/host/src/processligand.cpp +++ b/host/src/processligand.cpp @@ -1720,7 +1720,7 @@ std::vector analyze_ligand_receptor( ) // The function performs a simple distance based ligand-receptor analysis { - int atom_cnt; + int atom_cnt = 0; float x, y, z; int atomtypeid; std::vector result; @@ -1734,8 +1734,11 @@ std::vector analyze_ligand_receptor( const unsigned int* receptor_list; AnalysisData datum; - - for (atom_cnt=0; atom_cnttrue_ligand_atoms; atom_cnt++) // for each ligand atom + + // use moving ligand atoms if specified or flex res (aka covalently bound ligand) atoms otherwise + int nr_atoms = (myligand->true_ligand_atoms > 0) ? myligand->true_ligand_atoms : myligand->num_of_atoms; + + for (; atom_cntbase_type_idx[(int)myligand->atom_idxyzq [atom_cnt][0]]; x = myligand->atom_idxyzq [atom_cnt][1];