*** Imakefile Thu Apr 28 22:10:16 2005 --- Imakefile Fri May 20 12:24:49 2005 *************** *** 121,132 **** infile.h repres.c repres.h tokens.c cif_fract.c cif_fract.h cif.c \ cif.h cif_ctonum.c cif_ctonum.h cif_stx.c \ multiple.h multiple.c vector.h vector.c \ ! wbrotate.c wbrotate.c langsel.h langsel.c OBJS = rasmol.o molecule.o abstree.o cmndline.o command.o transfor.o \ render.o repres.o x11win.o pixutils.o outfile.o script.o \ infile.o tokens.o cif_fract.o cif.o cif_ctonum.o cif_stx.o \ ! multiple.o vector.o wbrotate.o langsel.o # Previous Risc/Os definition # LDLIBS = -lm -lXinput $(XLIB) --- 121,134 ---- infile.h repres.c repres.h tokens.c cif_fract.c cif_fract.h cif.c \ cif.h cif_ctonum.c cif_ctonum.h cif_stx.c \ multiple.h multiple.c vector.h vector.c \ ! wbrotate.c wbrotate.c langsel.h langsel.c \ ! symtry.h symtry.c getsymop.h getsymop.c OBJS = rasmol.o molecule.o abstree.o cmndline.o command.o transfor.o \ render.o repres.o x11win.o pixutils.o outfile.o script.o \ infile.o tokens.o cif_fract.o cif.o cif_ctonum.o cif_stx.o \ ! multiple.o vector.o wbrotate.o langsel.o \ ! symtry.o getsymop.o # Previous Risc/Os definition # LDLIBS = -lm -lXinput $(XLIB) *** Makefile.in Tue Feb 3 13:24:45 2004 --- Makefile.in Fri May 20 12:29:18 2005 *************** *** 120,141 **** INCS = abstree.h cmndline.h command.h font.h graphics.h infile.h \ molecule.h outfile.h pixutils.h rasmol.h render.h repres.h \ script.h tokens.h transfor.h cif.h cif_ctonum.h \ ! multiple.h vector.h wbrotate.h SRCS = abstree.c cmndline.c command.c infile.c molecule.c outfile.c \ pixutils.c render.c repres.c script.c transfor.c tokens.c \ cif_fract.c cif.c cif_ctonum.c cif_stx.c \ ! multiple.c vector.c wbrotate.c OBJS = abstree.o cmndline.o command.o infile.o molecule.o outfile.o \ pixutils.o render.o repres.o script.o transfor.o tokens.o \ cif_fract.o cif.o cif_ctonum.o cif_stx.o \ ! multiple.o vector.o wbrotate.o TOBJS = abstree.to cmndline.to command.to infile.to molecule.to outfile.to \ pixutils.to render.to repres.to script.to transfor.to tokens.to \ cif_fract.to cif.to cif_ctonum.to cif_stx.to \ ! multiple.to vector.o wbrotate.to X11INCS = $(INCS) bitmaps.h --- 120,141 ---- INCS = abstree.h cmndline.h command.h font.h graphics.h infile.h \ molecule.h outfile.h pixutils.h rasmol.h render.h repres.h \ script.h tokens.h transfor.h cif.h cif_ctonum.h \ ! multiple.h vector.h wbrotate.h symtry.h getsymop.h SRCS = abstree.c cmndline.c command.c infile.c molecule.c outfile.c \ pixutils.c render.c repres.c script.c transfor.c tokens.c \ cif_fract.c cif.c cif_ctonum.c cif_stx.c \ ! multiple.c vector.c wbrotate.c symtry.c getsymop.c OBJS = abstree.o cmndline.o command.o infile.o molecule.o outfile.o \ pixutils.o render.o repres.o script.o transfor.o tokens.o \ cif_fract.o cif.o cif_ctonum.o cif_stx.o \ ! multiple.o vector.o wbrotate.o symtry.o getsymop.o TOBJS = abstree.to cmndline.to command.to infile.to molecule.to outfile.to \ pixutils.to render.to repres.to script.to transfor.to tokens.to \ cif_fract.to cif.to cif_ctonum.to cif_stx.to \ ! multiple.to vector.o wbrotate.to symtry.to getsymop.to X11INCS = $(INCS) bitmaps.h *************** *** 334,339 **** --- 334,344 ---- langsel.to: langsel.c rasmol.h graphics.h langsel.h $(CC) -c $(CFLAGS) -I- -I./txt -I. langsel.c -o langsel.to + symtry.o: symtry.h symtry.c getsymop.h getsymop.c + $(CC) -c $(CFLAGS) symtry.c + + symtry.to: symtry.h symtry.c getsymop.h getsymop.c + $(CC) -c $(CFLAGS) -I- -I./txt -I. symtry.c -o symtry.to esv: $(X11SRCS) $(X11INCS) cc -systype bsd43 -O3 -Olimit 600 -s -o rasmol \ *** getsymop.c Wed Dec 31 19:00:00 1969 --- getsymop.c Fri May 20 12:32:56 2005 *************** *** 0 **** --- 1,139 ---- + #include "rasmol.h" + #ifdef IBMPC + #include + #include + #endif + #ifdef APPLEMAC + #include + #endif + #ifndef sun386 + #include + #endif + + #include + #if defined(IBMPC) || defined(VMS) || defined(APPLEMAC) + #include "string_case.h" + #else + #include + #endif + #include + #include + #include + + #define SYMTRY + #include "getsymop.h" + #include "symtry.h" + #include "infile.h" + #include "molecule.h" + #include "command.h" + #include "cmndline.h" + #include "langsel.h" + #include "cif.h" + #include "cif_fract.h" + #include "cif_ctonum.h" + + FILE *infile; + char *title; + Long ftarget; + + /* + typedef struct _Mtx { + double theMatrix[12]; + char sign[12]; + int size = 12; + } Mtx; + */ + + void GetMatrix(Long _offset) + { + int x,y,m,n; + + fseek(infile,_offset+2,SEEK_SET); /*moves to first matrix element*/ + for ( m=0; mrefno = SimpleAtomType(Record+13); - ptr->xorg = dx/4; ptr->yorg = dy/4; ptr->zorg = -dz/4; ptr->xtrl = (short) (10*(dx-4*ptr->xorg)); ptr->ytrl = (short) (10*(dy-4*ptr->yorg)); ptr->ztrl = (short) (10*(-dz-4*ptr->zorg)); - if( heta ) ptr->flag |= HeteroFlag; ProcessAtom( ptr ); --- 712,723 ---- *************** *** 854,864 **** return; } int LoadPDBMolecule( FILE *fp, int flag ) { register FeatEntry __far *ptr; register int ignore, notCIF; ! if (UseCIF) return (LoadCIFMolecule (fp)); --- 853,871 ---- return; } + + + + + int LoadPDBMolecule( FILE *fp, int flag ) { register FeatEntry __far *ptr; register int ignore, notCIF; ! register Chain __far *chain; ! register Group __far *group; ! register RAtom __far *aptr; ! if (UseCIF) return (LoadCIFMolecule (fp)); *************** *** 956,963 **** break; case('M'): if( !strncmp("MODE",Record,4) ) ! NMRModel = (int)ReadValue(10,5); ! flag = True; break; case('S'): if( !strncmp("SHEE",Record,4) ) --- 963,988 ---- break; case('M'): if( !strncmp("MODE",Record,4) ) ! { ! NMRModel = (int)ReadValue(10,5); ! }else if(!strncmp("MTRIX",Record,5) ) ! { ! int row=(int)ReadValue(5,1); ! int SymOp=(int)ReadValue(9,1); ! Info.matrix[SymOp-1][row-1][0]=ReadDecValue(10,10); ! Info.matrix[SymOp-1][row-1][1]=ReadDecValue(20,10); ! Info.matrix[SymOp-1][row-1][2]= ReadDecValue(30,10); ! ! Info.transmatrix[SymOp-1][row-1]=ReadDecValue(45,10); ! if(Info.NumAsymOp) ! { ! if(SymOp>Info.NumAsymOp) ! Info.NumAsymOp=SymOp; ! } ! else ! Info.NumAsymOp=SymOp; ! } ! flag = True; break; case('S'): if( !strncmp("SHEE",Record,4) ) *************** *** 1019,1028 **** break; } } ! if( Database ) ! strcpy(Info.filename,DataFileName); ! if( FeatList ) ProcessFeatures(); DataFileFormat = FormatPDB; return True; } --- 1044,1072 ---- break; } } ! /*CHAN*/ if( Database ) ! { ! ParseDict(Info.spacegroup); ! UpdateInfoAsy(); ! strcpy(Info.filename,DataFileName); ! if(Info.NumOpr>0) ! { ! ApplyOperator(); /* Apply OPerations*/ ! ! if(Info.Asbondcount>0) ! BondUpdate(0); ! } ! ! } ! if( FeatList ) ! { ! if(Info.NumOpr>0) ! UpdateSymFeature(FeatList); ! ProcessFeatures(); ! } ! ! DataFileFormat = FormatPDB; return True; } *************** *** 3057,3062 **** --- 3101,3107 ---- fprintf(DataFile," 1.00%6.2f\n",aptr->temp/100.0); ch = chain->ident; + printf("Chain Identifier %c",chain->ident); prev = group; } *** molecule.c Tue Apr 26 22:32:56 2005 --- molecule.c Fri May 20 12:20:58 2005 *************** *** 726,731 **** --- 726,732 ---- if( heta ) { HetaGroupCount++; + CurGroup->flag|=HeteroFlag; /*Added 26 July 2004 */ if( HMinMaxFlag ) { if( serno > MaxHetaRes ) { MaxHetaRes = serno; *************** *** 822,827 **** --- 823,829 ---- ptr->fxorg = 0; ptr->fyorg = 0; ptr->fzorg = 0; + ptr->numbonds=0; return ptr; } *************** *** 1901,1906 **** --- 1903,1910 ---- /* Replace Long, Double & Triple Bonds! */ InsertBonds(&CurMolecule->blist,list); + if(Info.NumOpr>0) + /* BondUpdate(1); CHANGE Jul 05 2004 Sagar*/ if( info ) { InvalidateCmndLine(); *************** *** 1908,1913 **** --- 1912,1927 ---- /* "Number of Bonds ....... " */ WriteString(buffer); } + Bond __far *bptr; + + /* ForEachBond{ + bptr->srcatom->x=0; + bptr->srcatom->y=0; + bptr->srcatom->z =0; + bptr->dstatom->x=0; + bptr->dstatom->y=0; + bptr->dstatom->z =0; + }*/ } *** molecule.h Mon Apr 25 08:31:12 2005 --- molecule.h Fri May 20 12:20:58 2005 *************** *** 93,98 **** --- 93,102 ---- #define MINRES 54 #define CIS 90 /* max. omega-angle to form a cis-peptide bond */ + /*CHANGE*/ + #define MaxOpr 8 + #define OprCount 1 + #define IsAmino(x) ((x)<=23) #define IsAminoNucleo(x) ((x)<=42) *************** *** 192,201 **** struct _Atom __far *anext; /* Linked list of atoms */ struct _Atom __far *bucket; /* Sphere Y-Bucket */ struct _Atom __far *next; /* Active Object List */ Long xorg, yorg, zorg; /* World Co-ordinates */ Long fxorg, fyorg, fzorg; /* Offsets for rotations */ Long x, y, z; /* Image Co-ordinates */ - /* also used as scratch */ short xtrl, ytrl, ztrl; /* Trailing Bits */ short radius; /* World Radius */ short temp; /* Temperature Factor */ --- 196,205 ---- struct _Atom __far *anext; /* Linked list of atoms */ struct _Atom __far *bucket; /* Sphere Y-Bucket */ struct _Atom __far *next; /* Active Object List */ + struct _Atom __far *copy[MaxOpr]; /*Storing pointers to all copies of this atom*/ Long xorg, yorg, zorg; /* World Co-ordinates */ Long fxorg, fyorg, fzorg; /* Offsets for rotations */ Long x, y, z; /* Image Co-ordinates */ short xtrl, ytrl, ztrl; /* Trailing Bits */ short radius; /* World Radius */ short temp; /* Temperature Factor */ *************** *** 210,216 **** short mbox; /* Shadow Casting NOnce */ short model; /* Atom Model Number */ short visited; /* For bond rotation */ ! short nbonds; /* For bond rotation */ struct _Atom __far *bonds[MaxBonds]; void *surfbonds; /* Surface bonds list */ } RAtom; --- 214,221 ---- short mbox; /* Shadow Casting NOnce */ short model; /* Atom Model Number */ short visited; /* For bond rotation */ ! short nbonds; /* For bond rotation */ ! int numbonds; struct _Atom __far *bonds[MaxBonds]; void *surfbonds; /* Surface bonds list */ } RAtom; *************** *** 227,232 **** --- 232,238 ---- short col; /* Bond Colour */ short flag; /* Database flags */ char altl; /* Bond Alternate Loc */ + int pdbbondflag; /* If bond is originally in PDB or calculated*/ } Bond; typedef struct _SurfBond { *************** *** 270,275 **** --- 276,282 ---- Group __far *glist; /* Linked list of groups */ Bond __far *blist; /* Linked list of back bonds */ char ident; /* Chain identifier */ + char copy[5]; /* Array of Pointer to identity of copy*/ Byte model; /* NMR Model / Symmetry */ } Chain; *************** *** 349,366 **** double vecf2o[3], veco2f[3], matf2o[3][3], mato2f[3][3]; double cell[6]; Long bondcount; Long srfbondcount; int chaincount; int ssbondcount; int hbondcount; int cisbondcount; ! int structsource; int laddercount; int helixcount; int turncount; } InfoStruct; #ifdef APPLEMAC --- 356,388 ---- double vecf2o[3], veco2f[3], matf2o[3][3], mato2f[3][3]; double cell[6]; + double matrix[5][3][3]; + double transmatrix[5][3]; Long bondcount; Long srfbondcount; + Long NumAsymOp; int chaincount; int ssbondcount; int hbondcount; int cisbondcount; ! int NumOpr; int structsource; int laddercount; int helixcount; int turncount; + /*Original container of Assymetric data*/ + Long Asrfbondcount; + Long Asatomcount; + Long Ashetatomcount; + Long Asbondcount; + Long Asgroupcount; + int Aschaincount; + int Asssbondcount; + int Ashbondcount; + int Ascisbondcount; + int Asbackbondcount; + } InfoStruct; #ifdef APPLEMAC *** symop.dic Wed Dec 31 19:00:00 1969 --- symop.dic Fri May 20 12:33:54 2005 *************** *** 0 **** --- 1,83 ---- + * + P21 + 1 + -1.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + -1.0 + 0.000 + 0.500 + 0.000 + + * + P212121 + 3 + 1.0 + 0.0 + 0.0 + 0.0 + -1.0 + 0.0 + 0.0 + 0.0 + -1.0 + 0.500 + 0.500 + 0.000 + -1.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + -1.0 + 0.000 + 0.500 + 0.500 + -1.0 + 0.0 + 0.0 + 0.0 + -1.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.500 + 0.000 + 0.500 + + * + H3 + 2 + 0.0 + -1.0 + 0.0 + 1.0 + -1.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.000 + 0.000 + 0.000 + -1.0 + 1.0 + 0.0 + -1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.000 + 0.000 + 0.000 *** symtry.c Wed Dec 31 19:00:00 1969 --- symtry.c Fri May 20 12:32:36 2005 *************** *** 0 **** --- 1,787 ---- + /*Steve and Sagar July 22 2004*/ + /* Last modified August 16 04*/ + #include "rasmol.h" + #ifdef IBMPC + #include + #include + #endif + #ifdef APPLEMAC + #include + #endif + #ifndef sun386 + #include + #endif + + #include + #if defined(IBMPC) || defined(VMS) || defined(APPLEMAC) + #include "string_case.h" + #else + #include + #endif + #include + #include + #include + + #define SYMTRY + #include "symtry.h" + #include "infile.h" + #include "molecule.h" + #include "command.h" + #include "cmndline.h" + #include "langsel.h" + #include "cif.h" + #include "cif_fract.h" + #include "cif_ctonum.h" + #include "getsymop.h" + #define grouppool 8 + #define NEWCHAIN ((!curchain) || (chain->ident)!=(ident)) + #define ForEachAtom for(chain=Database->clist;chain;chain=chain->cnext) \ + for(group=chain->glist;group;group=group->gnext) \ + for(aptr=group->alist;aptr;aptr=aptr->anext) /* Access each atom */ + #define ForEachBond for(bptr=Database->blist;bptr;bptr=bptr->bnext) /* Access each bond */ + #define ForEachHBond for(hptr=Database->hlist;hptr;hptr=hptr->hnext) /* Access each Hydrogen Bond */ + #define ForEachBack for(chain=Database->clist;chain;chain=chain->cnext) \ + for(bptr=chain->blist;bptr;bptr=bptr->bnext) /* Access each Back Bond */ + #define ForEachSSBond for(sptr=Database->slist;sptr;sptr=sptr->hnext) /* Access each SSBond */ + #define ForEachSBBond for(sbptr=Database->sblist;sbptr;sbptr=sbptr->sbnext) /* Access each SB Bond */ + #define true 1 + #define false 0 + + + RAtom __far *Append(Long*, RAtom __far* , RAtom __far*); + Group __far *ProcessGroupSS(Group __far*,Chain __far*,Group __far*); + Chain __far *ProcessChainSS(Chain __far*); + + int OPERATORNUMBER=1; + Long AtomSerialNumber=0; + Long GroupSerialNumber=0; + Long GroupSecondarySerno=0; + char ChainIdent=65; + int OwnIdentityFlag; + typedef struct { + int init, term; + char chain; + char type; + } FeatEntry; + + #define FeatSize 32 + typedef struct _Feature { + struct _Feature __far *fnext; + FeatEntry data[FeatSize]; + int count; + } Feature; + Feature __far *UpdateSymFeature(Feature __far *); + + void ApplyOperator() + { + /*Allocating all variables*/ + + int breaknow=false; /* Used to break the loops accessing the atoms when app. number of atoms have been processed*/ + register Bond __far *bptr; + register Chain __far *chain; + register Group __far *group; + register RAtom __far *aptr; + register char ident=0; /* Identity of the current chain*/ + register Long CurSerial=0; /* Current Serial Number of Group*/ + register RAtom __far *curatom; + register Group __far *curgroup; + register Chain __far *curchain; + register Group __far *ptr; + Long* newcoord=malloc(3*sizeof(Long)); /* New coordinates formed after operation */ + Long* oldcoord=malloc(3*sizeof(Long)); /* Old coordinates */ + int x=1,y=0; + int Starter=true; /* Marking the first operation */ + + /*Initialization of Chain Identifier*/ + + if(OPERATORNUMBER==1) + for(chain=Database->clist;chain;chain=chain->cnext) + { + if(chain->ident!=' ') + { + chain->ident=ChainIdent++; //Assign chain identities to each starting chain + } + } + + + /*Getting the last item of each linked list*/ + + ForEachAtom + { + curchain=chain; + curgroup=group; + curatom=aptr; + } + /*initialization*/ + AtomSerialNumber=curatom->serno; + GroupSerialNumber=curgroup->serno; + GroupSecondarySerno=curgroup->sserno; + CurSerial=Database->clist->glist->serno; + + /*Traversing Each Atom, Group and Chain*/ + int ChainChange; + for(chain=Database->clist;chain;chain=chain->cnext) + { + if(breaknow==true){break;} + ChainChange=true; + for(group=chain->glist;group;group=group->gnext) + { + if(breaknow==true){break;} + for(aptr=group->alist;aptr;aptr=aptr->anext) + { + oldcoord[0]=aptr->xorg; + oldcoord[1]=aptr->yorg; + oldcoord[2]=aptr->zorg; + + /*PERFORM ALL SYMMETRY OPERATIONS AND GET NEW ATOM*/ + newcoord=(Long*)(GetNewCoordinate(oldcoord,Info.spacegroup)); /*Get the new coordinate*/ + register RAtom __far *newatom; + newatom=Append(newcoord,aptr,curatom); + aptr->copy[OPERATORNUMBER-1]=newatom; /*COPY STORED IN THE ATOM*/ + + if(CurSerial!=group->serno || Starter) + { + CurSerial=group->serno; + register Group __far *newgroup; + if(ChainChange) + { + GroupSerialNumber=0; + GroupSecondarySerno=0; + } + newgroup=ProcessGroupSS(group,chain,curgroup); + + if(ChainChange) + { + curgroup->gnext=NULL; + curchain->cnext=ProcessChainSS(chain); + curchain=curchain->cnext; + curchain->cnext=NULL; + curchain->glist=newgroup; + curgroup=curchain->glist; + curgroup->gnext=NULL; + } + else{ + /*FOR THE NEW GROUP*/ + curgroup->gnext=newgroup; + + curgroup=curgroup->gnext; + } + Starter=false; + curatom->anext=NULL; + curgroup->alist=newatom; + + curatom=curgroup->alist; + curatom->anext=NULL; + } + + else{ + curatom->anext=newatom; + curatom=curatom->anext; + curatom->anext=NULL; + } + + ident=chain->ident; + if(x==(Info.Asatomcount+Info.Ashetatomcount)) + { + breaknow=true; + break; + } + x++; + ChainChange=false; + } + } + } + /*Update different type of bonds */ + HBondUpdate(); + BackBondUpdate(); + SSBondUpdate(); + SBBondUpdate(); + if((++OPERATORNUMBER)<=Info.NumOpr) + { + ApplyOperator(); + } + + } + + double** GetRotationMatrice(char spacename[]) + { + /*Get Matrices from getsymop.c and return them to GetNewCoordinate mathod*/ + int rcount=0; + int i=0,j=0; + double** trip; + static double rotation[3][3]; + for(i=0;i<3;i++) + for(j=0;j<3;j++) + { + rotation[i][j]=rsymarray[(OPERATORNUMBER-1)*9+(rcount++)]; /*rsymarray updated in getsymop.c*/ + } + trip=(double**)rotation; + return trip; + } + + + double* GetTransMatrice(char spacename[]) + { + + /*Get Translation Matrice from getsymop.c and return them to GetNewCoordinate*/ + int i=0; + static double trans[3]; + for(i=0;i<3;i++) + { + trans[i]=tsymarray[(OPERATORNUMBER-1)*3+i]; /*tsymarray updated in getsymop.c*/ + } + return trans; + } + + + Long* GetNewCoordinate(Long* coordinate,char spacename[]) + { + /*Multiply old coordinate with rotation and translation matrice and return new coordinates */ + double* coord=malloc(3*sizeof(double)); + double* fractional=malloc(3*sizeof(double)); + double* temp=malloc(3*sizeof(double)); + fractional=(double*)(OrthotoFrac(coordinate)); + double row; + + int i,k; /*Counters*/ + double** rotat=GetRotationMatrice(spacename); + double* trans=GetTransMatrice(spacename); + double kipp[3][3]; + for(i=0;i<9;i++) + { + kipp[(int)(i/3)][i%3]=*((double*)rotat + i); + } + temp=multiplymatrice(fractional,kipp); + + for(k=0;k<3;k++) + coord[k]=(temp[k]+trans[k]); + + free(fractional); + free(temp); + return FractoOrtho(coord); + } + + + RAtom __far *Append(Long *newxyz,RAtom __far *aptr,RAtom __far *curatom)/*RETURNS A NEW ATOM WITH REQUIRED VALUES*/ + { + /* Create a new atom and return it back */ + RAtom __far *newatom; + newatom=CreateAtom(); + newatom->xorg=newxyz[0]; + newatom->yorg=newxyz[1]; + newatom->zorg=newxyz[2]; + newatom->fxorg=aptr->fxorg; + newatom->fzorg=aptr->fyorg; + newatom->fxorg=aptr->fzorg; + newatom->serno=(++AtomSerialNumber); + newatom->radius=aptr->radius; + newatom->temp=aptr->temp; + newatom->elemno=aptr->elemno; + newatom->label=aptr->label; + newatom->col=aptr->col; + newatom->irad=aptr->irad; + newatom->mbox=aptr->mbox; + newatom->model=aptr->model; + newatom->visited=aptr->visited; + newatom->xtrl=aptr->xtrl; + newatom->ytrl=aptr->ytrl; + newatom->ztrl=aptr->ztrl; + newatom->x=aptr->x; + newatom->y=aptr->y; + newatom->z=aptr->z; + newatom->anext=NULL; + newatom->numbonds=0; + newatom->refno=aptr->refno; + newatom->flag=aptr->flag; + /* Update MinX, MinY and MinZ */ + if(newatom->flag&HeteroFlag) + HetaAtomCount++; + else + MainAtomCount++; + + if(HMinMaxFlag || MMinMaxFlag) + { + if(newatom->xorg>MaxX) + MaxX=newatom->xorg; + else if(newatom->xorgxorg; + + if(newatom->yorg>MaxY) + MaxY=newatom->yorg; + else if(newatom->yorgyorg; + + if(newatom->zorg>MaxZ) + MaxZ=newatom->zorg; + else if(newatom->zorgzorg; + } + else{ + MaxX=MinX=newatom->xorg; + MaxY=MinY=newatom->yorg; + MaxZ=MinZ=newatom->zorg; + } + + return newatom; + } + + + Group __far *ProcessGroupSS(Group __far *group,Chain __far *chain, Group __far *curgroup) + { + /* Create new group and return it */ + register Group __far *ptr; + ptr=_fmalloc(sizeof(Group)); + ptr->serno = (++GroupSerialNumber); + ptr->sserno=(++GroupSecondarySerno); + ptr->insert = group->insert; + ptr->sinsert = group->sinsert; + ptr->struc = group->struc; + ptr->flag = group->flag; + ptr->col1 = group->col1; + ptr->col2 = group->col2; + ptr->model = group->model; + ptr->refno=group->refno; + ptr->width=group->width; + ptr->gnext=NULL; + if(ptr->flag&HeteroFlag) + HetaGroupCount++; + else + MainGroupCount++; + return ptr; + } + + + double* OrthotoFrac(Long* ortho) /* Conversion from orthogonal to fractional coordinates*/ + { + double* frac=malloc(sizeof(double)*3); + double* angstorm=malloc(sizeof(double)*3); + int i=0; + angstorm[0]=(ortho[0]*1.00)/250.00; + angstorm[1]=(ortho[1]*1.00)/250.00; + angstorm[2]=(ortho[2]*1.00)/250.00; + /* Divide for 250 for Rasmol coordinates*/ + double* temp=(double*)(multiplymatrice(angstorm,Info.mato2f)); + for(i=0;i<3;i++) + { + frac[i]=temp[i]+Info.veco2f[i]; + } + + free(angstorm); + return frac; + } + + + Long* FractoOrtho(double* frac) /*Converts from Fractional to Orthogonal */ + { + double* ortho=malloc(sizeof(double)*3); + double* temp=(double*)(multiplymatrice(frac,Info.matf2o)); + int k=0; + for(k=0;k<3;k++) + ortho[k]=temp[k]+Info.vecf2o[k]; + Long* angstorm=malloc(sizeof(Long)*3); + for(k =0;k<3;k++)angstorm[k]=ortho[k]*250.00; + /*Multiply by 250 for Rasmol Coordinates */ + free(ortho); + free(temp); + return angstorm; + } + + + double* multiplymatrice(double matrice1[3],double matrice2[3][3]) /*Multiplcation of a 1 by 3 to a 3 by 3*/ + { + double *result=malloc(sizeof(double)*3); + result[0]=0; + result[1]=0; + result[2]=0; + int i,j=0; + for(j=0;j<3;j++) + { + for(i=0;i<3;i++) + { + result[j]+=matrice1[i]*matrice2[j][i]; + } + } + return result; + } + + + Chain __far *ProcessChainSS(Chain __far *chain) /* Create a new chain and return it */ + { + register Chain __far *newchain; + newchain=_fmalloc(sizeof(Chain __far)); + if(chain->ident!=' ') + { + /* For the chain identity */ + newchain->ident=ChainIdent++; + chain->copy[OPERATORNUMBER-1]=ChainIdent-1; + } + newchain->model=chain->model; + Info.chaincount++; + return newchain; + } + + + /*DIFFERENT KINDS OF BONDS */ + void BondUpdate(int flag) + { + int bcount; + if(flag==0) + bcount=Info.Asbondcount; + if(flag==1) + bcount=Info.bondcount; + register Bond __far *bptr; + register Bond __far *curbond; + RAtom __far *srcatom; + RAtom __far *dstatom; + int y=0; + register Bond __far *list; + register Bond __far *newbond; + list=(Bond __far*)0; + int x=1; + for(x=1;x<=GetTotalOpr();x++) + { + int counter=0; + ForEachBond{ + + list=bptr; + } + list->bnext=NULL; + ForEachBond{ + if(bptr->srcatom && bptr->dstatom) + { + if(bptr->srcatom->copy[x-1] && bptr->dstatom->copy[x-1]) + { + newbond=(Bond __far *)_fmalloc(sizeof(Bond)); + + newbond->srcatom=bptr->srcatom->copy[x-1]; + newbond->dstatom=bptr->dstatom->copy[x-1]; + newbond->radius=bptr->radius; + newbond->irad=bptr->irad; + newbond->aradius=bptr->aradius; + newbond->iarad=bptr->iarad; + newbond->col=bptr->col; + newbond->flag=bptr->flag; + newbond->altl=bptr->altl; + + + newbond->bnext=NULL; + list->bnext=newbond; + list=list->bnext; + list->bnext=NULL; + } + } + if(counter==bcount) + break; + counter++; + Info.bondcount++; + } + } + } + + + int GetTotalOpr() + { + return Info.NumOpr; + } + + + void HBondUpdate() + { + Long hcount=Info.Ashbondcount; + if(hcount>0) + { + register HBond __far *hptr; + register HBond __far *curbond; + RAtom __far *Carsrcatom; + RAtom __far *Cardstatom; + RAtom __far *srcatom; + RAtom __far *dstatom; + int counter=1; + int x=0; + ForEachHBond{ + + curbond=hptr; + } + + ForEachHBond{ + register HBond __far *newbond; + newbond=_fmalloc(sizeof(HBond)); + Carsrcatom=hptr->srcCA->copy[OPERATORNUMBER-1]; + Cardstatom=hptr->dstCA->copy[OPERATORNUMBER-1]; + srcatom=hptr->src->copy[OPERATORNUMBER-1]; + dstatom=hptr->dst->copy[OPERATORNUMBER-1]; + newbond->src=srcatom; + newbond->dst=dstatom; + newbond->srcCA=Carsrcatom; + newbond->dstCA=Cardstatom; + + newbond->radius=hptr->radius; + newbond->irad=hptr->irad; + newbond->aradius=hptr->aradius; + newbond->iarad=hptr->iarad; + newbond->col=hptr->col; + newbond->flag=hptr->flag; + newbond->altl=hptr->altl; + newbond->energy=hptr->offset; + newbond->hnext=NULL; + curbond->hnext=newbond; + curbond=curbond->hnext; + curbond->hnext=NULL; + + /*Add bonds to the new atom */ + /*UPDATE*/ + Info.hbondcount++; + counter++; + if(counter>hcount) + break; + } + } + } + + void SBBondUpdate() + { + Long sbcount=Info.Asrfbondcount; + if(sbcount>0) + { + register SurfBond __far *sbptr; + register SurfBond __far *curbond; + RAtom __far *srcatom; + RAtom __far *dstatom; + int counter=1; + int x=0; + ForEachSBBond + { + curbond=sbptr; + } + + ForEachSBBond + { + if(counter>sbcount) + break; + register SurfBond __far *newbond; + newbond=_fmalloc(sizeof(SurfBond)); + srcatom=sbptr->srcatom->copy[OPERATORNUMBER-1]; + dstatom=sbptr->dstatom->copy[OPERATORNUMBER-1]; + newbond->srcatom=srcatom; + newbond->dstatom=dstatom; + + newbond->sxyz=sbptr->sxyz; + newbond->wp=sbptr->wp; + newbond->w1=sbptr->w1; + newbond->w2=sbptr->w2; + newbond->u1=sbptr->u1; + newbond->t1=sbptr->t1; + newbond->u2=sbptr->u2; + newbond->t2=sbptr->t2; + newbond->col=sbptr->col; + newbond->altl=sbptr->altl; + newbond->sbnext=NULL; + curbond->sbnext=newbond; + curbond=curbond->sbnext; + curbond->sbnext=NULL; + + Info.srfbondcount++; + counter++; + } + } + + } + void BackBondUpdate() + { + int bcount=Info.Asbackbondcount; + int breaknow=false; + register Bond __far *bptr; + register Chain __far *chain; + register Bond __far *curbond; + register Bond __far *newbond; + register Chain __far *curchain; + curbond=_fmalloc(sizeof(Bond __far)); + curbond=(Bond __far*)0; + RAtom __far *srcatom; + RAtom __far *dstatom; + char ident=Database->clist->ident; + int Starter=true; + int counter=1; + + ForEachBack{ + curbond=bptr; + curchain=(Chain __far*)(chain); + } + breaknow=false; + + for(chain=Database->clist;chain;chain=chain->cnext) + { + if(breaknow==true)break; + for(bptr=chain->blist;bptr;bptr=bptr->bnext) + { + newbond = _fmalloc(sizeof(Bond)); + newbond->srcatom = bptr->srcatom->copy[OPERATORNUMBER-1]; + newbond->dstatom = bptr->dstatom->copy[OPERATORNUMBER-1]; + newbond->radius=bptr->radius; + newbond->irad=bptr->irad; + newbond->aradius=bptr->aradius; + newbond->iarad=bptr->iarad; + newbond->col=bptr->col; + newbond->flag=bptr->flag; + newbond->altl=bptr->altl; + newbond->bnext=NULL; + + if(Starter || chain->ident!=ident) + { + Starter=false; + curbond->bnext=NULL; + curchain->cnext->blist=newbond; + curbond=curchain->cnext->blist; + curchain=curchain->cnext; + curbond->bnext=NULL; + } + else{ + curbond->bnext=newbond; + curbond=curbond->bnext; + curbond->bnext=NULL; + } + counter++; + ident=chain->ident; + if(counter==bcount) + { breaknow=true; + break; + } + } + } + + } + void SSBondUpdate() + { + int sscount=Info.Asssbondcount; + if(sscount>0) + { + register HBond __far *sptr; + register HBond __far *curbond; + RAtom __far *Carsrcatom; + RAtom __far *Cardstatom; + RAtom __far *srcatom; + RAtom __far *dstatom; + int counter=1; + int x=0; + ForEachSSBond{ + + curbond=sptr; + } + + ForEachSSBond{ + register HBond __far *newbond; + newbond=_fmalloc(sizeof(HBond)); + Carsrcatom=sptr->srcCA->copy[OPERATORNUMBER-1]; + Cardstatom=sptr->dstCA->copy[OPERATORNUMBER-1]; + srcatom=sptr->src->copy[OPERATORNUMBER-1]; + dstatom=sptr->dst->copy[OPERATORNUMBER-1]; + newbond->src=srcatom; + newbond->dst=dstatom; + newbond->srcCA=Carsrcatom; + newbond->dstCA=Cardstatom; + + newbond->radius=sptr->radius; + newbond->irad=sptr->irad; + newbond->aradius=sptr->aradius; + newbond->iarad=sptr->iarad; + newbond->col=sptr->col; + newbond->flag=sptr->flag; + newbond->altl=sptr->altl; + newbond->energy=sptr->offset; + + newbond->hnext=NULL; + curbond->hnext=newbond; + curbond=curbond->hnext; + curbond->hnext=NULL; + Info.ssbondcount++; + counter++; + if(counter>sscount) + break; + } + } + } + void UpdateInfoAsy() + { + int backcnt=0; + register Bond __far *bptr; + register Chain __far *chain; + + Info.Asatomcount=MainAtomCount; + Info.Ashetatomcount=HetaAtomCount; + Info.Asgroupcount=MainGroupCount; + Info.Asbondcount=Info.bondcount; + Info.Asrfbondcount=Info.srfbondcount; + ForEachBack + { + backcnt++; + } + Info.Asbackbondcount=backcnt; + Info.Aschaincount=Info.chaincount; + Info.Asssbondcount=Info.ssbondcount; + Info.Ashbondcount=Info.hbondcount; + Info.Ascisbondcount=Info.cisbondcount; + } + Feature __far *UpdateSymFeature(Feature __far *Feat) + { + Feature __far *newFeat; + newFeat=(Feature __far*)_fmalloc(sizeof(Feature __far)); + Feature __far *curFeat=Feat; + Chain __far *chain; + int featurecount; + int counter=0; + int x=0,y=0,z=0; + Feature __far *Featlist=Feat; + while(curFeat->fnext) + { + curFeat=curFeat->fnext; + } + featurecount=curFeat->count; + + for(x=1;x<=GetTotalOpr();x++) + { + + Feat=Featlist; + while(Feat) + { + for(y=0;ydata[y].type=Feat->data[y].type; + newFeat->data[y].init=Feat->data[y].init; + newFeat->data[y].term=Feat->data[y].term; + char newident='O'; + if(Feat->data[y].chain && Feat->data[y].chain!=' ') + { + for(chain=Database->clist;chain;chain=chain->cnext) + { + if(chain->ident==Feat->data[y].chain) + { + newident=(chain->copy[x-1]); + break; + } + counter++; + } + + newFeat->data[y].chain=newident; + } + else{ + newFeat->data[y].chain=Feat->data[y].chain; + } + + } + newFeat->fnext=NULL; + if((FeatSize-curFeat->count) < featurecount) + { + newFeat->count=Feat->count; + curFeat->fnext=newFeat; + curFeat=curFeat->fnext; + } + else{ + for(z=0;zcount;z++) + curFeat->data[curFeat->count+z]=newFeat->data[z]; + curFeat->count+=featurecount; + } + curFeat->fnext=NULL; + Feat=Feat->fnext; + } + } + } *** symtry.h Wed Dec 31 19:00:00 1969 --- symtry.h Fri May 20 12:32:36 2005 *************** *** 0 **** --- 1,21 ---- + /*SAGAR AND STEVE*/ + void ApplyOperator(); + double** GetRotationMatrice(char[]); + double* GetTransMatrice(char[]); + Long* GetNewCoordinate(Long*,char[]); /*Does the multiplication*/ + void UpdateInfoAsy(); + double* OrthotoFrac(Long*); + Long* FractoOrtho(double*); + double* multiplymatrice(double*,double[3][3]); + void CreateGroupSS(int); + void BondUpdate(int); + void HBondUpdate(); + void SBBondUpdate(); + void BackBondUpdate(); + void SSBondUpdate(); + int GetTotalOpr(); + /*RAtom __far *Append(Long*, RAtom __far* , RAtom __far*); + Group __far *ProcessGroupSS(Group __far*,Chain __far*,Group __far*); + Chain __far *ProcessChainSS(Chain __far*);*/ + void FormChainIdentity(char[],int); + char Identity[62];