X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=source%2Funres%2FMD.f90;h=1d044a74d6ff7587e47d594684d28616ddac5357;hb=3cfa75a7cde45537ea8ebf322ae4d396b8e29ddc;hp=3725902b446821db4a162c33a10183125febf9ca;hpb=8d2ab9ba185dbbc31bfe3d1c66d7e1c9d632463b;p=unres4.git diff --git a/source/unres/MD.f90 b/source/unres/MD.f90 index 3725902..1d044a7 100644 --- a/source/unres/MD.f90 +++ b/source/unres/MD.f90 @@ -141,7 +141,7 @@ real(kind=8),dimension(:,:),allocatable :: ginvfric !(2*nres,2*nres) !maxres2=2*maxres !----------------------------------------------------------------------------- ! common /przechowalnia/ subroutine: setup_fricmat -!el real(kind=8),dimension(:,:),allocatable :: fcopy !(2*nres,2*nres) + real(kind=8),dimension(:,:),allocatable :: fcopy !(2*nres,2*nres) !----------------------------------------------------------------------------- ! ! @@ -187,6 +187,9 @@ real(kind=8),dimension(6*nres,2*nres) :: Bmat,GBmat,Tmat !(MAXRES6,MAXRES2) (maxres2=2*maxres,maxres6=6*maxres) real(kind=8),dimension(2*nres,2*nres) :: Cmat_,Cinv !(maxres2,maxres2) maxres2=2*maxres real(kind=8),dimension(6*nres,6*nres) :: Pmat !(maxres6,maxres6) maxres6=6*maxres +! real(kind=8),dimension(:,:),allocatable :: Bmat,GBmat,Tmat !(MAXRES6,MAXRES2) (maxres2=2*maxres,maxres6=6*maxres) +! real(kind=8),dimension(:,:),allocatable :: Cmat_,Cinv !(maxres2,maxres2) maxres2=2*maxres +! real(kind=8),dimension(:,:),allocatable :: Pmat !(maxres6,maxres6) maxres6=6*maxres real(kind=8),dimension(6*nres) :: Td !(maxres6) maxres6=6*maxres real(kind=8),dimension(2*nres) :: ppvec !(maxres2) maxres2=2*maxres !el common /stochcalc/ stochforcvec @@ -202,12 +205,18 @@ logical :: osob nres2=2*nres nres6=6*nres +! if (.not.allocated(Bmat)) allocate(Bmat(nres6,nres2)) +! if (.not.allocated(GBmat)) allocate (GBmat(nres6,nres2)) +! if (.not.allocated(Tmat)) allocate (Tmat(nres6,nres2)) +! if (.not.allocated(Cmat_)) allocate(Cmat_(nres2,nres2)) +! if (.not.allocated(Cinv)) allocate (Cinv(nres2,nres2)) +! if (.not.allocated(Pmat)) allocate(Pmat(6*nres,6*nres)) if (.not.allocated(stochforcvec)) allocate(stochforcvec(nres6)) !(MAXRES6) maxres6=6*maxres nbond=nct-nnt do i=nnt,nct - if (itype(i).ne.10) nbond=nbond+1 + if (itype(i,1).ne.10) nbond=nbond+1 enddo ! if (lprn1) then @@ -229,7 +238,7 @@ ind=ind+3 enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind1=ind1+1 do j=1,3 Bmat(ind+j,ind1)=dC_norm(j,i+nres) @@ -306,9 +315,9 @@ Td(i)=Td(i)+vbl*Tmat(i,ind) enddo do k=nnt,nct - if (itype(k).ne.10) then + if (itype(k,1).ne.10) then ind=ind+1 - Td(i)=Td(i)+vbldsc0(1,itype(k))*Tmat(i,ind) + Td(i)=Td(i)+vbldsc0(1,itype(k,1))*Tmat(i,ind) endif enddo enddo @@ -339,7 +348,7 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then do j=1,3 ind=ind+1 zapas(ind)=-gxcart(j,i)+stochforcvec(ind) @@ -410,9 +419,9 @@ i,(dC(j,i),j=1,3),xx enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 - xx=vbld(i+nres)-vbldsc0(1,itype(i)) + xx=vbld(i+nres)-vbldsc0(1,itype(i,1)) write (iout,'(i5,3f10.5,5x,f10.5,e15.5)') & i,(dC(j,i+nres),j=1,3),xx endif @@ -438,11 +447,11 @@ endif enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 blen2 = scalar(dc(1,i+nres),dc(1,i+nres)) - ppvec(ind)=2*vbldsc0(1,itype(i))**2-blen2 - diffbond=dabs(vbldsc0(1,itype(i))-dsqrt(blen2)) + ppvec(ind)=2*vbldsc0(1,itype(i,1))**2-blen2 + diffbond=dabs(vbldsc0(1,itype(i,1))-dsqrt(blen2)) if (diffbond.gt.diffmax) diffmax=diffbond if (ppvec(ind).gt.0.0d0) then ppvec(ind)=dsqrt(ppvec(ind)) @@ -481,7 +490,7 @@ ind=ind+3 enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then do j=1,3 dc(j,i+nres)=zapas(ind+j) dc_work(ind+j)=zapas(ind+j) @@ -525,9 +534,9 @@ i,(dC(j,i),j=1,3),xx enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 - xx=vbld(i+nres)-vbldsc0(1,itype(i)) + xx=vbld(i+nres)-vbldsc0(1,itype(i,1)) write (iout,'(i5,3f10.5,5x,f10.5,e15.5)') & i,(dC(j,i+nres),j=1,3),xx endif @@ -652,9 +661,9 @@ ! include 'COMMON.INTERACT' ! include 'COMMON.MD' ! include 'COMMON.IOUNITS' - real(kind=8) :: KE_total + real(kind=8) :: KE_total,mscab - integer :: i,j,k,iti + integer :: i,j,k,iti,mnum real(kind=8) :: KEt_p,KEt_sc,KEr_p,KEr_sc,incr(3),& mag1,mag2,v(3) #ifdef DEBUG @@ -666,18 +675,20 @@ #endif KEt_p=0.0d0 KEt_sc=0.0d0 -! write (iout,*) "ISC",(isc(itype(i)),i=1,nres) +! write (iout,*) "ISC",(isc(itype(i,1)),i=1,nres) ! The translational part for peptide virtual bonds do j=1,3 incr(j)=d_t(j,0) enddo do i=nnt,nct-1 + mnum=molnum(i) + if (mnum.eq.5) mp(mnum)=msc(itype(i,mnum),mnum) ! write (iout,*) "Kinetic trp:",i,(incr(j),j=1,3) do j=1,3 v(j)=incr(j)+0.5d0*d_t(j,i) enddo vtot(i)=v(1)*v(1)+v(2)*v(2)+v(3)*v(3) - KEt_p=KEt_p+(v(1)*v(1)+v(2)*v(2)+v(3)*v(3)) + KEt_p=KEt_p+mp(mnum)*(v(1)*v(1)+v(2)*v(2)+v(3)*v(3)) do j=1,3 incr(j)=incr(j)+d_t(j,i) enddo @@ -690,8 +701,16 @@ incr(j)=d_t(j,0) enddo do i=nnt,nct - iti=iabs(itype(i)) - if (itype(i).eq.10) then + mnum=molnum(i) + iti=iabs(itype(i,mnum)) + if (mnum.eq.5) then + mscab=0.0d0 + else + mscab=msc(iti,mnum) + endif +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).eq.10 .or. itype(i,mnum).eq.ntyp1_molec(mnum)& + .or.(mnum.eq.5)) then do j=1,3 v(j)=incr(j) enddo @@ -702,7 +721,7 @@ endif ! write (iout,*) "Kinetic trsc:",i,(incr(j),j=1,3) ! write (iout,*) "i",i," msc",msc(iti)," v",(v(j),j=1,3) - KEt_sc=KEt_sc+msc(iti)*(v(1)*v(1)+v(2)*v(2)+v(3)*v(3)) + KEt_sc=KEt_sc+mscab*(v(1)*v(1)+v(2)*v(2)+v(3)*v(3)) vtot(i+nres)=v(1)*v(1)+v(2)*v(2)+v(3)*v(3) do j=1,3 incr(j)=incr(j)+d_t(j,i) @@ -713,13 +732,14 @@ ! The part due to stretching and rotation of the peptide groups KEr_p=0.0D0 do i=nnt,nct-1 + mnum=molnum(i) ! write (iout,*) "i",i ! write (iout,*) "i",i," mag1",mag1," mag2",mag2 do j=1,3 incr(j)=d_t(j,i) enddo ! write (iout,*) "Kinetic rotp:",i,(incr(j),j=1,3) - KEr_p=KEr_p+(incr(1)*incr(1)+incr(2)*incr(2) & + KEr_p=KEr_p+Ip(mnum)*(incr(1)*incr(1)+incr(2)*incr(2) & +incr(3)*incr(3)) enddo ! goto 111 @@ -727,20 +747,23 @@ ! The rotational part of the side chain virtual bond KEr_sc=0.0D0 do i=nnt,nct - iti=iabs(itype(i)) - if (itype(i).ne.10) then + mnum=molnum(i) + iti=iabs(itype(i,mnum)) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then do j=1,3 incr(j)=d_t(j,nres+i) enddo ! write (iout,*) "Kinetic rotsc:",i,(incr(j),j=1,3) - KEr_sc=KEr_sc+Isc(iti)*(incr(1)*incr(1)+incr(2)*incr(2)+ & + KEr_sc=KEr_sc+Isc(iti,mnum)*(incr(1)*incr(1)+incr(2)*incr(2)+ & incr(3)*incr(3)) endif enddo ! The total kinetic energy 111 continue ! write(iout,*) 'KEr_sc', KEr_sc - KE_total=0.5d0*(mp*KEt_p+KEt_sc+0.25d0*Ip*KEr_p+KEr_sc) + KE_total=0.5d0*(KEt_p+KEt_sc+0.25d0*KEr_p+KEr_sc) ! write (iout,*) "KE_total",KE_total return end subroutine kinetic @@ -796,8 +819,10 @@ real(kind=8) :: tt0,scalfac integer :: nres2 nres2=2*nres + print *, "ENTER MD" ! #ifdef MPI + print *,"MY tmpdir",tmpdir,ilen(tmpdir) if (ilen(tmpdir).gt.0) & call copy_to_tmp(pref_orig(:ilen(pref_orig))//"_" & //liczba(:ilen(liczba))//'.rst') @@ -816,10 +841,14 @@ #else tt0 = tcpu() #endif + print *,"just befor setup matix",nres ! Determine the inverse of the inertia matrix. call setup_MD_matrices ! Initialize MD + print *,"AFTER SETUP MATRICES" call init_MD + print *,"AFTER INIT MD" + #ifdef MPI t_MDsetup = MPI_Wtime()-tt0 #else @@ -863,7 +892,9 @@ stop #endif else if (lang.eq.1 .or. lang.eq.4) then + print *,"before setup_fricmat" call setup_fricmat + print *,"after setup_fricmat" endif #ifdef MPI t_langsetup=MPI_Wtime()-tt0 @@ -956,7 +987,11 @@ #endif endif if (ntwe.ne.0) then - if (mod(itime,ntwe).eq.0) call statout(itime) + if (mod(itime,ntwe).eq.0) then + call statout(itime) + call returnbox +! call check_ecartint + endif #ifdef VOUT do j=1,3 v_work(j)=d_t(j,0) @@ -969,7 +1004,8 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1.and.mnum.ne.5) then do j=1,3 ind=ind+1 v_work(ind)=d_t(j,i+nres) @@ -990,6 +1026,7 @@ #endif endif if (mod(itime,ntwx).eq.0) then + call returnbox write (tytul,'("time",f8.2)') totT if(mdpdb) then call hairpin(.true.,nharp,iharp) @@ -1767,7 +1804,7 @@ ! include 'COMMON.INTERACT' ! include 'COMMON.IOUNITS' ! include 'COMMON.NAMES' - integer :: i,j,inres + integer :: i,j,inres,mnum do j=1,3 d_t(j,0)=d_t(j,0)+0.5d0*d_a(j,0)*d_time @@ -1778,7 +1815,10 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then inres=i+nres do j=1,3 d_t(j,inres)=d_t(j,inres)+0.5d0*d_a(j,inres)*d_time @@ -1804,7 +1844,7 @@ ! include 'COMMON.IOUNITS' ! include 'COMMON.NAMES' real(kind=8) :: adt,adt2 - integer :: i,j,inres + integer :: i,j,inres,mnum #ifdef DEBUG write (iout,*) "VELVERLET1 START: DC" @@ -1830,7 +1870,10 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then inres=i+nres do j=1,3 adt=d_a_old(j,inres)*d_time @@ -1866,7 +1909,7 @@ ! include 'COMMON.INTERACT' ! include 'COMMON.IOUNITS' ! include 'COMMON.NAMES' - integer :: i,j,inres + integer :: i,j,inres,mnum do j=1,3 d_t(j,0)=d_t_new(j,0)+0.5d0*d_a(j,0)*d_time @@ -1877,7 +1920,11 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! iti=iabs(itype(i,mnum)) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then inres=i+nres do j=1,3 d_t(j,inres)=d_t_new(j,inres)+0.5d0*d_a(j,inres)*d_time @@ -1960,7 +2007,7 @@ ! position and velocity increments included. real(kind=8) :: sqrt13 = 0.57735026918962576451d0 ! 1/sqrt(3) real(kind=8) :: adt,adt2 - integer :: i,j,ind,inres + integer :: i,j,ind,inres,mnum ! ! Add the contribution from BOTH friction and stochastic force to the ! coordinates, but ONLY the contribution from the friction forces to velocities @@ -1984,7 +2031,11 @@ ind=ind+3 enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! iti=iabs(itype(i,mnum)) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then inres=i+nres do j=1,3 adt=(d_a_old(j,inres)+d_af_work(ind+j))*d_time @@ -2022,7 +2073,7 @@ ! include 'COMMON.NAMES' real(kind=8),dimension(6*nres) :: stochforcvec,d_as_work1 !(MAXRES6) maxres6=6*maxres real(kind=8) :: cos60 = 0.5d0, sin60 = 0.86602540378443864676d0 - integer :: i,j,ind,inres + integer :: i,j,ind,inres,mnum ! Revised 3/31/05 AL: correlation between random contributions to ! position and velocity increments included. ! The correlation coefficients are calculated at low-friction limit. @@ -2052,7 +2103,11 @@ ind=ind+3 enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! iti=iabs(itype(i,mnum)) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then inres=i+nres do j=1,3 d_t(j,inres)=d_t_new(j,inres)+(0.5d0*(d_a(j,inres) & @@ -2084,7 +2139,7 @@ ! include 'COMMON.IOUNITS' real(kind=8),dimension(3) :: aux,accel,accel_old real(kind=8) :: dacc - integer :: i,j + integer :: i,j,mnum do j=1,3 ! aux(j)=d_a(j,0)-d_a_old(j,0) @@ -2122,7 +2177,11 @@ enddo endif do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! iti=iabs(itype(i,mnum)) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then do j=1,3 ! accel(j)=accel(j)+d_a(j,i+nres)-d_a_old(j,i+nres) accel_old(j)=accel_old(j)+d_a_old(j,i+nres) @@ -2179,7 +2238,8 @@ enddo endif ! Side chains - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1.and.& + molnum(i).ne.5) then do j=1,3 epdriftij= & dabs((d_a(j,i+nres)-d_a_old(j,i+nres))*gxcart(j,i)) @@ -2212,7 +2272,7 @@ ! include 'COMMON.IOUNITS' ! include 'COMMON.NAMES' real(kind=8) :: T_half,fact - integer :: i,j,inres + integer :: i,j,inres,mnum ! T_half=2.0d0/(dimen3*Rb)*EK fact=dsqrt(1.0d0+(d_time/tau_bath)*(t_bath/T_half-1.0d0)) @@ -2228,7 +2288,11 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! iti=iabs(itype(i,mnum)) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then inres=i+nres do j=1,3 d_t(j,inres)=fact*d_t(j,inres) @@ -2283,7 +2347,7 @@ character(len=50) :: tytul logical :: file_exist !el common /gucio/ cm - integer :: i,j,ipos,iq,iw,nft_sc,iretcode,nfun,itime,ierr + integer :: i,j,ipos,iq,iw,nft_sc,iretcode,nfun,itime,ierr,mnum real(kind=8) :: etot,tt0 logical :: fail @@ -2293,11 +2357,13 @@ ! if the friction coefficients do not depend on surface area if (lang.gt.0 .and. .not.surfarea) then do i=nnt,nct-1 - stdforcp(i)=stdfp*dsqrt(gamp) + mnum=molnum(i) + stdforcp(i)=stdfp(mnum)*dsqrt(gamp(mnum)) enddo do i=nnt,nct - stdforcsc(i)=stdfsc(iabs(itype(i))) & - *dsqrt(gamsc(iabs(itype(i)))) + mnum=molnum(i) + stdforcsc(i)=stdfsc(iabs(itype(i,mnum)),mnum) & + *dsqrt(gamsc(iabs(itype(i,mnum)),mnum)) enddo endif ! Open the pdb file for snapshotshots @@ -2641,15 +2707,17 @@ ! include 'COMMON.NAMES' ! include 'COMMON.TIME1' real(kind=8) :: xv,sigv,lowb,highb ,Ek1 +#define DEBUG #ifdef FIVEDIAG real(kind=8) ,allocatable, dimension(:) :: DDU1,DDU2,DL2,DL1,xsolv,DML,rs real(kind=8) :: sumx #ifdef DEBUG real(kind=8) ,allocatable, dimension(:) :: rsold real (kind=8),allocatable,dimension(:,:) :: matold + integer :: iti #endif #endif - integer :: i,j,ii,k,ind,mark,imark + integer :: i,j,ii,k,ind,mark,imark,mnum ! Generate random velocities from Gaussian distribution of mean 0 and std of KT/m ! First generate velocities in the eigenspace of the G matrix ! write (iout,*) "Calling random_vel dimen dimen3",dimen,dimen3 @@ -2873,7 +2941,13 @@ Ek1=0.0d0 ii=0 do i=nnt,nct - if (itype(i).eq.10) then +! if (itype(i,1).eq.10) then + mnum=molnum(i) + if (mnum.eq.5) mp(mnum)=msc(itype(i,mnum),mnum) + iti=iabs(itype(i,mnum)) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).eq.10 .or. itype(i,mnum).eq.ntyp1_molec(mnum)& + .or.(mnum.eq.5)) then j=ii+3 else j=ii+6 @@ -2881,18 +2955,21 @@ if (i.lt.nct) then do k=1,3 ! write (iout,*) "k",k," ii+k",ii+k," ii+j+k",ii+j+k,"EK1",Ek1 - Ek1=Ek1+0.5d0*mp*((d_t_work(ii+j+k)+d_t_work_new(ii+k))/2)**2+& - 0.5d0*0.25d0*IP*(d_t_work(ii+j+k)-d_t_work_new(ii+k))**2 + Ek1=Ek1+0.5d0*mp(mnum)*((d_t_work(ii+j+k)+d_t_work_new(ii+k))/2)**2+& + 0.5d0*0.25d0*IP(mnum)*(d_t_work(ii+j+k)-d_t_work_new(ii+k))**2 enddo endif - if (itype(i).ne.10) ii=ii+3 - write (iout,*) "i",i," itype",itype(i)," mass",msc(itype(i)) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) ii=ii+3 + write (iout,*) "i",i," itype",itype(i,mnum)," mass",msc(itype(i,mnum),mnum) write (iout,*) "ii",ii do k=1,3 ii=ii+1 write (iout,*) "k",k," ii",ii,"EK1",EK1 - if (iabs(itype(i)).ne.10) Ek1=Ek1+0.5d0*Isc(iabs(itype(i)))*(d_t_work(ii)-d_t_work(ii-3))**2 - Ek1=Ek1+0.5d0*msc(iabs(itype(i)))*d_t_work(ii)**2 + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5))& + Ek1=Ek1+0.5d0*Isc(iabs(itype(i,mnum)),mnum)*(d_t_work(ii)-d_t_work(ii-3))**2 + Ek1=Ek1+0.5d0*msc(iabs(itype(i,mnum)),mnum)*d_t_work(ii)**2 enddo write (iout,*) "i",i," ii",ii enddo @@ -2916,7 +2993,9 @@ d_t(k,j)=d_t_work(ind) ind=ind+1 enddo - if (itype(j).ne.10 .and. itype(j).ne.ntyp1) then + mnum=molnum(j) + if (itype(j,1).ne.10 .and. itype(j,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then do k=1,3 d_t(k,j+nres)=d_t_work(ind) ind=ind+1 @@ -2936,7 +3015,10 @@ d_t(j,0)=d_t(j,nnt) enddo do i=nnt,nct - if (itype(i).eq.10) then +! if (itype(i,1).eq.10) then + mnum=molnum(i) + if (itype(i,1).eq.10 .or. itype(i,mnum).eq.ntyp1_molec(mnum)& + .or.(mnum.eq.5)) then do j=1,3 d_t(j,i)=d_t(j,i+1)-d_t(j,i) enddo @@ -2984,7 +3066,10 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then do j=1,3 ind=ind+1 d_t(j,i+nres)=d_t_work(ind) @@ -2996,8 +3081,8 @@ ! write (iout,*) "Kinetic energy",Ek,EK1," kinetic temperature",& ! 2.0d0/(dimen3*Rb)*EK,2.0d0/(dimen3*Rb)*EK1 ! call flush(iout) +! write(iout,*) "end init MD" return -#undef DEBUG end subroutine random_vel !----------------------------------------------------------------------------- #ifndef LANG0 @@ -3225,7 +3310,10 @@ ind=ind+3 enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then do j=1,3 dc_work(ind+j)=dc_old(j,i+nres) d_t_work(ind+j)=d_t_old(j,i+nres) @@ -3273,7 +3361,10 @@ ind=ind+3 enddo do i=nnt,nct - if (itype(i).ne.10) then + mnum=molnum(i) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then inres=i+nres do j=1,3 dc(j,inres)=dc_work(ind+j) @@ -3339,7 +3430,10 @@ ind=ind+3 enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then inres=i+nres do j=1,3 d_t(j,inres)=d_t_work(ind+j) @@ -3503,7 +3597,7 @@ ind=ind+3 enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then do j=1,3 dc_work(ind+j)=dc_old(j,i+nres) d_t_work(ind+j)=d_t_old(j,i+nres) @@ -3552,7 +3646,10 @@ ind=ind+3 enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then inres=i+nres do j=1,3 dc(j,inres)=dc_work(ind+j) @@ -3618,7 +3715,10 @@ ind=ind+3 enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) +! if (itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then inres=i+nres do j=1,3 d_t(j,inres)=d_t_work(ind+j) @@ -3654,13 +3754,13 @@ real(kind=8),dimension(3,3) :: Im,Imcp,eigvec,Id real(kind=8),dimension(3) :: pr,eigval,L,vp,vrot - real(kind=8) :: M_SC,mag,mag2 + real(kind=8) :: M_SC,mag,mag2,M_PEP real(kind=8),dimension(3,0:nres) :: vpp !(3,0:MAXRES) real(kind=8),dimension(3) :: vs_p,pp,incr,v real(kind=8),dimension(3,3) :: pr1,pr2 !el common /gucio/ cm - integer :: iti,inres,i,j,k + integer :: iti,inres,i,j,k,mnum do i=1,3 do j=1,3 Im(i,j)=0.0d0 @@ -3672,91 +3772,106 @@ vrot(i)=0.0d0 enddo ! calculating the center of the mass of the protein + M_PEP=0.0d0 do i=nnt,nct-1 + mnum=molnum(i) + if (mnum.eq.5) mp(mnum)=msc(itype(i,mnum),mnum) + if (itype(i,mnum).eq.ntyp1_molec(mnum)) cycle + M_PEP=M_PEP+mp(mnum) do j=1,3 - cm(j)=cm(j)+c(j,i)+0.5d0*dc(j,i) + cm(j)=cm(j)+(c(j,i)+0.5d0*dc(j,i))*mp(mnum) enddo enddo - do j=1,3 - cm(j)=mp*cm(j) - enddo +! do j=1,3 +! cm(j)=mp(1)*cm(j) +! enddo M_SC=0.0d0 do i=nnt,nct - iti=iabs(itype(i)) - M_SC=M_SC+msc(iabs(iti)) + mnum=molnum(i) + if (mnum.eq.5) cycle + iti=iabs(itype(i,mnum)) + M_SC=M_SC+msc(iabs(iti),mnum) inres=i+nres do j=1,3 - cm(j)=cm(j)+msc(iabs(iti))*c(j,inres) + cm(j)=cm(j)+msc(iabs(iti),mnum)*c(j,inres) enddo enddo do j=1,3 - cm(j)=cm(j)/(M_SC+(nct-nnt)*mp) + cm(j)=cm(j)/(M_SC+M_PEP) enddo do i=nnt,nct-1 + mnum=molnum(i) + if (mnum.eq.5) mp(mnum)=msc(itype(i,mnum),mnum) do j=1,3 pr(j)=c(j,i)+0.5d0*dc(j,i)-cm(j) enddo - Im(1,1)=Im(1,1)+mp*(pr(2)*pr(2)+pr(3)*pr(3)) - Im(1,2)=Im(1,2)-mp*pr(1)*pr(2) - Im(1,3)=Im(1,3)-mp*pr(1)*pr(3) - Im(2,3)=Im(2,3)-mp*pr(2)*pr(3) - Im(2,2)=Im(2,2)+mp*(pr(3)*pr(3)+pr(1)*pr(1)) - Im(3,3)=Im(3,3)+mp*(pr(1)*pr(1)+pr(2)*pr(2)) + Im(1,1)=Im(1,1)+mp(mnum)*(pr(2)*pr(2)+pr(3)*pr(3)) + Im(1,2)=Im(1,2)-mp(mnum)*pr(1)*pr(2) + Im(1,3)=Im(1,3)-mp(mnum)*pr(1)*pr(3) + Im(2,3)=Im(2,3)-mp(mnum)*pr(2)*pr(3) + Im(2,2)=Im(2,2)+mp(mnum)*(pr(3)*pr(3)+pr(1)*pr(1)) + Im(3,3)=Im(3,3)+mp(mnum)*(pr(1)*pr(1)+pr(2)*pr(2)) enddo do i=nnt,nct - iti=iabs(itype(i)) + mnum=molnum(i) + iti=iabs(itype(i,mnum)) + if (mnum.eq.5) cycle inres=i+nres do j=1,3 pr(j)=c(j,inres)-cm(j) enddo - Im(1,1)=Im(1,1)+msc(iabs(iti))*(pr(2)*pr(2)+pr(3)*pr(3)) - Im(1,2)=Im(1,2)-msc(iabs(iti))*pr(1)*pr(2) - Im(1,3)=Im(1,3)-msc(iabs(iti))*pr(1)*pr(3) - Im(2,3)=Im(2,3)-msc(iabs(iti))*pr(2)*pr(3) - Im(2,2)=Im(2,2)+msc(iabs(iti))*(pr(3)*pr(3)+pr(1)*pr(1)) - Im(3,3)=Im(3,3)+msc(iabs(iti))*(pr(1)*pr(1)+pr(2)*pr(2)) + Im(1,1)=Im(1,1)+msc(iabs(iti),mnum)*(pr(2)*pr(2)+pr(3)*pr(3)) + Im(1,2)=Im(1,2)-msc(iabs(iti),mnum)*pr(1)*pr(2) + Im(1,3)=Im(1,3)-msc(iabs(iti),mnum)*pr(1)*pr(3) + Im(2,3)=Im(2,3)-msc(iabs(iti),mnum)*pr(2)*pr(3) + Im(2,2)=Im(2,2)+msc(iabs(iti),mnum)*(pr(3)*pr(3)+pr(1)*pr(1)) + Im(3,3)=Im(3,3)+msc(iabs(iti),mnum)*(pr(1)*pr(1)+pr(2)*pr(2)) enddo do i=nnt,nct-1 - Im(1,1)=Im(1,1)+Ip*(1-dc_norm(1,i)*dc_norm(1,i))* & + mnum=molnum(i) + Im(1,1)=Im(1,1)+Ip(mnum)*(1-dc_norm(1,i)*dc_norm(1,i))* & vbld(i+1)*vbld(i+1)*0.25d0 - Im(1,2)=Im(1,2)+Ip*(-dc_norm(1,i)*dc_norm(2,i))* & + Im(1,2)=Im(1,2)+Ip(mnum)*(-dc_norm(1,i)*dc_norm(2,i))* & vbld(i+1)*vbld(i+1)*0.25d0 - Im(1,3)=Im(1,3)+Ip*(-dc_norm(1,i)*dc_norm(3,i))* & + Im(1,3)=Im(1,3)+Ip(mnum)*(-dc_norm(1,i)*dc_norm(3,i))* & vbld(i+1)*vbld(i+1)*0.25d0 - Im(2,3)=Im(2,3)+Ip*(-dc_norm(2,i)*dc_norm(3,i))* & + Im(2,3)=Im(2,3)+Ip(mnum)*(-dc_norm(2,i)*dc_norm(3,i))* & vbld(i+1)*vbld(i+1)*0.25d0 - Im(2,2)=Im(2,2)+Ip*(1-dc_norm(2,i)*dc_norm(2,i))* & + Im(2,2)=Im(2,2)+Ip(mnum)*(1-dc_norm(2,i)*dc_norm(2,i))* & vbld(i+1)*vbld(i+1)*0.25d0 - Im(3,3)=Im(3,3)+Ip*(1-dc_norm(3,i)*dc_norm(3,i))* & + Im(3,3)=Im(3,3)+Ip(mnum)*(1-dc_norm(3,i)*dc_norm(3,i))* & vbld(i+1)*vbld(i+1)*0.25d0 enddo do i=nnt,nct - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then - iti=iabs(itype(i)) + mnum=molnum(i) +! if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then + iti=iabs(itype(i,mnum)) inres=i+nres - Im(1,1)=Im(1,1)+Isc(iti)*(1-dc_norm(1,inres)* & + Im(1,1)=Im(1,1)+Isc(iti,mnum)*(1-dc_norm(1,inres)* & dc_norm(1,inres))*vbld(inres)*vbld(inres) - Im(1,2)=Im(1,2)-Isc(iti)*(dc_norm(1,inres)* & + Im(1,2)=Im(1,2)-Isc(iti,mnum)*(dc_norm(1,inres)* & dc_norm(2,inres))*vbld(inres)*vbld(inres) - Im(1,3)=Im(1,3)-Isc(iti)*(dc_norm(1,inres)* & + Im(1,3)=Im(1,3)-Isc(iti,mnum)*(dc_norm(1,inres)* & dc_norm(3,inres))*vbld(inres)*vbld(inres) - Im(2,3)=Im(2,3)-Isc(iti)*(dc_norm(2,inres)* & + Im(2,3)=Im(2,3)-Isc(iti,mnum)*(dc_norm(2,inres)* & dc_norm(3,inres))*vbld(inres)*vbld(inres) - Im(2,2)=Im(2,2)+Isc(iti)*(1-dc_norm(2,inres)* & + Im(2,2)=Im(2,2)+Isc(iti,mnum)*(1-dc_norm(2,inres)* & dc_norm(2,inres))*vbld(inres)*vbld(inres) - Im(3,3)=Im(3,3)+Isc(iti)*(1-dc_norm(3,inres)* & + Im(3,3)=Im(3,3)+Isc(iti,mnum)*(1-dc_norm(3,inres)* & dc_norm(3,inres))*vbld(inres)*vbld(inres) endif enddo call angmom(cm,L) ! write(iout,*) "The angular momentum before adjustment:" -! write(iout,*) (L(j),j=1,3) +! write(iout,*) (L(j),j=1,3) Im(2,1)=Im(1,2) Im(3,1)=Im(1,3) @@ -3766,7 +3881,7 @@ do i=1,3 do j=1,3 Imcp(i,j)=Im(i,j) - Id(i,j)=0.0d0 + Id(i,j)=0.0d0 enddo enddo @@ -3819,7 +3934,11 @@ enddo enddo do i=nnt,nct - if(itype(i).ne.10 .and. itype(i).ne.ntyp1) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then +! if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)) then +! if(itype(i,1).ne.10 .and. itype(i,1).ne.ntyp1) then inres=i+nres call vecpr(vrot(1),dc(1,inres),vp) do j=1,3 @@ -3829,7 +3948,7 @@ enddo call angmom(cm,L) ! write(iout,*) "The angular momentum after adjustment:" -! write(iout,*) (L(j),j=1,3) +! write(iout,*) (L(j),j=1,3) return end subroutine inertia_tensor @@ -3849,9 +3968,9 @@ ! include 'COMMON.INTERACT' ! include 'COMMON.IOUNITS' ! include 'COMMON.NAMES' - + real(kind=8) :: mscab real(kind=8),dimension(3) :: L,cm,pr,vp,vrot,incr,v,pp - integer :: iti,inres,i,j + integer :: iti,inres,i,j,mnum ! Calculate the angular momentum do j=1,3 L(j)=0.0d0 @@ -3860,6 +3979,8 @@ incr(j)=d_t(j,0) enddo do i=nnt,nct-1 + mnum=molnum(i) + if (mnum.eq.5) mp(mnum)=msc(itype(i,mnum),mnum) do j=1,3 pr(j)=c(j,i)+0.5d0*dc(j,i)-cm(j) enddo @@ -3871,7 +3992,7 @@ enddo call vecpr(pr(1),v(1),vp) do j=1,3 - L(j)=L(j)+mp*vp(j) + L(j)=L(j)+mp(mnum)*vp(j) enddo do j=1,3 pr(j)=0.5d0*dc(j,i) @@ -3879,19 +4000,26 @@ enddo call vecpr(pr(1),pp(1),vp) do j=1,3 - L(j)=L(j)+Ip*vp(j) + L(j)=L(j)+Ip(mnum)*vp(j) enddo enddo do j=1,3 incr(j)=d_t(j,0) enddo do i=nnt,nct - iti=iabs(itype(i)) + mnum=molnum(i) + iti=iabs(itype(i,mnum)) inres=i+nres + if (mnum.eq.5) then + mscab=0.0d0 + else + mscab=msc(iti,mnum) + endif do j=1,3 pr(j)=c(j,inres)-cm(j) enddo - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then do j=1,3 v(j)=incr(j)+d_t(j,inres) enddo @@ -3901,19 +4029,20 @@ enddo endif call vecpr(pr(1),v(1),vp) -! write (iout,*) "i",i," iti",iti," pr",(pr(j),j=1,3), -! & " v",(v(j),j=1,3)," vp",(vp(j),j=1,3) +! write (iout,*) "i",i," iti",iti," pr",(pr(j),j=1,3),& +! " v",(v(j),j=1,3)," vp",(vp(j),j=1,3) do j=1,3 - L(j)=L(j)+msc(iabs(iti))*vp(j) + L(j)=L(j)+mscab*vp(j) enddo ! write (iout,*) "L",(l(j),j=1,3) - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + if (itype(i,mnum).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then do j=1,3 v(j)=incr(j)+d_t(j,inres) enddo call vecpr(dc(1,inres),d_t(1,inres),vp) do j=1,3 - L(j)=L(j)+Isc(iti)*vp(j) + L(j)=L(j)+Isc(iti,mnum)*vp(j) enddo endif do j=1,3 @@ -3938,7 +4067,7 @@ ! include 'COMMON.IOUNITS' real(kind=8),dimension(3) :: vcm,vv real(kind=8) :: summas,amas - integer :: i,j + integer :: i,j,mnum do j=1,3 vcm(j)=0.0d0 @@ -3946,15 +4075,22 @@ enddo summas=0.0d0 do i=nnt,nct + mnum=molnum(i) + if (mnum.eq.5) mp(mnum)=msc(itype(i,mnum),mnum) if (i.lt.nct) then - summas=summas+mp + summas=summas+mp(mnum) do j=1,3 - vcm(j)=vcm(j)+mp*(vv(j)+0.5d0*d_t(j,i)) + vcm(j)=vcm(j)+mp(mnum)*(vv(j)+0.5d0*d_t(j,i)) enddo endif - amas=msc(iabs(itype(i))) + if (mnum.ne.5) then + amas=msc(iabs(itype(i,mnum)),mnum) + else + amas=0.0d0 + endif summas=summas+amas - if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then + if (itype(i,mnum).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then do j=1,3 vcm(j)=vcm(j)+amas*(vv(j)+d_t(j,i+nres)) enddo @@ -4023,7 +4159,9 @@ if (lprn) write (iout,*) "RATTLE1" nbond=nct-nnt do i=nnt,nct - if (itype(i).ne.10) nbond=nbond+1 + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) nbond=nbond+1 enddo ! Make a folded form of the Ginv-matrix ind=0 @@ -4042,7 +4180,9 @@ enddo enddo do k=nnt,nct - if (itype(k).ne.10) then + mnum=molnum(k) + if (itype(k,1).ne.10 .and. itype(k,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then jj=jj+1 do l=1,3 ind1=ind1+1 @@ -4053,7 +4193,9 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) ii=ii+1 do j=1,3 ind=ind+1 @@ -4067,7 +4209,7 @@ enddo enddo do k=nnt,nct - if (itype(k).ne.10) then + if (itype(k,1).ne.10) then jj=jj+1 do l=1,3 ind1=ind1+1 @@ -4099,7 +4241,7 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind1=ind1+1 do j=1,3 dC_uncor(j,ind1)=dC(j,i+nres) @@ -4115,7 +4257,7 @@ enddo enddo do k=nnt,nct - if (itype(k).ne.10) then + if (itype(k,1).ne.10) then ind=ind+1 do j=1,3 gdc(j,i,ind)=GGinv(i,ind)*dC_old(j,k+nres) @@ -4130,9 +4272,9 @@ x(ind)=vbld(i+1)**2-vbl**2 enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 - x(ind)=vbld(i+nres)**2-vbldsc0(1,itype(i))**2 + x(ind)=vbld(i+nres)**2-vbldsc0(1,itype(i,1))**2 endif enddo if (lprn) then @@ -4149,7 +4291,10 @@ i,ind,(d_t_new(j,i),j=1,3),scalar(d_t_new(1,i),dC_old(1,i)) enddo do i=nnt,nct - if (itype(i).ne.10) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then + ind=ind+1 write (iout,'(2i5,3f10.5,5x,e15.5)') & i+nres,ind,(d_t_new(j,i+nres),j=1,3),& @@ -4203,7 +4348,7 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 do j=1,3 xx=0.0d0 @@ -4229,9 +4374,11 @@ i,(dC(j,i),j=1,3),x(ind),xx enddo do i=nnt,nct - if (itype(i).ne.10) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) ind=ind+1 - xx=vbld(i+nres)**2-vbldsc0(1,itype(i))**2 + xx=vbld(i+nres)**2-vbldsc0(1,itype(i,1))**2 write (iout,'(i5,3f10.5,5x,f10.5,e15.5)') & i,(dC(j,i+nres),j=1,3),x(ind),xx endif @@ -4244,7 +4391,7 @@ i,ind,(d_t_new(j,i),j=1,3),scalar(d_t_new(1,i),dC_old(1,i)) enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 write (iout,'(2i5,3f10.5,5x,e15.5)') & i+nres,ind,(d_t_new(j,i+nres),j=1,3),& @@ -4319,7 +4466,9 @@ enddo enddo do k=nnt,nct - if (itype(k).ne.10) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then ind=ind+1 do j=1,3 gdc(j,i,ind)=GGinv(i,ind)*dC(j,k+nres) @@ -4348,7 +4497,9 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then ind=ind+1 do j=1,nbond Cmat(ind,j)=0.0d0 @@ -4365,7 +4516,9 @@ x(ind)=scalar(d_t(1,i),dC(1,i)) enddo do i=nnt,nct - if (itype(i).ne.10) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then ind=ind+1 x(ind)=scalar(d_t(1,i+nres),dC(1,i+nres)) endif @@ -4379,7 +4532,9 @@ i,ind,(d_t(j,i),j=1,3),x(ind) enddo do i=nnt,nct - if (itype(i).ne.10) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then ind=ind+1 write (iout,'(2i5,3f10.5,5x,e15.5)') & i+nres,ind,(d_t(j,i+nres),j=1,3),x(ind) @@ -4414,7 +4569,9 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) then ind=ind+1 do j=1,3 xx=0.0d0 @@ -4435,7 +4592,9 @@ i,ind,(d_t(j,i),j=1,3),x(ind),scalar(d_t(1,i),dC(1,i)) enddo do i=nnt,nct - if (itype(i).ne.10) then + mnum=molnum(i) + if (itype(i,1).ne.10 .and. itype(i,mnum).ne.ntyp1_molec(mnum)& + .and.(mnum.ne.5)) ind=ind+1 write (iout,'(2i5,3f10.5,5x,2e15.5)') & i+nres,ind,(d_t(j,i+nres),j=1,3),x(ind),& @@ -4501,7 +4660,7 @@ if (lprn) write (iout,*) "RATTLE_BROWN" nbond=nct-nnt do i=nnt,nct - if (itype(i).ne.10) nbond=nbond+1 + if (itype(i,1).ne.10) nbond=nbond+1 enddo ! Make a folded form of the Ginv-matrix ind=0 @@ -4520,7 +4679,7 @@ enddo enddo do k=nnt,nct - if (itype(k).ne.10) then + if (itype(k,1).ne.10) then jj=jj+1 do l=1,3 ind1=ind1+1 @@ -4531,7 +4690,7 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ii=ii+1 do j=1,3 ind=ind+1 @@ -4545,7 +4704,7 @@ enddo enddo do k=nnt,nct - if (itype(k).ne.10) then + if (itype(k,1).ne.10) then jj=jj+1 do l=1,3 ind1=ind1+1 @@ -4577,7 +4736,7 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind1=ind1+1 do j=1,3 dC_uncor(j,ind1)=dC(j,i+nres) @@ -4593,7 +4752,7 @@ enddo enddo do k=nnt,nct - if (itype(k).ne.10) then + if (itype(k,1).ne.10) then ind=ind+1 do j=1,3 gdc(j,i,ind)=GGinv(i,ind)*dC_old(j,k+nres) @@ -4608,9 +4767,9 @@ x(ind)=vbld(i+1)**2-vbl**2 enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 - x(ind)=vbld(i+nres)**2-vbldsc0(1,itype(i))**2 + x(ind)=vbld(i+nres)**2-vbldsc0(1,itype(i,1))**2 endif enddo if (lprn) then @@ -4627,7 +4786,7 @@ i,ind,(d_t(j,i),j=1,3),scalar(d_t(1,i),dC_old(1,i)) enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 write (iout,'(2i5,3f10.5,5x,e15.5)') & i+nres,ind,(d_t(j,i+nres),j=1,3),& @@ -4681,7 +4840,7 @@ enddo enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 do j=1,3 xx=0.0d0 @@ -4707,9 +4866,9 @@ i,(dC(j,i),j=1,3),x(ind),xx enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 - xx=vbld(i+nres)**2-vbldsc0(1,itype(i))**2 + xx=vbld(i+nres)**2-vbldsc0(1,itype(i,1))**2 write (iout,'(i5,3f10.5,5x,f10.5,e15.5)') & i,(dC(j,i+nres),j=1,3),x(ind),xx endif @@ -4722,7 +4881,7 @@ i,ind,(d_t_new(j,i),j=1,3),scalar(d_t_new(1,i),dC_old(1,i)) enddo do i=nnt,nct - if (itype(i).ne.10) then + if (itype(i,1).ne.10) then ind=ind+1 write (iout,'(2i5,3f10.5,5x,e15.5)') & i+nres,ind,(d_t_new(j,i+nres),j=1,3),& @@ -4772,7 +4931,7 @@ !el common /przechowalnia/ ginvfric logical :: lprn = .false., checkmode = .false. - integer :: i,j,ind,k,nres2,nres6 + integer :: i,j,ind,k,nres2,nres6,mnum nres2=2*nres nres6=6*nres @@ -4795,7 +4954,9 @@ ind=ind+3 enddo do i=nnt,nct - if ((itype(i).ne.10).and.(itype(i).ne.ntyp1)) then + mnum=molnum(i) + if ((itype(i,1).ne.10).and.(itype(i,mnum).ne.ntyp1_molec(mnum))& + .and.(mnum.ne.5)) then do j=1,3 d_t_work(ind+j)=d_t(j,i+nres) enddo @@ -4824,7 +4985,10 @@ ind=ind+3 enddo do i=nnt,nct - if ((itype(i).ne.10).and.(itype(i).ne.ntyp1)) then + mnum=molnum(i) + if ((itype(i,1).ne.10).and.(itype(i,mnum).ne.ntyp1_molec(mnum))& + .and.(mnum.ne.5)) then +! if ((itype(i,1).ne.10).and.(itype(i,1).ne.ntyp1)) then do j=1,3 friction(j,i+nres)=fric_work(ind+j) enddo @@ -4945,26 +5109,30 @@ logical :: lprn = .false. real(kind=8) :: dtdi !el ,gamvec(2*nres) !el real(kind=8),dimension(2*nres,2*nres) :: ginvfric,fcopy - real(kind=8),dimension(2*nres,2*nres) :: fcopy +! real(kind=8),allocatable,dimension(:,:) :: fcopy !el real(kind=8),dimension(2*nres*(2*nres+1)/2) :: Ghalf !(mmaxres2) (mmaxres2=(maxres2*(maxres2+1)/2)) !el common /syfek/ gamvec real(kind=8) :: work(8*2*nres) integer :: iwork(2*nres) !el common /przechowalnia/ ginvfric,Ghalf,fcopy - integer :: ii,iti,k,l,nzero,nres2,nres6,ierr + integer :: ii,iti,k,l,nzero,nres2,nres6,ierr,mnum + nres2=2*nres + nres6=6*nres #ifdef MPI + if(.not.allocated(fricmat)) allocate(fricmat(nres2,nres2)) + if(.not.allocated(fcopy)) allocate(fcopy(nres2,nres2)) !maxres2=2*maxres if (fg_rank.ne.king) goto 10 #endif - nres2=2*nres - nres6=6*nres +! nres2=2*nres +! nres6=6*nres if(.not.allocated(gamvec)) allocate(gamvec(nres2)) !(MAXRES2) if(.not.allocated(ginvfric)) allocate(ginvfric(nres2,nres2)) !maxres2=2*maxres -!el if(.not.allocated(fcopy)) allocate(fcopy(nres2,nres2)) !maxres2=2*maxres + if(.not.allocated(fcopy)) allocate(fcopy(nres2,nres2)) !maxres2=2*maxres !el allocate(fcopy(nres2,nres2)) !maxres2=2*maxres if(.not.allocated(Ghalf)) allocate(Ghalf(nres2*(nres2+1)/2)) !maxres2=2*maxres -!el if(.not.allocated(fricmat)) allocate(fricmat(nres2,nres2)) + if(.not.allocated(fricmat)) allocate(fricmat(nres2,nres2)) ! Zeroing out fricmat do i=1,dimen do j=1,dimen @@ -4974,18 +5142,22 @@ ! Load the friction coefficients corresponding to peptide groups ind1=0 do i=nnt,nct-1 + mnum=molnum(i) ind1=ind1+1 - gamvec(ind1)=gamp + gamvec(ind1)=gamp(mnum) enddo ! Load the friction coefficients corresponding to side chains m=nct-nnt ind=0 - gamsc(ntyp1)=1.0d0 + do j=1,2 + gamsc(ntyp1_molec(j),j)=1.0d0 + enddo do i=nnt,nct + mnum=molnum(i) ind=ind+1 ii = ind+m - iti=itype(i) - gamvec(ii)=gamsc(iabs(iti)) + iti=itype(i,mnum) + gamvec(ii)=gamsc(iabs(iti),mnum) enddo if (surfarea) call sdarea(gamvec) ! if (lprn) then @@ -5180,7 +5352,7 @@ real(kind=8) :: highb2,sig2,forcvec(6*nres),stochforcvec(6*nres) real(kind=8) :: time00 logical :: lprn = .false. - integer :: i,j,ind + integer :: i,j,ind,mnum do i=0,2*nres do j=1,3 @@ -5227,7 +5399,9 @@ do j=1,3 ff(j)=ff(j)+force(j,i) enddo - if (itype(i+1).ne.ntyp1) then +! if (itype(i+1,1).ne.ntyp1) then + mnum=molnum(i) + if (itype(i+1,mnum).ne.ntyp1_molec(mnum)) then do j=1,3 stochforc(j,i)=stochforc(j,i)+force(j,i+nres+1) ff(j)=ff(j)+force(j,i+nres+1) @@ -5238,7 +5412,10 @@ stochforc(j,0)=ff(j)+force(j,nnt+nres) enddo do i=nnt,nct - if ((itype(i).ne.10).and.(itype(i).ne.ntyp1)) then + mnum=molnum(i) + if ((itype(i,1).ne.10).and.(itype(i,mnum).ne.ntyp1_molec(mnum))& + .and.(mnum.ne.5)) then +! if ((itype(i,1).ne.10).and.(itype(i,1).ne.ntyp1)) then do j=1,3 stochforc(j,i+nres)=force(j,i+nres) enddo @@ -5256,7 +5433,10 @@ ind=ind+3 enddo do i=nnt,nct - if ((itype(i).ne.10).and.(itype(i).ne.ntyp1)) then + mnum=molnum(i) + if ((itype(i,1).ne.10).and.(itype(i,mnum).ne.ntyp1_molec(mnum))& + .and.(mnum.ne.5)) then +! if ((itype(i,1).ne.10).and.(itype(i,1).ne.ntyp1)) then do j=1,3 stochforcvec(ind+j)=stochforc(j,i+nres) enddo @@ -5347,7 +5527,7 @@ real(kind=8),parameter :: twosix = 1.122462048309372981d0 logical :: lprn = .false. real(kind=8) :: probe,area,ratio - integer :: i,j,ind,iti + integer :: i,j,ind,iti,mnum ! ! determine new friction coefficients every few SD steps ! @@ -5361,12 +5541,14 @@ enddo ! Load peptide group radii do i=nnt,nct-1 - radius(i)=pstok + mnum=molnum(i) + radius(i)=pstok(mnum) enddo ! Load side chain radii do i=nnt,nct - iti=itype(i) - radius(i+nres)=restok(iti) + mnum=molnum(i) + iti=itype(i,mnum) + radius(i+nres)=restok(iti,mnum) enddo ! do i=1,2*nres ! write (iout,*) "i",i," radius",radius(i) @@ -5392,7 +5574,8 @@ ind=ind+1 gamvec(ind) = ratio * gamvec(ind) enddo - stdforcp(i)=stdfp*dsqrt(gamvec(ind)) + mnum=molnum(i) + stdforcp(i)=stdfp(mnum)*dsqrt(gamvec(ind)) if (lprn) write (iout,'(2f10.5)') gamvec(ind),stdforcp(i) endif enddo @@ -5406,7 +5589,8 @@ ind=ind+1 gamvec(ind) = ratio * gamvec(ind) enddo - stdforcsc(i)=stdfsc(itype(i))*dsqrt(gamvec(ind)) + mnum=molnum(i) + stdforcsc(i)=stdfsc(itype(i,mnum),mnum)*dsqrt(gamvec(ind)) if (lprn) write (iout,'(2f10.5)') gamvec(ind),stdforcsc(i) endif enddo @@ -5956,7 +6140,7 @@ allocate(flag_stoch(0:maxflag_stoch)) !(0:maxflag_stoch) #endif -!el if(.not.allocated(fcopy)) allocate(fcopy(nres2,nres2)) + if(.not.allocated(fcopy)) allocate(fcopy(nres2,nres2)) !---------------------- ! commom.hairpin in CSA module !----------------------