score_dock.c

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

C
2,053 行
字号
*     Calculate intramolecular score*     3/97 te*/      if (score->intra_flag)      {        if (!molecule->segment[si].score.intra.current_flag ||          (molecule->segment[si].score.type != molecule->score.type))        {          reset_score_parts (&molecule->segment[si].score.intra);          molecule->segment[si].score.intra.current_flag = TRUE;/**         Loop from current layer to all inner layers*         3/97 te*/          for (lj = li; lj >= 0; lj--)          {/**           Loop through layer segments*             For current layer, only consider previous segments*             For inner layers, consider all segments*           3/97 te*/            for            (              slj =                (li == lj                  ? sli - 1                  : molecule->layer[lj].segment_total - 1);              slj >= 0;              slj--            )            {              sj = molecule->layer[lj].segment[slj];/**             Loop through segment atoms*             3/97 te*/              for (asi = molecule->segment[si].atom_total - 1; asi >= 0; asi--)              {                ai = molecule->segment[si].atom[asi];                for                  (asj = molecule->segment[sj].atom_total - 1; asj >= 0; asj--)                {                  aj = molecule->segment[sj].atom[asj];                  if (!score->near.flag[ai][aj])                    calc_intra_score                    (                      label,                      score,                      molecule,                      ai,                      aj,                      &molecule->segment[si].score.intra                    );                } /* End of asj loop */              } /* End of asi loop */            } /* End of slj loop */          } /* End of lj loop */        } /* End of current_flag IF block */        sum_score        (          molecule->score.type,          &molecule->score.intra,          &molecule->segment[si].score.intra        );      } /* End of intra-scoring IF block */      molecule->segment[si].score.type = molecule->score.type;      molecule->segment[si].score.total =        molecule->segment[si].score.intra.total +        molecule->segment[si].score.inter.total;    } /* End of sli loop */  } /* End of li loop */  molecule->score.total =    molecule->score.intra.total +    molecule->score.inter.total;  return molecule->score.total;}/* ////////////////////////////////////////////////////////////////// */void calc_intra_score(  LABEL		*label,  SCORE		*score,  MOLECULE	*molecule,  int		atomi,  int		atomj,  SCORE_PART	*intra){  if (molecule->score.type == CONTACT)    calc_intra_contact    (      &score->contact,      label,      molecule,      atomi,      atomj,      intra    );  else if (molecule->score.type == ENERGY)    calc_intra_energy    (      &score->energy,      label,      molecule,      atomi,      atomj,      intra    );  else if (molecule->score.type == CHEMICAL)    calc_intra_energy    (      &score->energy,      label,      molecule,      atomi,      atomj,      intra    );  else    exit (fprintf (global.outfile,      "ERROR update_score_pair: illegal score type requested\n"));}/* ////////////////////////////////////////////////////////////////// */void calc_inter_score(  LABEL		*label,  SCORE		*score,  MOLECULE	*molecule,  int		atom,  SCORE_PART	*inter){  if (molecule->score.type == CONTACT)    calc_inter_contact    (      &score->grid,      &score->bump,      &score->contact,      label,      molecule,      atom,      inter    );  else if (molecule->score.type == CHEMICAL)    calc_inter_chemical    (      &score->grid,      &score->energy,      &score->chemical,      label,      molecule,      atom,      inter    );  else if (molecule->score.type == ENERGY)    calc_inter_energy    (      &score->grid,      &score->energy,      label,      molecule,      atom,      inter    );  else if (molecule->score.type == RMSD)    calc_inter_rmsd    (      &score->grid,      molecule,      atom,      inter    );}/* ////////////////////////////////////////////////////////////////// */void sum_score(  int		score_type,  SCORE_PART	*sum,  SCORE_PART	*increment){  if (score_type == CONTACT)    sum_contact (sum, increment);  else if (score_type == ENERGY)    sum_energy (sum, increment);  else if (score_type == CHEMICAL)    sum_chemical (sum, increment);  else if (score_type == RMSD)    sum_rmsd (sum, increment);  else    exit (fprintf (global.outfile, "ERROR sum_score: unknown score type\n"));}/* ////////////////////////////////////////////////////////////////// */void output_score_info(  DOCK		*dock,  LABEL		*label,  SCORE		*score,  MOLECULE	*molecule,  LIST		*list,  int		ligand_id,  float		time){  int i;  STRING80 line;  if (global.output_volume == 't')  {    if (ligand_id == 0)    {      fprintf (global.outfile, "%s", "Result_header");      fprintf (global.outfile, " %s", "name");      if (label->flex.flag)      {        if (label->flex.multiple_anchors)          fprintf (global.outfile, " %s", "anchors");        if (label->flex.drive_flag && !label->flex.anchor_flag)          fprintf (global.outfile, " %s", "conforms");      }      if (dock->multiple_orients)      {        fprintf (global.outfile, " %s", "matches");        if (score->bump.flag)          fprintf (global.outfile, " %s", "orients");      }      for (i = 0; i < SCORE_TOTAL; i++)        if (score->type[i].flag)        {          fprintf (global.outfile, " %s", score->type[i].name);          if (score->intra_flag && score->intra_flag)            fprintf (global.outfile, " %s %s", "intra", "inter");          if (dock->multiple_orients || score->type[i].minimize)            fprintf (global.outfile, " %s", "rmsd");        }      fprintf (global.outfile, " %s\n", "time");    }    fprintf (global.outfile, "%s", "Results");    fprintf (global.outfile, " %s", molecule->info.name);    if (label->flex.flag)    {      if (label->flex.multiple_anchors)        fprintf (global.outfile, " %d", dock->anchor_total);      if (label->flex.drive_flag && !label->flex.anchor_flag)        fprintf (global.outfile, " %d", dock->conform_total);    }    if (dock->multiple_orients)    {      fprintf (global.outfile, " %d", dock->orient_total);      if (score->bump.flag)        fprintf (global.outfile, " %d", dock->score_total);    }    for (i = 1; i < SCORE_TOTAL; i++)      if (score->type[i].flag)      {        fprintf (global.outfile, " %.2f",          list->member[i][0]->score.total);        if (score->intra_flag && score->intra_flag)          fprintf (global.outfile, " %.2f %.2f",            list->member[i][0]->score.intra.total,            list->member[i][0]->score.inter.total);        if (dock->multiple_orients || score->type[i].minimize)          fprintf (global.outfile, " %.2f", list->member[i][0]->transform.rmsd);      }    fprintf (global.outfile, " %.2f\n", time);  }  else  {    fprintf (global.outfile,      "\n_______________________Docking_Results_______________________\n");    fprintf (global.outfile, "%-12s : %s\n", "Name", molecule->info.name);    fprintf (global.outfile, "%-12s : %s\n", "Description",      molecule->info.comment);    if (label->flex.flag)    {      if (label->flex.multiple_anchors)        fprintf (global.outfile, "%-50s : %10d\n", "Total anchors",          dock->anchor_total);      if (label->flex.drive_flag && !label->flex.anchor_flag)        fprintf (global.outfile, "%-50s : %10d\n", "Total conformations",          dock->conform_total);    }    if (dock->multiple_orients)    {      fprintf (global.outfile, "%-50s : %10d\n", "Orientations tried",        dock->orient_total);      if (score->bump.flag)        fprintf (global.outfile, "%-50s : %10d\n", "Orientations scored",          dock->score_total);    }    fprintf (global.outfile, "\n");    for (i = 1; i < SCORE_TOTAL; i++)      if (score->type[i].flag)      {        if (score->intra_flag || score->inter_flag)        {          sprintf (line, "Best %s%s score",            score->intra_flag              ? (score->inter_flag ? "" : "intramolecular ")              : (score->inter_flag ? "intermolecular " : ""),            score->type[i].name);          fprintf (global.outfile, "%-50s : %10.2f\n", line,            list->member[i][0]->score.total);          if (score->intra_flag && score->inter_flag)          {            sprintf (line, "  Intramolecular %s score", score->type[i].name);            fprintf (global.outfile, "%-50s : %10.2f\n", line,              list->member[i][0]->score.intra.total);            sprintf (line, "  Intermolecular %s score", score->type[i].name);            fprintf (global.outfile, "%-50s : %10.2f\n", line,              list->member[i][0]->score.inter.total);          }        }        if (dock->multiple_orients|| score->type[i].minimize)        {          sprintf (line, "RMSD of best %s scorer (A)",            score->type[i].name);          fprintf (global.outfile, "%-50s : %10.2f\n", line,            list->member[i][0]->transform.rmsd);        }        if        (          !dock->rank_ligands &&          dock->write_orients &&          !dock->rank_orients        )          fprintf (global.outfile, "%-50s : %10d\n", "Orientations written",            score->type[i].number_written);        fprintf (global.outfile, "\n");      }    fprintf (global.outfile,      "%-50s : %10.2f\n", "Elapsed cpu time (sec)", time);    fprintf (global.outfile, "\n\n");  }  fflush (global.outfile);}/* //////////////////////////////////////////////////////////////////Top score list processing routines////////////////////////////////////////////////////////////////// */void allocate_lists(  SCORE		*score,  LIST		*list,  int		length,  int		lite_flag){  int i;  list->lite_flag = lite_flag;  for (i = 0; i < SCORE_TOTAL; i++)    if (score->type[i].flag == TRUE)    {      list->total[i] = length;      allocate_list (list, i);      list->total[i] = 0;    }}/* //////////////////////////////////////////////////////////////////// */void allocate_list(  LIST		*list,  int		type){  int i;  ecalloc  (    (void **) &list->member[type],    list->total[type],    sizeof (MOLECULE *),    "molecule list",    global.outfile  );  for (i = 0; i < list->total[type]; i++)  {    ecalloc    (      (void **) &list->member[type][i],      1,      sizeof (MOLECULE),      "molecule list",      global.outfile    );    reset_molecule (list->member[type][i]);  }  list->max[type] = list->total[type];}/* //////////////////////////////////////////////////////////////////// */void reset_lists (SCORE *score, LIST *list){  int i;  for (i = 0; i < SCORE_TOTAL; i++)    if (score->type[i].flag == TRUE)      reset_list (list, i);}/* //////////////////////////////////////////////////////////////////// */void reset_list (LIST *list, int type){  int i;  for (i = 0; i < list->max[type]; i++)    reset_molecule (list->member[type][i]);  list->total[type] = 0;}/* //////////////////////////////////////////////////////////////////// */void free_lists (SCORE *score, LIST *list){  int i;  for (i = 0; i < SCORE_TOTAL; i++)    if (score->type[i].flag == TRUE)      free_list (list, i);}/* //////////////////////////////////////////////////////////////////// */void free_list (LIST *list, int type){  int i;  for (i = 0; i < list->max[type]; i++)  {    free_molecule (list->member[type][i]);    efree ((void **) &list->member[type][i]);  }

⌨️ 快捷键说明

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