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

📄 gnm.c

📁 Gauss network model方法研究蛋白质运动模式的程序
💻 C
字号:
#include <stdio.h>
#include <math.h>
#include <string.h>
 
main()
{
  char filein[40];
  FILE *fpi;
  float coor[300][3];  //put the CA coor of the protein
  int kirchhoff[300][300];  //is the kirchhoff matix
  int i,presnum;
  int resnum[300];
  char line[80];
  char test[5],test1[3];

//the following is read the CA coor of the protein
  scanf("%s\n",filein);
  printf("%s\n",filein);
  
  if((fpi=fopen(filein,"r"))==NULL)
    {printf("can not open the input file");
     exit(0);
    }
  fgets(line,80,fpi);
  presnum=0;
  while(!feof(fpi))
   {
     strncpy(test,line,4);test[4]='\0';
     strncpy(test1,line+13,2);test[2]='\0';
     if((strcmp(test,"ATOM")==0&&(strcmp(test1,"CA")==0))
       {  
          sscanf(line+28,"%f",&coor[presnum][0]);
          sscanf(line+38,"%f",&coor[presnum][1]);
          sscanf(line+46,"%f",&coor[presnum][2]);
          sscanf(line+22,"%d",&resnum[presnum]);
          presnum++;
        }  
      fgets(line,80,fpi);
    }
 
//the following is calculating the Kirchhoff matix 
  
  for(i=0;i<presnum;i++)
    {
      for(j=i+1;j<+presnum;j++)
         {
           dist=sqrt((coor[j][0]-coor[i][0])*(coor[j][0]-coor[i][0])+(coor[j][1]-coor[i][1])*(coor[j][1]-coor[i][1])+(coor[j][2]-coor[i][2])*(coor[j][2]-coor[i][2]));
            if(dist<=7)
              {kirchhoff[i][j]=-1;}
            else
              {kirchhoff[i][j]=0;}
           }
     }
  for(i=0;i<=presnum;i++)
    {
      kirchhoff[i][i]=0;
      for(j=0;j<=presnum;j++)
       {
         if(j!=i)
           {kirchhoff[i][i]=kirchhoff[i][i]-kirchhoff[i][j];}
        }    
     }

//the following is cal the eigntors and eignvectors of the matix    

⌨️ 快捷键说明

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