- Timestamp:
- 09/05/08 11:49:42 (16 years ago)
- Branches:
- master
- Children:
- fafe4d6
- Parents:
- 2ebb8b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rmsdfun.f
r2ebb8b6 rbd2278d 1 c**************************************************************2 c 3 cThis file contains the subroutines: rmsdfun,rmsdopt,fitmol,4 cjacobi,rmsinit5 c 6 cCopyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,7 cShura Hayryan, Chin-Ku8 cCopyright 2007 Frank Eisenmenger, U.H.E. Hansmann,9 cJan H. Meinke, Sandipan Mohanty10 c 11 c**************************************************************1 ! ************************************************************** 2 ! 3 ! This file contains the subroutines: rmsdfun,rmsdopt,fitmol, 4 ! jacobi,rmsinit 5 ! 6 ! Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann, 7 ! Shura Hayryan, Chin-Ku 8 ! Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann, 9 ! Jan H. Meinke, Sandipan Mohanty 10 ! 11 ! ************************************************************** 12 12 13 13 real*8 function rmsdfun(nml,ir1,ir2,ixat,xrf,yrf,zrf,isl) 14 C 15 C--------------------------------------------------------------16 cWrapping function for calculating rmsd17 c 18 cLIMITATION: requires call of rmsinit BEFORE calling this function19 c 20 cCALLS: rmsdopt21 c 22 c---------------------------------------------------------------23 c 14 ! 15 ! -------------------------------------------------------------- 16 ! Wrapping function for calculating rmsd 17 ! 18 ! LIMITATION: requires call of rmsinit BEFORE calling this function 19 ! 20 ! CALLS: rmsdopt 21 ! 22 ! --------------------------------------------------------------- 23 ! 24 24 include 'INCL.H' 25 25 include 'INCP.H' 26 c 27 cInput26 ! 27 ! Input 28 28 dimension ixat(mxat),xrf(mxatp),yrf(mxatp),zrf(mxatp) 29 cLocal29 ! Local 30 30 dimension rm(3,3),av1(3),av2(3) 31 31 call rmsdopt(nml,ir1,ir2,ixat,xrf,yrf,zrf,isl,rm,av1,av2,rssd) … … 37 37 end 38 38 39 c*******************************************************************39 !******************************************************************* 40 40 subroutine rmsdopt(nml,ir1,ir2,ixat,xrf,yrf,zrf,isl, 41 #rm,av1,av2,rmsd)42 43 c---------------------------------------------------------------44 cPURPOSE: root mean square deviation (rmsd) between current SMMP45 cstructure and reference atom coordinates 'x,y,zrf()'46 cfor range of SMMP residues [ir1,ir2] in molecule 'nml'47 c 48 cixat(i) - points to the atom in ref. coords., which is49 cequivalent to atom i of SMMP structure50 c(=0 if no equivalent in ref. structure exists)51 c 52 cisl = 0 : select all heavy atoms53 cisl = 1 : backbone atoms n,ca,c54 cisl = 2 : only ca atoms55 c 56 cCALLS: fitmol [S.K.Kearsley, Acta Cryst. 1989, A45, 208-210]57 c 58 cNB uncomment last lines in 'fitmol' to return coordinates59 cin 'x2' after fitting the ref. str. onto SMMP structure60 c----------------------------------------------------------------41 & rm,av1,av2,rmsd) 42 43 ! --------------------------------------------------------------- 44 ! PURPOSE: root mean square deviation (rmsd) between current SMMP 45 ! structure and reference atom coordinates 'x,y,zrf()' 46 ! for range of SMMP residues [ir1,ir2] in molecule 'nml' 47 ! 48 ! ixat(i) - points to the atom in ref. coords., which is 49 ! equivalent to atom i of SMMP structure 50 ! (=0 if no equivalent in ref. structure exists) 51 ! 52 ! isl = 0 : select all heavy atoms 53 ! isl = 1 : backbone atoms n,ca,c 54 ! isl = 2 : only ca atoms 55 ! 56 ! CALLS: fitmol [S.K.Kearsley, Acta Cryst. 1989, A45, 208-210] 57 ! 58 ! NB uncomment last lines in 'fitmol' to return coordinates 59 ! in 'x2' after fitting the ref. str. onto SMMP structure 60 ! ---------------------------------------------------------------- 61 61 62 62 include 'INCL.H' 63 63 include 'INCP.H' 64 64 65 c-------------------------------------------------------- input65 !-------------------------------------------------------- input 66 66 dimension ixat(mxat),xrf(mxatp),yrf(mxatp),zrf(mxatp) 67 c-------------------------------------------------------- output67 !-------------------------------------------------------- output 68 68 dimension rm(3,3),av1(3),av2(3) 69 c-------------------------------------------------------- local69 !-------------------------------------------------------- local 70 70 dimension x1(3,mxat),x2(3,mxat) 71 71 character*4 atnm … … 99 99 if ( isl.eq.0 100 100 101 #.or.102 103 #(isl.eq.1.and.(index(atnm,'n ').gt.0 .or.104 #index(atnm,'ca ').gt.0 .or.105 #index(atnm,'c ').gt.0 ))106 #.or.107 108 #(isl.eq.2.and.index(atnm,'ca ').gt.0)109 110 #) then101 & .or. 102 103 & (isl.eq.1.and.(index(atnm,'n ').gt.0 .or. 104 & index(atnm,'ca ').gt.0 .or. 105 & index(atnm,'c ').gt.0 )) 106 & .or. 107 108 & (isl.eq.2.and.index(atnm,'ca ').gt.0) 109 110 & ) then 111 111 112 112 n=n+1 … … 136 136 return 137 137 end 138 c*********************************************138 ! ********************************************* 139 139 subroutine fitmol(n,x1,x2, rm,a1,a2,rmsd) 140 creal*8 function fitmol(n,x1,x2)141 142 c.......................................................143 cPURPOSE: compute RMSD of n positions in x1(3,) & x2(3,)144 c[S.K.Kearsley Acta Cryst. 1989,A45,208-210]145 c 146 cCALLS: jacobi147 c.......................................................148 cf2py intent(out) rmsd140 ! real*8 function fitmol(n,x1,x2) 141 142 ! ....................................................... 143 ! PURPOSE: compute RMSD of n positions in x1(3,) & x2(3,) 144 ! [S.K.Kearsley Acta Cryst. 1989,A45,208-210] 145 ! 146 ! CALLS: jacobi 147 ! ....................................................... 148 !f2py intent(out) rmsd 149 149 150 150 include 'INCL.H' 151 cimplicit real*8 (a-h,o-z)152 cimplicit integer*4 (i-n)151 ! implicit real*8 (a-h,o-z) 152 ! implicit integer*4 (i-n) 153 153 154 c------------------------------------------- input/output154 ! ------------------------------------------- input/output 155 155 dimension x1(3,mxat),x2(3,mxat) 156 c-------------------------------------------------- local156 ! -------------------------------------------------- local 157 157 dimension e(4),q(4,4),v(4,4),dm(3),dp(3),a1(3),a2(3),rm(3,3) 158 158 159 159 dn=dble(n) 160 c------------------- average of coordinates160 ! ------------------- average of coordinates 161 161 do i=1,3 162 162 a1(i) = 0.d0 … … 169 169 a2(i) = a2(i)/dn 170 170 enddo 171 c------------------------- compile quaternion171 ! ------------------------- compile quaternion 172 172 do i=1,4 173 173 do j=1,4 … … 208 208 enddo 209 209 enddo 210 c------------------------------ eigenvalues & -vectors210 ! ------------------------------ eigenvalues & -vectors 211 211 ndim4=4 212 212 call jacobi(q,ndim4,e,v) 213 c--------------------------- lowest eigenvalue213 ! --------------------------- lowest eigenvalue 214 214 im=1 215 215 em=e(1) … … 223 223 rmsd = sqrt(em/dn) 224 224 225 c================= uncomment following lines to fit molecule 2 onto 1226 227 c---------------------------------------------------rotation matrix225 ! ================= uncomment following lines to fit molecule 2 onto 1 226 227 ! ---------------------------------------------------rotation matrix 228 228 rm(1,1) = v(1,im)**2+v(2,im)**2-v(3,im)**2-v(4,im)**2 229 229 rm(1,2) = 2.d0*( v(2,im)*v(3,im)-v(1,im)*v(4,im) ) … … 236 236 rm(3,3) = v(1,im)**2+v(4,im)**2-v(2,im)**2-v(3,im)**2 237 237 238 cdo i=1,n239 cdo j=1,3240 cdm(j) = x2(j,i) - a2(j)241 cenddo242 cdo j=1,3243 cdp(j) = a1(j)244 cdo k=1,3245 cdp(j) = dp(j) + rm(j,k) * dm(k)246 cenddo247 cx2(j,i) = dp(j)248 cenddo249 cenddo250 251 cfitmol=rmsd238 ! do i=1,n 239 ! do j=1,3 240 ! dm(j) = x2(j,i) - a2(j) 241 ! enddo 242 ! do j=1,3 243 ! dp(j) = a1(j) 244 ! do k=1,3 245 ! dp(j) = dp(j) + rm(j,k) * dm(k) 246 ! enddo 247 ! x2(j,i) = dp(j) 248 ! enddo 249 ! enddo 250 251 ! fitmol=rmsd 252 252 253 253 return 254 254 end 255 c******************************255 ! ****************************** 256 256 subroutine jacobi(a,n,d,v) 257 257 258 c......................................................259 cPURPOSE: for given symmetric matrix 'a(n,n)260 ccompute eigenvalues 'd' & eigenvectors 'v(,)'261 c 262 c[W.H.Press,S.A.Teukolsky,W.T.Vetterling,263 cB.P.Flannery, Numerical Recipes in FORTRAN,264 cCambridge Univ. Press, 2nd Ed. 1992, 456-462]265 c 266 cCALLS: none267 c 268 c......................................................269 270 cf2py intent(out) d271 cf2py intent(out) v258 ! ...................................................... 259 ! PURPOSE: for given symmetric matrix 'a(n,n) 260 ! compute eigenvalues 'd' & eigenvectors 'v(,)' 261 ! 262 ! [W.H.Press,S.A.Teukolsky,W.T.Vetterling, 263 ! B.P.Flannery, Numerical Recipes in FORTRAN, 264 ! Cambridge Univ. Press, 2nd Ed. 1992, 456-462] 265 ! 266 ! CALLS: none 267 ! 268 ! ...................................................... 269 270 !f2py intent(out) d 271 !f2py intent(out) v 272 272 parameter (NMAX=500) 273 273 … … 276 276 277 277 real*8 a(n,n),d(n),v(n,n), 278 #c,g,h,s,sm,t,tau,theta,tresh,b(NMAX),z(NMAX),smeps278 & c,g,h,s,sm,t,tau,theta,tresh,b(NMAX),z(NMAX),smeps 279 279 280 280 smeps=1.0d-6 … … 318 318 if((i.gt.4).and.(abs(d(ip))+ 319 319 320 #g.eq.abs(d(ip))).and.(abs(d(iq))+g.eq.abs(d(iq))))then320 &g.eq.abs(d(ip))).and.(abs(d(iq))+g.eq.abs(d(iq))))then 321 321 a(ip,iq)=0.d0 322 322 … … 393 393 end 394 394 395 c***********************************************************395 ! *********************************************************** 396 396 397 397 subroutine rmsinit(nml,string) 398 c 399 c------------------------------------------------------------------------------400 cReads in pdb-file 'string' into INCP.H and initalizes401 cthe files that 'rmdsopt' needs to calculate the rmsd402 cof a configuration with the pdb-configuration403 C 404 cCALLS: pdbread,atixpdb405 c 406 c----------------------------------------------------------------------------407 c 398 ! 399 !------------------------------------------------------------------------------ 400 ! Reads in pdb-file 'string' into INCP.H and initalizes 401 ! the files that 'rmdsopt' needs to calculate the rmsd 402 ! of a configuration with the pdb-configuration 403 ! 404 ! CALLS: pdbread,atixpdb 405 ! 406 ! ---------------------------------------------------------------------------- 407 ! 408 408 include 'INCL.H' 409 409 include 'INCP.H' … … 412 412 413 413 if(string.eq.'smmp') then 414 c 415 cCompare with a smmp-structure416 c 414 ! 415 ! Compare with a smmp-structure 416 ! 417 417 do i=iatrs1(irsml1(nml)),iatrs2(irsml2(nml)) 418 418 if(nmat(i)(1:1).ne.'h') then … … 422 422 end if 423 423 enddo 424 c 424 ! 425 425 else 426 c 427 cReference structure is read in from pdb-file428 c 426 ! 427 ! Reference structure is read in from pdb-file 428 ! 429 429 call pdbread(string,ier) 430 430 if(ier.ne.0) stop 431 431 call atixpdb(nml) 432 c 432 ! 433 433 end if 434 434 print *,'RMSD initialized with ',string
Note:
See TracChangeset
for help on using the changeset viewer.