- Timestamp:
- 09/05/08 11:49:42 (16 years ago)
- Branches:
- master
- Children:
- fafe4d6
- Parents:
- 2ebb8b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
redvar.f
r2ebb8b6 rbd2278d 1 c**************************************************************2 c 3 cThis file contains the subroutines: redvar4 c 5 cCopyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,6 cShura Hayryan, Chin-Ku7 cCopyright 2007 Frank Eisenmenger, U.H.E. Hansmann,8 cJan H. Meinke, Sandipan Mohanty9 c 10 c**************************************************************1 !************************************************************** 2 ! 3 ! This file contains the subroutines: redvar 4 ! 5 ! Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann, 6 ! Shura Hayryan, Chin-Ku 7 ! Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann, 8 ! Jan H. Meinke, Sandipan Mohanty 9 ! 10 ! ************************************************************** 11 11 12 12 13 13 subroutine redvar 14 14 15 c...................................................................16 c 17 cPURPOSE: Read global parameters for molecules from lines18 c 19 c+--------------------------------------------------+20 c|@ molecule no. : six floats separated by commas |21 c+--------------------------------------------------+22 c 23 cNB: 1) if omit field with molecule no. assume: nml=124 c2) last 3 float are angles in deg.25 c 26 cRead and interpret file to SET and FIX internal variables27 cby commands:28 c 29 c+-----------------------------------------+30 c| molecule : residue : variable : value |31 c+-----------------------------------------+32 c 33 c* Lines containing '&' assign FIXED variable(s), they will34 cnot be varied during subsequent minimization etc.35 c 36 c* Empty LINES or lines containing '#' are ignored37 c* Several commands on same line must be separated by ';'38 c* Empty COMMANDS, i.e. ' : : ' are ignored39 c* All spaces are not significant and are therefore ignored40 c 41 c* A command consists of up to 4 (maxfld) fields, separated42 cby ':'43 c 44 c- last field : value for VARIABLE (REAL)45 c! should never be empty46 c- 1st before last: name(s) (CHAR) or index(ices) of VARIABLE(S)47 c- 2nd before last: name(s) or index(ices) of RESIDUE(S)48 c- 3rd before last: name or number(ices) of MOLECULE(S)49 c 50 c* molecules, residues, variables can be identified, either by,51 cINDICES (zones 'n1-n2' possible) or NAMES52 c 53 c* several identifiers in a field can be separated by ','54 c 55 c* INDICES: for residues - refer to numbering within molecule56 c: for variables - refer to numbering within residue57 c* ZONES: '-n2' indicates '1-n2'58 c'n1-' indicates 'n1-(all)'59 c* NAMES or their ends can be indicated by wild-card '*'60 care case-sensitive61 c 62 cExample: phi:-65; psi:-45 >set all phi=-65, all psi=-4563 com*: 180 & >set all omg, omt ... to 180 & fix them64 c5 : x* : -60 >set all xi-angles of residue 5 to 6065 c 66 cCALLS: setvar,extstr,iendst,ibegst,iopfil,iredin,iredrl67 c......................................................................15 ! ................................................................... 16 ! 17 ! PURPOSE: Read global parameters for molecules from lines 18 ! 19 ! +--------------------------------------------------+ 20 ! |@ molecule no. : six floats separated by commas | 21 ! +--------------------------------------------------+ 22 ! 23 ! NB: 1) if omit field with molecule no. assume: nml=1 24 ! 2) last 3 float are angles in deg. 25 ! 26 ! Read and interpret file to SET and FIX internal variables 27 ! by commands: 28 ! 29 ! +-----------------------------------------+ 30 ! | molecule : residue : variable : value | 31 ! +-----------------------------------------+ 32 ! 33 ! * Lines containing '&' assign FIXED variable(s), they will 34 ! not be varied during subsequent minimization etc. 35 ! 36 ! * Empty LINES or lines containing '#' are ignored 37 ! * Several commands on same line must be separated by ';' 38 ! * Empty COMMANDS, i.e. ' : : ' are ignored 39 ! * All spaces are not significant and are therefore ignored 40 ! 41 ! * A command consists of up to 4 (maxfld) fields, separated 42 ! by ':' 43 ! 44 ! - last field : value for VARIABLE (REAL) 45 ! ! should never be empty 46 ! - 1st before last: name(s) (CHAR) or index(ices) of VARIABLE(S) 47 ! - 2nd before last: name(s) or index(ices) of RESIDUE(S) 48 ! - 3rd before last: name or number(ices) of MOLECULE(S) 49 ! 50 ! * molecules, residues, variables can be identified, either by, 51 ! INDICES (zones 'n1-n2' possible) or NAMES 52 ! 53 ! * several identifiers in a field can be separated by ',' 54 ! 55 ! * INDICES: for residues - refer to numbering within molecule 56 ! : for variables - refer to numbering within residue 57 ! * ZONES: '-n2' indicates '1-n2' 58 ! 'n1-' indicates 'n1-(all)' 59 ! * NAMES or their ends can be indicated by wild-card '*' 60 ! are case-sensitive 61 ! 62 ! Example: phi:-65; psi:-45 >set all phi=-65, all psi=-45 63 ! om*: 180 & >set all omg, omt ... to 180 & fix them 64 ! 5 : x* : -60 >set all xi-angles of residue 5 to 60 65 ! 66 ! CALLS: setvar,extstr,iendst,ibegst,iopfil,iredin,iredrl 67 ! ...................................................................... 68 68 69 69 70 70 include 'INCL.H' 71 71 72 cmaxfld: max. # of fields in one command73 cmaxide: max. # of identifiers in a field74 cmaxcmd: max. # of commands to be interpreted75 cilrg: a large integer72 ! maxfld: max. # of fields in one command 73 ! maxide: max. # of identifiers in a field 74 ! maxcmd: max. # of commands to be interpreted 75 ! ilrg: a large integer 76 76 77 77 parameter (maxfld=4, 78 #maxide=30,79 #maxcmd=5000,80 #ilrg=1000000)78 & maxide=30, 79 & maxcmd=5000, 80 & ilrg=1000000) 81 81 82 82 character spcm,spfd,spcc,sphy,cmt,wdc,sfix,blnk, sglp, 83 #line*132,lincmd*132,linfld(maxfld)*132,linide*132,84 #linh*132,strg(6)*1783 & line*132,lincmd*132,linfld(maxfld)*132,linide*132, 84 & linh*132,strg(6)*17 85 85 dimension ifdend(maxfld),vlvrx(mxvr),rn(6) 86 86 logical fix,did,exa,forml(mxml),forrs(mxrs),forvr(mxvr), 87 #stvr(mxvr)87 & stvr(mxvr) 88 88 data spcm/';'/,spfd/':'/,spcc/','/,sphy/'-'/,cmt/'#'/,wdc/'*'/, 89 #sfix/'&'/,blnk/' '/, sglp/'@'/90 91 92 c___________________________________ Checks89 & sfix/'&'/,blnk/' '/, sglp/'@'/ 90 91 92 ! ___________________________________ Checks 93 93 ntlvr=ivrml1(ntlml)+nvrml(ntlml)-1 94 94 if (ntlvr.eq.0) then … … 96 96 return 97 97 endif 98 c___________________________________ Initialize98 ! ___________________________________ Initialize 99 99 100 100 io=iopfil(lunvar,varfil,'old','formatted') 101 101 if (io.eq.0) then 102 102 write (*,'(a,/,a,i3,2a)') 103 #' redvar> ERROR opening file to set variables:',104 #' LUN=',lunvar,' FILE=',varfil(1:iendst(varfil))103 & ' redvar> ERROR opening file to set variables:', 104 & ' LUN=',lunvar,' FILE=',varfil(1:iendst(varfil)) 105 105 stop 106 106 elseif (io.eq.-1) then 107 107 return 108 108 endif 109 c___________________________________ Initialization109 ! ___________________________________ Initialization 110 110 do i=1,ntlml 111 111 forml(i)=.true. … … 138 138 1 read (lunvar,'(a)',end=2) line 139 139 ile=iendst(line) 140 c_________________________________ ! ignore empty and commentary lines140 ! _________________________________ ! ignore empty and commentary lines 141 141 if (ile.gt.0.and.index(line(1:ile),cmt).le.0) then 142 142 143 c_________________________________________ Global variables143 ! _________________________________________ Global variables 144 144 ilb = index(line(1:ile),sglp)+1 145 145 if (ilb.ge.2) then … … 150 150 151 151 if (iredin(lincmd,nml).le.0.or. 152 #nml.le.0.or.nml.gt.ntlml) then152 & nml.le.0.or.nml.gt.ntlml) then 153 153 write (*,*) 'redvar> ','Incorrect molecule number >', 154 #lincmd(1:l),'< Must be in range [1,',155 #ntlml,'] !'154 & lincmd(1:l),'< Must be in range [1,', 155 & ntlml,'] !' 156 156 close(lunvar) 157 157 stop … … 179 179 if (iredrl(linh,rn(6)).le.0) goto 105 180 180 181 c---------------------------------------- check global angles181 ! ---------------------------------------- check global angles 182 182 if ( abs(rn(4)).gt.(1.8d2+1d-6) 183 #.or. abs(rn(5)).gt.(9d1+1d-6)184 #.or. abs(rn(6)).gt.(1.8d2+1d-6)185 #) goto 106183 & .or. abs(rn(5)).gt.(9d1+1d-6) 184 & .or. abs(rn(6)).gt.(1.8d2+1d-6) 185 & ) goto 106 186 186 187 187 do i = 1,3 … … 221 221 endif 222 222 223 c_________________________________________ Extract Command Fields223 ! _________________________________________ Extract Command Fields 224 224 nfld=0 225 225 icb=1 … … 235 235 236 236 enddo 237 c_______________________________ Interpret Command Fields (except last)237 ! _______________________________ Interpret Command Fields (except last) 238 238 do i=1,nfld-1 239 239 ii=i … … 255 255 enddo 256 256 endif 257 c__________________________________ Identifiers in field257 ! __________________________________ Identifiers in field 258 258 nide=0 259 259 ifb=1 … … 299 299 if (ifld.eq.3) then ! Mol. 300 300 301 c################### impossible # (inum) of molecule301 ! ################### impossible # (inum) of molecule 302 302 303 303 if (inum.le.0.or.inum.gt.ntlml) then … … 313 313 k=inum+nfi-1 314 314 315 c################### impossible # of residue (inum) in molecule315 ! ################### impossible # of residue (inum) in molecule 316 316 317 317 if (k.lt.nfi.or.k.gt.irsml2(j)) then … … 331 331 l=inum+nfi-1 332 332 333 c################### impossible # of variable (inum) in residue333 ! ################### impossible # of variable (inum) in residue 334 334 335 335 if (l.lt.nfi.or. 336 #l.gt.nfi+nvrrs(k)-1) then336 & l.gt.nfi+nvrrs(k)-1) then 337 337 write (*,*) ' # 3: ',inum 338 338 goto 104 … … 364 364 linh(1:ieh1)=nmml(j)(ib:ieh) 365 365 if (((exa.and.ieh1.eq.id).or. 366 #(.not.exa.and.ieh1.ge.id)).and.367 #linh(1:id).eq.linide(1:id))368 #forml(j)=.true.366 & (.not.exa.and.ieh1.ge.id)).and. 367 & linh(1:id).eq.linide(1:id)) 368 & forml(j)=.true. 369 369 endif 370 370 enddo … … 380 380 linh(1:ieh1)=seq(k)(ib:ieh) 381 381 if (((exa.and.ieh1.eq.id).or. 382 #(.not.exa.and.ieh1.ge.id))383 #.and.linh(1:id).eq.linide(1:id))384 #forrs(k)=.true.382 & (.not.exa.and.ieh1.ge.id)) 383 & .and.linh(1:id).eq.linide(1:id)) 384 & forrs(k)=.true. 385 385 endif 386 386 enddo … … 401 401 linh(1:ieh1)=nmvr(l)(ib:ieh) 402 402 if (((exa.and.ieh1.eq.id) 403 #.or.(.not.exa.and.ieh1.ge.id))404 #.and.linh(1:id).eq.linide(1:id))405 #forvr(l)=.true.403 & .or.(.not.exa.and.ieh1.ge.id)) 404 & .and.linh(1:id).eq.linide(1:id)) 405 & forvr(l)=.true. 406 406 endif 407 407 enddo … … 416 416 else ! ___ Zone 417 417 418 c################### impossible zone '-' (without integer)418 ! ################### impossible zone '-' (without integer) 419 419 420 420 if (ide.eq.1.and.ihy.eq.ide) then … … 429 429 linh=linide(1:ihy-1) 430 430 431 c################### impossible (to read) integer before '-'431 ! ################### impossible (to read) integer before '-' 432 432 433 433 if (iredin(linh,ibz).le.0.or.ibz.le.0) 434 #then434 & then 435 435 write (*,*) ' # 5 ' 436 436 goto 104 … … 444 444 linh=linide(ihy+1:ide) 445 445 446 c################### impossible (to read) integer after '-'446 ! ################### impossible (to read) integer after '-' 447 447 448 448 if (iredin(linh,iez).le.0.or.iez.le.0.or. 449 #iez.lt.ibz) then449 & iez.lt.ibz) then 450 450 write (*,*) ' # 6 ' 451 451 goto 104 … … 502 502 enddo ! ... Fields (excl. value) 503 503 504 c_____________________________________________________ Execute Command504 ! _____________________________________________________ Execute Command 505 505 506 506 if (iredrl(linfld(nfld),val).gt.izero) then ! Read Value … … 517 517 enddo 518 518 if (.not.did) write (*,'(3a)') 519 #' redvar> No variables affected by command >',520 #lincmd(1:ice),'<'519 & ' redvar> No variables affected by command >', 520 & lincmd(1:ice),'<' 521 521 else 522 522 … … 524 524 ll2=iendst(linfld(nfld)) 525 525 write (*,*) 'll1,ll2, linfld(nfld): ',ll1,ll2, 526 #'>',linfld(nfld)(ll1:ll2),'<'526 & '>',linfld(nfld)(ll1:ll2),'<' 527 527 528 528 goto 102 … … 535 535 536 536 2 close(lunvar) 537 c__________________________ Summary537 ! __________________________ Summary 538 538 iv=0 539 539 do i=1,ntlml … … 552 552 553 553 write (*,'(3a,/,1x,5(a,2x),a)') ' redvar> ',nmml(i)(1:ie), 554 #' with global parameters:',555 #(strg(k)(ibegst(strg(k)):),k=1,6)554 & ' with global parameters:', 555 & (strg(k)(ibegst(strg(k)):),k=1,6) 556 556 call setvar(i,vlvrx) 557 557 goto 3 … … 572 572 if (fxvr(iv)) then 573 573 write (*,'(3a,i4,1x,4a,f10.3,a)') ' redvar> ', 574 #nmml(i)(1:ie),': residue ',j-jb,seq(j),575 #': ',nmvr(iv),' set ',vlvrx(iv),' Fixed'574 & nmml(i)(1:ie),': residue ',j-jb,seq(j), 575 & ': ',nmvr(iv),' set ',vlvrx(iv),' Fixed' 576 576 else 577 577 write (*,'(3a,i4,1x,4a,f10.3)') ' redvar> ', 578 #nmml(i)(1:ie),': residue ',j-jb,seq(j),579 #': ',nmvr(iv),' set ',vlvrx(iv)578 & nmml(i)(1:ie),': residue ',j-jb,seq(j), 579 & ': ',nmvr(iv),' set ',vlvrx(iv) 580 580 endif 581 581 ity=ityvr(iv) 582 582 if (ity.eq.3.or.ity.eq.2) 583 #vlvrx(iv)=vlvrx(iv)*cdr ! angles583 & vlvrx(iv)=vlvrx(iv)*cdr ! angles 584 584 585 585 else … … 590 590 if (did) then 591 591 if (in.gt.0) write (*,'(3a,i5,a)') 592 #' redvar> Molecule ',nmml(i)(1:ie),': ',in,593 #' variable(s) remain unchanged'592 & ' redvar> Molecule ',nmml(i)(1:ie),': ',in, 593 & ' variable(s) remain unchanged' 594 594 call setvar(iml,vlvrx) 595 595 else 596 596 write (*,'(3a)') ' redvar> Molecule ', 597 #nmml(i)(1:ie),': No internal variables changed'597 & nmml(i)(1:ie),': No internal variables changed' 598 598 endif 599 599 endif … … 601 601 602 602 return 603 c____________________________________________________________ Errors603 ! ____________________________________________________________ Errors 604 604 100 write (*,'(3a)') ' redvar> Cannot interpret command >', 605 #lincmd(1:ice),'<'605 & lincmd(1:ice),'<' 606 606 close(lunvar) 607 607 stop … … 610 610 stop 611 611 102 write (*,'(3a)') ' redvar> Cannot read value from >', 612 #lincmd(1:ice),'<'612 & lincmd(1:ice),'<' 613 613 close(lunvar) 614 614 stop 615 615 103 write (*,'(a,i3,3a)') ' redvar> Cannot read >',maxide, 616 #' identifiers from >',linfld(ii)(1:ife),'<'616 & ' identifiers from >',linfld(ii)(1:ife),'<' 617 617 close(lunvar) 618 618 stop 619 619 104 write (*,'(5a)') ' redvar> Error in identifier >', 620 #linide(1:ide),'< of command >',lincmd(1:ice),'<'620 & linide(1:ide),'< of command >',lincmd(1:ice),'<' 621 621 close(lunvar) 622 622 stop 623 623 105 write (*,'(a,/,a,/,2a,/)') ' redvar> line with global paramters:', 624 #line(1:ile),' must contain 6 floating',625 #' point numbers separated by commas !'624 & line(1:ile),' must contain 6 floating', 625 & ' point numbers separated by commas !' 626 626 close(lunvar) 627 627 stop 628 628 629 629 106 write (*,'(a,/,a,/,2a,/)') ' redvar> line with global paramters:', 630 #line(1:ile),' angles must be inside ',631 #'ranges [-180,180], [-90,90], and [-180,180] Deg., respectively !'630 & line(1:ile),' angles must be inside ', 631 &'ranges [-180,180], [-90,90], and [-180,180] Deg., respectively !' 632 632 close(lunvar) 633 633 stop
Note:
See TracChangeset
for help on using the changeset viewer.