1)Clean-up 2)making similar src_MD and its multichain version 3)
authorAdam Kazimierz Sieradzan <adasko@sun1.chem.univ.gda.pl>
Sat, 31 Aug 2013 19:08:38 +0000 (15:08 -0400)
committerAdam Kazimierz Sieradzan <adasko@sun1.chem.univ.gda.pl>
Sat, 31 Aug 2013 19:08:38 +0000 (15:08 -0400)
correction of potentials and bugfix in ../PARAM/pot_theta_G631_DIL.parm
4) introduction of theta_pdb and rotam_pdb in multichain

PARAM/pot_theta_G631_DIL.parm
PARAM/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
source/unres/src_MD-M/COMMON.IOUNITS
source/unres/src_MD-M/energy_p_new_barrier.F
source/unres/src_MD-M/initialize_p.F
source/unres/src_MD-M/parmread.F
source/unres/src_MD-M/readrtns_CSA.F
source/unres/src_MD/energy_p_new_barrier.F
source/unres/src_MD/parmread.F

index 3b94e8b..494bff1 100644 (file)
@@ -1,5 +1,5 @@
 2 10 4 4 6 4
 2 10 4 4 6 4
-1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 2
+1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 2 3
 Gppreg
     4.58415E+01 
     1.05721E+03 
 Gppreg
     4.58415E+01 
     1.05721E+03 
index d66c9c9..f371faa 100644 (file)
    5.263842382200000   5.496195412400000   4.292812416200000   4.358225054000000
    4.266775592100000   3.681384595800000   3.540542964700000   3.702698591200000
    4.717759615600000   3.381199222700000   3.793608545800000   4.515749058500000
    5.263842382200000   5.496195412400000   4.292812416200000   4.358225054000000
    4.266775592100000   3.681384595800000   3.540542964700000   3.702698591200000
    4.717759615600000   3.381199222700000   3.793608545800000   4.515749058500000
+
    6.629674668000000   6.671726050800000   6.816887694500000   6.837896015200000
    6.351203998600000   6.142519242300000   5.520020640600000   5.485893602400000
    4.938257326200000   4.279512916600000   4.053485701800000   4.208642852500000
    3.538808627900000   3.420973032700000   2.799574419300000   4.816426855300000
    6.629674668000000   6.671726050800000   6.816887694500000   6.837896015200000
    6.351203998600000   6.142519242300000   5.520020640600000   5.485893602400000
    4.938257326200000   4.279512916600000   4.053485701800000   4.208642852500000
    3.538808627900000   3.420973032700000   2.799574419300000   4.816426855300000
-   3.879075507100000   3.587826217700000   4.645743255500000   5.434261193691611
-   6.009504353949445   5.751833613689151   4.388369927131041   6.139482146000000
-   4.432779364180328   3.635448013213493   3.042556269070575   1.858255457238648
-   3.619846653665197   3.902273188000000   2.840826371233924   1.901219059651194
-   3.010635482615414   2.681361243261458   3.871192813400000   3.639660062795308
-   4.487266103000000   7.144249845164532   5.950132764851209   5.636408114630104
-   6.256568766200000   4.721753486138623   5.072743940945156   4.725634408062251
-   3.773513014441411   3.537762800513723   4.309235277900000   4.002278495651890
-   4.124103654261368   1.771213000543424   3.864752062532702   4.468184401000000
-   4.481956278333824   4.902394508200000   5.956274037802311   7.211686591187319
-   6.204787608200000   5.376059458542183   5.023511032618925   3.156887023825594
-   2.932344993803476   2.999897908513799   3.895407345300000   2.991138620007669
-   2.096199593475473   1.780803572610500   3.558049006448599   4.023841260600000
-   3.682633555857166   4.808718037700000   5.741243604492526   5.884448203300000
-   3.398137040446693   5.432746439707773   4.729707784043235   3.970010356404483
-   3.414577863946629   3.650628980600000   2.605234605568324   2.392978757746573
-   3.096075853472831   4.009206356643173   3.441595274000000   3.721594130855455
-   4.593424600900000   5.282881132500000   4.829846631500000   4.757532777700000
-   4.724977904200000   3.565638428500000   3.561336656700000   3.927304556400000
-   3.766477911800000   3.586169976100000   3.552319162700000   4.650867246300000
-   4.242430826000000   4.098772778300000   4.507966992900000   4.222264575400000
-   3.568880377430671   1.710507474941357   0.726915001472055   2.519422404183540
-   3.136598518800000   2.564808696931206   3.101026335222954   2.213396947938416
-   3.343125814753411   3.444306825200000   2.416478592751639   4.091530576300000
+   3.879075507100000   3.587826217700000   4.645743255500000
+
+   5.434261193691611   6.009504353949445   5.751833613689151   4.388369927131041
+   6.139482146000000   4.432779364180328   3.635448013213493   3.042556269070575
+   1.858255457238648   3.619846653665197   3.902273188000000   2.840826371233924
+   1.901219059651194   3.010635482615414   2.681361243261458   3.871192813400000
+   3.639660062795308   4.487266103000000
+
+   7.144249845164532   5.950132764851209   5.636408114630104   6.256568766200000
+   4.721753486138623   5.072743940945156   4.725634408062251   3.773513014441411
+   3.537762800513723   4.309235277900000   4.002278495651890   4.124103654261368
+   1.771213000543424   3.864752062532702   4.468184401000000   4.481956278333824
+   4.902394508200000
+
+   5.956274037802311   7.211686591187319   6.204787608200000   5.376059458542183
+   5.023511032618925   3.156887023825594   2.932344993803476   2.999897908513799
+   3.895407345300000   2.991138620007669   2.096199593475473   1.780803572610500
+   3.558049006448599   4.023841260600000   3.682633555857166   4.808718037700000
+
+   5.741243604492526   5.884448203300000   3.398137040446693   5.432746439707773
+   4.729707784043235   3.970010356404483   3.414577863946629   3.650628980600000
+   2.605234605568324   2.392978757746573   3.096075853472831   4.009206356643173
+   3.441595274000000   3.721594130855455   4.593424600900000
+
+   5.282881132500000   4.829846631500000   4.757532777700000   4.724977904200000
+   3.565638428500000   3.561336656700000   3.927304556400000   3.766477911800000
+   3.586169976100000   3.552319162700000   4.650867246300000   4.242430826000000
+   4.098772778300000   4.507966992900000
+
+   4.222264575400000   3.568880377430671   1.710507474941357   0.726915001472055
+   2.519422404183540   3.136598518800000   2.564808696931206   3.101026335222954
+   2.213396947938416   3.343125814753411   3.444306825200000   2.416478592751639
+   4.091530576300000
+
    4.157487725645439   3.262380685905436   2.953659747759453   1.237209789211462
    2.500185737000000   1.984183152198450   1.368828812773212   2.060401072298498
    2.863410468895249   2.015232903800000   1.541966676954322   3.639585254600000
    4.157487725645439   3.262380685905436   2.953659747759453   1.237209789211462
    2.500185737000000   1.984183152198450   1.368828812773212   2.060401072298498
    2.863410468895249   2.015232903800000   1.541966676954322   3.639585254600000
+
    2.501655793500000   2.394681323067151   2.071384505085577   1.074154474700000
    0.985099710786774   0.001985439127056   0.921773098679111   5.126752085199419
    2.501655793500000   2.394681323067151   2.071384505085577   1.074154474700000
    0.985099710786774   0.001985439127056   0.921773098679111   5.126752085199419
-   1.500212764900000  -0.018286801754111   3.538112898500000   2.248058879145623
-   2.683627337507786   1.505360785600000  -0.706299059260768   1.284606704482992
-   1.109202790492530   2.070407759035996   1.983305353800000  -0.008577364700000
-   2.955755366600000   1.280003824300000   0.768980610000000   0.625889188870640
-   1.535343520692143   0.574105444778441   1.174671233709513   1.497548217400000
-  -0.665902088339257   2.941502147900000  -0.679242885900000   0.453238323900000
-  -0.759038766000000  -0.361703484600000   1.680327505800000   0.677520998800000
-  -0.535483746800000   2.620859136300000   0.290068410287431  -0.092399325129687
-   1.982203632452388   0.078357579868221   0.389638827500000  -0.177470106993247
-   2.325532607700000  -3.392465857895507  -1.871634582322480   1.071505323254014
-   2.748917412400000   1.802089391960750   1.797571866700000  -1.397996047062832
-   0.263585152937208   2.820287379000000   1.642062410367716   1.862509124700000
+   1.500212764900000  -0.018286801754111   3.538112898500000
+
+   2.248058879145623   2.683627337507786   1.505360785600000  -0.706299059260768
+   1.284606704482992   1.109202790492530   2.070407759035996   1.983305353800000
+  -0.008577364700000   2.955755366600000
+
+   1.280003824300000   0.768980610000000   0.625889188870640   1.535343520692143
+   0.574105444778441   1.174671233709513   1.497548217400000  -0.665902088339257
+   2.941502147900000
+
+  -0.679242885900000   0.453238323900000  -0.759038766000000  -0.361703484600000
+   1.680327505800000   0.677520998800000  -0.535483746800000   2.620859136300000 
+
+   0.290068410287431  -0.092399325129687   1.982203632452388   0.078357579868221
+   0.389638827500000  -0.177470106993247   2.325532607700000
+
+  -3.392465857895507  -1.871634582322480   1.071505323254014   2.748917412400000
+   1.802089391960750   1.797571866700000
+
+  -1.397996047062832   0.263585152937208   2.820287379000000   1.642062410367716
+   1.862509124700000
+
    3.729277869700000   2.294443648100000  -0.070327972331951   3.111577617700000
    3.729277869700000   2.294443648100000  -0.070327972331951   3.111577617700000
-  -0.082736296100000  -1.604311318200000   2.443983743500000  -3.048709356063184
-   2.366463453300000   4.192796926000000   2.674806001700000   2.733881014500000
-   2.966464722900000   2.881963673700000   3.021073815000000   2.841428615200000
-   2.477343866000000   2.461194378800000   2.465320121300000   2.492508737100000
-   2.573476775100000   2.456402674400000   2.484782528100000   2.488928923300000
-   2.508951764500000   2.508333838300000   2.422062272300000   2.271460977000000
-   2.452070308900000   2.702612978800000   4.927215476100000   5.105428423000000
-   4.207351616500000   4.851397283700000   2.784887529300000   3.582986163400000
-   7.866021757600000   7.429920984700000   1.962593983200000   0.798776956900000
-   4.058089968100000   1.888902103200000   3.198719702600000   3.267327453800000
-   2.684813190400000   2.004302740400000   6.244634191000000   8.195945209500000
-  13.474829585800000   2.663237683700000   0.869902301100000   1.054066001400000
-   0.938590929800000   1.026327410100000   1.083527704500000   1.054318388600000
-   0.788868699600000   0.898930583300000   1.003996287500000   1.242751812800000
-   0.893280172400000   0.917392899000000   1.615769565700000   1.431586037300000
-   2.049831787900000   1.419961554600000   0.993367797100000   1.431962560000000
-  27.495176328800000   0.778802528600000   0.010369755600000   0.061138567400000
-   0.044830334600000   0.039283178200000   0.085416633800000   0.039889661900000
-   0.024949656900000   0.023241090800000   0.086137910000000  -0.075479418500000
-  -0.026614602100000  -0.016342909900000   0.057216710300000  -0.046860882500000
-   0.015104845500000   0.008496367800000   0.027893039700000   0.007692291100000
-   0.103353673800000  -0.009825603600000
+
+  -0.082736296100000  -1.604311318200000   2.443983743500000
+
+  -3.048709356063184   2.366463453300000
+
+   4.192796926000000
+
+   2.674806001700000   2.733881014500000   2.966464722900000   2.881963673700000
+   3.021073815000000   2.841428615200000   2.477343866000000   2.461194378800000
+   2.465320121300000   2.492508737100000   2.573476775100000   2.456402674400000
+   2.484782528100000   2.488928923300000   2.508951764500000   2.508333838300000
+   2.422062272300000   2.271460977000000   2.452070308900000   2.702612978800000
+
+   4.927215476100000   5.105428423000000   4.207351616500000   4.851397283700000
+   2.784887529300000   3.582986163400000   7.866021757600000   7.429920984700000
+   1.962593983200000   0.798776956900000   4.058089968100000   1.888902103200000
+   3.198719702600000   3.267327453800000   2.684813190400000   2.004302740400000
+   6.244634191000000   8.195945209500000  13.474829585800000   2.663237683700000
+
+   0.869902301100000   1.054066001400000   0.938590929800000   1.026327410100000
+   1.083527704500000   1.054318388600000   0.788868699600000   0.898930583300000
+   1.003996287500000   1.242751812800000   0.893280172400000   0.917392899000000
+   1.615769565700000   1.431586037300000   2.049831787900000   1.419961554600000
+   0.993367797100000   1.431962560000000  27.495176328800000   0.778802528600000
+
+   0.010369755600000   0.061138567400000   0.044830334600000   0.039283178200000
+   0.085416633800000   0.039889661900000   0.024949656900000   0.023241090800000
+   0.086137910000000  -0.075479418500000  -0.026614602100000  -0.016342909900000
+   0.057216710300000  -0.046860882500000   0.015104845500000   0.008496367800000
+   0.027893039700000   0.007692291100000   0.103353673800000  -0.009825603600000
index a9ace0b..49b6db3 100644 (file)
@@ -11,11 +11,11 @@ C General I/O units & files
       integer inp,iout,igeom,intin,ipdb,imol2,ipdbin,ithep,irotam,
      &        itorp,itordp,ifourier,ielep,isidep,iscpp,icbase,istat,
      &        ientin,ientout,izs1,isecpred,ibond,irest2,iifrag,icart,
       integer inp,iout,igeom,intin,ipdb,imol2,ipdbin,ithep,irotam,
      &        itorp,itordp,ifourier,ielep,isidep,iscpp,icbase,istat,
      &        ientin,ientout,izs1,isecpred,ibond,irest2,iifrag,icart,
-     &        irest1,isccor
+     &        irest1,isccor,ithep_pdb,irotam_pdb
       common /iounits/ inp,iout,igeom,intin,ipdb,imol2,ipdbin,ithep,
      &        irotam,itorp,itordp,ifourier,ielep,isidep,iscpp,icbase,
      &        istat,ientin,ientout,izs1,isecpred,ibond,irest2,iifrag,
       common /iounits/ inp,iout,igeom,intin,ipdb,imol2,ipdbin,ithep,
      &        irotam,itorp,itordp,ifourier,ielep,isidep,iscpp,icbase,
      &        istat,ientin,ientout,izs1,isecpred,ibond,irest2,iifrag,
-     &        icart,irest1,isccor
+     &        icart,irest1,isccor,ithep_pdb,irotam_pdb
       character*256 outname,intname,pdbname,mol2name,statname,intinname,
      &        entname,prefix,secpred,rest2name,qname,cartname,tmpdir,
      &        mremd_rst_name,curdir,pref_orig
       character*256 outname,intname,pdbname,mol2name,statname,intinname,
      &        entname,prefix,secpred,rest2name,qname,cartname,tmpdir,
      &        mremd_rst_name,curdir,pref_orig
@@ -38,9 +38,11 @@ C CSA I/O units & files
      & icsa_bank_reminimized,icsa_native_int,icsa_in,icsa_pdb
 C Parameter files
       character*256 bondname,thetname,rotname,torname,tordname,
      & icsa_bank_reminimized,icsa_native_int,icsa_in,icsa_pdb
 C Parameter files
       character*256 bondname,thetname,rotname,torname,tordname,
-     &       fouriername,elename,sidename,scpname,sccorname,patname
+     &       fouriername,elename,sidename,scpname,sccorname,patname,
+     &       thetname_pdb,rotname_pdb
       common /parfiles/ bondname,thetname,rotname,torname,tordname,
       common /parfiles/ bondname,thetname,rotname,torname,tordname,
-     &       fouriername,elename,sidename,scpname,sccorname,patname
+     &       fouriername,elename,sidename,scpname,sccorname,patname,
+     &       thetname_pdb,rotname_pdb
       character*3 pot
 C-----------------------------------------------------------------------
 C INP    - main input file
       character*3 pot
 C-----------------------------------------------------------------------
 C INP    - main input file
index b651f0a..b7e216c 100644 (file)
@@ -5116,7 +5116,7 @@ c        write (2,*) "xx",xx," yy",yy," zz",zz
 Cc diagnostics - remove later
         xx1 = dcos(alph(2))
         yy1 = dsin(alph(2))*dcos(omeg(2))
 Cc diagnostics - remove later
         xx1 = dcos(alph(2))
         yy1 = dsin(alph(2))*dcos(omeg(2))
-        zz1 = -dsign(1.0,itype(i))*dsin(alph(2))*dsin(omeg(2))
+        zz1 = -dsign(1.0,dfloat(itype(i)))*dsin(alph(2))*dsin(omeg(2))
         write(2,'(3f8.1,3f9.3,1x,3f9.3)') 
      &    alph(2)*rad2deg,omeg(2)*rad2deg,theta(3)*rad2deg,xx,yy,zz,
      &    xx1,yy1,zz1
         write(2,'(3f8.1,3f9.3,1x,3f9.3)') 
      &    alph(2)*rad2deg,omeg(2)*rad2deg,theta(3)*rad2deg,xx,yy,zz,
      &    xx1,yy1,zz1
index a91149e..ed6b83c 100644 (file)
@@ -80,7 +80,9 @@ C
       igeom=  8
       intin=  9
       ithep= 11
       igeom=  8
       intin=  9
       ithep= 11
+      ithep_pdb=51
       irotam=12
       irotam=12
+      irotam_pdb=52
       itorp= 13
       itordp= 23
       ielep= 14
       itorp= 13
       itordp= 23
       ielep= 14
index 154fcf4..6ea0840 100644 (file)
@@ -388,13 +388,15 @@ C
       enddo
       call flush(iout)
       endif
       enddo
       call flush(iout)
       endif
-      write (2,*) "Start reading THETA_PDB"
+      write (2,*) "Start reading THETA_PDB",ithep_pdb
       do i=1,ntyp
       do i=1,ntyp
-        read (ithep,*,err=111,end=111) a0thet(i),(athet(j,i,1,1),j=1,2),
+c      write (2,*) 'i=',i
+        read (ithep_pdb,*,err=111,end=111)
+     &     a0thet(i),(athet(j,i,1,1),j=1,2),
      &    (bthet(j,i,1,1),j=1,2)
      &    (bthet(j,i,1,1),j=1,2)
-        read (ithep,*,err=111,end=111) (polthet(j,i),j=0,3)
-        read (ithep,*,err=111,end=111) (gthet(j,i),j=1,3)
-        read (ithep,*,err=111,end=111) theta0(i),sig0(i),sigc0(i)
+        read (ithep_pdb,*,err=111,end=111) (polthet(j,i),j=0,3)
+        read (ithep_pdb,*,err=111,end=111) (gthet(j,i),j=1,3)
+        read (ithep_pdb,*,err=111,end=111) theta0(i),sig0(i),sigc0(i)
         sigc0(i)=sigc0(i)**2
       enddo
       do i=1,ntyp
         sigc0(i)=sigc0(i)**2
       enddo
       do i=1,ntyp
@@ -539,6 +541,7 @@ C
 C Read the parameters of the probability distribution/energy expression
 C of the side chains.
 C
 C Read the parameters of the probability distribution/energy expression
 C of the side chains.
 C
+      write (2,*) "Start reading ROTAM_PDB"
       do i=1,ntyp
         read (irotam_pdb,'(3x,i3,f8.3)',end=112,err=112) nlob(i),dsc(i)
         if (i.eq.10) then
       do i=1,ntyp
         read (irotam_pdb,'(3x,i3,f8.3)',end=112,err=112) nlob(i),dsc(i)
         if (i.eq.10) then
@@ -577,6 +580,7 @@ C
         endif
       enddo
       close (irotam_pdb)
         endif
       enddo
       close (irotam_pdb)
+      write (2,*) "End reading ROTAM_PDB"
 #endif
       close(irotam)
 
 #endif
       close(irotam)
 
index 7ac0669..265b705 100644 (file)
@@ -1916,12 +1916,22 @@ C Get parameter filenames and open the parameter files.
       open (itordp,file=tordname,status='old',readonly)
       call getenv_loc('SCCORPAR',sccorname)
       open (isccor,file=sccorname,status='old',readonly)
       open (itordp,file=tordname,status='old',readonly)
       call getenv_loc('SCCORPAR',sccorname)
       open (isccor,file=sccorname,status='old',readonly)
+#ifndef CRYST_THETA
+      call getenv_loc('THETPARPDB',thetname_pdb)
+      print *,"thetname_pdb ",thetname_pdb
+      open (ithep_pdb,file=thetname_pdb,status='old',action='read')
+      print *,ithep_pdb," opened"
+#endif
       call getenv_loc('FOURIER',fouriername)
       open (ifourier,file=fouriername,status='old',readonly)
       call getenv_loc('ELEPAR',elename)
       open (ielep,file=elename,status='old',readonly)
       call getenv_loc('SIDEPAR',sidename)
       open (isidep,file=sidename,status='old',readonly)
       call getenv_loc('FOURIER',fouriername)
       open (ifourier,file=fouriername,status='old',readonly)
       call getenv_loc('ELEPAR',elename)
       open (ielep,file=elename,status='old',readonly)
       call getenv_loc('SIDEPAR',sidename)
       open (isidep,file=sidename,status='old',readonly)
+#ifndef CRYST_SC
+      call getenv_loc('ROTPARPDB',rotname_pdb)
+      open (irotam_pdb,file=rotname_pdb,status='old',action='read')
+#endif
 #endif
 #ifndef OLDSCP
 C
 #endif
 #ifndef OLDSCP
 C
@@ -2083,6 +2093,8 @@ C Write file names
      &  thetname(:ilen(thetname))
       write (iout,*) "Rotamer parameter file          : ",
      &  rotname(:ilen(rotname))
      &  thetname(:ilen(thetname))
       write (iout,*) "Rotamer parameter file          : ",
      &  rotname(:ilen(rotname))
+      write (iout,*) "Thetpdb parameter file          : ",
+     &  thetname_pdb(:ilen(thetname_pdb))
       write (iout,*) "Threading database              : ",
      &  patname(:ilen(patname))
       if (lentmp.ne.0) 
       write (iout,*) "Threading database              : ",
      &  patname(:ilen(patname))
       if (lentmp.ne.0) 
index ba31354..bb85d93 100644 (file)
@@ -4791,7 +4791,7 @@ C
         dephii=0.0d0
         dephii1=0.0d0
         theti2=0.5d0*theta(i)
         dephii=0.0d0
         dephii1=0.0d0
         theti2=0.5d0*theta(i)
-        ityp2=ithetyp(iabs(itype(i-1)))
+        ityp2=ithetyp(itype(i-1))
         do k=1,nntheterm
           coskt(k)=dcos(k*theti2)
           sinkt(k)=dsin(k*theti2)
         do k=1,nntheterm
           coskt(k)=dcos(k*theti2)
           sinkt(k)=dsin(k*theti2)
@@ -4803,7 +4803,7 @@ C
 #else
           phii=phi(i)
 #endif
 #else
           phii=phi(i)
 #endif
-          ityp1=ithetyp(iabs(itype(i-2)))
+          ityp1=ithetyp(itype(i-2))
           do k=1,nsingle
             cosph1(k)=dcos(k*phii)
             sinph1(k)=dsin(k*phii)
           do k=1,nsingle
             cosph1(k)=dcos(k*phii)
             sinph1(k)=dsin(k*phii)
@@ -4817,6 +4817,9 @@ C
           enddo 
         endif
         if (i.lt.nres) then
           enddo 
         endif
         if (i.lt.nres) then
+
+        if (iabs(itype(i+1)).eq.20) iblock=2
+        if (iabs(itype(i+1)).ne.20) iblock=1
 #ifdef OSF
           phii1=phi(i+1)
           if (phii1.ne.phii1) phii1=150.0
 #ifdef OSF
           phii1=phi(i+1)
           if (phii1.ne.phii1) phii1=150.0
@@ -4824,7 +4827,7 @@ C
 #else
           phii1=phi(i+1)
 #endif
 #else
           phii1=phi(i+1)
 #endif
-          ityp3=ithetyp(iabs(itype(i)))
+          ityp3=ithetyp(itype(i))
           do k=1,nsingle
             cosph2(k)=dcos(k*phii1)
             sinph2(k)=dsin(k*phii1)
           do k=1,nsingle
             cosph2(k)=dcos(k*phii1)
             sinph2(k)=dsin(k*phii1)
@@ -4837,7 +4840,7 @@ C
             sinph2(k)=0.0d0
           enddo
         endif  
             sinph2(k)=0.0d0
           enddo
         endif  
-        ethetai=aa0thet(ityp1,ityp2,ityp3)
+         ethetai=aa0thet(ityp1,ityp2,ityp3,iblock)
         do k=1,ndouble
           do l=1,k-1
             ccl=cosph1(l)*cosph2(k-l)
         do k=1,ndouble
           do l=1,k-1
             ccl=cosph1(l)*cosph2(k-l)
         enddo
         endif
         do k=1,ntheterm
         enddo
         endif
         do k=1,ntheterm
-          ethetai=ethetai+aathet(k,ityp1,ityp2,ityp3)*sinkt(k)
-          dethetai=dethetai+0.5d0*k*aathet(k,ityp1,ityp2,ityp3)
+          ethetai=ethetai+aathet(k,ityp1,ityp2,ityp3,iblock)*sinkt(k)
+          dethetai=dethetai+0.5d0*k*aathet(k,ityp1,ityp2,ityp3,iblock)
      &      *coskt(k)
           if (lprn)
      &      *coskt(k)
           if (lprn)
-     &    write (iout,*) "k",k," aathet",aathet(k,ityp1,ityp2,ityp3),
+     &    write (iout,*) "k",k,
+     &    "aathet",aathet(k,ityp1,ityp2,ityp3,iblock),
      &     " ethetai",ethetai
         enddo
         if (lprn) then
      &     " ethetai",ethetai
         enddo
         if (lprn) then
         endif
         do m=1,ntheterm2
           do k=1,nsingle
         endif
         do m=1,ntheterm2
           do k=1,nsingle
-            aux=bbthet(k,m,ityp1,ityp2,ityp3)*cosph1(k)
-     &         +ccthet(k,m,ityp1,ityp2,ityp3)*sinph1(k)
-     &         +ddthet(k,m,ityp1,ityp2,ityp3)*cosph2(k)
-     &         +eethet(k,m,ityp1,ityp2,ityp3)*sinph2(k)
+            aux=bbthet(k,m,ityp1,ityp2,ityp3,iblock)*cosph1(k)
+     &         +ccthet(k,m,ityp1,ityp2,ityp3,iblock)*sinph1(k)
+     &         +ddthet(k,m,ityp1,ityp2,ityp3,iblock)*cosph2(k)
+     &         +eethet(k,m,ityp1,ityp2,ityp3,iblock)*sinph2(k)
             ethetai=ethetai+sinkt(m)*aux
             dethetai=dethetai+0.5d0*m*aux*coskt(m)
             dephii=dephii+k*sinkt(m)*(
             ethetai=ethetai+sinkt(m)*aux
             dethetai=dethetai+0.5d0*m*aux*coskt(m)
             dephii=dephii+k*sinkt(m)*(
-     &          ccthet(k,m,ityp1,ityp2,ityp3)*cosph1(k)-
-     &          bbthet(k,m,ityp1,ityp2,ityp3)*sinph1(k))
+     &          ccthet(k,m,ityp1,ityp2,ityp3,iblock)*cosph1(k)-
+     &          bbthet(k,m,ityp1,ityp2,ityp3,iblock)*sinph1(k))
             dephii1=dephii1+k*sinkt(m)*(
             dephii1=dephii1+k*sinkt(m)*(
-     &          eethet(k,m,ityp1,ityp2,ityp3)*cosph2(k)-
-     &          ddthet(k,m,ityp1,ityp2,ityp3)*sinph2(k))
+     &          eethet(k,m,ityp1,ityp2,ityp3,iblock)*cosph2(k)-
+     &          ddthet(k,m,ityp1,ityp2,ityp3,iblock)*sinph2(k))
             if (lprn)
      &      write (iout,*) "m",m," k",k," bbthet",
             if (lprn)
      &      write (iout,*) "m",m," k",k," bbthet",
-     &         bbthet(k,m,ityp1,ityp2,ityp3)," ccthet",
-     &         ccthet(k,m,ityp1,ityp2,ityp3)," ddthet",
-     &         ddthet(k,m,ityp1,ityp2,ityp3)," eethet",
-     &         eethet(k,m,ityp1,ityp2,ityp3)," ethetai",ethetai
+     &         bbthet(k,m,ityp1,ityp2,ityp3,iblock)," ccthet",
+     &         ccthet(k,m,ityp1,ityp2,ityp3,iblock)," ddthet",
+     &         ddthet(k,m,ityp1,ityp2,ityp3,iblock)," eethet",
+     &         eethet(k,m,ityp1,ityp2,ityp3,iblock)," ethetai",ethetai
           enddo
         enddo
         if (lprn)
           enddo
         enddo
         if (lprn)
         do m=1,ntheterm3
           do k=2,ndouble
             do l=1,k-1
         do m=1,ntheterm3
           do k=2,ndouble
             do l=1,k-1
-              aux=ffthet(l,k,m,ityp1,ityp2,ityp3)*cosph1ph2(l,k)+
-     &            ffthet(k,l,m,ityp1,ityp2,ityp3)*cosph1ph2(k,l)+
-     &            ggthet(l,k,m,ityp1,ityp2,ityp3)*sinph1ph2(l,k)+
-     &            ggthet(k,l,m,ityp1,ityp2,ityp3)*sinph1ph2(k,l)
+       aux=ffthet(l,k,m,ityp1,ityp2,ityp3,iblock)*cosph1ph2(l,k)+
+     & ffthet(k,l,m,ityp1,ityp2,ityp3,iblock)*cosph1ph2(k,l)+
+     & ggthet(l,k,m,ityp1,ityp2,ityp3,iblock)*sinph1ph2(l,k)+
+     & ggthet(k,l,m,ityp1,ityp2,ityp3,iblock)*sinph1ph2(k,l)
+
               ethetai=ethetai+sinkt(m)*aux
               dethetai=dethetai+0.5d0*m*coskt(m)*aux
               dephii=dephii+l*sinkt(m)*(
               ethetai=ethetai+sinkt(m)*aux
               dethetai=dethetai+0.5d0*m*coskt(m)*aux
               dephii=dephii+l*sinkt(m)*(
-     &           -ffthet(l,k,m,ityp1,ityp2,ityp3)*sinph1ph2(l,k)-
-     &            ffthet(k,l,m,ityp1,ityp2,ityp3)*sinph1ph2(k,l)+
-     &            ggthet(l,k,m,ityp1,ityp2,ityp3)*cosph1ph2(l,k)+
-     &            ggthet(k,l,m,ityp1,ityp2,ityp3)*cosph1ph2(k,l))
+     & -ffthet(l,k,m,ityp1,ityp2,ityp3,iblock)*sinph1ph2(l,k)-
+     &  ffthet(k,l,m,ityp1,ityp2,ityp3,iblock)*sinph1ph2(k,l)+
+     &  ggthet(l,k,m,ityp1,ityp2,ityp3,iblock)*cosph1ph2(l,k)+
+     &  ggthet(k,l,m,ityp1,ityp2,ityp3,iblock)*cosph1ph2(k,l))
+
               dephii1=dephii1+(k-l)*sinkt(m)*(
               dephii1=dephii1+(k-l)*sinkt(m)*(
-     &           -ffthet(l,k,m,ityp1,ityp2,ityp3)*sinph1ph2(l,k)+
-     &            ffthet(k,l,m,ityp1,ityp2,ityp3)*sinph1ph2(k,l)+
-     &            ggthet(l,k,m,ityp1,ityp2,ityp3)*cosph1ph2(l,k)-
-     &            ggthet(k,l,m,ityp1,ityp2,ityp3)*cosph1ph2(k,l))
+     &-ffthet(l,k,m,ityp1,ityp2,ityp3,iblock)*sinph1ph2(l,k)+
+     & ffthet(k,l,m,ityp1,ityp2,ityp3,iblock)*sinph1ph2(k,l)+
+     & ggthet(l,k,m,ityp1,ityp2,ityp3,iblock)*cosph1ph2(l,k)-
+     & ggthet(k,l,m,ityp1,ityp2,ityp3,iblock)*cosph1ph2(k,l))
+
               if (lprn) then
               write (iout,*) "m",m," k",k," l",l," ffthet",
               if (lprn) then
               write (iout,*) "m",m," k",k," l",l," ffthet",
-     &            ffthet(l,k,m,ityp1,ityp2,ityp3),
-     &            ffthet(k,l,m,ityp1,ityp2,ityp3)," ggthet",
-     &            ggthet(l,k,m,ityp1,ityp2,ityp3),
-     &            ggthet(k,l,m,ityp1,ityp2,ityp3)," ethetai",ethetai
+     &            ffthet(l,k,m,ityp1,ityp2,ityp3,iblock),
+     &            ffthet(k,l,m,ityp1,ityp2,ityp3,iblock)," ggthet",
+     &            ggthet(l,k,m,ityp1,ityp2,ityp3,iblock),
+     &            ggthet(k,l,m,ityp1,ityp2,ityp3,iblock),
+     &            " ethetai",ethetai
+
               write (iout,*) cosph1ph2(l,k)*sinkt(m),
      &            cosph1ph2(k,l)*sinkt(m),
      &            sinph1ph2(l,k)*sinkt(m),sinph1ph2(k,l)*sinkt(m)
               write (iout,*) cosph1ph2(l,k)*sinkt(m),
      &            cosph1ph2(k,l)*sinkt(m),
      &            sinph1ph2(l,k)*sinkt(m),sinph1ph2(k,l)*sinkt(m)
@@ -5280,7 +5289,7 @@ C
         cosfac=dsqrt(cosfac2)
         sinfac2=0.5d0/(1.0d0-costtab(i+1))
         sinfac=dsqrt(sinfac2)
         cosfac=dsqrt(cosfac2)
         sinfac2=0.5d0/(1.0d0-costtab(i+1))
         sinfac=dsqrt(sinfac2)
-        it=itype(i)
+        it=iabs(itype(i))
         if (it.eq.10) goto 1
 c
 C  Compute the axes of tghe local cartesian coordinates system; store in
         if (it.eq.10) goto 1
 c
 C  Compute the axes of tghe local cartesian coordinates system; store in
@@ -5298,7 +5307,7 @@ C     &   dc_norm(3,i+nres)
           y_prime(j) = (dc_norm(j,i) + dc_norm(j,i-1))*sinfac
         enddo
         do j = 1,3
           y_prime(j) = (dc_norm(j,i) + dc_norm(j,i-1))*sinfac
         enddo
         do j = 1,3
-          z_prime(j) = -uz(j,i-1)
+          z_prime(j) = -uz(j,i-1)*dsign(1.0d0,dfloat(itype(i)))
         enddo     
 c       write (2,*) "i",i
 c       write (2,*) "x_prime",(x_prime(j),j=1,3)
         enddo     
 c       write (2,*) "i",i
 c       write (2,*) "x_prime",(x_prime(j),j=1,3)
@@ -5320,8 +5329,7 @@ c
         do j = 1,3
           xx = xx + x_prime(j)*dc_norm(j,i+nres)
           yy = yy + y_prime(j)*dc_norm(j,i+nres)
         do j = 1,3
           xx = xx + x_prime(j)*dc_norm(j,i+nres)
           yy = yy + y_prime(j)*dc_norm(j,i+nres)
-          zz = zz + dsign(1.0,dfloat(itype(i)))
-     &             *z_prime(j)*dc_norm(j,i+nres)
+          zz = zz + z_prime(j)*dc_norm(j,i+nres)
         enddo
 
         xxtab(i)=xx
         enddo
 
         xxtab(i)=xx
@@ -5509,8 +5517,10 @@ c     &   (dC_norm(j,i-1),j=1,3)," vbld_inv",vbld_inv(i+1),vbld_inv(i)
          dZZ_Ci1(k)=0.0d0
          dZZ_Ci(k)=0.0d0
          do j=1,3
          dZZ_Ci1(k)=0.0d0
          dZZ_Ci(k)=0.0d0
          do j=1,3
-           dZZ_Ci(k)=dZZ_Ci(k)-uzgrad(j,k,2,i-1)*dC_norm(j,i+nres)
-           dZZ_Ci1(k)=dZZ_Ci1(k)-uzgrad(j,k,1,i-1)*dC_norm(j,i+nres)
+           dZZ_Ci(k)=dZZ_Ci(k)-uzgrad(j,k,2,i-1)
+     &     *dsign(1.0d0,dfloat(itype(i)))*dC_norm(j,i+nres)
+           dZZ_Ci1(k)=dZZ_Ci1(k)-uzgrad(j,k,1,i-1)
+     &     *dsign(1.0d0,dfloat(itype(i)))*dC_norm(j,i+nres)
          enddo
           
          dXX_XYZ(k)=vbld_inv(i+nres)*(x_prime(k)-xx*dC_norm(k,i+nres))
          enddo
           
          dXX_XYZ(k)=vbld_inv(i+nres)*(x_prime(k)-xx*dC_norm(k,i+nres))
@@ -5796,6 +5806,8 @@ c     lprn=.true.
       etors=0.0D0
       do i=iphi_start,iphi_end
       etors_ii=0.0D0
       etors=0.0D0
       do i=iphi_start,iphi_end
       etors_ii=0.0D0
+c        if (itype(i-2).eq.ntyp1 .or. itype(i-1).eq.ntyp1
+c     &      .or. itype(i).eq.ntyp1 .or. itype(i+1).eq.ntyp1) cycle
         itori=itortyp(itype(i-2))
         itori1=itortyp(itype(i-1))
         if (iabs(itype(i)).eq.20) then
         itori=itortyp(itype(i-2))
         itori1=itortyp(itype(i-1))
         if (iabs(itype(i)).eq.20) then
@@ -5895,6 +5907,8 @@ C Set lprn=.true. for debugging
 c     lprn=.true.
       etors_d=0.0D0
       do i=iphid_start,iphid_end
 c     lprn=.true.
       etors_d=0.0D0
       do i=iphid_start,iphid_end
+c        if (itype(i-2).eq.ntyp1 .or. itype(i-1).eq.ntyp1
+c     &      .or. itype(i).eq.ntyp1 .or. itype(i+1).eq.ntyp1) cycle
         itori=itortyp(itype(i-2))
         itori1=itortyp(itype(i-1))
         itori2=itortyp(itype(i))
         itori=itortyp(itype(i-2))
         itori1=itortyp(itype(i-1))
         itori2=itortyp(itype(i))
@@ -5969,7 +5983,7 @@ c        amino-acid residues.
 C Set lprn=.true. for debugging
       lprn=.false.
 c      lprn=.true.
 C Set lprn=.true. for debugging
       lprn=.false.
 c      lprn=.true.
-c      write (iout,*) "EBACK_SC_COR",iphi_start,iphi_end,nterm_sccor
+c     write (iout,*) "EBACK_SC_COR",itau_start,itau_end
       esccor=0.0D0
       do i=itau_start,itau_end
         esccor_ii=0.0D0
       esccor=0.0D0
       do i=itau_start,itau_end
         esccor_ii=0.0D0
@@ -5995,9 +6009,11 @@ c   3 = SC...Ca...Ca...SCi
      &      (itype(i-1).eq.10).or.(itype(i-2).eq.ntyp1).or.
      &      (itype(i-1).eq.ntyp1)))
      &    .or. ((intertyp.eq.1).and.((itype(i-2).eq.10)
      &      (itype(i-1).eq.10).or.(itype(i-2).eq.ntyp1).or.
      &      (itype(i-1).eq.ntyp1)))
      &    .or. ((intertyp.eq.1).and.((itype(i-2).eq.10)
-     &     .or.(itype(i-2).eq.ntyp1)))
+     &     .or.(itype(i-2).eq.ntyp1).or.(itype(i-1).eq.ntyp1)
+     &     .or.(itype(i).eq.ntyp1)))
      &    .or.((intertyp.eq.2).and.((itype(i-1).eq.10).or.
      &    .or.((intertyp.eq.2).and.((itype(i-1).eq.10).or.
-     &      (itype(i-1).eq.ntyp1)))) cycle  
+     &      (itype(i-1).eq.ntyp1).or.(itype(i-2).eq.ntyp1).or.
+     &      (itype(i-3).eq.ntyp1)))) cycle
         if ((intertyp.eq.2).and.(i.eq.4).and.(itype(1).eq.ntyp1)) cycle
         if ((intertyp.eq.1).and.(i.eq.nres).and.(itype(nres).eq.ntyp1))
      & cycle
         if ((intertyp.eq.2).and.(i.eq.4).and.(itype(1).eq.ntyp1)) cycle
         if ((intertyp.eq.1).and.(i.eq.nres).and.(itype(nres).eq.ntyp1))
      & cycle
@@ -6014,9 +6030,9 @@ c        write (iout,*) "WTF",intertyp,i,itype(i),v1ij*cosphi+v2ij*sinphi
 c     &gloc_sc(intertyp,i-3,icg)
         if (lprn)
      &  write (iout,'(2(a3,2x,i3,2x),2i3,6f8.3/26x,6f8.3/)')
 c     &gloc_sc(intertyp,i-3,icg)
         if (lprn)
      &  write (iout,'(2(a3,2x,i3,2x),2i3,6f8.3/26x,6f8.3/)')
-     &  restyp(itype(i-2)),i-2,restyp(itype(i-1)),i-1,itori,itori1,
-     &  (v1sccor(j,intertyp,itori,itori1),j=1,6)
-     & ,(v2sccor(j,intertyp,itori,itori1),j=1,6)
+     &  restyp(itype(i-2)),i-2,restyp(itype(i-1)),i-1,isccori,isccori1,
+     &  (v1sccor(j,intertyp,isccori,isccori1),j=1,6)
+     & ,(v2sccor(j,intertyp,isccori,isccori1),j=1,6)
         gsccor_loc(i-3)=gsccor_loc(i-3)+gloci
        enddo !intertyp
       enddo
         gsccor_loc(i-3)=gsccor_loc(i-3)+gloci
        enddo !intertyp
       enddo
index 68f599a..074db7c 100644 (file)
@@ -391,11 +391,12 @@ C
       endif
       write (2,*) "Start reading THETA_PDB"
       do i=1,ntyp
       endif
       write (2,*) "Start reading THETA_PDB"
       do i=1,ntyp
-        read (ithep,*,err=111,end=111) a0thet(i),(athet(j,i,1,1),j=1,2),
+        read (ithep_pdb,*,err=111,end=111)
+     &     a0thet(i),(athet(j,i,1,1),j=1,2),
      &    (bthet(j,i,1,1),j=1,2)
      &    (bthet(j,i,1,1),j=1,2)
-        read (ithep,*,err=111,end=111) (polthet(j,i),j=0,3)
-       read (ithep,*,err=111,end=111) (gthet(j,i),j=1,3)
-       read (ithep,*,err=111,end=111) theta0(i),sig0(i),sigc0(i)
+        read (ithep_pdb,*,err=111,end=111) (polthet(j,i),j=0,3)
+       read (ithep_pdb,*,err=111,end=111) (gthet(j,i),j=1,3)
+       read (ithep_pdb,*,err=111,end=111) theta0(i),sig0(i),sigc0(i)
        sigc0(i)=sigc0(i)**2
       enddo
       do i=1,ntyp
        sigc0(i)=sigc0(i)**2
       enddo
       do i=1,ntyp
@@ -541,6 +542,8 @@ C
 C Read the parameters of the probability distribution/energy expression
 C of the side chains.
 C
 C Read the parameters of the probability distribution/energy expression
 C of the side chains.
 C
+      write (2,*) "Start reading ROTAM_PDB"
+
       do i=1,ntyp
        read (irotam_pdb,'(3x,i3,f8.3)',end=112,err=112) nlob(i),dsc(i)
         if (i.eq.10) then
       do i=1,ntyp
        read (irotam_pdb,'(3x,i3,f8.3)',end=112,err=112) nlob(i),dsc(i)
         if (i.eq.10) then
@@ -579,6 +582,7 @@ C
        endif
       enddo
       close (irotam_pdb)
        endif
       enddo
       close (irotam_pdb)
+      write (2,*) "Ending reading ROTAM_PDB"
 #endif
       close(irotam)
 
 #endif
       close(irotam)