⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autosphere.c

📁 最经典的分子对结软件
💻 C
📖 第 1 页 / 共 3 页
字号:
      if (not read_molecule(mol_ref, mol_init, molS, file, true))      {         printf("ERROR:  Unable to read molecule |%s|.\n", molS);         retI = false;      }      else      {         if (DB_READ_MOL)          {            printf("  ref mol, at: %d, bd: %d.\n", mol_ref->total.atoms, mol_ref->total.bonds);            printf("  init mol, at: %d, bd: %d.\n", mol_init->total.atoms, mol_init->total.bonds);         }/**         SetLabel(&label);         if (not prepare_molecule(mol_ref, molS, file, &label, 0, 0, 1, 1))**/      }   }   close(file);   return (retI);}/** mark SetLabel **//****************************************************************************  Author:   Jim Arnold**  Purpose:  Sets parameters in the label structure so the dock4.0 mols**            can be perceived.**  Notes:    **************************************************************************/void SetLabel(LABEL *label){   if (DB_SET_LAB) {printf("**SetLabel.\n");}   label->flex.flag = 1;   label->flex.anchor_flag = 0;   label->flex.multiple_anchors = 0;      label->flex.anchor_size = 0;   label->flex.periph_flag = label->flex.anchor_flag;   label->flex.write_flag = 0;   label->flex.drive_flag = 0;   label->flex.clash_overlap = 0;   label->flex.max_conforms = 0;   label->flex.minimize_flag = 0;   label->flex.reminimize_layers = 0;   label->flex.minimize_anchor_flag = 0;   label->flex.reminimize_anchor_flag = 0;   label->flex.max_torsions = 0;   label->chemical.screen.flag = 0;   label->chemical.flag = label->chemical.screen.flag;   sprintf(label->chemical.file_name, "%s", "chem_file");   sprintf(label->chemical.match_file_name, "%s", "chem_match_file");   sprintf(label->chemical.score_file_name, "%s", "chem_score_file_name");   sprintf(label->chemical.screen_file_name, "%s", "chem_screen_file_name");   label->vdw.flag = (label->flex.flag or label->chemical.screen.flag);   label->vdw.init_flag = 0;   label->vdw.member = NULL;   label->vdw.total = 0;   label->vdw.definition = NULL;   sprintf(label->vdw.file_name, "%s", "vdw_file_name");   if (DB_SET_LAB) {printf("  finished setting labels.\n");}}/** mark TestParams **//****************************************************************************  Author:   Jim Arnold**  Purpose:  Tests the parameters read in from an input file.**  Notes:    **************************************************************************/int TestParams(TS_INFO *info){   int     retI = true;   if (DB_TEST) {printf("**TestParams.\n");}   /** Temporarily disable the box option. **/   if (info->box equal 1)   {      printf("\n\n  Box option currently waiting to be debugged.  Use residue option.\n\n");      retI = false;   }   /** regular cases **/   else if ((info->residue equal 0) and (info->sphere equal 0) and (info->box equal 0))   {      printf("\n\nERROR with parameters.  Must specify residue, or sphere, or box.\n\n\n");      retI = false;   }   else if ((info->residue equal 1) and (info->sphere equal 1))   {      printf("\n\nERROR with parameters.  Choose residue OR sphere.\n\n\n");      retI = false;   }   else if ((info->residue equal 1) and (info->box equal 1))   {      printf("\n\nERROR with parameters.  Choose residue OR box.\n\n\n");      retI = false;   }   else if ((info->sphere equal 1) and (info->box equal 1))   {      printf("\n\nERROR with parameters.  Choose sphere OR box.\n\n\n");      retI = false;   }   else if ((info->residue equal true) and (info->res_num equal NULL))   {      printf("\n\nERROR with parameters.  Must specify a res num if residue is true.\n");      retI = false;   }   else if ((info->residue equal true) and (info->res_cut equal NULL))   {      printf("\n\nERROR with parameters.  Must specify a residue_cutoff if residue is true.\n");      retI = false;   }   else if ((info->sphere equal true) and (info->radius equal NULL))   {      printf("\n\nERROR with parameters.  Must specify a radius if sphere is true.\n");      retI = false;   }   else if (info->surf_cut < 0.1)   {      printf("\nWarning, surface cutoff value is: %4.3f.\n", info->surf_cut);   }   else if (info->sph_input[0] equal NULL)   {      printf("\n\nERROR with parameters.  Must specify a sphere input filename.\n\n\n");      retI = false;   }   else if (info->sph_output[0] equal NULL)   {      printf("\n\nERROR with parameters.  Must specify a sphere output filename.\n\n\n");      retI = false;   }   else if (info->receptor_filename[0] equal NULL)   {      printf("\n\nERROR with parameters.  Must specify a receptor filename.\n\n\n");      retI = false;   }   else   {      if (DB_TEST) {printf("  The params are good.\n");}   }   if (DB_TEST) {printf("  returning %d from TestParams.\n", retI);}   return (retI);}/** mark read_args **//****************************************************************************  Author:   Scott Pegg, Jim Arnold**  Purpose:  A function to read in the parameters from a file**  Notes:    **************************************************************************/void read_args(FILE *file, TS_INFO *info){  char s1[101];  if (DB_READ) {printf("**read_args.\n");}  if (DB_READ) {printf("  setting init values to NULL.\n");}  info->residue  = 0;  info->res_num  = 0;  info->sphere   = 0;  info->sph_x    = 0.0;  info->sph_y    = 0.0;  info->sph_z    = 0.0;  info->radius   = 0;  info->box      = 0;  info->size_x   = 0.0;  info->size_y   = 0.0;  info->size_z   = 0.0;  info->filt_cut = 0.0;   info->surf_cut = 0.0;  info->res_cut  = 0.0;   info->lig_sph_file[0]  = NULL;  info->sph_input[0]  = NULL;  info->sph_output[0] = NULL;           info->receptor_file   = NULL;    info->receptor_filename[0] = NULL;  /* read the parameters from the file */  while (fscanf(file, "%s", s1) != EOF)   {    if (strcmp(s1, "residue") == 0)     {       fscanf(file, "%d", &info->residue);    }    else if (strcmp(s1, "res_num") == 0)       fscanf(file, "%d", &info->res_num);    else if (strcmp(s1, "residue_cutoff") == 0)       fscanf(file, "%f", &info->res_cut);    else if (strcmp(s1, "filter_cutoff") == 0)       fscanf(file, "%f", &info->filt_cut);    else if (strcmp(s1, "surface_cutoff") == 0)       fscanf(file, "%f", &info->surf_cut);    else if (strcmp(s1, "sphere") == 0)     {       fscanf(file, "%d", &info->sphere);    }    else if (strcmp(s1, "sphere_center") == 0)        {fscanf(file, "%f %f %f", &info->sph_x, &info->sph_y, &info->sph_z);}    else if (strcmp(s1, "radius") == 0)       fscanf(file, "%f", &info->radius);    else if (strcmp(s1, "box") == 0)    {       fscanf(file, "%d", &info->box);    }    else if (strcmp(s1, "box_center") == 0)       fscanf(file, "%f %f %f", &info->sph_x, &info->sph_y, &info->sph_z);    else if (strcmp(s1, "receptor_file") == 0)     {      fscanf(file, "%s", info->receptor_filename);      info->receptor_file = 1;    }    else if (strcmp(s1, "lig_sph_file") == 0)       fscanf(file, "%s", info->lig_sph_file);    else if (strcmp(s1, "sph_file") == 0)       fscanf(file, "%s", info->sph_input);    else if (strcmp(s1, "output_file") == 0)       fscanf(file, "%s", info->sph_output);    else {      printf("Error: Unrecognized input variable: %s\n", s1);    }  } /* end while */}/** mark read_spheres **//****************************************************************************  Author:   Scott Pegg**  Purpose:  A function to read in sphere cluster 0 from the SPHGEN **            output file.**  Notes:    **************************************************************************/SPHERE *read_spheres(TS_INFO *info, SPHERE *spheres) {  int      ctI;  FILE     *file = NULL;  int      t1, t2, t3, t4;  float    x, y, z, radius;  SPHERE   *new_sphere;  char     line[300];     /* if there's a line over 300 chars in the sphere file,                             there's probably something wrong with the file */  if (DB_READ_SPH) {printf("**read_spheres, file: |%s|.\n", info->sph_input);}  file = fopen(info->sph_input, "r");  if (file == NULL) {    printf("Error: Could not open sphere file: |%s|\n", info->sph_input);    exit(0);  }  if (DB_READ_SPH) {printf("  Read lines until a marker for cluster 0.\n");}  while (fgets(line, 299, file) != NULL) {    if (strncmp(line, "cluster     0", 13) == 0) break;  }  if (DB_READ_SPH) {printf("  Now read in the sphere information.\n");}  ctI = 0;  while (fscanf(file, "%d %f %f %f %f %d %d %d",		&t1, &x, &y, &z, &radius, &t2, &t3, &t4) == 8)   {    if (DB_READ_SPH) {printf("  make new sphere: %d.\n", ctI);}    new_sphere = malloc(sizeof(struct sphere));    new_sphere->x = x;    new_sphere->y = y;    new_sphere->z = z;    new_sphere->radius = radius;    new_sphere->visited = 0;    if (DB_READ_SPH) {printf("  add sphere %d to the list.\n", ctI);}    spheres = add_sphere(new_sphere, spheres);    ctI++;  }  fclose(file);  if (DB_READ_SPH) {printf("  returning sphere list of len: %d.\n", SphLen(spheres));}  return (spheres);}/** mark show_info **//****************************************************************************  Author:   Scott Pegg**  Purpose:  A debugging function that prints an INFO instance**  Notes:    **************************************************************************/void show_info(TS_INFO *info) {  printf("TS_INFO instance\n-------------\n");  printf("info->filt_cut = %f\n", info->filt_cut);  printf("info->surf_cut = %f\n", info->surf_cut);  printf("info->sphere = %d\n", info->sphere);  printf("info->sph_x = %f\n", info->sph_x);  printf("info->sph_y = %f\n", info->sph_y);  printf("info->sph_z = %f\n", info->sph_z);  printf("info->radius = %f\n", info->radius);  printf("info->box = %d\n", info->box);  printf("info->size_x = %f\n", info->size_x);  printf("info->size_y = %f\n", info->size_y);  printf("info->size_z = %f\n", info->size_z);  printf("info->sph_input = %s\n", info->sph_input);  printf("info->sph_output = %s\n", info->sph_output);  printf("info->receptor_file = %d\n", info->receptor_file);  printf("info->receptor_filename = %s\n", info->receptor_filename);}/** mark show_spheres **//****************************************************************************  Author:   Scott Pegg**  Purpose:  A debugging function that prints the list of SPHEREs**  Notes:    **************************************************************************/void show_spheres(SPHERE *spheres) {  SPHERE *temp;  int count = 0;  if (spheres == NULL) {    printf("No spheres\n");    return;  }  temp = spheres;  while (temp != NULL) {    printf("Sphere %d\n", temp);    printf("Coords = %f, %f, %f\n", temp->x, temp->y, temp->z);    printf("Radius = %f\n", temp->radius);    printf("Prev = %d\n", temp->prev);    printf("Next = %d\n", temp->next);    count++;    temp = temp->next;  }   printf("%d total spheres\n", count);}/**            printf("  atom, num: %d, h_flag: %d, chem_id: %d, vdw_id: %d, name: %s, type: %s.\n",                      mol->atom[i].number, mol->atom[i].heavy_flag, mol->atom[i].chem_id, mol->atom[i].vdw_id,                      mol->atom[i].name, mol->atom[i].type);            printf("  atom, num: %d, name: %s, type: %s, subst id: %d, segment id: %d.\n",                      mol->atom[i].number, mol->atom[i].name, mol->atom[i].type,                       mol->atom[i].subst_id, mol->atom[i].segment_id);            printf("  atom, num: %d, name: %s, type: %s, res num: %d, subst id: %d.\n",                      mol->atom[i].number, mol->atom[i].name, mol->atom[i].type,                       mol->atom[i].res_num, mol->atom[i].subst_id);**/

⌨️ 快捷键说明

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