parm_dock.c

来自「最经典的分子对结软件」· C语言 代码 · 共 1,659 行 · 第 1/3 页

C
1,659 行
字号
    (void *) &dock->max_heavies,    &parm, Integer, "heavy_atoms_maximum",    orient->flag && dock->multiple_ligands ? "100" : "<infinity>",    dock->multiple_ligands  );  get_parameter  (    (void *) &dock->rank_ligands,    &parm, Boolean,    "rank_ligands",    "no",    dock->multiple_ligands &&      (score->flag || label->chemical.screen.similar_flag) &&      (!dock->write_orients || dock->rank_orients)  );  get_parameter  (    (void *) &dock->rank_ligand_total,    &parm, Integer,    "rank_ligand_total",    dock->rank_ligands ? "100" : "1",    dock->rank_ligands  );  get_parameter  (    (void *) &dock->restart_interval,    &parm, Integer, "restart_interval",    dock->rank_ligands ? "100" : "0",    dock->rank_ligands  );  fprintf (global.outfile,    "\n____________________File_Input____________________\n");  get_parameter  (    (void *) &dock->ligand_file_name,    &parm, String, "ligand_atom_file",    dock->multiple_ligands ?      (label->chemical.screen.process_flag ? "database.ptr" : "database.mol2")      : "ligand.mol2",    !dock->parallel.flag || dock->parallel.server  );  format = check_file_extension (dock->ligand_file_name, TRUE);  if (format == Unknown)    exit (fprintf (global.outfile,      "ERROR get_parameters: "      "Unrecognized file extension of ligand_atom_file\n"));  else if (label->chemical.screen.process_flag && (format != Ptr))    exit (fprintf (global.outfile,      "ERROR get_parameters: "      "PTR file required to chemical screen ligands.\n"));  get_parameter  (    (void *) &orient->match.ligand_file_name,    &parm, String, "ligand_center_file",    "ligand_center.sph",    orient->match.centers_flag  );  if (check_file_extension (orient->match.ligand_file_name, TRUE) == Unknown)    exit (fprintf (global.outfile,      "ERROR get_parameters: "      "Unrecognized file extension of ligand_center_file\n"));  get_parameter  (    (void *) &orient->match.receptor_file_name,    &parm, String, "receptor_site_file",    label->chemical.screen.process_flag ? "target.mol2" : "receptor_site.sph",    orient->flag || label->chemical.screen.process_flag  );  if (check_file_extension (orient->match.receptor_file_name, TRUE) == Unknown)    exit (fprintf (global.outfile,      "ERROR get_parameters: "      "Unrecognized file extension of receptor_site_file\n"));  get_parameter  (    (void *) &score->grid.file_prefix,    &parm, String, "score_grid_prefix",    "score_grid",    score->inter_flag && score->grid.flag  );  get_parameter  (    (void *) &score->grid.receptor_file_name,    &parm, String, "receptor_atom_file",    "receptor.mol2",    score->inter_flag && !score->grid.flag  );  if (!check_file_extension (score->grid.receptor_file_name, TRUE))    exit (fprintf (global.outfile,      "ERROR get_parameters: "      "Unrecognized file extension of receptor_atom_file\n"));  get_parameter  (    (void *) &label->vdw.file_name,    &parm, String, "vdw_definition_file",    PARAMETER_PATH "vdw.defn",    label->vdw.flag  );  get_parameter  (    (void *) &label->chemical.file_name,    &parm, String, "chemical_definition_file",    PARAMETER_PATH "chem.defn",    label->chemical.flag  );  get_parameter  (    (void *) &label->chemical.match_file_name,    &parm, String, "chemical_match_file",    PARAMETER_PATH "chem_match.tbl",    orient->match.chemical_flag  );  get_parameter  (    (void *) &label->chemical.score_file_name,    &parm, String, "chemical_score_file",    PARAMETER_PATH "chem_score.tbl",    score->chemical.flag  );  get_parameter  (    (void *) &label->chemical.screen_file_name,    &parm, String, "chemical_screen_file",    PARAMETER_PATH "chem_screen.tbl",    label->chemical.screen.similar_flag  );  get_parameter  (    (void *) &label->flex.file_name,    &parm, String, "flex_definition_file",    PARAMETER_PATH "flex.defn",    label->flex.flag  );  get_parameter  (    (void *) &label->flex.search_file_name,    &parm, String, "flex_drive_file",    PARAMETER_PATH "flex_drive.tbl",    label->flex.drive_flag  );  strcat (strcpy (parameter_value, global.job_name), ".quit");  get_parameter  (    (void *) &dock->quit_file_name,    &parm, String, "quit_file",    parameter_value,    dock->rank_ligands || (dock->multiple_ligands && dock->parallel.flag)  );  strcat (strcpy (parameter_value, global.job_name), ".dump");  get_parameter  (    (void *) &dock->dump_file_name,    &parm, String, "dump_file",    parameter_value,    dock->rank_ligands  );  fprintf (global.outfile,    "\n____________________File_Output___________________\n");  for (i = 0; i < SCORE_TOTAL; i++)  {    sprintf (parameter_name, "ligand_%s_file", i ? score->type[i].name : "out");    sprintf (parameter_value, "%s_%s.%s", global.job_name,      score->type[i].abbrev,      label->chemical.screen.flag || dock->parallel.flag ? "ptr" : "mol2");    get_parameter    (      (void *) &score->type[i].file_name,      &parm, String, parameter_name,      parameter_value,      score->type[i].flag && !dock->parallel.server    );    if (score->type[i].flag)    {      if (dock->parallel.flag && !dock->parallel.server)      {        if (check_file_extension (score->type[i].file_name, TRUE) != Ptr)          exit (fprintf (global.outfile,            "ERROR get_parameters: "            "Parallel client must write in PTR format\n"));      }      else if (label->chemical.screen.construct_flag)      {        if (check_file_extension (score->type[i].file_name, TRUE) != Ptr)          exit (fprintf (global.outfile,            "ERROR get_parameters: "            "Constructed screen must be written in PTR format\n"));      }      else      {        if (check_file_extension (score->type[i].file_name, TRUE) == Unknown)          exit (fprintf (global.outfile,            "ERROR get_parameters: "            "Unrecognized file extension of ligand output file\n"));      }    }  }  strcat (strcpy (parameter_value, global.job_name), ".info");  get_parameter  (    (void *) &dock->info_file_name,    &parm, String, "info_file",    parameter_value,    score->flag && dock->multiple_ligands  );  strcat (strcpy (parameter_value, global.job_name), ".rst");  get_parameter  (    (void *) &dock->restart_file_name,    &parm, String, "restart_file",    parameter_value,    dock->rank_ligands  );/** Flush output and clean up memory* 11/96 te*/  fprintf (global.outfile, "\n\n");  fflush (global.outfile);  if (global.infile != stdin)  {    fclose (global.infile);    efree ((void **) &parm.line);  }}/* ////////////////////////////////////////////////////////////// */int process_commands(  DOCK *dock,  int argc,  char *argv[]){  int i = 1, j;  int molecule_io = FALSE;  FILE_NAME infile_name = "", outfile_name = "";/** Extract name of global.executable from command line,* ignoring any path description if present* 6/95 te*/  strcpy (global.executable,    strrchr (argv[0], '/') ? strrchr (argv[0], '/') + 1 : argv[0]);  strcpy (global.job_name, "dock");/** Step through each command line argument* 6/95 te*/  while (i < argc)  {/**   Look for command flag prefix (-)*   6/95 te*/    if (argv[i][0] == '-')    {/**     For "-i" flag read in next field as the input file name*     6/95 te*/      if (argv[i][1] == 'i')      {        if ((i + 1 < argc) && (argv[i + 1][0] != '-'))        {          strncpy (infile_name, argv[i + 1], 80);          i++;/**         Set the job name to the root name of the the "*.in" file*         10/95 te*/          if (strrchr (infile_name, '.') &&            !strcmp (strrchr (infile_name, '.'), ".in"))          {            for (j = 0; j < strlen (infile_name); j++)            {              if (!strcmp (&infile_name[j], ".in"))              {                global.job_name[j] = 0;                break;              }              else                global.job_name[j] = infile_name[j];            }          }          else            strcpy (global.job_name, infile_name);        }        else          sprintf (infile_name, "%s.in", global.job_name);      }/**     For "-o" flag read in next field as the output file name.*     If the next field does not exist or is another flag, then*     use default output file name.*     6/95 te*/      else if (argv[i][1] == 'o')      {        if ((i + 1 < argc) && (argv[i + 1][0] != '-'))        {          strncpy (outfile_name, argv[i + 1], 80);          i++;        }        else          sprintf (outfile_name, "%s.out", global.job_name);        if (!strcmp (infile_name, ""))          break;      }/**     For "-p" flag, set performance flag*     1/97 te*/      else if (argv[i][1] == 'p')        dock->performance_flag = TRUE;/**     For "-r" flag, turn on flag to perform restart run*     6/95 te*/      else if (argv[i][1] == 'r')      {        if (strcmp (infile_name, ""))          dock->restart = TRUE;        else          break;      }/**     For "-s" flag, allow all input and output through standard streams*     6/95 te*/      else if (argv[i][1] == 's')      {        if ((strcmp (infile_name, "")) || (strcmp (outfile_name, "")))          break;      }/**     For "-t" flag, set output volume to terse*     6/95 te*/      else if (argv[i][1] == 't')        global.output_volume = 't';/**     For "-v" flag, set output volume to verbose*     6/95 te*/      else if (argv[i][1] == 'v')        global.output_volume = 'v';      else        break;      i++;    }    else      break;  }/** Check if no arguments were given, to conform to old style input/output* 10/95 te*/  if (argc == 1)  {/**   If INDOCK file exists, then assume user wants output directed to OUTDOCK*   10/95 te*/    if (global.infile = fopen ("INDOCK", "r"))    {      fclose (global.infile);      if (global.infile = fopen ("OUTDOCK", "r"))      {        fclose (global.infile);        fprintf (stderr,          "ERROR get_parameters: \n"          "       Presence of INDOCK file implies OUTDOCK to receive output,\n"          "       but OUTDOCK file already exists.  For reverse compatibility\n"          "       reasons, this process will stop.\n");        exit (EXIT_FAILURE);      }      strcpy (infile_name, "INDOCK");      strcpy (outfile_name, "OUTDOCK");    }/**   If it doesn't, then trigger an error condition*   10/95 te*/    else      i = 0;  }/** If any error was made in the command line, then quit* 6/95 te*/  if (i < argc)  {    fprintf (stderr,      "  \n"      "Usage: %s [-i [input_file]] [-o [output_file]] ...\n"      "  [-restart] [-standard_i/o] [-terse] [-verbose]\n"      "  \n"      "  -i: read from %s.in or input_file, standard_in otherwise\n"      "  -o: write to %s.out or output_file (-i required), \n"      "      standard_out otherwise\n"      "  -p: monitor performance\n"      "  -r: restart run (-i required)\n"      "  -s: read from and write to standard streams (-i and/or -o illegal)\n"      "  -t: terse program output\n"      "  -v: verbose program output\n"       "  \n"      "  \n"      "To create or update an input file interactively just type:\n"      "  %s -i your_name.in\n"      "  \n",      global.executable, global.executable, global.executable,      global.executable);    exit (EXIT_FAILURE);  }/** Open the input file* 6/95 te*/  if (strcmp (infile_name, ""))  {    if (strcmp (outfile_name, ""))    {/**     Check to see if user has supplied molecule files as input/output*     6/95 te*/      if ((check_file_extension (infile_name, FALSE) != Unknown) &&        (check_file_extension (outfile_name, FALSE) != Unknown))      {        molecule_io = TRUE;/**       Open up scratch file and write necessary parameters to it*       6/95 te*/        global.infile = tmpfile ();        fprintf (global.infile, "orient_ligand             no\n");        fprintf (global.infile, "flexible_ligand           no\n");        fprintf (global.infile, "score_ligand              no\n");        fprintf (global.infile, "multiple_ligands          yes\n");        fprintf (global.infile, "chemical_screen           no\n");        fprintf (global.infile, "parallel_jobs             no\n");        fprintf (global.infile, "ligands_maximum           <infinity>\n");        fprintf (global.infile, "initial_skip              0\n");        fprintf (global.infile, "interval_skip             0\n");        fprintf (global.infile, "atoms_maximum             <infinity>\n");        fprintf (global.infile, "heavy_atoms_minimum       0\n");        fprintf (global.infile, "heavy_atoms_maximum       <infinity>\n");        fprintf (global.infile, "ligand_atom_file          %s\n", infile_name);        fprintf (global.infile, "vdw_definition_file       %s\n",          PARAMETER_PATH "vdw.defn");        fprintf (global.infile, "ligand_out_file          %s\n", outfile_name);        rewind (global.infile);      }      else        global.infile = efopen (infile_name, "r", stdout);    }    else      global.infile = efopen (infile_name, "a+", stdout);  }  else    global.infile = stdin;/** Open the output file* 6/95 te*/  if ((strcmp (outfile_name, "")) && (!molecule_io))  {    if (dock->restart)      global.outfile = efopen (outfile_name, "a", stdout);    else      global.outfile = efopen (outfile_name, "w", stdout);  }  else    global.outfile = stdout;  return TRUE;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?