240 cell[0] = cell[1] = cell[2] = 1.0;
241 alpha = beta = gamma = 90.0;
242 name[0] = title[0] =
'\0';
247 if(!fgets(buffer,160,fp))
return(
NULL);
250 if(strlen(buffer) >= 28)
253 strncpy(code,buffer+22,6);
257 if(strlen(buffer) >= 62)
260 sscanf(buffer+38,
"%lf%lf%lf",&cell[0],&cell[1],&cell[2]);
264 if(!fgets(buffer,160,fp))
return(
NULL);
267 if(strlen(buffer) >= 45)
270 sscanf(buffer+21,
"%lf%lf%lf",&alpha,&beta,&gamma);
274 if(!fgets(buffer,160,fp))
return(
NULL);
277 sscanf(buffer,
"%d%d",natom,&orthonormal);
278 strcpy(name,buffer+9);
281 if(!fgets(buffer,160,fp))
return(
NULL);
284 sscanf(buffer+4,
"%d",&nocharges);
285 if(nocharges != 1) nocharges = 0;
286 strcpy(title,buffer+7);
289 for(i=0; i < *natom; i++)
292 if(!fgets(buffer,160,fp))
return(cssr);
314 p->link[0] = p->link[1] = p->link[2] = p->link[3] =
315 p->link[4] = p->link[5] = p->link[6] = p->link[7] = 0;
317 sscanf(buffer,
"%d%s%lf%lf%lf%d%d%d%d%d%d%d%d",&p->atnum,
331 sscanf(buffer+73,
"%lf",&p->charge);
335 sscanf(buffer+83,
"%d",&p->group);
385 cell[0] = cell[1] = cell[2] = 1.0;
386 alpha = beta = gamma = 90.0;
387 name[0] = title[0] =
'\0';
392 if(!fgets(buffer,160,fp))
return(
NULL);
395 if(strlen(buffer) >= 28)
398 strncpy(code,buffer+22,6);
402 if(strlen(buffer) >= 62)
405 sscanf(buffer+38,
"%lf%lf%lf",&cell[0],&cell[1],&cell[2]);
409 if(!fgets(buffer,160,fp))
return(
NULL);
412 if(strlen(buffer) >= 45)
415 sscanf(buffer+21,
"%lf%lf%lf",&alpha,&beta,&gamma);
419 if(!fgets(buffer,160,fp))
return(
NULL);
422 sscanf(buffer,
"%d%d",natom,&orthonormal);
423 strcpy(name,buffer+9);
426 if(!fgets(buffer,160,fp))
return(
NULL);
429 sscanf(buffer+4,
"%d",&nocharges);
430 if(nocharges != 1) nocharges = 0;
431 strcpy(title,buffer+7);
434 for(i=0; i < *natom; i++)
436 if(!fgets(buffer,160,fp))
return(pdb);
460 sscanf(buffer,
"%d%s%lf%lf%lf%d%d%d%d%d%d%d%d",&p->atnum,
473 strcpy(p->record_type,
"ATOM ");
475 strcpy(p->resnam,
"ATM ");
476 strcpy(p->insert,
" ");
477 strcpy(p->chain,
" ");
483 sscanf(buffer+73,
"%lf",&p->bval);
525 blOrtho(cell,alpha,beta,gamma,matrix,isw,ncode);
528 for(p=cssr;p;
NEXT(p))
538 tempx = p->
x * matrix[0][0] +
539 p->
y * matrix[0][1] +
541 tempy = p->
x * matrix[1][0] +
542 p->
y * matrix[1][1] +
544 tempz = p->
x * matrix[2][0] +
545 p->
y * matrix[2][1] +
586 blOrtho(cell,alpha,beta,gamma,matrix,isw,ncode);
591 tempx = p->
x * matrix[0][0] +
592 p->
y * matrix[0][1] +
594 tempy = p->
x * matrix[1][0] +
595 p->
y * matrix[1][1] +
597 tempz = p->
x * matrix[2][0] +
598 p->
y * matrix[2][1] +
671 if(ncode==0) ncode = 1;
675 sina = (
REAL)sin((
double)alpha);
676 cosa = (
REAL)cos((
double)alpha);
677 sinb = (
REAL)sin((
double)beta);
678 cosb = (
REAL)cos((
double)beta);
679 sing = (
REAL)sin((
double)gamma);
680 cosg = (
REAL)cos((
double)gamma);
681 cosbs = (cosa*cosg-cosb)/(sina*sing);
682 sinbs = sqrt(1.0-cosbs*cosbs);
683 cosas = (cosg*cosb-cosa)/(sinb*sing);
684 sinas = sqrt(1.0-cosas*cosas);
685 cosgs = (cosa*cosb-cosg)/(sina*sinb);
686 sings = sqrt(1.0-cosgs*cosgs);
701 ro[1][2] = -c*sinb*cosas;
704 ro[2][2] = c*sinb*sinas;
710 ro[1][0] = -a*sing*cosbs;
713 ro[2][0] = a*sing*sinbs;
719 ro[1][1] = -b*sina*cosgs;
722 ro[2][1] = b*sina*sings;
745 ro[0][0] = a*sinb*sings;
748 ro[1][0] = -a*sinb*cosgs;
763 amatrx[j][i] = rf[j][i];
765 amatrx[j][i] = ro[j][i];
Defines for CSSR handling.
void blNormaliseCSSR(CSSR *cssr, REAL cell[3], REAL alpha, REAL beta, REAL gamma)
void blPadterm(char *string, int length)
void blOrtho(REAL cell[3], REAL alpha, REAL beta, REAL gamma, REAL amatrx[3][3], int isw, int ncode)
PDB * blReadCSSRasPDB(FILE *fp, int *natom)
CSSR * blReadCSSR(FILE *fp, int *natom, char *name, char *title)
Include file for matrix operations.
Header file for general purpose routines.
System-type variable type definitions.
Type definitions for maths.
void blInvert33(REAL s[3][3], REAL ss[3][3])
void blNormalisePDB(PDB *pdb, REAL cell[3], REAL alpha, REAL beta, REAL gamma)