CCL Home Page
Up Directory CCL csdpdb
/* converter from .dat file, from CSD to .ent file
   Francois Savary, University of Geneva
*/

#include 
#include 
#include 
#include 
#include 
#define SQR(a) (a)*(a)

FILE *open_file(char buffer[101],char type[5]);
char* get_name(char text[]);
char buffer[101],dumm[101],refcode[9],txtinfo[101],symetrypos[101],
     radiusvalue[101],nomat[250][6];
long sys,adat,nopr,nrad,nat,nsat,year,cella,cellb,cellc,cellA,cellB,cellC
     ,preca,precb,precc,precA,precB,precC,nline,nbat,nrfac,nrem,ndis,nerr
     ,nsymline,nradline,ntxtline;
float x[250],y[250],z[250],rcov[250];
void ortho(float x[250],float y[250],float z[250],long cella,long cellb,
	      long cellc,long cellA,long cellB,long cellC, long nbat);
void writepdb(char nomat[250][6],float x[250],float y[250],
	            float z[250], char refcode[9]);


static char rcovlab[98][3]={
" H","H1","H2","H3","NE"," F"," O","O1","O2","O3","O4"," N",
" C","C1","C2","C3","C4"," B","BE","HE","AR","CL"," S",
" P","SI","KR","BR","NI","CO","SE","MN","FE","CU","AL","CR","AS","GE",
" V","LI","RU","ZN","RH","GA","OS","IR","TC","RE","PD",
" W","PT","MO","XE","TI"," I","NB","TA","AU","AG","MG","TE","SB","SN",
" U","IN","SC","HF","AT","ZR","BI","PO","PB","TH","CD","HG","NA","LU",
"TM","ER","HO","DY","TB","GD","SM"," Y","PM","ND","TH","CE","PR","LA",
"CA","YB","EU","SR","BA"," K","RB","CS"};

static float rcovval[98]={
0.32,0.32,0.32,0.32,0.71,0.72,0.73,0.73,0.73,0.73,0.73,0.75,0.77,0.77,
0.77,0.77,0.77,0.82,0.90,0.93,0.98,0.99,1.02,1.00,1.11,1.12,1.14,1.15,
1.16,1.16,1.17,1.17,1.17,1.18,1.18,1.20,1.22,1.22,1.23,1.25,1.25,
1.25,1.26,1.26,1.27,1.27,1.28,1.28,1.30,1.30,1.30,1.31,1.32,1.33,
1.34,1.34,1.34,1.34,1.36,1.36,1.40,1.41,1.42,1.44,1.44,1.44,1.45,
1.45,1.46,1.46,1.47,1.48,1.48,1.49,1.54,1.56,1.56,1.57,1.58,1.59,
1.59,1.61,1.62,1.62,1.63,1.64,1.65,1.65,1.65,1.69,1.74,1.74,1.85,
1.91,1.98,2.03,2.16,2.35};


void main(void)
{
  register int i,j,k;
  char blank[21];
  FILE *inp;
  strcpy(buffer,get_name("nom input file : "));
  inp=open_file(buffer,"r");
  strcpy(blank,"                   ");
  while (fgets(buffer,100,inp))
    {
    sscanf(buffer,"%1c",dumm);
    if(!(strncmp(dumm,"#",1)))
      {
    sscanf(buffer+1,"%8c",refcode);
    sscanf(buffer+9,"%1c",dumm);
    sscanf(dumm,"%ld",&sys);strcpy(dumm,blank);
    sscanf(buffer+11,"%6c",dumm);
    sscanf(dumm,"%ld",&adat);strcpy(dumm,blank);
    sscanf(buffer+26,"%3c",dumm);
    sscanf(dumm,"%ld",&nrfac);strcpy(dumm,blank);
    sscanf(buffer+29,"%3c",dumm);
    sscanf(dumm,"%ld",&nrem);strcpy(dumm,blank);
    sscanf(buffer+32,"%3c",dumm);
    sscanf(dumm,"%ld",&ndis);strcpy(dumm,blank);
    sscanf(buffer+35,"%3c",dumm);
    sscanf(dumm,"%ld",&nerr);strcpy(dumm,blank);
    sscanf(buffer+38,"%3c",dumm);
    sscanf(dumm,"%ld",&nopr);strcpy(dumm,blank);
    sscanf(buffer+41,"%3c",dumm);
    sscanf(dumm,"%ld",&nrad);strcpy(dumm,blank);
    sscanf(buffer+44,"%3c",dumm);
    sscanf(dumm,"%ld",&nat);strcpy(dumm,blank);
    sscanf(buffer+47,"%3c",dumm);
    sscanf(dumm,"%ld",&nsat);strcpy(dumm,blank);
    sscanf(buffer+78,"%2c",dumm);
    sscanf(dumm,"%ld",&year);strcpy(dumm,blank);
    fgets(buffer,100,inp);
    sscanf(buffer,"%6c",dumm);
    sscanf(dumm,"%ld",&cella);strcpy(dumm,blank);
    sscanf(buffer+6,"%6c",dumm);
    sscanf(dumm,"%ld",&cellb);strcpy(dumm,blank);
    sscanf(buffer+12,"%6c",dumm);
    sscanf(dumm,"%ld",&cellc);strcpy(dumm,blank);
    sscanf(buffer+18,"%6c",dumm);
    sscanf(dumm,"%ld",&cellA);strcpy(dumm,blank);
    sscanf(buffer+24,"%6c",dumm);
    sscanf(dumm,"%ld",&cellB);strcpy(dumm,blank);
    sscanf(buffer+30,"%6c",dumm);
    sscanf(dumm,"%ld",&cellC);strcpy(dumm,blank);
    sscanf(buffer+36,"%1c",dumm);
    sscanf(dumm,"%d",&preca);strcpy(dumm,blank);
    sscanf(buffer+37,"%1c",dumm);
    sscanf(dumm,"%d",&precb);strcpy(dumm,blank);
    sscanf(buffer+38,"%1c",dumm);
    sscanf(dumm,"%d",&precc);strcpy(dumm,blank);
    sscanf(buffer+39,"%1c",dumm);
    sscanf(dumm,"%d",&precA);strcpy(dumm,blank);
    sscanf(buffer+40,"%1c",dumm);
    sscanf(dumm,"%d",&precB);strcpy(dumm,blank);
    sscanf(buffer+41,"%1c",dumm);
    sscanf(dumm,"%d",&precC);strcpy(dumm,blank);
    nline=(nrfac+nrem+ndis+nerr) %80;
    if (nline !=0) {ntxtline=(nrfac+nrem+ndis+nerr) / 80 +1;}
    else {ntxtline=(nrfac+nrem+ndis+nerr) / 80;};
    for (i=0;i4) strcpy(nom+4,"\0");

   fprintf(out,"ATOM   %4d %4s NUL     0    %8.3f%8.3f%8.3f\n",
	      i+1,nom,x[i],y[i],z[i]);

    j=0;
    while (1)
    {
     if (strstr(nom,rcovlab[j]))
     {
      rcov[i]=rcovval[j];
      break;
     }
     j++;
    }


 }


  for (i=0;i
  
Modified: Mon May 2 16:00:00 1994 GMT
Page accessed 6808 times since Sat Apr 17 21:32:32 1999 GMT