3 include 'COMMON.INTERACT'
5 DATA CK/1.0D0,1.58740105197D0,2.08008382305D0,2.51984209979D0/
6 DATA SCK/1.0D0,1.25992104989D0,1.44224957031D0,1.58740105197D0/
7 DATA S1/3.75D0,5.75D0,7.75D0,9.75D0/
8 DATA S2/4.25D0,6.25D0,8.25D0,10.25D0/
10 c------------------------------------------------------------------------
12 subroutine init_dfa_vars
15 include 'COMMON.INTERACT'
20 C Number of restraints
39 CC WEIGHTS for each min
56 C weights for each E term
57 C these should be identical with
64 C precalculate exp table!
67 c dfaexp(ii) = exp(-ii*0.001d0 + 0.0005d0)
73 print *,'ishiftca=',ishiftca,'ilastca=',ilastca
79 subroutine read_dfa_info
81 C read fragment informations
83 implicit real*8 (a-h,o-z)
85 include 'COMMON.IOUNITS'
86 include 'COMMON.CHAIN'
90 C NOTE THAT FILENAMES are FIXED, CURRENTLY!!
91 C THIS SHOULD BE MODIFIED!!
98 integer ica1, ica2,ica3,ica4,ica5
99 integer ishell, inca, itmp,iitmp
100 double precision wtmp
104 open(iodfa, file = 'dist_dfa.dat', status = 'old', err=33)
106 33 write(iout,'(a)') 'Error opening dist_dfa.dat file'
109 write(iout,'(a)') 'dist_dfa.dat is opened!'
111 read(iodfa, '(a)') buffer
112 C read number of restraints
113 read(iodfa, *) IDFADIS
114 read(iodfa, *) dis_inc
116 read(iodfa, '(i10,1x,i10,1x,i10)') ica1, ica2, nval
135 C READ ANGLE RESTRAINTS
137 open(iodfa, file='phi_dfa.dat',status='old',err=35)
139 35 write(iout,'(a)') 'Error opening dist_dfa.dat file'
143 write(iout,'(a)') 'phi_dfa.dat is opened!'
146 read(iodfa, '(a)') buffer
147 C READ NUMBER OF RESTRAINTS
148 READ(iodfa, *) IDFAPHI
149 read(iodfa,*) phi_inc
151 read(iodfa,'(5(i10,1x),1x,i10)')ica1,ica2,ica3,ica4,ica5,nval
162 read(iodfa,*) tmp1,tmp2
176 open(iodfa, file='theta_dfa.dat',status='old',err=41)
178 41 write(iout,'(a)') 'Error opening dist_dfa.dat file'
181 write(iout,'(a)') 'theta_dfa.dat is opened!'
183 read(iodfa, '(a)') buffer
184 C READ NUMBER OF RESTRAINTS
185 READ(iodfa, *) IDFATHE
186 read(iodfa,*) the_inc
189 read(iodfa, '(5(i10,1x),1x,i10)')ica1,ica2,ica3,ica4,ica5,nval
200 read(iodfa,*) tmp1,tmp2
212 C END of READING ANGLE RESTRAINT!
214 C NUMBER OF NEIGHBOR CAs
215 open(iodfa,file='nei_dfa.dat',status='old',err=37)
217 37 write(iout,'(a)') 'Error opening nei_dfa.dat file'
220 write(iout,'(a)') 'nei_dfa.dat is opened!'
222 read(iodfa, '(a)') buffer
223 C READ NUMBER OF RESTRAINTS
224 READ(iodfa, *) idfanei
225 read(iodfa,*) nei_inc
228 read(iodfa,'(2(i10,1x),i10)')ica1,ishell,nval
237 C write(*,*) 'READ NEI:',i,j,fnei(i,j)
247 C END OF NEIGHBORING CA
249 C READ BETA RESTRAINT
250 open(iodfa, file='beta_dfa.dat',status='old',err=39)
252 39 write(iout,'(a)') 'Error opening beta_dfa.dat file'
255 write(iout,'(a)') 'beta_dfa.dat is opened!'
257 read(iodfa,'(a)') buffer
259 read(iodfa,*) beta_inc
262 read(iodfa,*) ica1, iitmp
266 c write(*,*) 'BETA:',i,j,wtmp,wshet(i,j)
271 C END OF BETA RESTRAINT
276 subroutine edfad(edfadis)
278 implicit real*8 (a-h,o-z)
280 include 'COMMON.CHAIN'
281 include 'COMMON.DERIV'
284 double precision edfadis
285 integer i, iatm1, iatm2,idiff
286 double precision ckk, sckk,dist,texp
287 double precision jix,jiy,jiz,ep,fp,scc
294 iatm1=idislis(1,i)+ishiftca
295 iatm2=idislis(2,i)+ishiftca
296 idiff = abs(iatm1-iatm2)
298 JIX=c(1,iatm2)-c(1,iatm1)
299 JIY=c(2,iatm2)-c(2,iatm1)
300 JIZ=c(3,iatm2)-c(3,iatm1)
301 DIST=SQRT(JIX*JIX+JIY*JIY+JIZ*JIZ)
314 if (dtmp.ge.15.0d0) then
317 c texp = dfaexp( idint(dtmp*1000)+1 )/sckk
318 texp = exp(-dtmp)/sckk
321 ep=ep+sccdist(i,j)*texp
322 fp=fp+sccdist(i,j)*texp*dd*2.0d0/ckk
324 C write(*,'(2i8,6f12.5)') i, j, dist,
325 C & fdist(i,j), ep, fp, sccdist(i,j), scc
333 c IF(ABS(EP).lt.1.0d-20)THEN
336 c IF (ABS(FP).lt.1.0d-20) THEN
340 edfadis=edfadis+ep*dis_inc*wwdist
342 gdfad(1,iatm1) = gdfad(1,iatm1)-jix/dist*fp*dis_inc*wwdist
343 gdfad(2,iatm1) = gdfad(2,iatm1)-jiy/dist*fp*dis_inc*wwdist
344 gdfad(3,iatm1) = gdfad(3,iatm1)-jiz/dist*fp*dis_inc*wwdist
346 gdfad(1,iatm2) = gdfad(1,iatm2)+jix/dist*fp*dis_inc*wwdist
347 gdfad(2,iatm2) = gdfad(2,iatm2)+jiy/dist*fp*dis_inc*wwdist
348 gdfad(3,iatm2) = gdfad(3,iatm2)+jiz/dist*fp*dis_inc*wwdist
355 subroutine edfat(edfator)
357 implicit real*8 (a-h,o-z)
359 include 'COMMON.CHAIN'
360 include 'COMMON.DERIV'
365 double precision aphi(2),athe(2),tdx(5),tdy(5),tdz(5)
366 double precision cwidth, cwidth2
367 PARAMETER(CWIDTH=0.1D0,CWIDTH2=0.2D0,PAI=3.14159265358979323846D0)
379 iatom(iii)=iphilis(iii,i)+ishiftca
382 C ANGLE VECTOR CALCULTION
383 RIX=C(1,IATOM(2))-C(1,IATOM(1))
384 RIY=C(2,IATOM(2))-C(2,IATOM(1))
385 RIZ=C(3,IATOM(2))-C(3,IATOM(1))
387 RIPX=C(1,IATOM(3))-C(1,IATOM(2))
388 RIPY=C(2,IATOM(3))-C(2,IATOM(2))
389 RIPZ=C(3,IATOM(3))-C(3,IATOM(2))
391 RIPPX=C(1,IATOM(4))-C(1,IATOM(3))
392 RIPPY=C(2,IATOM(4))-C(2,IATOM(3))
393 RIPPZ=C(3,IATOM(4))-C(3,IATOM(3))
395 RIP3X=C(1,IATOM(5))-C(1,IATOM(4))
396 RIP3Y=C(2,IATOM(5))-C(2,IATOM(4))
397 RIP3Z=C(3,IATOM(5))-C(3,IATOM(4))
399 GIX=RIY*RIPZ-RIZ*RIPY
400 GIY=RIZ*RIPX-RIX*RIPZ
401 GIZ=RIX*RIPY-RIY*RIPX
403 GIPX=RIPY*RIPPZ-RIPZ*RIPPY
404 GIPY=RIPZ*RIPPX-RIPX*RIPPZ
405 GIPZ=RIPX*RIPPY-RIPY*RIPPX
407 CIPX=C(1,IATOM(3))-C(1,IATOM(1))
408 CIPY=C(2,IATOM(3))-C(2,IATOM(1))
409 CIPZ=C(3,IATOM(3))-C(3,IATOM(1))
411 CIPPX=C(1,IATOM(4))-C(1,IATOM(2))
412 CIPPY=C(2,IATOM(4))-C(2,IATOM(2))
413 CIPPZ=C(3,IATOM(4))-C(3,IATOM(2))
415 CIP3X=C(1,IATOM(5))-C(1,IATOM(3))
416 CIP3Y=C(2,IATOM(5))-C(2,IATOM(3))
417 CIP3Z=C(3,IATOM(5))-C(3,IATOM(3))
419 DGI=SQRT(GIX*GIX+GIY*GIY+GIZ*GIZ)
420 DGIP=SQRT(GIPX*GIPX+GIPY*GIPY+GIPZ*GIPZ)
421 DRIPP=SQRT(RIPPX*RIPPX+RIPPY*RIPPY+RIPPZ*RIPPZ)
422 DRIP3=SQRT(RIP3X*RIP3X+RIP3Y*RIP3Y+RIP3Z*RIP3Z)
424 C END OF ANGLE VECTOR CALCULTION
426 TDOT=GIX*RIPPX+GIY*RIPPY+GIZ*RIPPZ
427 APHI(1)=TDOT/(DGI*DRIPP)
428 TDOT=GIPX*RIP3X+GIPY*RIP3Y+GIPZ*RIP3Z
429 APHI(2)=TDOT/(DGIP*DRIP3)
437 DDPS1=APHI(1)-FPHI1(i,j)
438 DDPS2=APHI(2)-FPHI2(i,j)
440 DTMP = (DDPS1**2+DDPS2**2)/CWIDTH2
442 if (dtmp.ge.15.0d0) then
445 c ps_tmp = dfaexp(idint(dtmp*1000)+1)
449 ephi=ephi+sccphi(i,j)*ps_tmp
451 tfphi1=tfphi1+sccphi(i,j)*ddps1/cwidth*ps_tmp
452 tfphi2=tfphi2+sccphi(i,j)*ddps2/cwidth*ps_tmp
455 C write(*,'(2i8,8f12.6)')i,j,aphi(1),fphi1(i,j),
456 C & aphi(2),fphi2(i,j),tfphi1,tfphi2,ephi,sccphi(i,j)
459 ephi=-ephi/scc*phi_inc*wwangle
460 tfphi1=tfphi1/scc*phi_inc*wwangle
461 tfphi2=tfphi2/scc*phi_inc*wwangle
463 IF (ABS(EPHI).LT.1d-20) THEN
466 IF (ABS(TFPHI1).LT.1d-20) THEN
469 IF (ABS(TFPHI2).LT.1d-20) THEN
473 C FORCE DIRECTION CALCULATION
478 DM1=1.0d0/(DGI*DRIPP)
480 GIRPP=GIX*RIPPX+GIY*RIPPY+GIZ*RIPPZ
481 DM2=GIRPP/(DGI**3*DRIPP)
482 DM3=GIRPP/(DGI*DRIPP**3)
484 DM4=1.0d0/(DGIP*DRIP3)
486 GIRP3=GIPX*RIP3X+GIPY*RIP3Y+GIPZ*RIP3Z
487 DM5=GIRP3/(DGIP**3*DRIP3)
488 DM6=GIRP3/(DGIP*DRIP3**3)
490 TDX(1)=(RIPZ*RIPPY-RIPY*RIPPZ)*DM1
491 & +( GIZ* RIPY- GIY* RIPZ)*DM2
492 TDY(1)=(RIPX*RIPPZ-RIPZ*RIPPX)*DM1
493 & +( GIX* RIPZ- GIZ* RIPX)*DM2
494 TDZ(1)=(RIPY*RIPPX-RIPX*RIPPY)*DM1
495 & +( GIY* RIPX- GIX* RIPY)*DM2
499 C SECOND ATOM BY PHI1
500 TDX(2)=(CIPY*RIPPZ-CIPZ*RIPPY)*DM1
501 & -(CIPY*GIZ-CIPZ*GIY)*DM2
502 TDY(2)=(CIPZ*RIPPX-CIPX*RIPPZ)*DM1
503 & -(CIPZ*GIX-CIPX*GIZ)*DM2
504 TDZ(2)=(CIPX*RIPPY-CIPY*RIPPX)*DM1
505 & -(CIPX*GIY-CIPY*GIX)*DM2
509 C SECOND ATOM BY PHI2
511 & ((RIPPZ*RIP3Y-RIPPY*RIP3Z)*DM4
512 & +( GIPZ*RIPPY- GIPY*RIPPZ)*DM5)*TFPHI2
514 & ((RIPPX*RIP3Z-RIPPZ*RIP3X)*DM4
515 & +( GIPX*RIPPZ- GIPZ*RIPPX)*DM5)*TFPHI2
517 & ((RIPPY*RIP3X-RIPPX*RIP3Y)*DM4
518 & +( GIPY*RIPPX- GIPX*RIPPY)*DM5)*TFPHI2
520 TDX(3)=(-GIX+RIPPY*RIZ-RIPPZ*RIY)*DM1
521 & -(GIY*RIZ-RIY*GIZ)*DM2+RIPPX*DM3
522 TDY(3)=(-GIY+RIPPZ*RIX-RIPPX*RIZ)*DM1
523 & -(GIZ*RIX-RIZ*GIX)*DM2+RIPPY*DM3
524 TDZ(3)=(-GIZ+RIPPX*RIY-RIPPY*RIX)*DM1
525 & -(GIX*RIY-RIX*GIY)*DM2+RIPPZ*DM3
531 & ((CIPPY*RIP3Z-CIPPZ*RIP3Y)*DM4
532 & -(CIPPY*GIPZ-CIPPZ*GIPY)*DM5)*TFPHI2
534 & ((CIPPZ*RIP3X-CIPPX*RIP3Z)*DM4
535 & -(CIPPZ*GIPX-CIPPX*GIPZ)*DM5)*TFPHI2
537 & ((CIPPX*RIP3Y-CIPPY*RIP3X)*DM4
538 & -(CIPPX*GIPY-CIPPY*GIPX)*DM5)*TFPHI2
539 C FOURTH ATOM BY PHI1
540 TDX(4)=(GIX*DM1-RIPPX*DM3)*TFPHI1
541 TDY(4)=(GIY*DM1-RIPPY*DM3)*TFPHI1
542 TDZ(4)=(GIZ*DM1-RIPPZ*DM3)*TFPHI1
543 C FOURTH ATOM BY PHI2
545 & ((-GIPX+RIP3Y*RIPZ-RIP3Z*RIPY)*DM4
546 & -( GIPY*RIPZ-RIPY*GIPZ)*DM5
547 & + RIP3X*DM6)*TFPHI2
549 & ((-GIPY+RIP3Z*RIPX-RIP3X*RIPZ)*DM4
550 & -( GIPZ*RIPX-RIPZ*GIPX)*DM5
551 & + RIP3Y*DM6)*TFPHI2
553 & ((-GIPZ+RIP3X*RIPY-RIP3Y*RIPX)*DM4
554 & -( GIPX*RIPY-RIPX*GIPY)*DM5
555 & + RIP3Z*DM6)*TFPHI2
557 TDX(5)=(GIPX*DM4-RIP3X*DM6)*TFPHI2
558 TDY(5)=(GIPY*DM4-RIP3Y*DM6)*TFPHI2
559 TDZ(5)=(GIPZ*DM4-RIP3Z*DM6)*TFPHI2
560 C END OF FORCE DIRECTION
563 gdfat(1,IATOM(II))=gdfat(1,IATOM(II))+TDX(II)
564 gdfat(2,IATOM(II))=gdfat(2,IATOM(II))+TDY(II)
565 gdfat(3,IATOM(II))=gdfat(3,IATOM(II))+TDZ(II)
568 enephi = enephi + ephi
569 c end of single assignment statement
571 C END OF PHI RESTRAINT
573 C START OF THETA ANGLE
578 iatom(iii)=ithelis(iii,i)+ishiftca
582 C ANGLE VECTOR CALCULTION
583 RIX=C(1,IATOM(2))-C(1,IATOM(1))
584 RIY=C(2,IATOM(2))-C(2,IATOM(1))
585 RIZ=C(3,IATOM(2))-C(3,IATOM(1))
587 RIPX=C(1,IATOM(3))-C(1,IATOM(2))
588 RIPY=C(2,IATOM(3))-C(2,IATOM(2))
589 RIPZ=C(3,IATOM(3))-C(3,IATOM(2))
591 RIPPX=C(1,IATOM(4))-C(1,IATOM(3))
592 RIPPY=C(2,IATOM(4))-C(2,IATOM(3))
593 RIPPZ=C(3,IATOM(4))-C(3,IATOM(3))
595 RIP3X=C(1,IATOM(5))-C(1,IATOM(4))
596 RIP3Y=C(2,IATOM(5))-C(2,IATOM(4))
597 RIP3Z=C(3,IATOM(5))-C(3,IATOM(4))
599 GIX=RIY*RIPZ-RIZ*RIPY
600 GIY=RIZ*RIPX-RIX*RIPZ
601 GIZ=RIX*RIPY-RIY*RIPX
603 GIPX=RIPY*RIPPZ-RIPZ*RIPPY
604 GIPY=RIPZ*RIPPX-RIPX*RIPPZ
605 GIPZ=RIPX*RIPPY-RIPY*RIPPX
607 GIPPX=RIPPY*RIP3Z-RIPPZ*RIP3Y
608 GIPPY=RIPPZ*RIP3X-RIPPX*RIP3Z
609 GIPPZ=RIPPX*RIP3Y-RIPPY*RIP3X
611 CIPX=C(1,IATOM(3))-C(1,IATOM(1))
612 CIPY=C(2,IATOM(3))-C(2,IATOM(1))
613 CIPZ=C(3,IATOM(3))-C(3,IATOM(1))
615 CIPPX=C(1,IATOM(4))-C(1,IATOM(2))
616 CIPPY=C(2,IATOM(4))-C(2,IATOM(2))
617 CIPPZ=C(3,IATOM(4))-C(3,IATOM(2))
619 CIP3X=C(1,IATOM(5))-C(1,IATOM(3))
620 CIP3Y=C(2,IATOM(5))-C(2,IATOM(3))
621 CIP3Z=C(3,IATOM(5))-C(3,IATOM(3))
623 DGI=SQRT(GIX*GIX+GIY*GIY+GIZ*GIZ)
624 DGIP=SQRT(GIPX*GIPX+GIPY*GIPY+GIPZ*GIPZ)
625 DGIPP=SQRT(GIPPX*GIPPX+GIPPY*GIPPY+GIPPZ*GIPPZ)
626 DRIPP=SQRT(RIPPX*RIPPX+RIPPY*RIPPY+RIPPZ*RIPPZ)
627 DRIP3=SQRT(RIP3X*RIP3X+RIP3Y*RIP3Y+RIP3Z*RIP3Z)
628 C END OF ANGLE VECTOR CALCULTION
630 TDOT=GIX*GIPX+GIY*GIPY+GIZ*GIPZ
631 ATHE(1)=TDOT/(DGI*DGIP)
632 TDOT=GIPX*GIPPX+GIPY*GIPPY+GIPZ*GIPPZ
633 ATHE(2)=TDOT/(DGIP*DGIPP)
642 ddth1=athe(1)-fthe1(i,j) !cos(the1)-cos(the1_ref)
643 ddth2=athe(2)-fthe2(i,j) !cos(the2)-cos(the2_ref)
644 dtmp= (ddth1**2+ddth2**2)/cwidth2
645 if ( dtmp .ge. 15.0d0) then
648 c th_tmp = dfaexp ( idint(dtmp*1000)+1 )
652 ethe=ethe+sccthe(i,j)*th_tmp
654 tfthe1=tfthe1+sccthe(i,j)*ddth1/cwidth*th_tmp !-dv/dcos(the1)
655 tfthe2=tfthe2+sccthe(i,j)*ddth2/cwidth*th_tmp !-dv/dcos(the2)
657 C write(*,'(2i8,8f12.6)')i,j,athe(1),fthe1(i,j),
658 C & athe(2),fthe2(i,j),tfthe1,tfthe2,ethe,sccthe(i,j)
661 ethe=-ethe/scc*the_inc*wwangle
662 tfthe1=tfthe1/scc*the_inc*wwangle
663 tfthe2=tfthe2/scc*the_inc*wwangle
665 IF (ABS(ETHE).LT.TENM20) THEN
668 IF (ABS(TFTHE1).LT.TENM20) THEN
671 IF (ABS(TFTHE2).LT.TENM20) THEN
680 DM2=(GIX*GIPX+GIY*GIPY+GIZ*GIPZ)/(DGI**3*DGIP)
681 DM3=(GIX*GIPX+GIY*GIPY+GIZ*GIPZ)/(DGI*DGIP**3)
683 DM4=1.0d0/(DGIP*DGIPP)
684 DM5=(GIPX*GIPPX+GIPY*GIPPY+GIPZ*GIPPZ)/(DGIP**3*DGIPP)
685 DM6=(GIPX*GIPPX+GIPY*GIPPY+GIPZ*GIPPZ)/(DGIP*DGIPP**3)
687 C FIRST ATOM BY THETA1
688 TDX(1)=((RIPZ*GIPY-RIPY*GIPZ)*DM1
689 & -(GIY*RIPZ-GIZ*RIPY)*DM2)*TFTHE1
690 TDY(1)=((-RIPZ*GIPX+RIPX*GIPZ)*DM1
691 & -(-GIX*RIPZ+GIZ*RIPX)*DM2)*TFTHE1
692 TDZ(1)=((RIPY*GIPX-RIPX*GIPY)*DM1
693 & -(GIX*RIPY-GIY*RIPX)*DM2)*TFTHE1
694 C SECOND ATOM BY THETA1
695 TDX(2)=((CIPY*GIPZ-CIPZ*GIPY-RIPPY*GIZ+RIPPZ*GIY)*DM1
696 & -(CIPY*GIZ-CIPZ*GIY)*DM2
697 & +(RIPPY*GIPZ-RIPPZ*GIPY)*DM3)*TFTHE1
698 TDY(2)=((CIPZ*GIPX-CIPX*GIPZ-RIPPZ*GIX+RIPPX*GIZ)*DM1
699 & -(CIPZ*GIX-CIPX*GIZ)*DM2
700 & +(RIPPZ*GIPX-RIPPX*GIPZ)*DM3)*TFTHE1
701 TDZ(2)=((CIPX*GIPY-CIPY*GIPX-RIPPX*GIY+RIPPY*GIX)*DM1
702 & -(CIPX*GIY-CIPY*GIX)*DM2
703 & +(RIPPX*GIPY-RIPPY*GIPX)*DM3)*TFTHE1
704 C SECOND ATOM BY THETA2
706 & ((RIPPZ*GIPPY-RIPPY*GIPPZ)*DM4
707 & -(GIPY*RIPPZ-GIPZ*RIPPY)*DM5)*TFTHE2
709 & ((-RIPPZ*GIPPX+RIPPX*GIPPZ)*DM4
710 & -(-GIPX*RIPPZ+GIPZ*RIPPX)*DM5)*TFTHE2
712 & ((RIPPY*GIPPX-RIPPX*GIPPY)*DM4
713 & -(GIPX*RIPPY-GIPY*RIPPX)*DM5)*TFTHE2
714 C THIRD ATOM BY THETA1
715 TDX(3)=((GIPY*RIZ-GIPZ*RIY-GIY*CIPPZ+GIZ*CIPPY)*DM1
716 & -(GIY*RIZ-GIZ*RIY)*DM2
717 & -(CIPPY*GIPZ-CIPPZ*GIPY)*DM3) *TFTHE1
718 TDY(3)=((GIPZ*RIX-GIPX*RIZ-GIZ*CIPPX+GIX*CIPPZ)*DM1
719 & -(GIZ*RIX-GIX*RIZ)*DM2
720 & -(CIPPZ*GIPX-CIPPX*GIPZ)*DM3) *TFTHE1
721 TDZ(3)=((GIPX*RIY-GIPY*RIX-GIX*CIPPY+GIY*CIPPX)*DM1
722 & -(GIX*RIY-GIY*RIX)*DM2
723 & -(CIPPX*GIPY-CIPPY*GIPX)*DM3) *TFTHE1
724 C THIRD ATOM BY THETA2
726 & ((CIPPY*GIPPZ-CIPPZ*GIPPY-RIP3Y*GIPZ+RIP3Z*GIPY)*DM4
727 & -(CIPPY*GIPZ-CIPPZ*GIPY)*DM5
728 & +(RIP3Y*GIPpZ-RIP3Z*GIPpY)*DM6) *TFTHE2
730 & ((CIPPZ*GIPPX-CIPPX*GIPPZ-RIP3Z*GIPX+RIP3X*GIPZ)*DM4
731 & -(CIPPZ*GIPX-CIPPX*GIPZ)*DM5
732 & +(RIP3Z*GIPpX-RIP3X*GIPpZ)*DM6) *TFTHE2
734 & ((CIPPX*GIPPY-CIPPY*GIPPX-RIP3X*GIPY+RIP3Y*GIPX)*DM4
735 & -(CIPPX*GIPY-CIPPY*GIPX)*DM5
736 & +(RIP3X*GIPpY-RIP3Y*GIPpX)*DM6) *TFTHE2
737 C FOURTH ATOM BY THETA1
738 TDX(4)=-((GIZ*RIPY-GIY*RIPZ)*DM1
739 & -(GIPZ*RIPY-GIPY*RIPZ)*DM3) *TFTHE1
740 TDY(4)=-((GIX*RIPZ-GIZ*RIPX)*DM1
741 & -(GIPX*RIPZ-GIPZ*RIPX)*DM3) *TFTHE1
742 TDZ(4)=-((GIY*RIPX-GIX*RIPY)*DM1
743 & -(GIPY*RIPX-GIPX*RIPY)*DM3) *TFTHE1
744 C FOURTH ATOM BY THETA2
746 & ((GIPPY*RIPZ-GIPPZ*RIPY-GIPY*CIP3Z+GIPZ*CIP3Y)*DM4
747 & -(GIPY*RIPZ-GIPZ*RIPY)*DM5
748 & -(CIP3Y*GIPPZ-CIP3Z*GIPPY)*DM6)*TFTHE2
750 & ((GIPPZ*RIPX-GIPPX*RIPZ-GIPZ*CIP3X+GIPX*CIP3Z)*DM4
751 & -(GIPZ*RIPX-GIPX*RIPZ)*DM5
752 & -(CIP3Z*GIPPX-CIP3X*GIPPZ)*DM6)*TFTHE2
754 & ((GIPPX*RIPY-GIPPY*RIPX-GIPX*CIP3Y+GIPY*CIP3X)*DM4
755 & -(GIPX*RIPY-GIPY*RIPX)*DM5
756 & -(CIP3X*GIPPY-CIP3Y*GIPPX)*DM6)*TFTHE2
757 C FIFTH ATOM BY THETA2
758 TDX(5)=-((GIPZ*RIPPY-GIPY*RIPPZ)*DM4
759 & -(GIPPZ*RIPPY-GIPPY*RIPPZ)*DM6)*TFTHE2
760 TDY(5)=-((GIPX*RIPPZ-GIPZ*RIPPX)*DM4
761 & -(GIPPX*RIPPZ-GIPPZ*RIPPX)*DM6)*TFTHE2
762 TDZ(5)=-((GIPY*RIPPX-GIPX*RIPPY)*DM4
763 & -(GIPPY*RIPPX-GIPPX*RIPPY)*DM6)*TFTHE2
764 C !! END OF FORCE DIRECTION!!!!
766 gdfat(1,iatom(II))=gdfat(1,iatom(II))+TDX(II)
767 gdfat(2,iatom(II))=gdfat(2,iatom(II))+TDY(II)
768 gdfat(3,iatom(II))=gdfat(3,iatom(II))+TDZ(II)
771 enethe = enethe + ethe
774 edfator = enephi + enethe
779 subroutine edfan(edfanei)
780 C DFA neighboring CA restraint
781 implicit real*8 (a-h,o-z)
783 include 'COMMON.CHAIN'
784 include 'COMMON.DERIV'
788 integer kshnum, n1atom
790 double precision enenei,tmp_n
791 double precision pai,hpai
792 double precision jix,jiy,jiz,ndiff,snorm_nei
793 double precision t2dx(maxres),t2dy(maxres),t2dz(maxres)
794 double precision dr,dr2,half,ntmp,dtmp
796 parameter(dr=0.25d0,dr2=0.50d0,half=0.50d0)
797 parameter(pai=3.14159265358979323846D0)
798 parameter(hpai=1.5707963267948966D0)
799 parameter(snorm_nei=0.886226925452758D0)
805 c print*, 's1:', s1(:)
806 c print*, 's2:', s2(:)
811 n1atom=ineilis(i)+ishiftca
812 C write(*,*) 'kshnum,n1atom:', kshnum, n1atom
825 do j = ishiftca+1, ilastca
827 if (n1atom.eq.j) cycle
829 jix=c(1,j)-c(1,n1atom)
830 jiy=c(2,j)-c(2,n1atom)
831 jiz=c(3,j)-c(3,n1atom)
832 dist=sqrt(jix*jix+jiy*jiy+jiz*jiz)
834 c write(*,*) n1atom, j, dist
837 if (dist.lt.s1(kshnum).and.
838 & dist.gt.s2(kshnum-1)) then
842 c write(*,*) 'case1:',tmp_n
851 elseif(dist.ge.s1(kshnum).and.
852 & dist.le.s2(kshnum)) then
854 dnei=(dist-s1(kshnum))/dr2*pai
855 tmp_n=tmp_n + half*(1+cos(dnei))
856 c write(*,*) 'case2:',tmp_n
857 ftmp=-pai*sin(dnei)/dr2/dist/2.0d0
867 elseif(dist.ge.s1(kshnum-1).and.
868 & dist.le.s2(kshnum-1)) then
869 dnei=(dist-s1(kshnum-1))/dr2*pai
870 tmp_n=tmp_n + 1.0d0 - half*(1+cos(dnei))
871 c write(*,*) 'case3:',tmp_n
872 ftmp = hpai*sin(dnei)/dr2/dist
884 elseif(kshnum.eq.1) then
886 if(dist.lt.s1(kshnum))then
889 c write(*,*) 'case4:',tmp_n
897 elseif(dist.ge.s1(kshnum).and.
898 & dist.le.s2(kshnum))then
900 dnei=(dist-s1(kshnum))/dr2*pai
901 tmp_n=tmp_n + half*(1+cos(dnei))
902 c write(*,*) 'case5:',tmp_n
903 ftmp = -hpai*sin(dnei)/dr2/dist
924 ndiff = tmp_n-fnei(i,imin)
927 if (dtmp.ge.15.0d0) then
930 c ntmp = dfaexp( idint(dtmp*1000) + 1 )
934 enei=enei+sccnei(i,imin)*ntmp
936 & sccnei(i,imin)*ntmp*ndiff*2.0d0
937 scc=scc+sccnei(i,imin)
939 c write(*,'(a,1x,2i8,f12.7,i8,3f12.7)')'NEI:',i,imin,tmp_n,
940 c & fnei(i,imin),sccnei(i,imin),enei,scc
943 enei=-enei/scc*snorm_nei*nei_inc*wwnei
944 tmp_fnei=tmp_fnei/scc*snorm_nei*nei_inc*wwnei
946 c if (abs(enei).lt.1.0d-20)then
949 c if (abs(tmp_fnei).lt.1.0d-20) then
958 do j=ishiftca+1,ilastca
959 t2dx(j)=t2dx(j)*tmp_fnei
960 t2dy(j)=t2dy(j)*tmp_fnei
961 t2dz(j)=t2dz(j)*tmp_fnei
964 gdfan(1,n1atom)=gdfan(1,n1atom)+t1dx
965 gdfan(2,n1atom)=gdfan(2,n1atom)+t1dy
966 gdfan(3,n1atom)=gdfan(3,n1atom)+t1dz
968 do j=ishiftca+1,ilastca
969 gdfan(1,j)=gdfan(1,j)+t2dx(j)
970 gdfan(2,j)=gdfan(2,j)+t2dy(j)
971 gdfan(3,j)=gdfan(3,j)+t2dz(j)
984 subroutine edfab(edfabeta)
986 implicit real*8 (a-h,o-z)
989 include 'COMMON.CHAIN'
990 include 'COMMON.DERIV'
994 parameter(PAI=3.14159265358979323846D0)
995 parameter (maxca=800)
997 real*8 bx(maxres),by(maxres),bz(maxres)
998 real*8 vbet(maxres,maxres)
999 real*8 shetfx(maxres),shetfy(maxres),shetfz(maxres)
1000 real*8 shefx(maxres,12),shefy(maxres,12),shefz(maxres,12)
1001 real*8 vbeta,vbetp,vbetm
1002 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
1003 & c00,s00,ulnex,dnex
1004 real*8 dp45,dm45,w_beta
1006 real*8 cph(maxca),cth(maxca)
1007 real*8 atx(maxca),aty(maxca),atz(maxca)
1008 real*8 atmx(maxca),atmy(maxca),atmz(maxca)
1009 real*8 atmmx(maxca),atmmy(maxca),atmmz(maxca)
1010 real*8 atm3x(maxca),atm3y(maxca),atm3z(maxca)
1012 real*8 astx(maxca),asty(maxca),astz(maxca)
1013 real*8 astmx(maxca),astmy(maxca),astmz(maxca)
1014 real*8 astmmx(maxca),astmmy(maxca),astmmz(maxca)
1015 real*8 astm3x(maxca),astm3y(maxca),astm3z(maxca)
1017 real*8 atxnum(maxca),atynum(maxca),atznum(maxca),
1018 & astxnum(maxca),astynum(maxca),astznum(maxca),
1019 & atmxnum(maxca),atmynum(maxca),atmznum(maxca),
1020 & astmxnum(maxca),astmynum(maxca),astmznum(maxca),
1021 & atmmxnum(maxca),atmmynum(maxca),atmmznum(maxca),
1022 & astmmxnum(maxca),astmmynum(maxca),astmmznum(maxca),
1023 & atm3xnum(maxca),atm3ynum(maxca),atm3znum(maxca),
1024 & astm3xnum(maxca),astm3ynum(maxca),astm3znum(maxca),
1025 & cth_orig(maxca),sth_orig(maxca)
1027 common /sheca/ bx,by,bz
1028 common /shee/ vbeta,vbet,vbetp,vbetm
1029 common /shetf/ shetfx,shetfy,shetfz
1030 common /shef/ shefx, shefy, shefz
1031 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
1032 & c00,s00,ulnex,dnex
1033 common /sheconst/ dp45,dm45,w_beta
1035 common /angvt/ atx,aty,atz,atmx,atmy,atmz,atmmx,atmmy,
1036 $ atmmz,atm3x,atm3y,atm3z
1037 common /angvt2/ astx,asty,astz,astmx,astmy,astmz,astmmx,astmmy,
1038 $ astmmz,astm3x,astm3y,astm3z
1040 common /coscos/ cph,cth
1043 C End of sheet variables
1046 double precision enebet
1049 bx=0.0d0;by=0.0d0;bz=0.0d0
1050 shetfx=0.0d0;shetfy=0.0d0;shetfz=0.0d0
1054 do i=ishiftca+1,ilastca
1055 bx(i-ishiftca)=c(1,i)
1056 by(i-ishiftca)=c(2,i)
1057 bz(i-ishiftca)=c(3,i)
1060 c do i=1,ilastca-ishiftca
1061 c read(99,*) bx(i),by(i),bz(i)
1069 ULNEX=COS(60.0D0/180.0D0*PAI)
1076 C00=COS((1.0D0+10.0D0/180.0D0)*PAI)
1077 S00=SIN((1.0D0+10.0D0/180.0D0)*PAI)
1083 C END OF INITIALIZATION
1085 nca=ilastca-ishiftca
1087 call angvectors(nca)
1088 call sheetforce(nca,wshet)
1090 c end of sheet energy and force
1093 shetfx(j)=shetfx(j)*beta_inc
1094 shetfy(j)=shetfy(j)*beta_inc
1095 shetfz(j)=shetfz(j)*beta_inc
1096 c write(*,*)'SHETF:',shetfx(j),shetfy(j),shetfz(j)
1099 vbeta=vbeta*beta_inc
1104 gdfab(1,j+ishiftca)=gdfab(1,j+ishiftca)-shetfx(j)
1105 gdfab(2,j+ishiftca)=gdfab(2,j+ishiftca)-shetfy(j)
1106 gdfab(3,j+ishiftca)=gdfab(3,j+ishiftca)-shetfz(j)
1111 write(*,'(5x,i5,10x,3f10.5)') j,bx(j),by(j),bz(j)
1125 call angvectors(nca)
1127 call angvectors(nca)
1128 atxnum(j)=0.5*(cth(j)-cth_orig(j))/dinc
1129 astxnum(j)=0.5*(sth(j)-sth_orig(j))/dinc
1131 atmxnum(j)=0.5*(cth(j-1)-cth_orig(j-1))/dinc
1132 astmxnum(j)=0.5*(sth(j-1)-sth_orig(j-1))/dinc
1135 atmmxnum(j)=0.5*(cth(j-2)-cth_orig(j-2))/dinc
1136 astmmxnum(j)=0.5*(sth(j-2)-sth_orig(j-2))/dinc
1139 atm3xnum(j)=0.5*(cth(j-3)-cth_orig(j-3))/dinc
1140 astm3xnum(j)=0.5*(sth(j-3)-sth_orig(j-3))/dinc
1144 call angvectors(nca)
1146 call angvectors(nca)
1148 atynum(j)=0.5*(cth(j)-cth_orig(j))/dinc
1149 astynum(j)=0.5*(sth(j)-sth_orig(j))/dinc
1151 atmynum(j)=0.5*(cth(j-1)-cth_orig(j-1))/dinc
1152 astmynum(j)=0.5*(sth(j-1)-sth_orig(j-1))/dinc
1155 atmmynum(j)=0.5*(cth(j-2)-cth_orig(j-2))/dinc
1156 astmmynum(j)=0.5*(sth(j-2)-sth_orig(j-2))/dinc
1159 atm3ynum(j)=0.5*(cth(j-3)-cth_orig(j-3))/dinc
1160 astm3ynum(j)=0.5*(sth(j-3)-sth_orig(j-3))/dinc
1164 call angvectors(nca)
1166 call angvectors(nca)
1169 atznum(j)=0.5*(cth(j)-cth_orig(j))/dinc
1170 astznum(j)=0.5*(sth(j)-sth_orig(j))/dinc
1172 atmznum(j)=0.5*(cth(j-1)-cth_orig(j-1))/dinc
1173 astmznum(j)=0.5*(sth(j-1)-sth_orig(j-1))/dinc
1176 atmmznum(j)=0.5*(cth(j-2)-cth_orig(j-2))/dinc
1177 astmmznum(j)=0.5*(sth(j-2)-sth_orig(j-2))/dinc
1180 atm3znum(j)=0.5*(cth(j-3)-cth_orig(j-3))/dinc
1181 astm3znum(j)=0.5*(sth(j-3)-sth_orig(j-3))/dinc
1187 write (*,'(2i5,a2,6f10.5)')
1188 & i,1,"x",atxnum(i),atx(i),atxnum(i)/atx(i),
1189 & astxnum(i),astx(i),astxnum(i)/astx(i),
1190 & i,1,"y",atynum(i),aty(i),atynum(i)/aty(i),
1191 & astynum(i),asty(i),astynum(i)/asty(i),
1192 & i,1,"z",atznum(i),atz(i),atznum(i)/atz(i),
1193 & astznum(i),astz(i),astznum(i)/astz(i),
1194 & i,2,"x",atmxnum(i),atmx(i),atmxnum(i)/atmx(i),
1195 & astmxnum(i),astmx(i),astmxnum(i)/astmx(i),
1196 & i,2,"y",atmynum(i),atmy(i),atmynum(i)/atmy(i),
1197 & astmynum(i),astmy(i),astmynum(i)/astmy(i),
1198 & i,2,"z",atmznum(i),atmz(i),atmznum(i)/atmz(i),
1199 & astmznum(i),astmz(i),astmznum(i)/astmz(i),
1200 & i,3,"x",atmmxnum(i),atmmx(i),atmmxnum(i)/atmmx(i),
1201 & astmmxnum(i),astmmx(i),astmmxnum(i)/astmmx(i),
1202 & i,3,"y",atmmynum(i),atmmy(i),atmmynum(i)/atmmy(i),
1203 & astmmynum(i),astmmy(i),astmmynum(i)/astmmy(i),
1204 & i,3,"z",atmmznum(i),atmmz(i),atmmznum(i)/atmmz(i),
1205 & astmmznum(i),astmmz(i),astmmznum(i)/astmmz(i),
1206 & i,4,"x",atm3xnum(i),atm3x(i),atm3xnum(i)/atm3x(i),
1207 & astm3xnum(i),astm3x(i),astm3xnum(i)/astm3x(i),
1208 & i,4,"y",atm3ynum(i),atm3y(i),atm3ynum(i)/atm3y(i),
1209 & astm3ynum(i),astm3y(i),astm3ynum(i)/astm3y(i),
1210 & i,4,"z",atm3znum(i),atm3z(i),atm3znum(i)/atm3z(i),
1211 & astm3znum(i),astm3z(i),astm3znum(i)/astm3z(i),
1212 & i,0," ",cth_orig(i),sth_orig(i)
1222 call angvectors(nca)
1223 call sheetforce(nca,wshet)
1224 vbeta1=vbeta*beta_inc
1226 call angvectors(nca)
1227 call sheetforce(nca,wshet)
1228 vbeta2=vbeta*beta_inc
1229 gdfab(1,j)=(vbeta2-vbeta1)/dinc/2
1233 call angvectors(nca)
1234 call sheetforce(nca,wshet)
1235 vbeta1=vbeta*beta_inc
1237 call angvectors(nca)
1238 call sheetforce(nca,wshet)
1239 vbeta2=vbeta*beta_inc
1240 gdfab(2,j)=(vbeta2-vbeta1)/dinc/2
1244 call angvectors(nca)
1245 call sheetforce(nca,wshet)
1246 vbeta1=vbeta*beta_inc
1248 call angvectors(nca)
1249 call sheetforce(nca,wshet)
1250 vbeta2=vbeta*beta_inc
1251 gdfab(3,j)=(vbeta2-vbeta1)/dinc/2
1258 call angvectors(nca)
1259 call sheetforce(nca,wshet)
1261 shetfx(j)=shetfx(j)*beta_inc
1262 shetfy(j)=shetfy(j)*beta_inc
1263 shetfz(j)=shetfz(j)*beta_inc
1267 write(*,*) 'xyz analytical and numerical gradient'
1269 write(*,'(5x,i5,10x,6f10.5)') j,-shetfx(j),-shetfy(j),-shetfz(j)
1270 & ,(-gdfab(i,j),i=1,3)
1274 write(*,'(5x,i5,10x,3f10.2)') j,shetfx(j)/gdfab(1,j),
1275 & shetfy(j)/gdfab(2,j),
1276 & shetfz(j)/gdfab(3,j)
1284 C-------------------------------------------------------------------------------
1285 subroutine angvectors(nca)
1286 c implicit real*4(a-h,o-z)
1290 parameter(maxca=800)
1292 parameter(PAI=3.14159265358979323846D0,zero=0.0d0)
1294 real*8 bx(maxca),by(maxca),bz(maxca)
1295 real*8 dis(maxca,maxca)
1296 real*8 apx(maxca),apy(maxca),apz(maxca)
1297 real*8 apmx(maxca),apmy(maxca),apmz(maxca)
1298 real*8 apmmx(maxca),apmmy(maxca),apmmz(maxca)
1299 real*8 apm3x(maxca),apm3y(maxca),apm3z(maxca)
1300 real*8 atx(maxca),aty(maxca),atz(maxca)
1301 real*8 atmx(maxca),atmy(maxca),atmz(maxca)
1302 real*8 atmmx(maxca),atmmy(maxca),atmmz(maxca)
1303 real*8 atm3x(maxca),atm3y(maxca),atm3z(maxca)
1304 real*8 astx(maxca),asty(maxca),astz(maxca)
1305 real*8 astmx(maxca),astmy(maxca),astmz(maxca)
1306 real*8 astmmx(maxca),astmmy(maxca),astmmz(maxca)
1307 real*8 astm3x(maxca),astm3y(maxca),astm3z(maxca)
1309 real*8 cph(maxca),cth(maxca)
1312 integer i, ip, ipp, ip3, j
1313 real*8 rx(maxca, maxca), ry(maxca, maxca), rz(maxca, maxca)
1314 real*8 rix, riy, riz, ripx, ripy, ripz, rippx, rippy, rippz
1315 real*8 gix, giy, giz, gipx, gipy, gipz, gippx, gippy, gippz
1316 real*8 cix, ciy, ciz, cipx, cipy, cipz
1317 real*8 gpcrp_x, gpcrp_y, gpcrp_z, d_gpcrp, gpcrp__g
1318 real*8 d10, d11, d12, d13, d20, d21, d22, d23, d24
1319 real*8 d30, d31, d32, d33, d34, d35, d40, d41, d42, d43
1320 real*8 d_gcr, d_gcr3, d_gmcrim,d_gmcrim3,dgmmcrimm,d_gmmcrimm3
1321 real*8 dg, dg3, dg30, dgm, dgm3, dgmm, dgmm3, dgp, dri
1322 real*8 dri3, drim, drim3, drimm, drip, dripp, g3gmm, g3rim
1323 real*8 g3x, g3y, g3z, d_gmmcrimm, g3rim_,gcr__gm
1324 real*8 gcr_x,gcr_y,gcr_z,ggm,ggp,gmcrim__gmm
1325 real*8 gmcrim_x,gmcrim_y,gmcrim_z,gmmcrimm__gmmm
1326 real*8 gmmcrimm_x,gmmcrimm_y,gmmcrimm_z,gmmgm,gmmr
1327 real*8 gmmx,gmmy,gmmz,gmrp,gmx,gmy,gmz,gpx,gpy,gpz
1328 real*8 grpp,gx,gy,gz
1329 real*8 rim3x,rim3y,rim3z,rimmx,rimmy,rimmz,rimx,rimy,rimz
1330 real*8 sd10,sd11,sd20,sd21,sd22,sd30,sd31,sd32,sd40,sd41
1331 integer inb,nmax,iselect
1333 common /sheca/ bx,by,bz
1334 common /difvec/ rx, ry, rz
1335 common /ulang/ ulcos
1336 common /phys1/ inb,nmax,iselect
1339 common /angvp/ apx,apy,apz,apmx,apmy,apmz,apmmx,apmmy,
1340 & apmmz,apm3x,apm3y,apm3z
1341 common /angvt/ atx,aty,atz,atmx,atmy,atmz,atmmx,atmmy,
1342 & atmmz,atm3x,atm3y,atm3z
1343 common /coscos/ cph,cth
1344 common /angvt2/ astx,asty,astz,astmx,astmy,astmz,astmmx,astmmy,
1345 & astmmz,astm3x,astm3y,astm3z
1347 C-------------------------------------------------------------------------------
1348 c write(*,*) 'inside angvectors'
1353 cph=zero; cth=zero; sth=zero
1354 apx=zero;apy=zero;apz=zero;apmx=zero;apmy=zero;apmz=zero
1355 apmmx=zero;apmmy=zero;apmmz=zero;apm3x=zero;apm3y=zero;apm3z=zero
1356 atx=zero;aty=zero;atz=zero;atmx=zero;atmy=zero;atmz=zero
1357 atmmx=zero;atmmy=zero;atmmz=zero;atm3x=zero;atm3y=zero;atm3z=zero
1358 astx=zero;asty=zero;astz=zero;astmx=zero;astmy=zero;astmz=zero
1359 astmmx=zero;astmmy=zero;astmmz=zero;astm3x=zero;astm3y=zero
1362 C r[x,y,z] calc and distance calculation
1363 rx=zero;ry=zero;rz=zero
1370 dis(i,j)=sqrt(rx(i,j)**2+ry(i,j)**2+rz(i,j)**2)
1371 c write(*,*) 'rx(i,j):',i,j,rx(i,j),bx(j),bx(i)
1372 c write(*,*) 'ry(i,j):',i,j,ry(i,j),by(j),by(i)
1373 c write(*,*) 'rz(i,j):',i,j,rz(i,j),bz(j),bz(i)
1374 c write(*,*) 'dis(i,j):',i,j,dis(i,j)
1377 c end of r[x,y,z] calc
1383 if(dis(i,ip).ge.1.0e-8.and.dis(ip,ipp).ge.1.0e-8) then
1384 ulcos(i)=rx(i,ip)*rx(ip,ipp)+ry(i,ip)*ry(ip,ipp)
1385 $ +rz(i,ip)*rz(ip,ipp)
1386 ulcos(i)=ulcos(i)/(dis(i,ip)*dis(ip,ipp))
1389 c end of virtual bond angle
1390 c write(*,*) 'inside angvectors1'
1402 rippx=bx(ip3)-bx(ipp)
1403 rippy=by(ip3)-by(ipp)
1404 rippz=bz(ip3)-bz(ipp)
1406 gx=riy*ripz-riz*ripy
1407 gy=riz*ripx-rix*ripz
1408 gz=rix*ripy-riy*ripx
1409 gpx=ripy*rippz-ripz*rippy
1410 gpy=ripz*rippx-ripx*rippz
1411 gpz=ripx*rippy-ripy*rippx
1412 gpcrp_x=gpy*ripz-gpz*ripy
1413 gpcrp_y=gpz*ripx-gpx*ripz
1414 gpcrp_z=gpx*ripy-gpy*ripx
1415 d_gpcrp=sqrt(gpcrp_x**2+gpcrp_y**2+gpcrp_z**2)
1416 gpcrp__g=gx*gpy*ripz+gpx*ripy*gz+ripx*gpz*gy
1417 & -gz*gpy*ripx-gpz*ripy*gx-ripz*gpx*gy
1423 gmx=rimy*riz-rimz*riy
1424 gmy=rimz*rix-rimx*riz
1425 gmz=rimx*riy-rimy*rix
1426 dgm=sqrt(gmx**2+gmy**2+gmz**2)
1428 ggm=gmx*gx+gmy*gy+gmz*gz
1429 gmrp=gmx*ripx+gmy*ripy+gmz*ripz
1435 d_gcr=sqrt(gcr_x**2+gcr_y**2+gcr_z**2)
1437 gcr__gm=gmx*gy*riz+gx*riy*gmz+rix*gz*gmy
1438 & -gmz*gy*rix-gz*riy*gmx-riz*gx*gmy
1440 c write(*,*) 'inside angvectors2'
1442 rimmx=bx(i-1)-bx(i-2)
1443 rimmy=by(i-1)-by(i-2)
1444 rimmz=bz(i-1)-bz(i-2)
1446 gmmx=rimmy*rimz-rimmz*rimy
1447 gmmy=rimmz*rimx-rimmx*rimz
1448 gmmz=rimmx*rimy-rimmy*rimx
1449 dgmm=sqrt(gmmx**2+gmmy**2+gmmz**2)
1451 gmmgm=gmmx*gmx+gmmy*gmy+gmmz*gmz
1452 gmmr=gmmx*rix+gmmy*riy+gmmz*riz
1453 gmcrim_x=gmy*rimz-gmz*rimy
1454 gmcrim_y=gmz*rimx-gmx*rimz
1455 gmcrim_z=gmx*rimy-gmy*rimx
1456 d_gmcrim=sqrt(gmcrim_x**2+gmcrim_y**2+gmcrim_z**2)
1457 d_gmcrim3=d_gmcrim**3
1458 gmcrim__gmm=gmmx*gmy*rimz+gmx*rimy*gmmz+rimx*gmz*gmmy
1459 & -gmmz*gmy*rimx-gmz*rimy*gmmx-rimz*gmx*gmmy
1463 rim3x=bx(i-2)-bx(i-3)
1464 rim3y=by(i-2)-by(i-3)
1465 rim3z=bz(i-2)-bz(i-3)
1466 g3x=rim3y*rimmz-rim3z*rimmy
1467 g3y=rim3z*rimmx-rim3x*rimmz
1468 g3z=rim3x*rimmy-rim3y*rimmx
1469 dg30=sqrt(g3x**2+g3y**2+g3z**2)
1470 g3gmm=g3x*gmmx+g3y*gmmy+g3z*gmmz
1471 g3rim_=g3x*rimx+g3y*rimy+g3z*rimz
1472 cc**********************************************************************
1473 gmmcrimm_x=gmmy*rimmz-gmmz*rimmy
1474 gmmcrimm_y=gmmz*rimmx-gmmx*rimmz
1475 gmmcrimm_z=gmmx*rimmy-gmmy*rimmx
1476 d_gmmcrimm=sqrt(gmmcrimm_x**2+gmmcrimm_y**2+gmmcrimm_z**2)
1477 d_gmmcrimm3=d_gmmcrimm**3
1478 gmmcrimm__gmmm=g3x*gmmy*rimmz+gmmx*rimmy*g3z+rimmx*gmmz*g3y
1479 & -g3z*gmmy*rimmx-gmmz*rimmy*g3x-rimmz*gmmx*g3y
1486 dg=sqrt(gx**2+gy**2+gz**2)
1487 dgp=sqrt(gpx**2+gpy**2+gpz**2)
1490 ggp=gx*gpx+gy*gpy+gz*gpz
1491 grpp=gx*rippx+gy*rippy+gz*rippz
1493 if(dg.gt.0.0D0.and.dripp.gt.0.0D0.and.dgp.gt.0.0D0
1494 & .and.d_gpcrp.gt.0.0D0) then
1495 cph(i)=grpp/dg/dripp
1497 sth(i)=gpcrp__g/d_gpcrp/dg
1505 c write(*,*) 'inside angvectors3'
1507 if(dgp.gt.0.0D0.and.dg3.gt.0.0D0
1508 & .and.dripp.gt.0.0D0.and.d_gpcrp.gt.0.0D0) then
1511 d12=1.0D0/(dg*dripp)
1512 d13=grpp/(dg3*dripp)
1513 sd10=1.0D0/(d_gpcrp*dg)
1514 sd11=gpcrp__g/(d_gpcrp*dg3)
1524 atx(i)=(ripz*gpy-ripy*gpz)*d10
1525 & -(gy*ripz-gz*ripy)*d11
1526 aty(i)=(ripx*gpz-ripz*gpx)*d10
1527 & -(gz*ripx-gx*ripz)*d11
1528 atz(i)=(ripy*gpx-ripx*gpy)*d10
1529 & -(gx*ripy-gy*ripx)*d11
1530 astx(i)=sd10*(-gpx*ripy**2+ripx*gpz*ripz
1531 & +ripy*gpy*ripx-gpx*ripz**2)
1532 & -sd11*(gy*ripz-gz*ripy)
1533 asty(i)=sd10*(-gpy*ripz**2+gpx*ripy*ripx
1534 & -gpy*ripx**2+gpz*ripy*ripz)
1535 & -sd11*(-gx*ripz+gz*ripx)
1536 astz(i)=sd10*(ripy*gpy*ripz-gpz*ripx**2
1537 & -gpz*ripy**2+ripz*gpx*ripx)
1538 & -sd11*(gx*ripy-gy*ripx)
1539 apx(i)=(ripz*rippy-ripy*rippz)*d12
1540 & -(gy*ripz-gz*ripy)*d13
1541 apy(i)=(ripx*rippz-ripz*rippx)*d12
1542 & -(gz*ripx-gx*ripz)*d13
1543 apz(i)=(ripy*rippx-ripx*rippy)*d12
1544 & -(gx*ripy-gy*ripx)*d13
1556 if(dgm3.gt.0.0D0.and.dg3.gt.0.0D0.and.drip.gt.0.0D0
1557 & .and.d_gcr3.gt.0.0D0) then
1561 d23=1.0D0/(dgm*drip)
1562 d24=gmrp/(dgm3*drip)
1563 sd20=1.0D0/(d_gcr*dgm)
1564 sd21=gcr__gm/(d_gcr3*dgm)
1565 sd22=gcr__gm/(d_gcr*dgm3)
1576 atmx(i)=(ciy*gz-ciz*gy-ripy*gmz+ripz*gmy)*d20
1577 & -(ciy*gmz-ciz*gmy)*d21
1578 & +(ripy*gz-ripz*gy)*d22
1579 atmy(i)=(ciz*gx-cix*gz-ripz*gmx+ripx*gmz)*d20
1580 & -(ciz*gmx-cix*gmz)*d21
1581 & +(ripz*gx-ripx*gz)*d22
1582 atmz(i)=(cix*gy-ciy*gx-ripx*gmy+ripy*gmx)*d20
1583 & -(cix*gmy-ciy*gmx)*d21
1584 & +(ripx*gy-ripy*gx)*d22
1585 cc**********************************************************************
1586 astmx(i)=sd20*(gmx*ripz*riz+gx*riy*ciy-gz*gmy
1587 & -rix*ripy*gmy-rix*gz*ciz-ciy*gy*rix-gmz*ripz*rix
1588 & +gmz*gy+ripy*riy*gmx+riz*gx*ciz)
1589 & -sd21*(gcr_x*(ripz*riz+ripy*riy)+gcr_y*(-ripy*rix-gz)
1590 & +gcr_z*(-ripz*rix+gy))
1591 & -sd22*(-gmy*ciz+gmz*ciy)
1593 astmy(i)=sd20*(ciz*gy*riz-ripz*riy*gmz-gx*gmz-gx*riy*cix
1594 & +rix*ripx*gmy+cix*gy*rix-ripx*riy*gmx+gz*gmx-gz*riy*ciz
1596 & -sd21*(gcr_x*(-ripx*riy+gz)+gcr_y*(ripx*rix+ripz*riz)
1597 & -gcr_z*(ripz*riy+gx))
1598 & -sd22*(gmx*ciz-gmz*cix)
1600 astmz(i)=sd20*(-ciy*gy*riz-gmx*ripx*riz-gmx*gy+ripy*riy*gmz
1601 & +rix*gz*cix+gmz*ripx*rix+gz*riy*ciy+gx*gmy-riz*ripy*gmy
1603 & -sd21*(gcr_x*(-ripx*riz-gy)+gcr_y*(-ripy*riz+gx)
1604 & +gcr_z*(ripy*riy+ripx*rix))
1605 & -sd22*(-gmx*ciy+gmy*cix)
1606 cc**********************************************************************
1607 apmx(i)=(ciy*ripz-ripy*ciz)*d23
1608 & -(ciy*gmz-ciz*gmy)*d24
1609 apmy(i)=(ciz*ripx-ripz*cix)*d23
1610 & -(ciz*gmx-cix*gmz)*d24
1611 apmz(i)=(cix*ripy-ripx*ciy)*d23
1612 & -(cix*gmy-ciy*gmx)*d24
1616 if(dgm3.gt.0.0D0.and.dgmm3.gt.0.0D0.and.dri3.gt.0.0D0
1617 & .and.d_gmcrim3.gt.0.0D0) then
1618 d30=1.0D0/(dgm*dgmm)
1619 d31=gmmgm/(dgm3*dgmm)
1620 d32=gmmgm/(dgm*dgmm3)
1621 d33=1.0D0/(dgmm*dri)
1622 d34=gmmr/(dgmm3*dri)
1623 d35=gmmr/(dgmm*dri3)
1624 sd30=1.0D0/(d_gmcrim*dgmm)
1625 sd31=gmcrim__gmm/(d_gmcrim3*dgmm)
1626 sd32=gmcrim__gmm/(d_gmcrim*dgmm3)
1639 c write(*,*) 'inside angvectors4'
1641 cc**********************************************************************
1642 atmmx(i)=(ciy*gmmz-ciz*gmmy-rimmy*gmz+rimmz*gmy)*d30
1643 & -(ciy*gmz-ciz*gmy)*d31
1644 & -(gmmy*rimmz-gmmz*rimmy)*d32
1645 atmmy(i)=(ciz*gmmx-cix*gmmz-rimmz*gmx+rimmx*gmz)*d30
1646 & -(ciz*gmx-cix*gmz)*d31
1647 & -(gmmz*rimmx-gmmx*rimmz)*d32
1648 atmmz(i)=(cix*gmmy-ciy*gmmx-rimmx*gmy+rimmy*gmx)*d30
1649 & -(cix*gmy-ciy*gmx)*d31
1650 & -(gmmx*rimmy-gmmy*rimmx)*d32
1651 cc**********************************************************************
1652 astmmx(i)=sd30*(-gmmx*ciz*rimz-gmx*rimy*rimmy
1653 & +gmz*gmmy+rimx*ciy*gmmy+rimx*gmz*rimmz
1654 & +rimmy*gmy*rimx+gmmz*ciz*rimx-gmmz*gmy
1655 & -ciy*rimy*gmmx-rimz*gmx*rimmz)
1656 & -sd31*(gmcrim_x*(-ciz*rimz-ciy*rimy)
1657 & +gmcrim_y*(ciy*rimx+gmz)+gmcrim_z*(ciz*rimx-gmy))
1658 & -sd32*(gmmy*rimmz-rimmy*gmmz)
1660 astmmy(i)=sd30*(-rimmz*gmy*rimz+ciz*rimy*gmmz
1661 & +gmx*gmmz+gmx*rimy*rimmx-rimx*cix*gmmy
1662 & -rimmx*gmy*rimx+cix*rimy*gmmx-gmz*gmmx
1663 & +gmz*rimy*rimmz-rimz*ciz*gmmy)
1664 & -sd31*(gmcrim_x*(cix*rimy-gmz)
1665 & +gmcrim_y*(-cix*rimx-ciz*rimz)+gmcrim_z*(ciz*rimy+gmx))
1666 & -sd32*(-gmmx*rimmz+rimmx*gmmz)
1668 astmmz(i)=sd30*(rimmy*gmy*rimz+gmmx*cix*rimz
1669 & +gmmx*gmy-ciy*rimy*gmmz-rimx*gmz*rimmx
1670 & -gmmz*cix*rimx-gmz*rimy*rimmy-gmx*gmmy
1671 & +rimz*ciy*gmmy+rimz*gmx*rimmx)
1672 & -sd31*(gmcrim_x*(cix*rimz+gmy)
1673 & +gmcrim_y*(ciy*rimz-gmx)+gmcrim_z*(-ciy*rimy-cix*rimx))
1674 & -sd32*(gmmx*rimmy-rimmx*gmmy)
1675 c**********************************************************************
1676 apmmx(i)=(riy*rimmz-riz*rimmy-gmmx)*d33
1677 & -(gmmy*rimmz-gmmz*rimmy)*d34
1679 apmmy(i)=(riz*rimmx-rix*rimmz-gmmy)*d33
1680 & -(gmmz*rimmx-gmmx*rimmz)*d34
1682 apmmz(i)=(rix*rimmy-riy*rimmx-gmmz)*d33
1683 & -(gmmx*rimmy-gmmy*rimmx)*d34
1688 if(dg30.gt.0.0D0.and.dgmm3.gt.0.0D0
1689 & .and.drim3.gt.0.0D0
1690 & .and.d_gmmcrimm3.gt.0.0D0) then
1691 d40=1.0D0/(dg30*dgmm)
1692 d41=g3gmm/(dg30*dgmm3)
1693 d42=1.0D0/(dg30*drim)
1694 d43=g3rim_/(dg30*drim3)
1695 sd40=1.0D0/(dg30*d_gmmcrimm)
1696 sd41=gmmcrimm__gmmm/(d_gmmcrimm3*dg30)
1705 atm3x(i)=(g3y*rimmz-g3z*rimmy)*d40
1706 & -(gmmy*rimmz-gmmz*rimmy)*d41
1707 atm3y(i)=(g3z*rimmx-g3x*rimmz)*d40
1708 & -(gmmz*rimmx-gmmx*rimmz)*d41
1709 atm3z(i)=(g3x*rimmy-g3y*rimmx)*d40
1710 & -(gmmx*rimmy-gmmy*rimmx)*d41
1711 cc**********************************************************************
1712 astm3x(i)=sd40*(g3x*rimmz**2-rimmx*rimmy*g3y
1713 & -g3z*rimmz*rimmx+rimmy**2*g3x)
1714 & -sd41*(gmmcrimm_x*(rimmz**2+rimmy**2)
1715 & -gmmcrimm_y*rimmy*rimmx-gmmcrimm_z*rimmz*rimmx)
1717 astm3y(i)=sd40*(-rimmz*rimmy*g3z+rimmx**2*g3y
1718 & -rimmx*rimmy*g3x+rimmz**2*g3y)
1719 & -sd41*(-gmmcrimm_x*rimmx*rimmy
1720 & +gmmcrimm_y*(rimmx**2+rimmz**2)-gmmcrimm_z*rimmz*rimmy)
1722 c & +gmmcrimm_y*(rimmx**2+rimmz**2)-gmmcrimm_z*rimmz*rimmx)
1724 astm3z(i)=sd40*(-g3x*rimmx*rimmz+rimmy**2*g3z
1725 & +g3z*rimmx**2-rimmz*rimmy*g3y)
1726 & -sd41*(-gmmcrimm_x*rimmx*rimmz-gmmcrimm_y*rimmy*rimmz
1727 & +gmmcrimm_z*(rimmy**2+rimmx**2))
1728 c**********************************************************************
1729 apm3x(i)=g3x*d42-rimx*d43
1730 apm3y(i)=g3y*d42-rimy*d43
1731 apm3z(i)=g3z*d42-rimz*d43
1734 c*******************************************************************************
1736 c write(*,*) 'inside angvectors5'
1743 rimmx=bx(i-1)-bx(i-2)
1744 rimmy=by(i-1)-by(i-2)
1745 rimmz=bz(i-1)-bz(i-2)
1746 rim3x=bx(i-2)-bx(i-3)
1747 rim3y=by(i-2)-by(i-3)
1748 rim3z=bz(i-2)-bz(i-3)
1749 gmmx=rimmy*rimz-rimmz*rimy
1750 gmmy=rimmz*rimx-rimmx*rimz
1751 gmmz=rimmx*rimy-rimmy*rimx
1752 g3x=rim3y*rimmz-rim3z*rimmy
1753 g3y=rim3z*rimmx-rim3x*rimmz
1754 g3z=rim3x*rimmy-rim3y*rimmx
1756 dg30=sqrt(g3x**2+g3y**2+g3z**2)
1757 g3gmm=g3x*gmmx+g3y*gmmy+g3z*gmmz
1758 dgmm=sqrt(gmmx**2+gmmy**2+gmmz**2)
1763 g3rim_=g3x*rimx+g3y*rimy+g3z*rimz
1764 cc**********************************************************************
1765 gmmcrimm_x=gmmy*rimmz-gmmz*rimmy
1766 gmmcrimm_y=gmmz*rimmx-gmmx*rimmz
1767 gmmcrimm_z=gmmx*rimmy-gmmy*rimmx
1768 d_gmmcrimm=sqrt(gmmcrimm_x**2+gmmcrimm_y**2+gmmcrimm_z**2)
1769 d_gmmcrimm3=d_gmmcrimm**3
1770 gmmcrimm__gmmm=g3x*gmmy*rimmz+gmmx*rimmy*g3z+rimmx*gmmz*g3y
1771 & -g3z*gmmy*rimmx-gmmz*rimmy*g3x-rimmz*gmmx*g3y
1773 if(dg30.gt.0.0D0.and.dgmm3.gt.0.0D0
1774 & .and.drim3.gt.0.0D0
1775 & .and.d_gmmcrimm3.gt.0.0D0) then
1776 d40=1.0D0/(dg30*dgmm)
1777 d41=g3gmm/(dg30*dgmm3)
1778 d42=1.0D0/(dg30*drim)
1779 d43=g3rim_/(dg30*drim3)
1780 sd40=1.0D0/(dg30*d_gmmcrimm)
1781 sd41=gmmcrimm__gmmm/(d_gmmcrimm3*dg30)
1790 atm3x(i)=(g3y*rimmz-g3z*rimmy)*d40
1791 & -(gmmy*rimmz-gmmz*rimmy)*d41
1792 atm3y(i)=(g3z*rimmx-g3x*rimmz)*d40
1793 & -(gmmz*rimmx-gmmx*rimmz)*d41
1794 atm3z(i)=(g3x*rimmy-g3y*rimmx)*d40
1795 & -(gmmx*rimmy-gmmy*rimmx)*d41
1796 cc**********************************************************************
1797 astm3x(i)=sd40*(g3x*rimmz**2-rimmx*rimmy*g3y
1798 & -g3z*rimmz*rimmx+rimmy**2*g3x)
1799 & -sd41*(gmmcrimm_x*(rimmz**2+rimmy**2)
1800 & -gmmcrimm_y*rimmy*rimmx-gmmcrimm_z*rimmz*rimmx)
1802 astm3y(i)=sd40*(-rimmz*rimmy*g3z+rimmx**2*g3y
1803 & -rimmx*rimmy*g3x+rimmz**2*g3y)
1804 & -sd41*(-gmmcrimm_x*rimmx*rimmy
1805 & +gmmcrimm_y*(rimmx**2+rimmz**2)-gmmcrimm_z*rimmz*rimmx)
1807 astm3z(i)=sd40*(-g3x*rimmx*rimmz+rimmy**2*g3z
1808 & +g3z*rimmx**2-rimmz*rimmy*g3y)
1809 & -sd41*(-gmmcrimm_x*rimmx*rimmz-gmmcrimm_y*rimmy*rimmz
1810 & +gmmcrimm_z*(rimmy**2+rimmx**2))
1811 cc**********************************************************************
1812 apm3x(i)=g3x*d42-rimx*d43
1813 apm3y(i)=g3y*d42-rimy*d43
1814 apm3z(i)=g3z*d42-rimz*d43
1824 gmx=rimy*riz-rimz*riy
1825 gmy=rimz*rix-rimx*riz
1826 gmz=rimx*riy-rimy*rix
1827 dgm=sqrt(gmx**2+gmy**2+gmz**2)
1831 gmmgm=gmmx*gmx+gmmy*gmy+gmmz+gmz
1832 gmmr=gmmx*rix+gmmy*riy+gmmz*riz
1833 gmcrim_x=gmy*rimz-gmz*rimy
1834 gmcrim_y=gmz*rimx-gmx*rimz
1835 gmcrim_z=gmx*rimy-gmy*rimx
1836 d_gmcrim=sqrt(gmcrim_x**2+gmcrim_y**2+gmcrim_z**2)
1837 d_gmcrim3=d_gmcrim**3
1838 gmcrim__gmm=gmmx*gmy*rimz+gmx*rimy*gmmz+rimx*gmz*gmmy
1839 & -gmmz*gmy*rimx-gmz*rimy*gmmx-rimz*gmx*gmmy
1841 if(dgm3.gt.0.0D0.and.
1842 & dgmm3.gt.0.0D0.and.dri3.gt.0.0D0
1843 & .and.d_gmcrim3.gt.0.0D0) then
1844 d30=1.0D0/(dgm*dgmm)
1845 d31=gmmgm/(dgm3*dgmm)
1846 d32=gmmgm/(dgm*dgmm3)
1847 d33=1.0D0/(dgmm*dri)
1848 d34=gmmr/(dgmm3*dri)
1849 d35=gmmr/(dgmm*dri3)
1850 sd30=1.0D0/(d_gmcrim*dgmm)
1851 sd31=gmcrim__gmm/(d_gmcrim3*dgmm)
1852 sd32=gmcrim__gmm/(d_gmcrim*dgmm3)
1865 cc**********************************************************************
1866 atmmx(i)=(ciy*gmmz-ciz*gmmy-rimmy*gmz+rimmz*gmy)*d30
1867 & -(ciy*gmz-ciz*gmy)*d31
1868 & -(gmmy*rimmz-gmmz*rimmy)*d32
1869 atmmy(i)=(ciz*gmmx-cix*gmmz-rimmz*gmx+rimmx*gmz)*d30
1870 & -(ciz*gmx-cix*gmz)*d31
1871 & -(gmmz*rimmx-gmmx*rimmz)*d32
1872 atmmz(i)=(cix*gmmy-ciy*gmmx-rimmx*gmy+rimmy*gmx)*d30
1873 & -(cix*gmy-ciy*gmx)*d31
1874 & -(gmmx*rimmy-gmmy*rimmx)*d32
1875 cc**********************************************************************
1876 astmmx(i)=sd30*(-gmmx*ciz*rimz-gmx*rimy*rimmy
1877 & +gmz*gmmy+rimx*ciy*gmmy+rimx*gmz*rimmz
1878 & +rimmy*gmy*rimx+gmmz*ciz*rimx-gmmz*gmy
1879 & -ciy*rimy*gmmx-rimz*gmx*rimmz)
1880 & -sd31*(gmcrim_x*(-ciz*rimz-ciy*rimy)
1881 & +gmcrim_y*(ciy*rimx+gmz)+gmcrim_z*(ciz*rimx-gmy))
1882 & -sd32*(gmmy*rimmz-rimmy*gmmz)
1884 astmmy(i)=sd30*(-rimmz*gmy*rimz+ciz*rimy*gmmz
1885 & +gmx*gmmz+gmx*rimy*rimmx-rimx*cix*gmmy
1886 & -rimmx*gmy*rimx+cix*rimy*gmmx-gmz*gmmx
1887 & +gmz*rimy*rimmz-rimz*ciz*gmmy)
1888 & -sd31*(gmcrim_x*(cix*rimy-gmz)
1889 & +gmcrim_y*(-cix*rimx-ciz*rimz)+gmcrim_z*(ciz*rimy+gmx))
1890 & -sd32*(-gmmx*rimmz+rimmx*gmmz)
1892 astmmz(i)=sd30*(rimmy*gmy*rimz+gmmx*cix*rimz
1893 & +gmmx*gmy-ciy*rimy*gmmz-rimx*gmz*rimmx
1894 & -gmmz*cix*rimx-gmz*rimy*rimmy-gmx*gmmy
1895 & +rimz*ciy*gmmy+rimz*gmx*rimmx)
1896 & -sd31*(gmcrim_x*(cix*rimz+gmy)
1897 & +gmcrim_y*(ciy*rimz-gmx)+gmcrim_z*(-ciy*rimy-cix*rimx))
1898 & -sd32*(gmmx*rimmy-rimmx*gmmy)
1899 cc**********************************************************************
1900 apmmx(i)=(riy*rimmz-riz*rimmy-gmmx)*d33
1901 & -(gmmy*rimmz-gmmz*rimmy)*d34
1903 apmmy(i)=(riz*rimmx-rix*rimmz-gmmy)*d33
1904 & -(gmmz*rimmx-gmmx*rimmz)*d34
1906 apmmz(i)=(rix*rimmy-riy*rimmx-gmmz)*d33
1907 & -(gmmx*rimmy-gmmy*rimmx)*d34
1911 c write(*,*) 'inside angvectors6'
1921 gx=riy*ripz-riz*ripy
1922 gy=riz*ripx-rix*ripz
1923 gz=rix*ripy-riy*ripx
1924 ggm=gmx*gx+gmy*gy+gmz*gz
1925 gmrp=gmx*ripx+gmy*ripy+gmz*ripz
1926 dg=sqrt(gx**2+gy**2+gz**2)
1932 d_gcr=sqrt(gcr_x**2+gcr_y**2+gcr_z**2)
1934 gcr__gm=gmx*gy*riz+gx*riy*gmz+rix*gz*gmy
1935 & -gmz*gy*rix-gz*riy*gmx-riz*gx*gmy
1936 if(dgm3.gt.0.0D0.and.
1937 & dg3.gt.0.0D0.and.drip.gt.0.0D0.and.d_gcr3.gt.0.0D0
1942 d23=1.0D0/(dgm*drip)
1943 d24=gmrp/(dgm3*drip)
1944 sd20=1.0D0/(d_gcr*dgm)
1945 sd21=gcr__gm/(d_gcr3*dgm)
1946 sd22=gcr__gm/(d_gcr*dgm3)
1957 atmx(i)=(ciy*gz-ciz*gy-ripy*gmz+ripz*gmy)*d20
1958 & -(ciy*gmz-ciz*gmy)*d21
1959 & +(ripy*gz-ripz*gy)*d22
1960 atmy(i)=(ciz*gx-cix*gz-ripz*gmx+ripx*gmz)*d20
1961 & -(ciz*gmx-cix*gmz)*d21
1962 & +(ripz*gx-ripx*gz)*d22
1963 atmz(i)=(cix*gy-ciy*gx-ripx*gmy+ripy*gmx)*d20
1964 & -(cix*gmy-ciy*gmx)*d21
1965 & +(ripx*gy-ripy*gx)*d22
1966 cc**********************************************************************
1967 astmx(i)=sd20*(gmx*ripz*riz+gx*riy*ciy-gz*gmy
1968 & -rix*ripy*gmy-rix*gz*ciz-ciy*gy*rix-gmz*ripz*rix
1969 & +gmz*gy+ripy*riy*gmx+riz*gx*ciz)
1970 & -sd21*(gcr_x*(ripz*riz+ripy*riy)+gcr_y*(-ripy*rix-gz)
1971 & +gcr_z*(-ripz*rix+gy))
1972 & -sd22*(-gmy*ciz+gmz*ciy)
1974 astmy(i)=sd20*(ciz*gy*riz-ripz*riy*gmz-gx*gmz-gx*riy*cix
1975 & +rix*ripx*gmy+cix*gy*rix-ripx*riy*gmx+gz*gmx-gz*riy*ciz
1977 & -sd21*(gcr_x*(-ripx*riy+gz)+gcr_y*(ripx*rix+ripz*riz)
1978 & -gcr_z*(ripz*riy+gx))
1979 & -sd22*(gmx*ciz-gmz*cix)
1981 astmz(i)=sd20*(-ciy*gy*riz-gmx*ripx*riz-gmx*gy+ripy*riy*gmz
1982 & +rix*gz*cix+gmz*ripx*rix+gz*riy*ciy+gx*gmy-riz*ripy*gmy
1984 & -sd21*(gcr_x*(-ripx*riz-gy)+gcr_y*(-ripy*riz+gx)
1985 & +gcr_z*(ripy*riy+ripx*rix))
1986 & -sd22*(-gmx*ciy+gmy*cix)
1987 cc**********************************************************************
1989 apmx(i)=(ciy*ripz-ripy*ciz)*d23
1990 & -(ciy*gmz-ciz*gmy)*d24
1991 apmy(i)=(ciz*ripx-ripz*cix)*d23
1992 & -(ciz*gmx-cix*gmz)*d24
1993 apmz(i)=(cix*ripy-ripx*ciy)*d23
1994 & -(cix*gmy-ciy*gmx)*d24
2002 c-------------------------------------------------------------------------------
2003 C---------------------------------------------------------------------------------
2004 subroutine sheetforce(nca,wshet)
2007 c this should be matched with dfa.fcm
2009 parameter(maxca=800)
2010 cc**********************************************************************
2013 integer inb,nmax,iselect
2015 c real*8 dfaexp(15001)
2017 real*8 vbeta,vbetp,vbetm
2018 real*8 shefx(maxca,12)
2019 real*8 shefy(maxca,12),shefz(maxca,12)
2020 real*8 shetfx(maxca),shetfy(maxca),shetfz(maxca)
2021 real*8 vbet(maxca,maxca)
2022 real*8 wshet(maxca,maxca)
2023 real*8 bx(maxca),by(maxca),bz(maxca)
2025 common /sheca/ bx,by,bz
2026 common /phys1/ inb,nmax,iselect
2027 common /shef/ shefx,shefy,shefz
2028 common /shee/ vbeta,vbet,vbetp,vbetm
2029 common /shetf/ shetfx,shetfy,shetfz
2046 call sheetene(nca,wshet)
2049 887 format(a,1x,i6,3x,f12.8)
2050 888 format(a,1x,i4,1x,i4,3x,f12.8)
2051 889 format(a,1x,i4,3x,f12.8)
2052 !write(2,*) 'coord : '
2054 !write(2,887) 'bx:',i,bx(i)
2055 !write(2,887) 'by:',i,by(i)
2056 !write(2,887) 'bz:',i,bz(i)
2058 !write(2,*) 'After sheetforce1'
2061 !write(2,888) 'shefx :',i,k,shefx(i,k)
2062 !write(2,888) 'shefy :',i,k,shefy(i,k)
2063 !write(2,888) 'shefz :',i,k,shefz(i,k)
2069 !write(2,*) 'After sheetforce5'
2072 !write(2,888) 'shefx :',i,k,shefx(i,k)
2073 !write(2,888) 'shefy :',i,k,shefy(i,k)
2074 !write(2,888) 'shefz :',i,k,shefz(i,k)
2080 !write(2,*) 'After sheetforce6'
2083 !write(2,888) 'shefx :',i,k,shefx(i,k)
2084 !write(2,888) 'shefy :',i,k,shefy(i,k)
2085 !write(2,888) 'shefz :',i,k,shefz(i,k)
2091 !write(2,*) 'After sheetforce11'
2094 !write(2,888) 'shefx :',i,k,shefx(i,k)
2095 !write(2,888) 'shefy :',i,k,shefy(i,k)
2096 !write(2,888) 'shefz :',i,k,shefz(i,k)
2102 !write(2,*) 'After sheetforce12'
2105 !write(2,888) 'shefx :',i,k,shefx(i,k)
2106 !write(2,888) 'shefy :',i,k,shefy(i,k)
2107 !write(2,888) 'shefz :',i,k,shefz(i,k)
2113 shetfx(i)=shetfx(i)+shefx(i,k)
2114 shetfy(i)=shetfy(i)+shefy(i,k)
2115 shetfz(i)=shetfz(i)+shefz(i,k)
2118 !write(2,*) 'Beta Finished'
2120 !write(2,889) 'shetfx : ',i,shetfx(i)
2121 !write(2,889) 'shetfy : ',i,shetfy(i)
2122 !write(2,889) 'shetfz : ',i,shetfz(i)
2128 c-------------------------------------------------------------------------------
2129 subroutine sheetene(nca,wshet)
2132 parameter(maxca=800)
2133 cc******************************************************************************
2135 c real*8 dfaexp(15001)
2136 real*8 dtmp1, dtmp2, dtmp3
2138 real*8 vbet(maxca,maxca)
2139 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2140 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2141 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2142 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
2143 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
2144 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
2145 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
2146 real*8 cph(maxca),cth(maxca)
2147 real*8 rx(maxca,maxca)
2148 real*8 ry(maxca,maxca),rz(maxca,maxca)
2149 real*8 bx(maxca),by(maxca),bz(maxca)
2150 real*8 dis(maxca,maxca)
2152 cc**********************************************************************
2153 real*8 astx(maxca),asty(maxca),astz(maxca)
2154 real*8 astmx(maxca),astmy(maxca),astmz(maxca)
2155 real*8 astmmx(maxca),astmmy(maxca),astmmz(maxca)
2156 real*8 astm3x(maxca),astm3y(maxca),astm3z(maxca)
2158 real*8 wshet(maxca,maxca)
2159 real*8 dp45, dm45, w_beta
2160 real*8 c00, s00, ulnex, dnex, dca,dlhb,ulhb,dshe,dldhb,uldhb
2162 integer i,ip,ipp,j,jp,jpp,inb,nmax,iselect
2164 real*8 vbeta,vbetp,vbetm,y,y1,y2,yshe1,yshe2,yy1,yy2
2166 common /sheca/ bx,by,bz
2167 common /phys1/ inb,nmax,iselect
2169 common /difvec/ rx,ry,rz
2170 common /coscos/ cph,cth
2171 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2172 & c00,s00,ulnex,dnex
2173 common /sheconst/ dp45,dm45,w_beta
2174 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2175 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
2176 common /shee/ vbeta,vbet,vbetp,vbetm
2177 common /ulang/ ulcos
2178 cc**********************************************************************
2179 common /angvt2/ astx,asty,astz,astmx,astmy,astmz,astmmx,astmmy,
2180 & astmmz,astm3x,astm3y,astm3z
2183 real*8 r_pair_mat(maxca,maxca)
2184 ci integer istrand(maxca,maxca)
2185 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
2186 ci common /shetest/ istrand,istrand_p,istrand_m
2187 common /beta_p/ r_pair_mat
2188 C-------------------------------------------------------------------------------
2192 r_pair_mat(i,j)=wshet(i,j)
2193 c write(*,*) 'r_pair_mat :',i,j,r_pair_mat(i,j)
2208 cc**********************************************************************
2209 y1=(cth(i)*c00+sth(i)*s00-1.0D0)**2
2210 & +(cth(j)*c00+sth(j)*s00-1.0D0)**2
2212 y2=(ulcos(i)-ulnex)**2+(ulcos(ip)-ulnex)**2
2213 & +(ulcos(j)-ulnex)**2+(ulcos(jp)-ulnex)**2
2226 ci if(istrand(i,j).eq.1) then
2228 yy1=-0.5d0*(dis(ip,jp)-ulhb)**2/dlhb
2229 yy2=-0.5d0*(dis(ipp,jpp)-ulhb)**2/dlhb
2232 pin1(i,j)=(rx(ip,jp)*rx(ip,ipp)+ry(ip,jp)*ry(ip,ipp)
2233 $ +rz(ip,jp)*rz(ip,ipp))/(dis(ip,jp)*dis(ip,ipp))
2234 pin2(i,j)=(rx(ip,jp)*rx(jp,jpp)+ry(ip,jp)*ry(jp,jpp)
2235 $ +rz(ip,jp)*rz(jp,jpp))/(dis(ip,jp)*dis(jp,jpp))
2236 pin3(i,j)=(rx(ipp,jpp)*rx(ip,ipp)+ry(ipp,jpp)*ry(ip,ipp)
2237 $ +rz(ipp,jpp)*rz(ip,ipp))/(dis(ipp,jpp)*dis(ip,ipp))
2238 pin4(i,j)=(rx(ipp,jpp)*rx(jp,jpp)+ry(ipp,jpp)*ry(jp,jpp)
2239 $ +rz(ipp,jpp)*rz(jp,jpp))/(dis(ipp,jpp)*dis(jp,jpp))
2241 yshe1=pin1(i,j)**2+pin2(i,j)**2
2242 yshe1=-0.5d0*yshe1/dshe
2243 yshe2=pin3(i,j)**2+pin4(i,j)**2
2244 yshe2=-0.5d0*yshe2/dshe
2246 ci if((yshe1+yshe2).ge.-4) then
2253 C write(*,*) 'rx(i,j):',i,j,rx(i,j),bx(j),bx(i)
2254 C write(*,*) 'ry(i,j):',i,j,ry(i,j),by(j),by(i)
2255 C write(*,*) 'rz(i,j):',i,j,rz(i,j),bz(j),bz(i)
2256 C write(*,*) 'dis(i,j):',i,j,dis(i,j)
2257 C write(*,*) 'rx(ip,jp):',ip,jp,bx(ip),bx(jp),rx(ip,jp)
2258 C write(*,*) 'rx(ip,ipp):',ip,ipp,bx(ip),bx(ipp),rx(ip,ipp)
2259 C write(*,*) 'pin1:',pin1(i,j)
2260 C write(*,*) 'pin2:',pin2(i,j)
2261 C write(*,*) 'pin3:',pin3(i,j)
2262 C write(*,*) 'pin4:',pin4(i,j)
2265 C write(*,*) 'yy1:',yy1
2266 C write(*,*) 'yy2:',yy2
2267 C write(*,*) 'yshe1:',yshe1
2268 C write(*,*) 'yshe2:',yshe2
2271 ci if (istrand_p(i,j).eq.1) then
2279 dtmp3 = y+yy1+yy2+yshe1+yshe2
2281 C write(*,*)'1', i,j,dtmp1,dtmp2,dtmp3
2282 C write(*,*)'2', y,yy1,yy2
2283 C write(*,*)'3', yshe1,yshe2
2285 cc if (dtmp3.le.-35.0d0) then
2286 c vbetap(i,j)=-dp45*exp(dtmp3)
2287 cc vbetap(i,j)=0.0d0
2289 c vbetap(i,j)=-dp45*dfaexp(idint(-dtmp3*1000)+1)
2290 vbetap(i,j)=-dp45*exp(dtmp3)
2293 cc if (dtmp1.le.-35.0d0) then
2294 c vbetap1(i,j)=-r_pair_mat(i+1,j+1)*exp(dtmp1)
2295 cc vbetap1(i,j)=0.0d0
2297 c vbetap1(i,j)=-r_pair_mat(i+1,j+1)
2298 c $ *dfaexp(idint(-dtmp1*1000)+1)
2299 vbetap1(i,j)=-r_pair_mat(i+1,j+1)*exp(dtmp1)
2302 cc if (dtmp2.le.-35.0d0) then
2303 C vbetap2(i,j)=-r_pair_mat(i+2,j+2)*exp(dtmp2)
2304 cc vbetap2(i,j)=0.0d0
2306 c vbetap2(i,j)=-r_pair_mat(i+2,j+2)
2307 c $ *dfaexp(idint(-dtmp2*1000)+1)
2308 vbetap2(i,j)=-r_pair_mat(i+2,j+2)*exp(dtmp2)
2311 c vbetap(i,j)=-dp45*exp(y+yy1+yy2+yshe1+yshe2)
2312 c vbetap1(i,j)=-r_pair_mat(i+1,j+1)*exp(y+yy1+yshe1)
2313 c vbetap2(i,j)=-r_pair_mat(i+2,j+2)*exp(y+yy2+yshe2)
2315 ! write(*,*) 'r_pair_mat>',i+1,j+1,r_pair_mat(i+1,j+1)
2316 ! write(*,*) 'r_pair_mat>',i+2,j+2,r_pair_mat(i+2,j+2)
2318 ci elseif (istrand_p(i,j).eq.0)then
2324 yy1=-0.5d0*(dis(ip,jpp)-ulhb)**2/dlhb
2325 yy2=-0.5d0*(dis(ipp,jp)-ulhb)**2/dlhb
2327 pina1(i,j)=(rx(ip,jpp)*rx(ip,ipp)+ry(ip,jpp)*ry(ip,ipp)
2328 $ +rz(ip,jpp)*rz(ip,ipp))/(dis(ip,jpp)*dis(ip,ipp))
2329 pina2(i,j)=(rx(ip,jpp)*rx(jp,jpp)+ry(ip,jpp)*ry(jp,jpp)
2330 $ +rz(ip,jpp)*rz(jp,jpp))/(dis(ip,jpp)*dis(jp,jpp))
2331 pina3(i,j)=(rx(jp,ipp)*rx(ip,ipp)+ry(jp,ipp)*ry(ip,ipp)
2332 $ +rz(jp,ipp)*rz(ip,ipp))/(dis(jp,ipp)*dis(ip,ipp))
2333 pina4(i,j)=(rx(jp,ipp)*rx(jp,jpp)+ry(jp,ipp)*ry(jp,jpp)
2334 $ +rz(jp,ipp)*rz(jp,jpp))/(dis(jp,ipp)*dis(jp,jpp))
2336 yshe1=pina1(i,j)**2+pina2(i,j)**2
2337 yshe1=-0.5d0*yshe1/dshe
2338 yshe2=pina3(i,j)**2+pina4(i,j)**2
2339 yshe2=-0.5d0*yshe2/dshe
2341 ci if((yshe1+yshe2).ge.-4) then
2348 C write(*,*) 'pina1:',pina1(i,j)
2349 C write(*,*) 'pina2:',pina2(i,j)
2350 C write(*,*) 'pina3:',pina3(i,j)
2351 C write(*,*) 'pina4:',pina4(i,j)
2352 C write(*,*) 'yshe1:',yshe1
2353 C write(*,*) 'yshe2:',yshe2
2354 C write(*,*) 'dshe:',dshe
2356 ci if (istrand_m(i,j).eq.1) then
2363 dtmp3=y+yy1+yy2+yshe1+yshe2
2367 cc if(dtmp3 .le. -35.0d0) then
2368 c vbetam(i,j)=-dm45*exp(dtmp3)
2369 cc vbetam(i,j)=0.0d0
2371 c vbetam(i,j)=-dm45*dfaexp(idint(-dtmp3*1000)+1)
2372 vbetam(i,j)=-dm45*exp(dtmp3)
2375 cc if(dtmp1 .le. -35.0d0) then
2376 c vbetam1(i,j)=-r_pair_mat(i+1,j+2)*exp(dtmp1)
2377 cc vbetam1(i,j)=0.0d0
2379 c vbetam1(i,j)=-r_pair_mat(i+1,j+2)
2380 c $ *dfaexp(idint(-dtmp1*1000)+1)
2381 vbetam1(i,j)=-r_pair_mat(i+1,j+2)*exp(dtmp1)
2384 cc if(dtmp2.le.-35.0d0) then
2385 c vbetam2(i,j)=-r_pair_mat(i+2,j+1)*exp(dtmp2)
2386 cc vbetam2(i,j)=0.0d0
2388 c vbetam2(i,j)=-r_pair_mat(i+2,j+1)
2389 c $ *dfaexp(idint(-dtmp2*1000)+1)
2390 vbetam2(i,j)=-r_pair_mat(i+2,j+1)*exp(dtmp2)
2393 ci elseif (istrand_m(i,j).eq.0)then
2400 c vbetam(i,j)=-dm45*exp(y+yy1+yy2+yshe1+yshe2)
2401 c vbetam1(i,j)=-r_pair_mat(i+1,j+2)*exp(y+yy1+yshe1)
2402 c vbetam2(i,j)=-r_pair_mat(i+2,j+1)*exp(y+yy2+yshe2)
2404 ! write(*,*) 'r_pair_mat>',i+1,j+2,r_pair_mat(i+1,j+2)
2405 ! write(*,*) 'r_pair_mat>',i+2,j+1,r_pair_mat(i+2,j+1)
2407 uup = vbetap(i,j)+vbetap1(i,j)+vbetap2(i,j)
2408 uum = vbetam(i,j)+vbetam1(i,j)+vbetam2(i,j)
2410 c write(*,*) 'uup,uum:', uup, uum
2412 c uup=vbetap1(i,j)+vbetap2(i,j)
2413 c uum=vbetam1(i,j)+vbetam2(i,j)
2418 vbeta=vbeta+vbet(i,j)
2420 ci elseif(istrand(i,j).eq.0)then
2424 c write(*,*) 'uup,uum:',uup,uum
2425 c write(*,*) 'vbetap(i,j):',vbetap(i,j)
2426 c write(*,*) 'vbetap1(i,j):',vbetap1(i,j)
2427 c write(*,*) 'vbetap2(i,j):',vbetap2(i,j)
2428 c write(*,*) 'vbetam(i,j):',vbetam(i,j)
2429 c write(*,*) 'vbetam1(i,j):',vbetam1(i,j)
2430 c write(*,*) 'vbetam2(i,j):',vbetam2(i,j)
2431 c write(*,*) 'uup:',uup
2432 c write(*,*) 'uum:',uum
2433 c write(*,*) 'vbetp:',vbetp
2434 c write(*,*) 'vbetm:',vbetm
2435 c write(*,*) 'vbet(i,j):',vbet(i,j)
2443 ! write(*,*) 'I,J:', i,j
2444 ! write(*,*) 'vbetap(i,j):',vbetap(i,j)
2445 ! write(*,*) 'vbetap1(i,j):',vbetap1(i,j)
2446 ! write(*,*) 'vbetap2(i,j):',vbetap2(i,j)
2447 ! write(*,*) 'vbetam(i,j):',vbetam(i,j)
2448 ! write(*,*) 'vbetam1(i,j):',vbetam1(i,j)
2449 ! write(*,*) 'vbetam2(i,j):',vbetam2(i,j)
2450 ! write(*,*) 'vbet(i,j):',vbet(i,j)
2456 c-------------------------------------------------------------------------------
2457 subroutine sheetforce1
2460 parameter(maxca=800)
2461 cc**********************************************************************
2462 real*8 vbet(maxca,maxca)
2463 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2464 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2465 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2466 real*8 cph(maxca),cth(maxca)
2467 real*8 rx(maxca,maxca)
2468 real*8 ry(maxca,maxca),rz(maxca,maxca)
2469 real*8 bx(maxca),by(maxca),bz(maxca)
2470 real*8 dis(maxca,maxca)
2471 real*8 shefx(maxca,12)
2472 real*8 shefy(maxca,12),shefz(maxca,12)
2473 real*8 atx(maxca),aty(maxca),atz(maxca)
2474 real*8 atmx(maxca),atmy(maxca),atmz(maxca)
2475 real*8 atmmx(maxca),atmmy(maxca),atmmz(maxca)
2476 real*8 atm3x(maxca),atm3y(maxca),atm3z(maxca)
2477 real*8 apx(maxca),apy(maxca),apz(maxca)
2478 real*8 apmx(maxca),apmy(maxca),apmz(maxca)
2479 real*8 apmmx(maxca),apmmy(maxca),apmmz(maxca)
2480 real*8 apm3x(maxca),apm3y(maxca),apm3z(maxca)
2482 real*8 astx(maxca),asty(maxca),astz(maxca)
2483 real*8 astmx(maxca),astmy(maxca),astmz(maxca)
2484 real*8 astmmx(maxca),astmmy(maxca),astmmz(maxca)
2485 real*8 astm3x(maxca),astm3y(maxca),astm3z(maxca)
2487 real*8 w_beta,dp45, dm45
2488 real*8 vbeta, vbetp, vbetm
2489 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
2490 $ c00,s00,ulnex,dnex
2491 integer inb,nmax,iselect
2493 common /phys1/ inb,nmax,iselect
2495 common /difvec/ rx,ry,rz
2496 common /coscos/ cph,cth
2497 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2498 $ c00,s00,ulnex,dnex
2499 common /sheconst/ dp45,dm45,w_beta
2500 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2501 common /angvt/ atx,aty,atz,atmx,atmy,atmz,atmmx,atmmy,
2502 $ atmmz,atm3x,atm3y,atm3z
2503 common /angvp/ apx,apy,apz,apmx,apmy,apmz,apmmx,apmmy,
2504 $ apmmz,apm3x,apm3y,apm3z
2505 common /shef/ shefx,shefy,shefz
2506 common /shee/ vbeta,vbet,vbetp,vbetm
2507 common /ulang/ ulcos
2508 c c**********************************************************************
2509 common /angvt2/ astx,asty,astz,astmx,astmy,astmz,astmmx,astmmy,
2510 $ astmmz,astm3x,astm3y,astm3z
2512 C--------------------------------------------------------------------------------
2514 integer i,j,im3,imm,im,ip,ipp,jm,jmm,jm3,jp,jpp
2515 real*8 c1,v1,cc1,dmm,dmm__,fx,fy,fz,c2,v2,dmm1
2516 real*8 c3,v3,cc2,cc3,dmm3,dmm3__,c4,v4,c7,v7,cc7,c8,v8,cc8
2517 real*8 c9,v9,cc9,dmm9,dmm9__,c10,v10,dmm2,dmm1__,dmm2_1,dmm2_2
2518 real*8 dmm7,dmm8,dmm7__,dmm8_1,dmm8_2
2519 C--------------------------------------------------------------------------------
2524 c1=(cth(im3)*c00+sth(im3)*s00-1)/dca
2529 cc1=(ulcos(imm)-ulnex)/dnex
2530 dmm=cc1/(dis(imm,im)*dis(im,i))
2531 dmm__=cc1*ulcos(imm)/dis(im,i)**2
2532 fx=rx(imm,im)*dmm-rx(im,i)*dmm__
2533 fy=ry(imm,im)*dmm-ry(im,i)*dmm__
2534 fz=rz(imm,im)*dmm-rz(im,i)*dmm__
2538 fx=fx+(atm3x(i)*c00+astm3x(i)*s00)*c1
2539 fy=fy+(atm3y(i)*c00+astm3y(i)*s00)*c1
2540 fz=fz+(atm3z(i)*c00+astm3z(i)*s00)*c1
2550 c2=(cth(imm)*c00+sth(imm)*s00-1)/dca
2555 cc1=(ulcos(imm)-ulnex)/dnex
2556 cc2=(ulcos(im)-ulnex)/dnex
2557 dmm1=cc1/(dis(imm,im)*dis(im,i))
2558 dmm2=cc2/(dis(im,i)*dis(i,ip))
2559 dmm1__=cc1*ulcos(imm)/dis(im,i)**2
2560 dmm2_1=cc2*ulcos(im)/dis(im,i)**2
2561 dmm2_2=cc2*ulcos(im)/dis(i,ip)**2
2562 cc**********************************************************************
2563 fx=rx(imm,im)*dmm1-rx(im,i)*dmm1__+rx(i,ip)*dmm2-rx(im,i)*dmm2
2564 $ -rx(im,i)*dmm2_1+rx(i,ip)*dmm2_2
2565 fy=ry(imm,im)*dmm1-ry(im,i)*dmm1__+ry(i,ip)*dmm2-ry(im,i)*dmm2
2566 $ -ry(im,i)*dmm2_1+ry(i,ip)*dmm2_2
2567 fz=rz(imm,im)*dmm1-rz(im,i)*dmm1__+rz(i,ip)*dmm2-rz(im,i)*dmm2
2568 $ -rz(im,i)*dmm2_1+rz(i,ip)*dmm2_2
2572 fx=fx+(atmmx(i)*c00+astmmx(i)*s00)*c2
2573 fy=fy+(atmmy(i)*c00+astmmy(i)*s00)*c2
2574 fz=fz+(atmmz(i)*c00+astmmz(i)*s00)*c2
2583 c3=(cth(im)*c00+sth(im)*s00-1)/dca
2588 cc2=(ulcos(im)-ulnex)/dnex
2589 cc3=(ulcos(i)-ulnex)/dnex
2590 dmm2=cc2/(dis(im,i)*dis(i,ip))
2591 dmm3=cc3/(dis(i,ip)*dis(ip,ipp))
2592 dmm2_1=cc2*ulcos(im)/dis(im,i)**2
2593 dmm2_2=cc2*ulcos(im)/dis(i,ip)**2
2594 dmm3__=cc3*ulcos(i)/dis(i,ip)**2
2595 fx=-rx(ip,ipp)*dmm3+rx(i,ip)*dmm2-rx(im,i)*dmm2
2596 $ -rx(im,i)*dmm2_1+rx(i,ip)*dmm2_2+rx(i,ip)*dmm3__
2597 fy=-ry(ip,ipp)*dmm3+ry(i,ip)*dmm2-ry(im,i)*dmm2
2598 $ -ry(im,i)*dmm2_1+ry(i,ip)*dmm2_2+ry(i,ip)*dmm3__
2599 fz=-rz(ip,ipp)*dmm3+rz(i,ip)*dmm2-rz(im,i)*dmm2
2600 $ -rz(im,i)*dmm2_1+rz(i,ip)*dmm2_2+rz(i,ip)*dmm3__
2604 fx=fx+(atmx(i)*c00+astmx(i)*s00)*c3
2605 fy=fy+(atmy(i)*c00+astmy(i)*s00)*c3
2606 fz=fz+(atmz(i)*c00+astmz(i)*s00)*c3
2614 c4=(cth(i)*c00+sth(i)*s00-1)/dca
2619 cc3=(ulcos(i)-ulnex)/dnex
2620 dmm3=cc3/(dis(i,ip)*dis(ip,ipp))
2621 dmm3__=cc3*ulcos(i)/dis(i,ip)**2
2622 fx=-rx(ip,ipp)*dmm3+rx(i,ip)*dmm3__
2623 fy=-ry(ip,ipp)*dmm3+ry(i,ip)*dmm3__
2624 fz=-rz(ip,ipp)*dmm3+rz(i,ip)*dmm3__
2628 fx=fx+(atx(i)*c00+astx(i)*s00)*c4
2629 fy=fy+(aty(i)*c00+asty(i)*s00)*c4
2630 fz=fz+(atz(i)*c00+astz(i)*s00)*c4
2639 c7=(cth(jm3)*c00+sth(jm3)*s00-1)/dca
2644 cc7=(ulcos(jmm)-ulnex)/dnex
2645 dmm=cc7/(dis(jmm,jm)*dis(jm,j))
2646 dmm__=cc7*ulcos(jmm)/dis(jm,j)**2
2647 fx=rx(jmm,jm)*dmm-rx(jm,j)*dmm__
2648 fy=ry(jmm,jm)*dmm-ry(jm,j)*dmm__
2649 fz=rz(jmm,jm)*dmm-rz(jm,j)*dmm__
2653 fx=fx+(atm3x(j)*c00+astm3x(j)*s00)*c7
2654 fy=fy+(atm3y(j)*c00+astm3y(j)*s00)*c7
2655 fz=fz+(atm3z(j)*c00+astm3z(j)*s00)*c7
2664 c8=(cth(jmm)*c00+sth(jmm)*s00-1)/dca
2669 cc7=(ulcos(jmm)-ulnex)/dnex
2670 cc8=(ulcos(jm)-ulnex)/dnex
2671 dmm7=cc7/(dis(jmm,jm)*dis(jm,j))
2672 dmm8=cc8/(dis(jm,j)*dis(j,jp))
2673 dmm7__=cc7*ulcos(jmm)/dis(jm,j)**2
2674 dmm8_1=cc8*ulcos(jm)/dis(jm,j)**2
2675 dmm8_2=cc8*ulcos(jm)/dis(j,jp)**2
2676 fx=rx(jmm,jm)*dmm7+rx(j,jp)*dmm8-rx(jm,j)*dmm8
2677 $ -rx(jm,j)*dmm7__-rx(jm,j)*dmm8_1+rx(j,jp)*dmm8_2
2678 fy=ry(jmm,jm)*dmm7+ry(j,jp)*dmm8-ry(jm,j)*dmm8
2679 $ -ry(jm,j)*dmm7__-ry(jm,j)*dmm8_1+ry(j,jp)*dmm8_2
2680 fz=rz(jmm,jm)*dmm7+rz(j,jp)*dmm8-rz(jm,j)*dmm8
2681 $ -rz(jm,j)*dmm7__-rz(jm,j)*dmm8_1+rz(j,jp)*dmm8_2
2685 fx=fx+(atmmx(j)*c00+astmmx(j)*s00)*c8
2686 fy=fy+(atmmy(j)*c00+astmmy(j)*s00)*c8
2687 fz=fz+(atmmz(j)*c00+astmmz(j)*s00)*c8
2697 c9=(cth(jm)*c00+sth(jm)*s00-1)/dca
2702 cc8=(ulcos(jm)-ulnex)/dnex
2703 cc9=(ulcos(j)-ulnex)/dnex
2704 dmm8=cc8/(dis(jm,j)*dis(j,jp))
2705 dmm9=cc9/(dis(j,jp)*dis(jp,jpp))
2706 dmm8_1=cc8*ulcos(jm)/dis(jm,j)**2
2707 dmm8_2=cc8*ulcos(jm)/dis(j,jp)**2
2708 dmm9__=cc9*ulcos(j)/dis(j,jp)**2
2709 fx=-rx(jp,jpp)*dmm9+rx(j,jp)*dmm8-rx(jm,j)*dmm8
2710 $ -rx(jm,j)*dmm8_1+rx(j,jp)*dmm8_2+rx(j,jp)*dmm9__
2711 fy=-ry(jp,jpp)*dmm9+ry(j,jp)*dmm8-ry(jm,j)*dmm8
2712 $ -ry(jm,j)*dmm8_1+ry(j,jp)*dmm8_2+ry(j,jp)*dmm9__
2713 fz=-rz(jp,jpp)*dmm9+rz(j,jp)*dmm8-rz(jm,j)*dmm8
2714 $ -rz(jm,j)*dmm8_1+rz(j,jp)*dmm8_2+rz(j,jp)*dmm9__
2718 fx=fx+(atmx(j)*c00+astmx(j)*s00)*c9
2719 fy=fy+(atmy(j)*c00+astmy(j)*s00)*c9
2720 fz=fz+(atmz(j)*c00+astmz(j)*s00)*c9
2729 c10=(cth(j)*c00+sth(j)*s00-1)/dca
2734 cc9=(ulcos(j)-ulnex)/dnex
2735 dmm9=cc9/(dis(j,jp)*dis(jp,jpp))
2736 dmm9__=cc9*ulcos(j)/dis(j,jp)**2
2737 fx=-rx(jp,jpp)*dmm9+rx(j,jp)*dmm9__
2738 fy=-ry(jp,jpp)*dmm9+ry(j,jp)*dmm9__
2739 fz=-rz(jp,jpp)*dmm9+rz(j,jp)*dmm9__
2743 fx=fx+(atx(j)*c00+astx(j)*s00)*c10
2744 fy=fy+(aty(j)*c00+asty(j)*s00)*c10
2745 fz=fz+(atz(j)*c00+astz(j)*s00)*c10
2753 c----------------------------------------------------------------------------
2754 subroutine sheetforce5
2757 parameter(maxca=800)
2758 cc**********************************************************************
2759 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2760 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2761 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2762 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
2763 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
2764 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
2765 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
2766 real*8 rx(maxca,maxca)
2767 real*8 ry(maxca,maxca),rz(maxca,maxca)
2768 real*8 bx(maxca),by(maxca),bz(maxca)
2769 real*8 dis(maxca,maxca)
2770 real*8 shefx(maxca,12),shefy(maxca,12)
2771 real*8 shefz(maxca,12)
2772 real*8 dp45,dm45,w_beta
2773 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
2774 $ c00,s00,ulnex,dnex
2775 integer inb,nmax,iselect
2776 cc**********************************************************************
2777 common /phys1/ inb,nmax,iselect
2779 common /difvec/ rx,ry,rz
2780 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2781 $ c00,s00,ulnex,dnex
2782 common /sheconst/ dp45,dm45,w_beta
2783 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2784 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
2785 common /shef/ shefx,shefy,shefz
2786 ci integer istrand(maxca,maxca)
2787 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
2788 ci common /shetest/ istrand,istrand_p,istrand_m
2789 c********************************************************************************
2791 integer i,imm,im,jp,jpp,j
2792 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
2793 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y,y5z
2794 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z
2795 real*8 y66x,y66y,y66z,yy6,yyy4,yyy5a,yyy5b
2796 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y,y9z
2797 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy8,yyy9a,yyy9b
2798 c********************************************************************************
2806 ci if(istrand(imm,j).eq.1
2807 ci & .and.(istrand_p(imm,j)+istrand_m(imm,j)).ge.1) then
2810 yy1=-(dis(i,jpp)-ulhb)/dlhb
2811 y1x=rx(jpp,i)/dis(i,jpp)
2812 y1y=ry(jpp,i)/dis(i,jpp)
2813 y1z=rz(jpp,i)/dis(i,jpp)
2818 yy33=1.0D0/(dis(im,jp)*dis(im,i))
2819 yyy3=pin1(imm,j)/(dis(im,i)**2)
2820 yy3=-pin1(imm,j)/dshe
2821 y3x=(yy33*rx(im,jp)-yyy3*rx(im,i))*yy3
2822 y3y=(yy33*ry(im,jp)-yyy3*ry(im,i))*yy3
2823 y3z=(yy33*rz(im,jp)-yyy3*rz(im,i))*yy3
2825 yy44=1.0D0/(dis(i,jpp)*dis(im,i))
2826 yyy4a=pin3(imm,j)/(dis(i,jpp)**2)
2827 yyy4b=pin3(imm,j)/(dis(im,i)**2)
2828 yy4=-pin3(imm,j)/dshe
2829 y4x=(yy44*(rx(i,jpp)-rx(im,i))+yyy4a*rx(i,jpp)
2830 $ -yyy4b*rx(im,i))*yy4
2831 y4y=(yy44*(ry(i,jpp)-ry(im,i))+yyy4a*ry(i,jpp)
2832 $ -yyy4b*ry(im,i))*yy4
2833 y4z=(yy44*(rz(i,jpp)-rz(im,i))+yyy4a*rz(i,jpp)
2834 $ -yyy4b*rz(im,i))*yy4
2837 yy55=1.0D0/(dis(i,jpp)*dis(jp,jpp))
2838 yyy5=pin4(imm,j)/(dis(i,jpp)**2)
2839 yy5=-pin4(imm,j)/dshe
2840 y5x=(-yy55*rx(jp,jpp)+yyy5*rx(i,jpp))*yy5
2841 y5y=(-yy55*ry(jp,jpp)+yyy5*ry(i,jpp))*yy5
2842 y5z=(-yy55*rz(jp,jpp)+yyy5*rz(i,jpp))*yy5
2855 shefx(i,5)=shefx(i,5)-sx*vbetap(imm,j)
2856 $ -sx1*vbetap1(imm,j)-sx2*vbetap2(imm,j)
2857 shefy(i,5)=shefy(i,5)-sy*vbetap(imm,j)
2858 $ -sy1*vbetap1(imm,j)-sy2*vbetap2(imm,j)
2859 shefz(i,5)=shefz(i,5)-sz*vbetap(imm,j)
2860 $ -sz1*vbetap1(imm,j)-sz2*vbetap2(imm,j)
2862 ! shefx(i,5)=shefx(i,5)
2863 ! $ -sx1*vbetap1(imm,j)-sx2*vbetap2(imm,j)
2864 ! shefy(i,5)=shefy(i,5)
2865 ! $ -sy1*vbetap1(imm,j)-sy2*vbetap2(imm,j)
2866 ! shefz(i,5)=shefz(i,5)
2867 ! $ -sz1*vbetap1(imm,j)-sz2*vbetap2(imm,j)
2869 yy6=-(dis(i,jp)-uldhb)/dldhb
2870 y6x=rx(jp,i)/dis(i,jp)
2871 y6y=ry(jp,i)/dis(i,jp)
2872 y6z=rz(jp,i)/dis(i,jp)
2877 yy88=1.0D0/(dis(im,jpp)*dis(im,i))
2878 yyy8=pina1(imm,j)/(dis(im,i)**2)
2879 yy8=-pina1(imm,j)/dshe
2880 y8x=(yy88*rx(im,jpp)-yyy8*rx(im,i))*yy8
2881 y8y=(yy88*ry(im,jpp)-yyy8*ry(im,i))*yy8
2882 y8z=(yy88*rz(im,jpp)-yyy8*rz(im,i))*yy8
2884 yy99=1.0D0/(dis(jp,i)*dis(im,i))
2885 yyy9a=pina3(imm,j)/(dis(jp,i)**2)
2886 yyy9b=pina3(imm,j)/(dis(im,i)**2)
2887 yy9=-pina3(imm,j)/dshe
2888 y9x=(yy99*(rx(jp,i)+rx(im,i))-yyy9a*rx(jp,i)
2889 $ -yyy9b*rx(im,i))*yy9
2890 y9y=(yy99*(ry(jp,i)+ry(im,i))-yyy9a*ry(jp,i)
2891 $ -yyy9b*ry(im,i))*yy9
2892 y9z=(yy99*(rz(jp,i)+rz(im,i))-yyy9a*rz(jp,i)
2893 $ -yyy9b*rz(im,i))*yy9
2895 yy1010=1.0D0/(dis(jp,i)*dis(jp,jpp))
2896 yyy10=pina4(imm,j)/(dis(jp,i)**2)
2897 yy10=-pina4(imm,j)/dshe
2898 y10x=(yy1010*rx(jp,jpp)-yyy10*rx(jp,i))*yy10
2899 y10y=(yy1010*ry(jp,jpp)-yyy10*ry(jp,i))*yy10
2900 y10z=(yy1010*rz(jp,jpp)-yyy10*rz(jp,i))*yy10
2902 sx=y66x+y8x+y9x+y10x
2903 sy=y66y+y8y+y9y+y10y
2904 sz=y66z+y8z+y9z+y10z
2913 shefx(i,5)=shefx(i,5)-sx*vbetam(imm,j)
2914 $ -sx1*vbetam1(imm,j)-sx2*vbetam2(imm,j)
2915 shefy(i,5)=shefy(i,5)-sy*vbetam(imm,j)
2916 $ -sy1*vbetam1(imm,j)-sy2*vbetam2(imm,j)
2917 shefz(i,5)=shefz(i,5)-sz*vbetam(imm,j)
2918 $ -sz1*vbetam1(imm,j)-sz2*vbetam2(imm,j)
2920 ! shefx(i,5)=shefx(i,5)
2921 ! $ -sx1*vbetam1(imm,j)-sx2*vbetam2(imm,j)
2922 ! shefy(i,5)=shefy(i,5)
2923 ! $ -sy1*vbetam1(imm,j)-sy2*vbetam2(imm,j)
2924 ! shefz(i,5)=shefz(i,5)
2925 ! $ -sz1*vbetam1(imm,j)-sz2*vbetam2(imm,j)
2934 c--------------------------------------------------------------------------c
2935 subroutine sheetforce6
2938 parameter(maxca=800)
2939 cc**********************************************************************
2940 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2941 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2942 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2943 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
2944 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
2945 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
2946 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
2947 real*8 rx(maxca,maxca)
2948 real*8 ry(maxca,maxca),rz(maxca,maxca)
2949 real*8 bx(maxca),by(maxca),bz(maxca)
2950 real*8 dis(maxca,maxca)
2951 real*8 shefx(maxca,12),shefy(maxca,12)
2952 real*8 shefz(maxca,12)
2953 real*8 dp45,dm45,w_beta
2954 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
2955 $ c00,s00,ulnex,dnex
2956 integer inb,nmax,iselect
2957 cc**********************************************************************
2958 common /phys1/ inb,nmax,iselect
2960 common /difvec/ rx,ry,rz
2961 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2962 $ c00,s00,ulnex,dnex
2963 common /sheconst/ dp45,dm45,w_beta
2964 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2965 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
2966 common /shef/ shefx,shefy,shefz
2967 ci integer istrand(maxca,maxca)
2968 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
2969 ci common /shetest/ istrand,istrand_p,istrand_m
2970 cc**********************************************************************
2972 integer i,imm,im,jp,jpp,j,ip
2973 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
2974 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y,y5z
2975 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z,y66x,y66y
2976 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y,y9z
2977 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy8,yyy9a,yyy9b,yyy4
2978 real*8 yyy3a,yyy3b,y66z,yy6,yyy5a,yyy5b
2979 C********************************************************************************
2987 ci if(istrand(im,j).eq.1
2988 ci & .and.(istrand_p(im,j)+istrand_m(im,j)).ge.1) then
2991 yy1=-(dis(i,jp)-ulhb)/dlhb
2992 y1x=rx(jp,i)/dis(i,jp)
2993 y1y=ry(jp,i)/dis(i,jp)
2994 y1z=rz(jp,i)/dis(i,jp)
2999 yy33=1.0D0/(dis(i,jp)*dis(i,ip))
3000 yyy3a=pin1(im,j)/(dis(i,jp)**2)
3001 yyy3b=pin1(im,j)/(dis(i,ip)**2)
3002 yy3=-pin1(im,j)/dshe
3003 y3x=(-yy33*(rx(i,ip)+rx(i,jp))+yyy3a*rx(i,jp)
3004 $ +yyy3b*rx(i,ip))*yy3
3005 y3y=(-yy33*(ry(i,ip)+ry(i,jp))+yyy3a*ry(i,jp)
3006 $ +yyy3b*ry(i,ip))*yy3
3007 y3z=(-yy33*(rz(i,ip)+rz(i,jp))+yyy3a*rz(i,jp)
3008 $ +yyy3b*rz(i,ip))*yy3
3010 yy44=1.0D0/(dis(i,jp)*dis(jp,jpp))
3011 yyy4=pin2(im,j)/(dis(i,jp)**2)
3012 yy4=-pin2(im,j)/dshe
3013 y4x=(-yy44*rx(jp,jpp)+yyy4*rx(i,jp))*yy4
3014 y4y=(-yy44*ry(jp,jpp)+yyy4*ry(i,jp))*yy4
3015 y4z=(-yy44*rz(jp,jpp)+yyy4*rz(i,jp))*yy4
3017 yy55=1.0D0/(dis(ip,jpp)*dis(i,ip))
3018 yyy5=pin3(im,j)/(dis(i,ip)**2)
3019 yy5=-pin3(im,j)/dshe
3020 y5x=(-yy55*rx(ip,jpp)+yyy5*rx(i,ip))*yy5
3021 y5y=(-yy55*ry(ip,jpp)+yyy5*ry(i,ip))*yy5
3022 y5z=(-yy55*rz(ip,jpp)+yyy5*rz(i,ip))*yy5
3035 shefx(i,6)=shefx(i,6)-sx*vbetap(im,j)
3036 $ -sx1*vbetap1(im,j)-sx2*vbetap2(im,j)
3037 shefy(i,6)=shefy(i,6)-sy*vbetap(im,j)
3038 $ -sy1*vbetap1(im,j)-sy2*vbetap2(im,j)
3039 shefz(i,6)=shefz(i,6)-sz*vbetap(im,j)
3040 $ -sz1*vbetap1(im,j)-sz2*vbetap2(im,j)
3041 ! shefx(i,6)=shefx(i,6)
3042 ! $ -sx1*vbetap1(im,j)-sx2*vbetap2(im,j)
3043 ! shefy(i,6)=shefy(i,6)
3044 ! $ -sy1*vbetap1(im,j)-sy2*vbetap2(im,j)
3045 ! shefz(i,6)=shefz(i,6)
3046 ! $ -sz1*vbetap1(im,j)-sz2*vbetap2(im,j)
3048 yy6=-(dis(jpp,i)-uldhb)/dldhb
3049 y6x=rx(jpp,i)/dis(jpp,i)
3050 y6y=ry(jpp,i)/dis(jpp,i)
3051 y6z=rz(jpp,i)/dis(jpp,i)
3056 yy88=1.0D0/(dis(i,jpp)*dis(i,ip))
3057 yyy8a=pina1(im,j)/(dis(i,jpp)**2)
3058 yyy8b=pina1(im,j)/(dis(i,ip)**2)
3059 yy8=-pina1(im,j)/dshe
3060 y8x=(-yy88*(rx(i,jpp)+rx(i,ip))+yyy8a*rx(i,jpp)
3061 $ +yyy8b*rx(i,ip))*yy8
3062 y8y=(-yy88*(ry(i,jpp)+ry(i,ip))+yyy8a*ry(i,jpp)
3063 $ +yyy8b*ry(i,ip))*yy8
3064 y8z=(-yy88*(rz(i,jpp)+rz(i,ip))+yyy8a*rz(i,jpp)
3065 $ +yyy8b*rz(i,ip))*yy8
3067 yy99=1.0D0/(dis(i,jpp)*dis(jp,jpp))
3068 yyy9=pina2(im,j)/(dis(i,jpp)**2)
3069 yy9=-pina2(im,j)/dshe
3070 y9x=(-yy99*rx(jp,jpp)+yyy9*rx(i,jpp))*yy9
3071 y9y=(-yy99*ry(jp,jpp)+yyy9*ry(i,jpp))*yy9
3072 y9z=(-yy99*rz(jp,jpp)+yyy9*rz(i,jpp))*yy9
3074 yy1010=1.0D0/(dis(jp,ip)*dis(i,ip))
3075 yyy10=pina3(im,j)/(dis(i,ip)**2)
3076 yy10=-pina3(im,j)/dshe
3077 y10x=(-yy1010*rx(jp,ip)+yyy10*rx(i,ip))*yy10
3078 y10y=(-yy1010*ry(jp,ip)+yyy10*ry(i,ip))*yy10
3079 y10z=(-yy1010*rz(jp,ip)+yyy10*rz(i,ip))*yy10
3081 sx=y66x+y8x+y9x+y10x
3082 sy=y66y+y8y+y9y+y10y
3083 sz=y66z+y8z+y9z+y10z
3092 shefx(i,6)=shefx(i,6)-sx*vbetam(im,j)
3093 $ -sx1*vbetam1(im,j)-sx2*vbetam2(im,j)
3094 shefy(i,6)=shefy(i,6)-sy*vbetam(im,j)
3095 $ -sy1*vbetam1(im,j)-sy2*vbetam2(im,j)
3096 shefz(i,6)=shefz(i,6)-sz*vbetam(im,j)
3097 $ -sz1*vbetam1(im,j)-sz2*vbetam2(im,j)
3099 ! shefx(i,6)=shefx(i,6)
3100 ! $ -sx1*vbetam1(im,j)-sx2*vbetam2(im,j)
3101 ! shefy(i,6)=shefy(i,6)
3102 ! $ -sy1*vbetam1(im,j)-sy2*vbetam2(im,j)
3103 ! shefz(i,6)=shefz(i,6)
3104 ! $ -sz1*vbetam1(im,j)-sz2*vbetam2(im,j)
3113 c-----------------------------------------------------------------------
3114 subroutine sheetforce11
3117 parameter(maxca=800)
3118 cc**********************************************************************
3119 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
3120 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
3121 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
3122 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
3123 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
3124 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
3125 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
3126 real*8 rx(maxca,maxca)
3127 real*8 ry(maxca,maxca),rz(maxca,maxca)
3128 real*8 bx(maxca),by(maxca),bz(maxca)
3129 real*8 dis(maxca,maxca)
3130 real*8 shefx(maxca,12),shefy(maxca,12)
3131 real*8 shefz(maxca,12)
3132 real*8 dp45,dm45,w_beta
3133 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
3134 $ c00,s00,ulnex,dnex
3135 integer inb,nmax,iselect
3136 cc**********************************************************************
3137 common /phys1/ inb,nmax,iselect
3139 common /difvec/ rx,ry,rz
3140 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
3141 $ c00,s00,ulnex,dnex
3142 common /sheconst/ dp45,dm45,w_beta
3143 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
3144 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
3145 common /shef/ shefx,shefy,shefz
3146 ci integer istrand(maxca,maxca)
3147 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
3148 ci common /shetest/ istrand,istrand_p,istrand_m
3149 C********************************************************************************
3151 integer j,jm,jmm,ip,i,ipp
3152 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
3153 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y
3154 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z,y66x,y66y
3155 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y
3156 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy4,yyy5a,yyy5b,yy6
3157 real*8 yyy9a,yyy9b,y5z,y66z,y9z,yyy8
3158 C********************************************************************************
3167 ci if(istrand(i,jmm).eq.1
3168 ci & .and.(istrand_p(i,jmm)+istrand_m(i,jmm)).ge.1) then
3171 yy1=-(dis(ipp,j)-ulhb)/dlhb
3172 y1x=rx(ipp,j)/dis(ipp,j)
3173 y1y=ry(ipp,j)/dis(ipp,j)
3174 y1z=rz(ipp,j)/dis(ipp,j)
3179 yy33=1.0D0/(dis(ip,jm)*dis(jm,j))
3180 yyy3=pin2(i,jmm)/(dis(jm,j)**2)
3181 yy3=-pin2(i,jmm)/dshe
3182 y3x=(yy33*rx(ip,jm)-yyy3*rx(jm,j))*yy3
3183 y3y=(yy33*ry(ip,jm)-yyy3*ry(jm,j))*yy3
3184 y3z=(yy33*rz(ip,jm)-yyy3*rz(jm,j))*yy3
3186 yy44=1.0D0/(dis(ipp,j)*dis(ip,ipp))
3187 yyy4=pin3(i,jmm)/(dis(ipp,j)**2)
3188 yy4=-pin3(i,jmm)/dshe
3189 y4x=(yy44*rx(ip,ipp)-yyy4*rx(ipp,j))*yy4
3190 y4y=(yy44*ry(ip,ipp)-yyy4*ry(ipp,j))*yy4
3191 y4z=(yy44*rz(ip,ipp)-yyy4*rz(ipp,j))*yy4
3193 yy55=1.0D0/(dis(ipp,j)*dis(jm,j))
3194 yyy5a=pin4(i,jmm)/(dis(ipp,j)**2)
3195 yyy5b=pin4(i,jmm)/(dis(jm,j)**2)
3196 yy5=-pin4(i,jmm)/dshe
3197 y5x=(yy55*(rx(jm,j)+rx(ipp,j))-yyy5a*rx(ipp,j)
3198 $ -yyy5b*rx(jm,j))*yy5
3199 y5y=(yy55*(ry(jm,j)+ry(ipp,j))-yyy5a*ry(ipp,j)
3200 $ -yyy5b*ry(jm,j))*yy5
3201 y5z=(yy55*(rz(jm,j)+rz(ipp,j))-yyy5a*rz(ipp,j)
3202 $ -yyy5b*rz(jm,j))*yy5
3215 shefx(j,11)=shefx(j,11)-sx*vbetap(i,jmm)
3216 $ -sx1*vbetap1(i,jmm)-sx2*vbetap2(i,jmm)
3217 shefy(j,11)=shefy(j,11)-sy*vbetap(i,jmm)
3218 $ -sy1*vbetap1(i,jmm)-sy2*vbetap2(i,jmm)
3219 shefz(j,11)=shefz(j,11)-sz*vbetap(i,jmm)
3220 $ -sz1*vbetap1(i,jmm)-sz2*vbetap2(i,jmm)
3222 ! shefx(j,11)=shefx(j,11)
3223 ! $ -sx1*vbetap1(i,jmm)-sx2*vbetap2(i,jmm)
3224 ! shefy(j,11)=shefy(j,11)
3225 ! $ -sy1*vbetap1(i,jmm)-sy2*vbetap2(i,jmm)
3226 ! shefz(j,11)=shefz(j,11)
3227 ! $ -sz1*vbetap1(i,jmm)-sz2*vbetap2(i,jmm)
3229 yy6=-(dis(ip,j)-uldhb)/dldhb
3230 y6x=rx(ip,j)/dis(ip,j)
3231 y6y=ry(ip,j)/dis(ip,j)
3232 y6z=rz(ip,j)/dis(ip,j)
3237 yy88=1.0D0/(dis(ip,j)*dis(ip,ipp))
3238 yyy8=pina1(i,jmm)/(dis(ip,j)**2)
3239 yy8=-pina1(i,jmm)/dshe
3240 y8x=(yy88*rx(ip,ipp)-yyy8*rx(ip,j))*yy8
3241 y8y=(yy88*ry(ip,ipp)-yyy8*ry(ip,j))*yy8
3242 y8z=(yy88*rz(ip,ipp)-yyy8*rz(ip,j))*yy8
3244 yy99=1.0D0/(dis(ip,j)*dis(jm,j))
3245 yyy9a=pina2(i,jmm)/(dis(ip,j)**2)
3246 yyy9b=pina2(i,jmm)/(dis(jm,j)**2)
3247 yy9=-pina2(i,jmm)/dshe
3248 y9x=(yy99*(rx(jm,j)+rx(ip,j))-yyy9a*rx(ip,j)
3249 $ -yyy9b*rx(jm,j))*yy9
3250 y9y=(yy99*(ry(jm,j)+ry(ip,j))-yyy9a*ry(ip,j)
3251 $ -yyy9b*ry(jm,j))*yy9
3252 y9z=(yy99*(rz(jm,j)+rz(ip,j))-yyy9a*rz(ip,j)
3253 $ -yyy9b*rz(jm,j))*yy9
3255 yy1010=1.0D0/(dis(jm,ipp)*dis(jm,j))
3256 yyy10=pina4(i,jmm)/(dis(jm,j)**2)
3257 yy10=-pina4(i,jmm)/dshe
3258 y10x=(yy1010*rx(jm,ipp)-yyy10*rx(jm,j))*yy10
3259 y10y=(yy1010*ry(jm,ipp)-yyy10*ry(jm,j))*yy10
3260 y10z=(yy1010*rz(jm,ipp)-yyy10*rz(jm,j))*yy10
3262 sx=y66x+y8x+y9x+y10x
3263 sy=y66y+y8y+y9y+y10y
3264 sz=y66z+y8z+y9z+y10z
3273 shefx(j,11)=shefx(j,11)-sx*vbetam(i,jmm)
3274 $ -sx1*vbetam1(i,jmm)-sx2*vbetam2(i,jmm)
3275 shefy(j,11)=shefy(j,11)-sy*vbetam(i,jmm)
3276 $ -sy1*vbetam1(i,jmm)-sy2*vbetam2(i,jmm)
3277 shefz(j,11)=shefz(j,11)-sz*vbetam(i,jmm)
3278 $ -sz1*vbetam1(i,jmm)-sz2*vbetam2(i,jmm)
3280 ! shefx(j,11)=shefx(j,11)
3281 ! $ -sx1*vbetam1(i,jmm)-sx2*vbetam2(i,jmm)
3282 ! shefy(j,11)=shefy(j,11)
3283 ! $ -sy1*vbetam1(i,jmm)-sy2*vbetam2(i,jmm)
3284 ! shefz(j,11)=shefz(j,11)
3285 ! $ -sz1*vbetam1(i,jmm)-sz2*vbetam2(i,jmm)
3294 c-----------------------------------------------------------------------
3295 subroutine sheetforce12
3298 parameter(maxca=800)
3299 cc**********************************************************************
3300 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
3301 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
3302 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
3303 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
3304 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
3305 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
3306 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
3307 real*8 rx(maxca,maxca)
3308 real*8 ry(maxca,maxca),rz(maxca,maxca)
3309 real*8 bx(maxca),by(maxca),bz(maxca)
3310 real*8 dis(maxca,maxca)
3311 real*8 shefx(maxca,12),shefy(maxca,12)
3312 real*8 shefz(maxca,12)
3313 real*8 dp45,dm45,w_beta
3314 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
3315 $ c00,s00,ulnex,dnex
3316 integer inb,nmax,iselect
3317 cc**********************************************************************
3318 common /phys1/ inb,nmax,iselect
3320 common /difvec/ rx,ry,rz
3321 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
3322 $ c00,s00,ulnex,dnex
3323 common /sheconst/ dp45,dm45,w_beta
3324 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
3325 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
3326 common /shef/ shefx,shefy,shefz
3327 ci integer istrand(maxca,maxca)
3328 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
3329 ci common /shetest/ istrand,istrand_p,istrand_m
3330 cc**********************************************************************
3332 integer j,jm,jmm,ip,i,ipp,jp
3333 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
3334 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y,y5z
3335 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z,y66x,y66y,y66z
3336 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y,y9z
3337 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy10a,yyy10b,yy6,yyy8
3338 !c*************************************************************************c
3346 ci if(istrand(i,jm).eq.1
3347 ci & .and.(istrand_p(i,jm)+istrand_m(i,jm)).ge.1) then
3350 yy1=-(dis(ip,j)-ulhb)/dlhb
3351 y1x=rx(ip,j)/dis(ip,j)
3352 y1y=ry(ip,j)/dis(ip,j)
3353 y1z=rz(ip,j)/dis(ip,j)
3358 yy33=1.0D0/(dis(ip,j)*dis(ip,ipp))
3359 yyy3=pin1(i,jm)/(dis(ip,j)**2)
3360 yy3=-pin1(i,jm)/dshe
3361 y3x=(yy33*rx(ip,ipp)-yyy3*rx(ip,j))*yy3
3362 y3y=(yy33*ry(ip,ipp)-yyy3*ry(ip,j))*yy3
3363 y3z=(yy33*rz(ip,ipp)-yyy3*rz(ip,j))*yy3
3364 yy44=1.0D0/(dis(ip,j)*dis(j,jp))
3366 yyy4a=pin2(i,jm)/(dis(ip,j)**2)
3367 yyy4b=pin2(i,jm)/(dis(j,jp)**2)
3368 yy4=-pin2(i,jm)/dshe
3369 y4x=(yy44*(rx(j,jp)-rx(ip,j))-yyy4a*rx(ip,j)
3370 $ +yyy4b*rx(j,jp))*yy4
3371 y4y=(yy44*(ry(j,jp)-ry(ip,j))-yyy4a*ry(ip,j)
3372 $ +yyy4b*ry(j,jp))*yy4
3373 y4z=(yy44*(rz(j,jp)-rz(ip,j))-yyy4a*rz(ip,j)
3374 $ +yyy4b*rz(j,jp))*yy4
3376 yy55=1.0D0/(dis(ipp,jp)*dis(j,jp))
3377 yyy5=pin4(i,jm)/(dis(j,jp)**2)
3378 yy5=-pin4(i,jm)/dshe
3379 y5x=(-yy55*rx(ipp,jp)+yyy5*rx(j,jp))*yy5
3380 y5y=(-yy55*ry(ipp,jp)+yyy5*ry(j,jp))*yy5
3381 y5z=(-yy55*rz(ipp,jp)+yyy5*rz(j,jp))*yy5
3394 shefx(j,12)=shefx(j,12)-sx*vbetap(i,jm)
3395 $ -sx1*vbetap1(i,jm)-sx2*vbetap2(i,jm)
3396 shefy(j,12)=shefy(j,12)-sy*vbetap(i,jm)
3397 $ -sy1*vbetap1(i,jm)-sy2*vbetap2(i,jm)
3398 shefz(j,12)=shefz(j,12)-sz*vbetap(i,jm)
3399 $ -sz1*vbetap1(i,jm)-sz2*vbetap2(i,jm)
3401 ! shefx(j,12)=shefx(j,12)
3402 ! $ -sx1*vbetap1(i,jm)-sx2*vbetap2(i,jm)
3403 ! shefy(j,12)=shefy(j,12)
3404 ! $ -sy1*vbetap1(i,jm)-sy2*vbetap2(i,jm)
3405 ! shefz(j,12)=shefz(j,12)
3406 ! $ -sz1*vbetap1(i,jm)-sz2*vbetap2(i,jm)
3408 yy6=-(dis(ipp,j)-uldhb)/dldhb
3409 y6x=rx(ipp,j)/dis(ipp,j)
3410 y6y=ry(ipp,j)/dis(ipp,j)
3411 y6z=rz(ipp,j)/dis(ipp,j)
3416 yy88=1.0D0/(dis(ip,jp)*dis(j,jp))
3417 yyy8=pina2(i,jm)/(dis(j,jp)**2)
3418 yy8=-pina2(i,jm)/dshe
3419 y8x=(-yy88*rx(ip,jp)+yyy8*rx(j,jp))*yy8
3420 y8y=(-yy88*ry(ip,jp)+yyy8*ry(j,jp))*yy8
3421 y8z=(-yy88*rz(ip,jp)+yyy8*rz(j,jp))*yy8
3423 yy99=1.0D0/(dis(j,ipp)*dis(ip,ipp))
3424 yyy9=pina3(i,jm)/(dis(j,ipp)**2)
3425 yy9=-pina3(i,jm)/dshe
3426 y9x=(-yy99*rx(ip,ipp)+yyy9*rx(j,ipp))*yy9
3427 y9y=(-yy99*ry(ip,ipp)+yyy9*ry(j,ipp))*yy9
3428 y9z=(-yy99*rz(ip,ipp)+yyy9*rz(j,ipp))*yy9
3430 yy1010=1.0D0/(dis(j,ipp)*dis(j,jp))
3431 yyy10a=pina4(i,jm)/(dis(j,ipp)**2)
3432 yyy10b=pina4(i,jm)/(dis(j,jp)**2)
3433 yy10=-pina4(i,jm)/dshe
3434 y10x=(-yy1010*(rx(j,ipp)+rx(j,jp))+yyy10a*rx(j,ipp)
3435 $ +yyy10b*rx(j,jp))*yy10
3436 y10y=(-yy1010*(ry(j,ipp)+ry(j,jp))+yyy10a*ry(j,ipp)
3437 $ +yyy10b*ry(j,jp))*yy10
3438 y10z=(-yy1010*(rz(j,ipp)+rz(j,jp))+yyy10a*rz(j,ipp)
3439 $ +yyy10b*rz(j,jp))*yy10
3441 sx=y66x+y8x+y9x+y10x
3442 sy=y66y+y8y+y9y+y10y
3443 sz=y66z+y8z+y9z+y10z
3452 shefx(j,12)=shefx(j,12)-sx*vbetam(i,jm)
3453 $ -sx1*vbetam1(i,jm)-sx2*vbetam2(i,jm)
3454 shefy(j,12)=shefy(j,12)-sy*vbetam(i,jm)
3455 $ -sy1*vbetam1(i,jm)-sy2*vbetam2(i,jm)
3456 shefz(j,12)=shefz(j,12)-sz*vbetam(i,jm)
3457 $ -sz1*vbetam1(i,jm)-sz2*vbetam2(i,jm)
3466 C===============================================================================