1 subroutine friction_force
2 implicit real*8 (a-h,o-z)
9 include 'COMMON.INTERACT'
12 include 'COMMON.LANGEVIN'
14 include 'COMMON.LANGEVIN.lang0'
16 include 'COMMON.IOUNITS'
17 double precision gamvec(MAXRES6)
19 double precision vv(3),vvtot(3,maxres),v_work(MAXRES6),
20 & ginvfric(maxres2,maxres2)
21 common /przechowalnia/ ginvfric
23 logical lprn /.false./, checkmode /.false./
37 d_t_work(ind+j)=d_t(j,i)
43 if (itype(i).ne.10 .and. itype(i).ne.21) then
45 if (itype(i).ne.10) then
46 >>>>>>> 2acc991... Wprowadznie potencjalow SC-COR do multichain oraz ich pseudosymetrii dla
48 d_t_work(ind+j)=d_t(j,i+nres)
54 call fricmat_mult(d_t_work,fric_work)
56 if (.not.checkmode) return
59 write (iout,*) "d_t_work and fric_work"
61 write (iout,'(i3,2e15.5)') i,d_t_work(i),fric_work(i)
65 friction(j,0)=fric_work(j)
70 friction(j,i)=fric_work(ind+j)
76 if (itype(i).ne.10 .and. itype(i).ne.21) then
78 if (itype(i).ne.10) then
79 >>>>>>> 2acc991... Wprowadznie potencjalow SC-COR do multichain oraz ich pseudosymetrii dla
81 friction(j,i+nres)=fric_work(ind+j)
87 write(iout,*) "Friction backbone"
89 write(iout,'(i5,3e15.5,5x,3e15.5)')
90 & i,(friction(j,i),j=1,3),(d_t(j,i),j=1,3)
92 write(iout,*) "Friction side chain"
94 write(iout,'(i5,3e15.5,5x,3e15.5)')
95 & i,(friction(j,i+nres),j=1,3),(d_t(j,i+nres),j=1,3)
104 vvtot(j,i)=vv(j)+0.5d0*d_t(j,i)
105 vvtot(j,i+nres)=vv(j)+d_t(j,i+nres)
109 write (iout,*) "vvtot backbone and sidechain"
111 write (iout,'(i5,3e15.5,5x,3e15.5)') i,(vvtot(j,i),j=1,3),
112 & (vvtot(j,i+nres),j=1,3)
117 v_work(ind+j)=vvtot(j,i)
123 v_work(ind+j)=vvtot(j,i+nres)
127 write (iout,*) "v_work gamvec and site-based friction forces"
129 write (iout,'(i5,3e15.5)') i,v_work(i),gamvec(i),
130 & gamvec(i)*v_work(i)
133 c fric_work1(i)=0.0d0
135 c fric_work1(i)=fric_work1(i)-A(j,i)*gamvec(j)*v_work(j)
138 c write (iout,*) "fric_work and fric_work1"
140 c write (iout,'(i5,2e15.5)') i,fric_work(i),fric_work1(i)
146 ginvfric(i,j)=ginvfric(i,j)+ginv(i,k)*fricmat(k,j)
150 write (iout,*) "ginvfric"
152 write (iout,'(i5,100f8.3)') i,(ginvfric(i,j),j=1,dimen)
154 write (iout,*) "symmetry check"
157 write (iout,*) i,j,ginvfric(i,j)-ginvfric(j,i)
163 c-----------------------------------------------------
164 subroutine stochastic_force(stochforcvec)
165 implicit real*8 (a-h,o-z)
171 include 'COMMON.CHAIN'
172 include 'COMMON.DERIV'
174 include 'COMMON.LOCAL'
175 include 'COMMON.INTERACT'
177 include 'COMMON.TIME1'
179 include 'COMMON.LANGEVIN'
181 include 'COMMON.LANGEVIN.lang0'
183 include 'COMMON.IOUNITS'
185 double precision x,sig,lowb,highb,
186 & ff(3),force(3,0:MAXRES2),zeta2,lowb2,
187 & highb2,sig2,forcvec(MAXRES6),stochforcvec(MAXRES6)
188 logical lprn /.false./
201 c Compute the stochastic forces acting on bodies. Store in force.
207 force(j,i)=anorm_distr(x,sig,lowb,highb)
215 force(j,i+nres)=anorm_distr(x,sig2,lowb2,highb2)
219 time_fsample=time_fsample+MPI_Wtime()-time00
221 time_fsample=time_fsample+tcpu()-time00
223 c Compute the stochastic forces acting on virtual-bond vectors.
229 stochforc(j,i)=ff(j)+0.5d0*force(j,i)
232 ff(j)=ff(j)+force(j,i)
234 if (itype(i+1).ne.21) then
236 stochforc(j,i)=stochforc(j,i)+force(j,i+nres+1)
237 ff(j)=ff(j)+force(j,i+nres+1)
242 stochforc(j,0)=ff(j)+force(j,nnt+nres)
246 if (itype(i).ne.10 .and. itype(i).ne.21) then
248 if (itype(i).ne.10) then
249 >>>>>>> 2acc991... Wprowadznie potencjalow SC-COR do multichain oraz ich pseudosymetrii dla
251 stochforc(j,i+nres)=force(j,i+nres)
257 stochforcvec(j)=stochforc(j,0)
262 stochforcvec(ind+j)=stochforc(j,i)
268 if (itype(i).ne.10 .and. itype(i).ne.21) then
270 if (itype(i).ne.10) then
271 >>>>>>> 2acc991... Wprowadznie potencjalow SC-COR do multichain oraz ich pseudosymetrii dla
273 stochforcvec(ind+j)=stochforc(j,i+nres)
279 write (iout,*) "stochforcvec"
281 write(iout,'(i5,e15.5)') i,stochforcvec(i)
283 write(iout,*) "Stochastic forces backbone"
285 write(iout,'(i5,3e15.5)') i,(stochforc(j,i),j=1,3)
287 write(iout,*) "Stochastic forces side chain"
289 write(iout,'(i5,3e15.5)')
290 & i,(stochforc(j,i+nres),j=1,3)
300 forcvec(ind+j)=force(j,i)
307 forcvec(j+ind)=force(j,i+nres)
312 write (iout,*) "forcvec"
316 write (iout,'(2i3,2f10.5)') i,j,force(j,i),
323 write (iout,'(2i3,2f10.5)') i,j,force(j,i+nres),
333 c------------------------------------------------------------------
334 subroutine setup_fricmat
335 implicit real*8 (a-h,o-z)
341 include 'COMMON.CHAIN'
342 include 'COMMON.DERIV'
344 include 'COMMON.LOCAL'
345 include 'COMMON.INTERACT'
347 include 'COMMON.SETUP'
348 include 'COMMON.TIME1'
349 c integer licznik /0/
352 include 'COMMON.LANGEVIN'
354 include 'COMMON.LANGEVIN.lang0'
356 include 'COMMON.IOUNITS'
358 integer i,j,ind,ind1,m
359 logical lprn /.false./
360 double precision dtdi,gamvec(MAXRES2),
361 & ginvfric(maxres2,maxres2),Ghalf(mmaxres2),fcopy(maxres2,maxres2)
362 common /syfek/ gamvec
363 double precision work(8*maxres2)
364 integer iwork(maxres2)
365 common /przechowalnia/ ginvfric,Ghalf,fcopy
367 if (fg_rank.ne.king) goto 10
369 c Zeroing out fricmat
375 c Load the friction coefficients corresponding to peptide groups
381 c Load the friction coefficients corresponding to side chains
388 gamvec(ii)=gamsc(iti)
390 if (surfarea) call sdarea(gamvec)
392 c write (iout,*) "Matrix A and vector gamma"
394 c write (iout,'(i2,$)') i
396 c write (iout,'(f4.1,$)') A(i,j)
398 c write (iout,'(f8.3)') gamvec(i)
402 write (iout,*) "Vector gamvec"
404 write (iout,'(i5,f10.5)') i, gamvec(i)
408 c The friction matrix
413 dtdi=dtdi+A(j,k)*A(j,i)*gamvec(j)
420 write (iout,'(//a)') "Matrix fricmat"
421 call matout2(dimen,dimen,maxres2,maxres2,fricmat)
423 if (lang.eq.2 .or. lang.eq.3) then
424 c Mass-scale the friction matrix if non-direct integration will be performed
430 Ginvfric(i,j)=Ginvfric(i,j)+
431 & Gsqrm(i,k)*Gsqrm(l,j)*fricmat(k,l)
436 c Diagonalize the friction matrix
441 Ghalf(ind)=Ginvfric(i,j)
444 call gldiag(maxres2,dimen,dimen,Ghalf,work,fricgam,fricvec,
447 write (iout,'(//2a)') "Eigenvectors and eigenvalues of the",
448 & " mass-scaled friction matrix"
449 call eigout(dimen,dimen,maxres2,maxres2,fricvec,fricgam)
451 c Precompute matrices for tinker stochastic integrator
458 mt1(i,j)=mt1(i,j)+fricvec(k,i)*gsqrm(k,j)
459 mt2(i,j)=mt2(i,j)+fricvec(k,i)*gsqrp(k,j)
465 else if (lang.eq.4) then
466 c Diagonalize the friction matrix
471 Ghalf(ind)=fricmat(i,j)
474 call gldiag(maxres2,dimen,dimen,Ghalf,work,fricgam,fricvec,
477 write (iout,'(//2a)') "Eigenvectors and eigenvalues of the",
479 call eigout(dimen,dimen,maxres2,maxres2,fricvec,fricgam)
481 c Determine the number of zero eigenvalues of the friction matrix
482 nzero=max0(dimen-dimen1,0)
483 c do while (fricgam(nzero+1).le.1.0d-5 .and. nzero.lt.dimen)
486 write (iout,*) "Number of zero eigenvalues:",nzero
491 fricmat(i,j)=fricmat(i,j)
492 & +fricvec(i,k)*fricvec(j,k)/fricgam(k)
497 write (iout,'(//a)') "Generalized inverse of fricmat"
498 call matout(dimen,dimen,maxres6,maxres6,fricmat)
503 if (nfgtasks.gt.1) then
504 if (fg_rank.eq.0) then
505 c The matching BROADCAST for fg processors is called in ERGASTULUM
511 call MPI_Bcast(10,1,MPI_INTEGER,king,FG_COMM,IERROR)
513 time_Bcast=time_Bcast+MPI_Wtime()-time00
515 time_Bcast=time_Bcast+tcpu()-time00
517 c print *,"Processor",myrank,
518 c & " BROADCAST iorder in SETUP_FRICMAT"
521 c write (iout,*) "setup_fricmat licznik",licznik
527 c Scatter the friction matrix
528 call MPI_Scatterv(fricmat(1,1),nginv_counts(0),
529 & nginv_start(0),MPI_DOUBLE_PRECISION,fcopy(1,1),
530 & myginv_ng_count,MPI_DOUBLE_PRECISION,king,FG_COMM,IERROR)
533 time_scatter_fmat=time_scatter_fmat+MPI_Wtime()-time00
535 time_scatter=time_scatter+tcpu()-time00
536 time_scatter_fmat=time_scatter_fmat+tcpu()-time00
541 fricmat(j,i)=fcopy(i,j)
544 c write (iout,*) "My chunk of fricmat"
545 c call MATOUT2(my_ng_count,dimen,maxres2,maxres2,fcopy)
550 c-------------------------------------------------------------------------------
551 subroutine sdarea(gamvec)
553 c Scale the friction coefficients according to solvent accessible surface areas
554 c Code adapted from TINKER
557 implicit real*8 (a-h,o-z)
559 include 'COMMON.CONTROL'
563 include 'COMMON.LANGEVIN'
565 include 'COMMON.LANGEVIN.lang0'
567 include 'COMMON.CHAIN'
568 include 'COMMON.DERIV'
570 include 'COMMON.LOCAL'
571 include 'COMMON.INTERACT'
572 include 'COMMON.IOUNITS'
573 include 'COMMON.NAMES'
574 double precision radius(maxres2),gamvec(maxres2)
575 parameter (twosix=1.122462048309372981d0)
576 logical lprn /.false./
578 c determine new friction coefficients every few SD steps
580 c set the atomic radii to estimates of sigma values
582 c print *,"Entered sdarea"
588 c Load peptide group radii
592 c Load side chain radii
595 radius(i+nres)=restok(iti)
598 c write (iout,*) "i",i," radius",radius(i)
601 radius(i) = radius(i) / twosix
602 if (radius(i) .ne. 0.0d0) radius(i) = radius(i) + probe
605 c scale atomic friction coefficients by accessible area
607 if (lprn) write (iout,*)
608 & "Original gammas, surface areas, scaling factors, new gammas, ",
609 & "std's of stochastic forces"
612 if (radius(i).gt.0.0d0) then
613 call surfatom (i,area,radius)
614 ratio = dmax1(area/(4.0d0*pi*radius(i)**2),1.0d-1)
615 if (lprn) write (iout,'(i5,3f10.5,$)')
616 & i,gamvec(ind+1),area,ratio
619 gamvec(ind) = ratio * gamvec(ind)
621 stdforcp(i)=stdfp*dsqrt(gamvec(ind))
622 if (lprn) write (iout,'(2f10.5)') gamvec(ind),stdforcp(i)
626 if (radius(i+nres).gt.0.0d0) then
627 call surfatom (i+nres,area,radius)
628 ratio = dmax1(area/(4.0d0*pi*radius(i+nres)**2),1.0d-1)
629 if (lprn) write (iout,'(i5,3f10.5,$)')
630 & i,gamvec(ind+1),area,ratio
633 gamvec(ind) = ratio * gamvec(ind)
635 stdforcsc(i)=stdfsc(itype(i))*dsqrt(gamvec(ind))
636 if (lprn) write (iout,'(2f10.5)') gamvec(ind),stdforcsc(i)