1 subroutine init_dfa_vars
4 include 'COMMON.INTERACT'
28 CC WEIGHTS for each min
45 C weights for each E term
46 C these should be identical with
53 C precalculate exp table!
56 c dfaexp(ii) = exp(-ii*0.001d0 + 0.0005d0)
62 print *,'ishiftca=',ishiftca,'ilastca=',ilastca
68 subroutine read_dfa_info
70 C read fragment informations
72 implicit real*8 (a-h,o-z)
74 include 'COMMON.IOUNITS'
75 include 'COMMON.CHAIN'
79 C NOTE THAT FILENAMES are FIXED, CURRENTLY!!
80 C THIS SHOULD BE MODIFIED!!
87 integer ica1, ica2,ica3,ica4,ica5
88 integer ishell, inca, itmp,iitmp
93 open(iodfa, file = 'dist_dfa.dat', status = 'old', err=33)
95 33 write(iout,'(a)') 'Error opening dist_dfa.dat file'
98 write(iout,'(a)') 'dist_dfa.dat is opened!'
100 read(iodfa, '(a)') buffer
101 C read number of restraints
102 read(iodfa, *) IDFADIS
103 read(iodfa, *) dis_inc
105 read(iodfa, '(i10,1x,i10,1x,i10)') ica1, ica2, nval
124 C READ ANGLE RESTRAINTS
126 open(iodfa, file='phi_dfa.dat',status='old',err=35)
128 35 write(iout,'(a)') 'Error opening dist_dfa.dat file'
132 write(iout,'(a)') 'phi_dfa.dat is opened!'
135 read(iodfa, '(a)') buffer
136 C READ NUMBER OF RESTRAINTS
137 READ(iodfa, *) IDFAPHI
138 read(iodfa,*) phi_inc
140 read(iodfa,'(5(i10,1x),1x,i10)')ica1,ica2,ica3,ica4,ica5,nval
151 read(iodfa,*) tmp1,tmp2
165 open(iodfa, file='theta_dfa.dat',status='old',err=41)
167 41 write(iout,'(a)') 'Error opening dist_dfa.dat file'
170 write(iout,'(a)') 'theta_dfa.dat is opened!'
172 read(iodfa, '(a)') buffer
173 C READ NUMBER OF RESTRAINTS
174 READ(iodfa, *) IDFATHE
175 read(iodfa,*) the_inc
178 read(iodfa, '(5(i10,1x),1x,i10)')ica1,ica2,ica3,ica4,ica5,nval
189 read(iodfa,*) tmp1,tmp2
201 C END of READING ANGLE RESTRAINT!
203 C NUMBER OF NEIGHBOR CAs
204 open(iodfa,file='nei_dfa.dat',status='old',err=37)
206 37 write(iout,'(a)') 'Error opening nei_dfa.dat file'
209 write(iout,'(a)') 'nei_dfa.dat is opened!'
211 read(iodfa, '(a)') buffer
212 C READ NUMBER OF RESTRAINTS
213 READ(iodfa, *) idfanei
214 read(iodfa,*) nei_inc
217 read(iodfa,'(2(i10,1x),i10)')ica1,ishell,nval
226 C write(*,*) 'READ NEI:',i,j,fnei(i,j)
236 C END OF NEIGHBORING CA
238 C READ BETA RESTRAINT
239 open(iodfa, file='beta_dfa.dat',status='old',err=39)
241 39 write(iout,'(a)') 'Error opening beta_dfa.dat file'
244 write(iout,'(a)') 'beta_dfa.dat is opened!'
246 read(iodfa,'(a)') buffer
248 read(iodfa,*) beta_inc
251 read(iodfa,*) ica1, iitmp
255 c write(*,*) 'BETA:',i,j,wtmp,wshet(i,j)
260 C END OF BETA RESTRAINT
265 subroutine edfad(edfadis)
267 implicit real*8 (a-h,o-z)
269 include 'COMMON.CHAIN'
270 include 'COMMON.DERIV'
273 double precision edfadis
274 integer i, iatm1, iatm2,idiff
275 double precision ckk, sckk,dist,texp
276 double precision jix,jiy,jiz,ep,fp,scc
283 iatm1=idislis(1,i)+ishiftca
284 iatm2=idislis(2,i)+ishiftca
285 idiff = abs(iatm1-iatm2)
287 JIX=c(1,iatm2)-c(1,iatm1)
288 JIY=c(2,iatm2)-c(2,iatm1)
289 JIZ=c(3,iatm2)-c(3,iatm1)
290 DIST=SQRT(JIX*JIX+JIY*JIY+JIZ*JIZ)
303 if (dtmp.ge.15.0d0) then
306 c texp = dfaexp( idint(dtmp*1000)+1 )/sckk
307 texp = exp(-dtmp)/sckk
310 ep=ep+sccdist(i,j)*texp
311 fp=fp+sccdist(i,j)*texp*dd*2.0d0/ckk
313 C write(*,'(2i8,6f12.5)') i, j, dist,
314 C & fdist(i,j), ep, fp, sccdist(i,j), scc
322 c IF(ABS(EP).lt.1.0d-20)THEN
325 c IF (ABS(FP).lt.1.0d-20) THEN
329 edfadis=edfadis+ep*dis_inc*wwdist
331 gdfad(1,iatm1) = gdfad(1,iatm1)-jix/dist*fp*dis_inc*wwdist
332 gdfad(2,iatm1) = gdfad(2,iatm1)-jiy/dist*fp*dis_inc*wwdist
333 gdfad(3,iatm1) = gdfad(3,iatm1)-jiz/dist*fp*dis_inc*wwdist
335 gdfad(1,iatm2) = gdfad(1,iatm2)+jix/dist*fp*dis_inc*wwdist
336 gdfad(2,iatm2) = gdfad(2,iatm2)+jiy/dist*fp*dis_inc*wwdist
337 gdfad(3,iatm2) = gdfad(3,iatm2)+jiz/dist*fp*dis_inc*wwdist
344 subroutine edfat(edfator)
346 implicit real*8 (a-h,o-z)
348 include 'COMMON.CHAIN'
349 include 'COMMON.DERIV'
354 double precision aphi(2),athe(2),tdx(5),tdy(5),tdz(5)
355 double precision cwidth, cwidth2
356 PARAMETER(CWIDTH=0.1D0,CWIDTH2=0.2D0,PAI=3.14159265358979323846D0)
368 iatom(iii)=iphilis(iii,i)+ishiftca
371 C ANGLE VECTOR CALCULTION
372 RIX=C(1,IATOM(2))-C(1,IATOM(1))
373 RIY=C(2,IATOM(2))-C(2,IATOM(1))
374 RIZ=C(3,IATOM(2))-C(3,IATOM(1))
376 RIPX=C(1,IATOM(3))-C(1,IATOM(2))
377 RIPY=C(2,IATOM(3))-C(2,IATOM(2))
378 RIPZ=C(3,IATOM(3))-C(3,IATOM(2))
380 RIPPX=C(1,IATOM(4))-C(1,IATOM(3))
381 RIPPY=C(2,IATOM(4))-C(2,IATOM(3))
382 RIPPZ=C(3,IATOM(4))-C(3,IATOM(3))
384 RIP3X=C(1,IATOM(5))-C(1,IATOM(4))
385 RIP3Y=C(2,IATOM(5))-C(2,IATOM(4))
386 RIP3Z=C(3,IATOM(5))-C(3,IATOM(4))
388 GIX=RIY*RIPZ-RIZ*RIPY
389 GIY=RIZ*RIPX-RIX*RIPZ
390 GIZ=RIX*RIPY-RIY*RIPX
392 GIPX=RIPY*RIPPZ-RIPZ*RIPPY
393 GIPY=RIPZ*RIPPX-RIPX*RIPPZ
394 GIPZ=RIPX*RIPPY-RIPY*RIPPX
396 CIPX=C(1,IATOM(3))-C(1,IATOM(1))
397 CIPY=C(2,IATOM(3))-C(2,IATOM(1))
398 CIPZ=C(3,IATOM(3))-C(3,IATOM(1))
400 CIPPX=C(1,IATOM(4))-C(1,IATOM(2))
401 CIPPY=C(2,IATOM(4))-C(2,IATOM(2))
402 CIPPZ=C(3,IATOM(4))-C(3,IATOM(2))
404 CIP3X=C(1,IATOM(5))-C(1,IATOM(3))
405 CIP3Y=C(2,IATOM(5))-C(2,IATOM(3))
406 CIP3Z=C(3,IATOM(5))-C(3,IATOM(3))
408 DGI=SQRT(GIX*GIX+GIY*GIY+GIZ*GIZ)
409 DGIP=SQRT(GIPX*GIPX+GIPY*GIPY+GIPZ*GIPZ)
410 DRIPP=SQRT(RIPPX*RIPPX+RIPPY*RIPPY+RIPPZ*RIPPZ)
411 DRIP3=SQRT(RIP3X*RIP3X+RIP3Y*RIP3Y+RIP3Z*RIP3Z)
413 C END OF ANGLE VECTOR CALCULTION
415 TDOT=GIX*RIPPX+GIY*RIPPY+GIZ*RIPPZ
416 APHI(1)=TDOT/(DGI*DRIPP)
417 TDOT=GIPX*RIP3X+GIPY*RIP3Y+GIPZ*RIP3Z
418 APHI(2)=TDOT/(DGIP*DRIP3)
426 DDPS1=APHI(1)-FPHI1(i,j)
427 DDPS2=APHI(2)-FPHI2(i,j)
429 DTMP = (DDPS1**2+DDPS2**2)/CWIDTH2
431 if (dtmp.ge.15.0d0) then
434 c ps_tmp = dfaexp(idint(dtmp*1000)+1)
438 ephi=ephi+sccphi(i,j)*ps_tmp
440 tfphi1=tfphi1+sccphi(i,j)*ddps1/cwidth*ps_tmp
441 tfphi2=tfphi2+sccphi(i,j)*ddps2/cwidth*ps_tmp
444 C write(*,'(2i8,8f12.6)')i,j,aphi(1),fphi1(i,j),
445 C & aphi(2),fphi2(i,j),tfphi1,tfphi2,ephi,sccphi(i,j)
448 ephi=-ephi/scc*phi_inc*wwangle
449 tfphi1=tfphi1/scc*phi_inc*wwangle
450 tfphi2=tfphi2/scc*phi_inc*wwangle
452 IF (ABS(EPHI).LT.1d-20) THEN
455 IF (ABS(TFPHI1).LT.1d-20) THEN
458 IF (ABS(TFPHI2).LT.1d-20) THEN
462 C FORCE DIRECTION CALCULATION
467 DM1=1.0d0/(DGI*DRIPP)
469 GIRPP=GIX*RIPPX+GIY*RIPPY+GIZ*RIPPZ
470 DM2=GIRPP/(DGI**3*DRIPP)
471 DM3=GIRPP/(DGI*DRIPP**3)
473 DM4=1.0d0/(DGIP*DRIP3)
475 GIRP3=GIPX*RIP3X+GIPY*RIP3Y+GIPZ*RIP3Z
476 DM5=GIRP3/(DGIP**3*DRIP3)
477 DM6=GIRP3/(DGIP*DRIP3**3)
479 TDX(1)=(RIPZ*RIPPY-RIPY*RIPPZ)*DM1
480 & +( GIZ* RIPY- GIY* RIPZ)*DM2
481 TDY(1)=(RIPX*RIPPZ-RIPZ*RIPPX)*DM1
482 & +( GIX* RIPZ- GIZ* RIPX)*DM2
483 TDZ(1)=(RIPY*RIPPX-RIPX*RIPPY)*DM1
484 & +( GIY* RIPX- GIX* RIPY)*DM2
488 C SECOND ATOM BY PHI1
489 TDX(2)=(CIPY*RIPPZ-CIPZ*RIPPY)*DM1
490 & -(CIPY*GIZ-CIPZ*GIY)*DM2
491 TDY(2)=(CIPZ*RIPPX-CIPX*RIPPZ)*DM1
492 & -(CIPZ*GIX-CIPX*GIZ)*DM2
493 TDZ(2)=(CIPX*RIPPY-CIPY*RIPPX)*DM1
494 & -(CIPX*GIY-CIPY*GIX)*DM2
498 C SECOND ATOM BY PHI2
500 & ((RIPPZ*RIP3Y-RIPPY*RIP3Z)*DM4
501 & +( GIPZ*RIPPY- GIPY*RIPPZ)*DM5)*TFPHI2
503 & ((RIPPX*RIP3Z-RIPPZ*RIP3X)*DM4
504 & +( GIPX*RIPPZ- GIPZ*RIPPX)*DM5)*TFPHI2
506 & ((RIPPY*RIP3X-RIPPX*RIP3Y)*DM4
507 & +( GIPY*RIPPX- GIPX*RIPPY)*DM5)*TFPHI2
509 TDX(3)=(-GIX+RIPPY*RIZ-RIPPZ*RIY)*DM1
510 & -(GIY*RIZ-RIY*GIZ)*DM2+RIPPX*DM3
511 TDY(3)=(-GIY+RIPPZ*RIX-RIPPX*RIZ)*DM1
512 & -(GIZ*RIX-RIZ*GIX)*DM2+RIPPY*DM3
513 TDZ(3)=(-GIZ+RIPPX*RIY-RIPPY*RIX)*DM1
514 & -(GIX*RIY-RIX*GIY)*DM2+RIPPZ*DM3
520 & ((CIPPY*RIP3Z-CIPPZ*RIP3Y)*DM4
521 & -(CIPPY*GIPZ-CIPPZ*GIPY)*DM5)*TFPHI2
523 & ((CIPPZ*RIP3X-CIPPX*RIP3Z)*DM4
524 & -(CIPPZ*GIPX-CIPPX*GIPZ)*DM5)*TFPHI2
526 & ((CIPPX*RIP3Y-CIPPY*RIP3X)*DM4
527 & -(CIPPX*GIPY-CIPPY*GIPX)*DM5)*TFPHI2
528 C FOURTH ATOM BY PHI1
529 TDX(4)=(GIX*DM1-RIPPX*DM3)*TFPHI1
530 TDY(4)=(GIY*DM1-RIPPY*DM3)*TFPHI1
531 TDZ(4)=(GIZ*DM1-RIPPZ*DM3)*TFPHI1
532 C FOURTH ATOM BY PHI2
534 & ((-GIPX+RIP3Y*RIPZ-RIP3Z*RIPY)*DM4
535 & -( GIPY*RIPZ-RIPY*GIPZ)*DM5
536 & + RIP3X*DM6)*TFPHI2
538 & ((-GIPY+RIP3Z*RIPX-RIP3X*RIPZ)*DM4
539 & -( GIPZ*RIPX-RIPZ*GIPX)*DM5
540 & + RIP3Y*DM6)*TFPHI2
542 & ((-GIPZ+RIP3X*RIPY-RIP3Y*RIPX)*DM4
543 & -( GIPX*RIPY-RIPX*GIPY)*DM5
544 & + RIP3Z*DM6)*TFPHI2
546 TDX(5)=(GIPX*DM4-RIP3X*DM6)*TFPHI2
547 TDY(5)=(GIPY*DM4-RIP3Y*DM6)*TFPHI2
548 TDZ(5)=(GIPZ*DM4-RIP3Z*DM6)*TFPHI2
549 C END OF FORCE DIRECTION
552 gdfat(1,IATOM(II))=gdfat(1,IATOM(II))+TDX(II)
553 gdfat(2,IATOM(II))=gdfat(2,IATOM(II))+TDY(II)
554 gdfat(3,IATOM(II))=gdfat(3,IATOM(II))+TDZ(II)
557 enephi = enephi + ephi
558 c end of single assignment statement
560 C END OF PHI RESTRAINT
562 C START OF THETA ANGLE
567 iatom(iii)=ithelis(iii,i)+ishiftca
571 C ANGLE VECTOR CALCULTION
572 RIX=C(1,IATOM(2))-C(1,IATOM(1))
573 RIY=C(2,IATOM(2))-C(2,IATOM(1))
574 RIZ=C(3,IATOM(2))-C(3,IATOM(1))
576 RIPX=C(1,IATOM(3))-C(1,IATOM(2))
577 RIPY=C(2,IATOM(3))-C(2,IATOM(2))
578 RIPZ=C(3,IATOM(3))-C(3,IATOM(2))
580 RIPPX=C(1,IATOM(4))-C(1,IATOM(3))
581 RIPPY=C(2,IATOM(4))-C(2,IATOM(3))
582 RIPPZ=C(3,IATOM(4))-C(3,IATOM(3))
584 RIP3X=C(1,IATOM(5))-C(1,IATOM(4))
585 RIP3Y=C(2,IATOM(5))-C(2,IATOM(4))
586 RIP3Z=C(3,IATOM(5))-C(3,IATOM(4))
588 GIX=RIY*RIPZ-RIZ*RIPY
589 GIY=RIZ*RIPX-RIX*RIPZ
590 GIZ=RIX*RIPY-RIY*RIPX
592 GIPX=RIPY*RIPPZ-RIPZ*RIPPY
593 GIPY=RIPZ*RIPPX-RIPX*RIPPZ
594 GIPZ=RIPX*RIPPY-RIPY*RIPPX
596 GIPPX=RIPPY*RIP3Z-RIPPZ*RIP3Y
597 GIPPY=RIPPZ*RIP3X-RIPPX*RIP3Z
598 GIPPZ=RIPPX*RIP3Y-RIPPY*RIP3X
600 CIPX=C(1,IATOM(3))-C(1,IATOM(1))
601 CIPY=C(2,IATOM(3))-C(2,IATOM(1))
602 CIPZ=C(3,IATOM(3))-C(3,IATOM(1))
604 CIPPX=C(1,IATOM(4))-C(1,IATOM(2))
605 CIPPY=C(2,IATOM(4))-C(2,IATOM(2))
606 CIPPZ=C(3,IATOM(4))-C(3,IATOM(2))
608 CIP3X=C(1,IATOM(5))-C(1,IATOM(3))
609 CIP3Y=C(2,IATOM(5))-C(2,IATOM(3))
610 CIP3Z=C(3,IATOM(5))-C(3,IATOM(3))
612 DGI=SQRT(GIX*GIX+GIY*GIY+GIZ*GIZ)
613 DGIP=SQRT(GIPX*GIPX+GIPY*GIPY+GIPZ*GIPZ)
614 DGIPP=SQRT(GIPPX*GIPPX+GIPPY*GIPPY+GIPPZ*GIPPZ)
615 DRIPP=SQRT(RIPPX*RIPPX+RIPPY*RIPPY+RIPPZ*RIPPZ)
616 DRIP3=SQRT(RIP3X*RIP3X+RIP3Y*RIP3Y+RIP3Z*RIP3Z)
617 C END OF ANGLE VECTOR CALCULTION
619 TDOT=GIX*GIPX+GIY*GIPY+GIZ*GIPZ
620 ATHE(1)=TDOT/(DGI*DGIP)
621 TDOT=GIPX*GIPPX+GIPY*GIPPY+GIPZ*GIPPZ
622 ATHE(2)=TDOT/(DGIP*DGIPP)
631 ddth1=athe(1)-fthe1(i,j) !cos(the1)-cos(the1_ref)
632 ddth2=athe(2)-fthe2(i,j) !cos(the2)-cos(the2_ref)
633 dtmp= (ddth1**2+ddth2**2)/cwidth2
634 if ( dtmp .ge. 15.0d0) then
637 c th_tmp = dfaexp ( idint(dtmp*1000)+1 )
641 ethe=ethe+sccthe(i,j)*th_tmp
643 tfthe1=tfthe1+sccthe(i,j)*ddth1/cwidth*th_tmp !-dv/dcos(the1)
644 tfthe2=tfthe2+sccthe(i,j)*ddth2/cwidth*th_tmp !-dv/dcos(the2)
646 C write(*,'(2i8,8f12.6)')i,j,athe(1),fthe1(i,j),
647 C & athe(2),fthe2(i,j),tfthe1,tfthe2,ethe,sccthe(i,j)
650 ethe=-ethe/scc*the_inc*wwangle
651 tfthe1=tfthe1/scc*the_inc*wwangle
652 tfthe2=tfthe2/scc*the_inc*wwangle
654 IF (ABS(ETHE).LT.TENM20) THEN
657 IF (ABS(TFTHE1).LT.TENM20) THEN
660 IF (ABS(TFTHE2).LT.TENM20) THEN
669 DM2=(GIX*GIPX+GIY*GIPY+GIZ*GIPZ)/(DGI**3*DGIP)
670 DM3=(GIX*GIPX+GIY*GIPY+GIZ*GIPZ)/(DGI*DGIP**3)
672 DM4=1.0d0/(DGIP*DGIPP)
673 DM5=(GIPX*GIPPX+GIPY*GIPPY+GIPZ*GIPPZ)/(DGIP**3*DGIPP)
674 DM6=(GIPX*GIPPX+GIPY*GIPPY+GIPZ*GIPPZ)/(DGIP*DGIPP**3)
676 C FIRST ATOM BY THETA1
677 TDX(1)=((RIPZ*GIPY-RIPY*GIPZ)*DM1
678 & -(GIY*RIPZ-GIZ*RIPY)*DM2)*TFTHE1
679 TDY(1)=((-RIPZ*GIPX+RIPX*GIPZ)*DM1
680 & -(-GIX*RIPZ+GIZ*RIPX)*DM2)*TFTHE1
681 TDZ(1)=((RIPY*GIPX-RIPX*GIPY)*DM1
682 & -(GIX*RIPY-GIY*RIPX)*DM2)*TFTHE1
683 C SECOND ATOM BY THETA1
684 TDX(2)=((CIPY*GIPZ-CIPZ*GIPY-RIPPY*GIZ+RIPPZ*GIY)*DM1
685 & -(CIPY*GIZ-CIPZ*GIY)*DM2
686 & +(RIPPY*GIPZ-RIPPZ*GIPY)*DM3)*TFTHE1
687 TDY(2)=((CIPZ*GIPX-CIPX*GIPZ-RIPPZ*GIX+RIPPX*GIZ)*DM1
688 & -(CIPZ*GIX-CIPX*GIZ)*DM2
689 & +(RIPPZ*GIPX-RIPPX*GIPZ)*DM3)*TFTHE1
690 TDZ(2)=((CIPX*GIPY-CIPY*GIPX-RIPPX*GIY+RIPPY*GIX)*DM1
691 & -(CIPX*GIY-CIPY*GIX)*DM2
692 & +(RIPPX*GIPY-RIPPY*GIPX)*DM3)*TFTHE1
693 C SECOND ATOM BY THETA2
695 & ((RIPPZ*GIPPY-RIPPY*GIPPZ)*DM4
696 & -(GIPY*RIPPZ-GIPZ*RIPPY)*DM5)*TFTHE2
698 & ((-RIPPZ*GIPPX+RIPPX*GIPPZ)*DM4
699 & -(-GIPX*RIPPZ+GIPZ*RIPPX)*DM5)*TFTHE2
701 & ((RIPPY*GIPPX-RIPPX*GIPPY)*DM4
702 & -(GIPX*RIPPY-GIPY*RIPPX)*DM5)*TFTHE2
703 C THIRD ATOM BY THETA1
704 TDX(3)=((GIPY*RIZ-GIPZ*RIY-GIY*CIPPZ+GIZ*CIPPY)*DM1
705 & -(GIY*RIZ-GIZ*RIY)*DM2
706 & -(CIPPY*GIPZ-CIPPZ*GIPY)*DM3) *TFTHE1
707 TDY(3)=((GIPZ*RIX-GIPX*RIZ-GIZ*CIPPX+GIX*CIPPZ)*DM1
708 & -(GIZ*RIX-GIX*RIZ)*DM2
709 & -(CIPPZ*GIPX-CIPPX*GIPZ)*DM3) *TFTHE1
710 TDZ(3)=((GIPX*RIY-GIPY*RIX-GIX*CIPPY+GIY*CIPPX)*DM1
711 & -(GIX*RIY-GIY*RIX)*DM2
712 & -(CIPPX*GIPY-CIPPY*GIPX)*DM3) *TFTHE1
713 C THIRD ATOM BY THETA2
715 & ((CIPPY*GIPPZ-CIPPZ*GIPPY-RIP3Y*GIPZ+RIP3Z*GIPY)*DM4
716 & -(CIPPY*GIPZ-CIPPZ*GIPY)*DM5
717 & +(RIP3Y*GIPpZ-RIP3Z*GIPpY)*DM6) *TFTHE2
719 & ((CIPPZ*GIPPX-CIPPX*GIPPZ-RIP3Z*GIPX+RIP3X*GIPZ)*DM4
720 & -(CIPPZ*GIPX-CIPPX*GIPZ)*DM5
721 & +(RIP3Z*GIPpX-RIP3X*GIPpZ)*DM6) *TFTHE2
723 & ((CIPPX*GIPPY-CIPPY*GIPPX-RIP3X*GIPY+RIP3Y*GIPX)*DM4
724 & -(CIPPX*GIPY-CIPPY*GIPX)*DM5
725 & +(RIP3X*GIPpY-RIP3Y*GIPpX)*DM6) *TFTHE2
726 C FOURTH ATOM BY THETA1
727 TDX(4)=-((GIZ*RIPY-GIY*RIPZ)*DM1
728 & -(GIPZ*RIPY-GIPY*RIPZ)*DM3) *TFTHE1
729 TDY(4)=-((GIX*RIPZ-GIZ*RIPX)*DM1
730 & -(GIPX*RIPZ-GIPZ*RIPX)*DM3) *TFTHE1
731 TDZ(4)=-((GIY*RIPX-GIX*RIPY)*DM1
732 & -(GIPY*RIPX-GIPX*RIPY)*DM3) *TFTHE1
733 C FOURTH ATOM BY THETA2
735 & ((GIPPY*RIPZ-GIPPZ*RIPY-GIPY*CIP3Z+GIPZ*CIP3Y)*DM4
736 & -(GIPY*RIPZ-GIPZ*RIPY)*DM5
737 & -(CIP3Y*GIPPZ-CIP3Z*GIPPY)*DM6)*TFTHE2
739 & ((GIPPZ*RIPX-GIPPX*RIPZ-GIPZ*CIP3X+GIPX*CIP3Z)*DM4
740 & -(GIPZ*RIPX-GIPX*RIPZ)*DM5
741 & -(CIP3Z*GIPPX-CIP3X*GIPPZ)*DM6)*TFTHE2
743 & ((GIPPX*RIPY-GIPPY*RIPX-GIPX*CIP3Y+GIPY*CIP3X)*DM4
744 & -(GIPX*RIPY-GIPY*RIPX)*DM5
745 & -(CIP3X*GIPPY-CIP3Y*GIPPX)*DM6)*TFTHE2
746 C FIFTH ATOM BY THETA2
747 TDX(5)=-((GIPZ*RIPPY-GIPY*RIPPZ)*DM4
748 & -(GIPPZ*RIPPY-GIPPY*RIPPZ)*DM6)*TFTHE2
749 TDY(5)=-((GIPX*RIPPZ-GIPZ*RIPPX)*DM4
750 & -(GIPPX*RIPPZ-GIPPZ*RIPPX)*DM6)*TFTHE2
751 TDZ(5)=-((GIPY*RIPPX-GIPX*RIPPY)*DM4
752 & -(GIPPY*RIPPX-GIPPX*RIPPY)*DM6)*TFTHE2
753 C !! END OF FORCE DIRECTION!!!!
755 gdfat(1,iatom(II))=gdfat(1,iatom(II))+TDX(II)
756 gdfat(2,iatom(II))=gdfat(2,iatom(II))+TDY(II)
757 gdfat(3,iatom(II))=gdfat(3,iatom(II))+TDZ(II)
760 enethe = enethe + ethe
763 edfator = enephi + enethe
768 subroutine edfan(edfanei)
769 C DFA neighboring CA restraint
770 implicit real*8 (a-h,o-z)
772 include 'COMMON.CHAIN'
773 include 'COMMON.DERIV'
777 integer kshnum, n1atom
779 double precision enenei,tmp_n
780 double precision pai,hpai
781 double precision jix,jiy,jiz,ndiff,snorm_nei
782 double precision t2dx(maxres),t2dy(maxres),t2dz(maxres)
783 double precision dr,dr2,half,ntmp,dtmp
785 parameter(dr=0.25d0,dr2=0.50d0,half=0.50d0)
786 parameter(pai=3.14159265358979323846D0)
787 parameter(hpai=1.5707963267948966D0)
788 parameter(snorm_nei=0.886226925452758D0)
794 c print*, 's1:', s1(:)
795 c print*, 's2:', s2(:)
800 n1atom=ineilis(i)+ishiftca
801 C write(*,*) 'kshnum,n1atom:', kshnum, n1atom
814 do j = ishiftca+1, ilastca
816 if (n1atom.eq.j) cycle
818 jix=c(1,j)-c(1,n1atom)
819 jiy=c(2,j)-c(2,n1atom)
820 jiz=c(3,j)-c(3,n1atom)
821 dist=sqrt(jix*jix+jiy*jiy+jiz*jiz)
823 c write(*,*) n1atom, j, dist
826 if (dist.lt.s1(kshnum).and.
827 & dist.gt.s2(kshnum-1)) then
831 c write(*,*) 'case1:',tmp_n
840 elseif(dist.ge.s1(kshnum).and.
841 & dist.le.s2(kshnum)) then
843 dnei=(dist-s1(kshnum))/dr2*pai
844 tmp_n=tmp_n + half*(1+cos(dnei))
845 c write(*,*) 'case2:',tmp_n
846 ftmp=-pai*sin(dnei)/dr2/dist/2.0d0
856 elseif(dist.ge.s1(kshnum-1).and.
857 & dist.le.s2(kshnum-1)) then
858 dnei=(dist-s1(kshnum-1))/dr2*pai
859 tmp_n=tmp_n + 1.0d0 - half*(1+cos(dnei))
860 c write(*,*) 'case3:',tmp_n
861 ftmp = hpai*sin(dnei)/dr2/dist
873 elseif(kshnum.eq.1) then
875 if(dist.lt.s1(kshnum))then
878 c write(*,*) 'case4:',tmp_n
886 elseif(dist.ge.s1(kshnum).and.
887 & dist.le.s2(kshnum))then
889 dnei=(dist-s1(kshnum))/dr2*pai
890 tmp_n=tmp_n + half*(1+cos(dnei))
891 c write(*,*) 'case5:',tmp_n
892 ftmp = -hpai*sin(dnei)/dr2/dist
913 ndiff = tmp_n-fnei(i,imin)
916 if (dtmp.ge.15.0d0) then
919 c ntmp = dfaexp( idint(dtmp*1000) + 1 )
923 enei=enei+sccnei(i,imin)*ntmp
925 & sccnei(i,imin)*ntmp*ndiff*2.0d0
926 scc=scc+sccnei(i,imin)
928 c write(*,'(a,1x,2i8,f12.7,i8,3f12.7)')'NEI:',i,imin,tmp_n,
929 c & fnei(i,imin),sccnei(i,imin),enei,scc
932 enei=-enei/scc*snorm_nei*nei_inc*wwnei
933 tmp_fnei=tmp_fnei/scc*snorm_nei*nei_inc*wwnei
935 c if (abs(enei).lt.1.0d-20)then
938 c if (abs(tmp_fnei).lt.1.0d-20) then
947 do j=ishiftca+1,ilastca
948 t2dx(j)=t2dx(j)*tmp_fnei
949 t2dy(j)=t2dy(j)*tmp_fnei
950 t2dz(j)=t2dz(j)*tmp_fnei
953 gdfan(1,n1atom)=gdfan(1,n1atom)+t1dx
954 gdfan(2,n1atom)=gdfan(2,n1atom)+t1dy
955 gdfan(3,n1atom)=gdfan(3,n1atom)+t1dz
957 do j=ishiftca+1,ilastca
958 gdfan(1,j)=gdfan(1,j)+t2dx(j)
959 gdfan(2,j)=gdfan(2,j)+t2dy(j)
960 gdfan(3,j)=gdfan(3,j)+t2dz(j)
973 subroutine edfab(edfabeta)
975 implicit real*8 (a-h,o-z)
978 include 'COMMON.CHAIN'
979 include 'COMMON.DERIV'
983 parameter(PAI=3.14159265358979323846D0)
984 parameter (maxca=800)
986 real*8 bx(maxres),by(maxres),bz(maxres)
987 real*8 vbet(maxres,maxres)
988 real*8 shetfx(maxres),shetfy(maxres),shetfz(maxres)
989 real*8 shefx(maxres,12),shefy(maxres,12),shefz(maxres,12)
990 real*8 vbeta,vbetp,vbetm
991 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
993 real*8 dp45,dm45,w_beta
995 real*8 cph(maxca),cth(maxca)
996 real*8 atx(maxca),aty(maxca),atz(maxca)
997 real*8 atmx(maxca),atmy(maxca),atmz(maxca)
998 real*8 atmmx(maxca),atmmy(maxca),atmmz(maxca)
999 real*8 atm3x(maxca),atm3y(maxca),atm3z(maxca)
1001 real*8 astx(maxca),asty(maxca),astz(maxca)
1002 real*8 astmx(maxca),astmy(maxca),astmz(maxca)
1003 real*8 astmmx(maxca),astmmy(maxca),astmmz(maxca)
1004 real*8 astm3x(maxca),astm3y(maxca),astm3z(maxca)
1006 real*8 atxnum(maxca),atynum(maxca),atznum(maxca),
1007 & astxnum(maxca),astynum(maxca),astznum(maxca),
1008 & atmxnum(maxca),atmynum(maxca),atmznum(maxca),
1009 & astmxnum(maxca),astmynum(maxca),astmznum(maxca),
1010 & atmmxnum(maxca),atmmynum(maxca),atmmznum(maxca),
1011 & astmmxnum(maxca),astmmynum(maxca),astmmznum(maxca),
1012 & atm3xnum(maxca),atm3ynum(maxca),atm3znum(maxca),
1013 & astm3xnum(maxca),astm3ynum(maxca),astm3znum(maxca),
1014 & cth_orig(maxca),sth_orig(maxca)
1016 common /sheca/ bx,by,bz
1017 common /shee/ vbeta,vbet,vbetp,vbetm
1018 common /shetf/ shetfx,shetfy,shetfz
1019 common /shef/ shefx, shefy, shefz
1020 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
1021 & c00,s00,ulnex,dnex
1022 common /sheconst/ dp45,dm45,w_beta
1024 common /angvt/ atx,aty,atz,atmx,atmy,atmz,atmmx,atmmy,
1025 $ atmmz,atm3x,atm3y,atm3z
1026 common /angvt2/ astx,asty,astz,astmx,astmy,astmz,astmmx,astmmy,
1027 $ astmmz,astm3x,astm3y,astm3z
1029 common /coscos/ cph,cth
1032 C End of sheet variables
1035 double precision enebet
1038 bx=0.0d0;by=0.0d0;bz=0.0d0
1039 shetfx=0.0d0;shetfy=0.0d0;shetfz=0.0d0
1043 do i=ishiftca+1,ilastca
1044 bx(i-ishiftca)=c(1,i)
1045 by(i-ishiftca)=c(2,i)
1046 bz(i-ishiftca)=c(3,i)
1049 c do i=1,ilastca-ishiftca
1050 c read(99,*) bx(i),by(i),bz(i)
1058 ULNEX=COS(60.0D0/180.0D0*PAI)
1065 C00=COS((1.0D0+10.0D0/180.0D0)*PAI)
1066 S00=SIN((1.0D0+10.0D0/180.0D0)*PAI)
1072 C END OF INITIALIZATION
1074 nca=ilastca-ishiftca
1076 call angvectors(nca)
1077 call sheetforce(nca,wshet)
1079 c end of sheet energy and force
1082 shetfx(j)=shetfx(j)*beta_inc
1083 shetfy(j)=shetfy(j)*beta_inc
1084 shetfz(j)=shetfz(j)*beta_inc
1085 c write(*,*)'SHETF:',shetfx(j),shetfy(j),shetfz(j)
1088 vbeta=vbeta*beta_inc
1093 gdfab(1,j+ishiftca)=gdfab(1,j+ishiftca)-shetfx(j)
1094 gdfab(2,j+ishiftca)=gdfab(2,j+ishiftca)-shetfy(j)
1095 gdfab(3,j+ishiftca)=gdfab(3,j+ishiftca)-shetfz(j)
1100 write(*,'(5x,i5,10x,3f10.5)') j,bx(j),by(j),bz(j)
1114 call angvectors(nca)
1116 call angvectors(nca)
1117 atxnum(j)=0.5*(cth(j)-cth_orig(j))/dinc
1118 astxnum(j)=0.5*(sth(j)-sth_orig(j))/dinc
1120 atmxnum(j)=0.5*(cth(j-1)-cth_orig(j-1))/dinc
1121 astmxnum(j)=0.5*(sth(j-1)-sth_orig(j-1))/dinc
1124 atmmxnum(j)=0.5*(cth(j-2)-cth_orig(j-2))/dinc
1125 astmmxnum(j)=0.5*(sth(j-2)-sth_orig(j-2))/dinc
1128 atm3xnum(j)=0.5*(cth(j-3)-cth_orig(j-3))/dinc
1129 astm3xnum(j)=0.5*(sth(j-3)-sth_orig(j-3))/dinc
1133 call angvectors(nca)
1135 call angvectors(nca)
1137 atynum(j)=0.5*(cth(j)-cth_orig(j))/dinc
1138 astynum(j)=0.5*(sth(j)-sth_orig(j))/dinc
1140 atmynum(j)=0.5*(cth(j-1)-cth_orig(j-1))/dinc
1141 astmynum(j)=0.5*(sth(j-1)-sth_orig(j-1))/dinc
1144 atmmynum(j)=0.5*(cth(j-2)-cth_orig(j-2))/dinc
1145 astmmynum(j)=0.5*(sth(j-2)-sth_orig(j-2))/dinc
1148 atm3ynum(j)=0.5*(cth(j-3)-cth_orig(j-3))/dinc
1149 astm3ynum(j)=0.5*(sth(j-3)-sth_orig(j-3))/dinc
1153 call angvectors(nca)
1155 call angvectors(nca)
1158 atznum(j)=0.5*(cth(j)-cth_orig(j))/dinc
1159 astznum(j)=0.5*(sth(j)-sth_orig(j))/dinc
1161 atmznum(j)=0.5*(cth(j-1)-cth_orig(j-1))/dinc
1162 astmznum(j)=0.5*(sth(j-1)-sth_orig(j-1))/dinc
1165 atmmznum(j)=0.5*(cth(j-2)-cth_orig(j-2))/dinc
1166 astmmznum(j)=0.5*(sth(j-2)-sth_orig(j-2))/dinc
1169 atm3znum(j)=0.5*(cth(j-3)-cth_orig(j-3))/dinc
1170 astm3znum(j)=0.5*(sth(j-3)-sth_orig(j-3))/dinc
1176 write (*,'(2i5,a2,6f10.5)')
1177 & i,1,"x",atxnum(i),atx(i),atxnum(i)/atx(i),
1178 & astxnum(i),astx(i),astxnum(i)/astx(i),
1179 & i,1,"y",atynum(i),aty(i),atynum(i)/aty(i),
1180 & astynum(i),asty(i),astynum(i)/asty(i),
1181 & i,1,"z",atznum(i),atz(i),atznum(i)/atz(i),
1182 & astznum(i),astz(i),astznum(i)/astz(i),
1183 & i,2,"x",atmxnum(i),atmx(i),atmxnum(i)/atmx(i),
1184 & astmxnum(i),astmx(i),astmxnum(i)/astmx(i),
1185 & i,2,"y",atmynum(i),atmy(i),atmynum(i)/atmy(i),
1186 & astmynum(i),astmy(i),astmynum(i)/astmy(i),
1187 & i,2,"z",atmznum(i),atmz(i),atmznum(i)/atmz(i),
1188 & astmznum(i),astmz(i),astmznum(i)/astmz(i),
1189 & i,3,"x",atmmxnum(i),atmmx(i),atmmxnum(i)/atmmx(i),
1190 & astmmxnum(i),astmmx(i),astmmxnum(i)/astmmx(i),
1191 & i,3,"y",atmmynum(i),atmmy(i),atmmynum(i)/atmmy(i),
1192 & astmmynum(i),astmmy(i),astmmynum(i)/astmmy(i),
1193 & i,3,"z",atmmznum(i),atmmz(i),atmmznum(i)/atmmz(i),
1194 & astmmznum(i),astmmz(i),astmmznum(i)/astmmz(i),
1195 & i,4,"x",atm3xnum(i),atm3x(i),atm3xnum(i)/atm3x(i),
1196 & astm3xnum(i),astm3x(i),astm3xnum(i)/astm3x(i),
1197 & i,4,"y",atm3ynum(i),atm3y(i),atm3ynum(i)/atm3y(i),
1198 & astm3ynum(i),astm3y(i),astm3ynum(i)/astm3y(i),
1199 & i,4,"z",atm3znum(i),atm3z(i),atm3znum(i)/atm3z(i),
1200 & astm3znum(i),astm3z(i),astm3znum(i)/astm3z(i),
1201 & i,0," ",cth_orig(i),sth_orig(i)
1211 call angvectors(nca)
1212 call sheetforce(nca,wshet)
1213 vbeta1=vbeta*beta_inc
1215 call angvectors(nca)
1216 call sheetforce(nca,wshet)
1217 vbeta2=vbeta*beta_inc
1218 gdfab(1,j)=(vbeta2-vbeta1)/dinc/2
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(2,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(3,j)=(vbeta2-vbeta1)/dinc/2
1247 call angvectors(nca)
1248 call sheetforce(nca,wshet)
1250 shetfx(j)=shetfx(j)*beta_inc
1251 shetfy(j)=shetfy(j)*beta_inc
1252 shetfz(j)=shetfz(j)*beta_inc
1256 write(*,*) 'xyz analytical and numerical gradient'
1258 write(*,'(5x,i5,10x,6f10.5)') j,-shetfx(j),-shetfy(j),-shetfz(j)
1259 & ,(-gdfab(i,j),i=1,3)
1263 write(*,'(5x,i5,10x,3f10.2)') j,shetfx(j)/gdfab(1,j),
1264 & shetfy(j)/gdfab(2,j),
1265 & shetfz(j)/gdfab(3,j)
1273 C-------------------------------------------------------------------------------
1274 subroutine angvectors(nca)
1275 c implicit real*4(a-h,o-z)
1279 parameter(maxca=800)
1281 parameter(PAI=3.14159265358979323846D0,zero=0.0d0)
1283 real*8 bx(maxca),by(maxca),bz(maxca)
1284 real*8 dis(maxca,maxca)
1285 real*8 apx(maxca),apy(maxca),apz(maxca)
1286 real*8 apmx(maxca),apmy(maxca),apmz(maxca)
1287 real*8 apmmx(maxca),apmmy(maxca),apmmz(maxca)
1288 real*8 apm3x(maxca),apm3y(maxca),apm3z(maxca)
1289 real*8 atx(maxca),aty(maxca),atz(maxca)
1290 real*8 atmx(maxca),atmy(maxca),atmz(maxca)
1291 real*8 atmmx(maxca),atmmy(maxca),atmmz(maxca)
1292 real*8 atm3x(maxca),atm3y(maxca),atm3z(maxca)
1293 real*8 astx(maxca),asty(maxca),astz(maxca)
1294 real*8 astmx(maxca),astmy(maxca),astmz(maxca)
1295 real*8 astmmx(maxca),astmmy(maxca),astmmz(maxca)
1296 real*8 astm3x(maxca),astm3y(maxca),astm3z(maxca)
1298 real*8 cph(maxca),cth(maxca)
1301 integer i, ip, ipp, ip3, j
1302 real*8 rx(maxca, maxca), ry(maxca, maxca), rz(maxca, maxca)
1303 real*8 rix, riy, riz, ripx, ripy, ripz, rippx, rippy, rippz
1304 real*8 gix, giy, giz, gipx, gipy, gipz, gippx, gippy, gippz
1305 real*8 cix, ciy, ciz, cipx, cipy, cipz
1306 real*8 gpcrp_x, gpcrp_y, gpcrp_z, d_gpcrp, gpcrp__g
1307 real*8 d10, d11, d12, d13, d20, d21, d22, d23, d24
1308 real*8 d30, d31, d32, d33, d34, d35, d40, d41, d42, d43
1309 real*8 d_gcr, d_gcr3, d_gmcrim,d_gmcrim3,dgmmcrimm,d_gmmcrimm3
1310 real*8 dg, dg3, dg30, dgm, dgm3, dgmm, dgmm3, dgp, dri
1311 real*8 dri3, drim, drim3, drimm, drip, dripp, g3gmm, g3rim
1312 real*8 g3x, g3y, g3z, d_gmmcrimm, g3rim_,gcr__gm
1313 real*8 gcr_x,gcr_y,gcr_z,ggm,ggp,gmcrim__gmm
1314 real*8 gmcrim_x,gmcrim_y,gmcrim_z,gmmcrimm__gmmm
1315 real*8 gmmcrimm_x,gmmcrimm_y,gmmcrimm_z,gmmgm,gmmr
1316 real*8 gmmx,gmmy,gmmz,gmrp,gmx,gmy,gmz,gpx,gpy,gpz
1317 real*8 grpp,gx,gy,gz
1318 real*8 rim3x,rim3y,rim3z,rimmx,rimmy,rimmz,rimx,rimy,rimz
1319 real*8 sd10,sd11,sd20,sd21,sd22,sd30,sd31,sd32,sd40,sd41
1320 integer inb,nmax,iselect
1322 common /sheca/ bx,by,bz
1323 common /difvec/ rx, ry, rz
1324 common /ulang/ ulcos
1325 common /phys1/ inb,nmax,iselect
1328 common /angvp/ apx,apy,apz,apmx,apmy,apmz,apmmx,apmmy,
1329 & apmmz,apm3x,apm3y,apm3z
1330 common /angvt/ atx,aty,atz,atmx,atmy,atmz,atmmx,atmmy,
1331 & atmmz,atm3x,atm3y,atm3z
1332 common /coscos/ cph,cth
1333 common /angvt2/ astx,asty,astz,astmx,astmy,astmz,astmmx,astmmy,
1334 & astmmz,astm3x,astm3y,astm3z
1336 C-------------------------------------------------------------------------------
1337 c write(*,*) 'inside angvectors'
1342 cph=zero; cth=zero; sth=zero
1343 apx=zero;apy=zero;apz=zero;apmx=zero;apmy=zero;apmz=zero
1344 apmmx=zero;apmmy=zero;apmmz=zero;apm3x=zero;apm3y=zero;apm3z=zero
1345 atx=zero;aty=zero;atz=zero;atmx=zero;atmy=zero;atmz=zero
1346 atmmx=zero;atmmy=zero;atmmz=zero;atm3x=zero;atm3y=zero;atm3z=zero
1347 astx=zero;asty=zero;astz=zero;astmx=zero;astmy=zero;astmz=zero
1348 astmmx=zero;astmmy=zero;astmmz=zero;astm3x=zero;astm3y=zero
1351 C r[x,y,z] calc and distance calculation
1352 rx=zero;ry=zero;rz=zero
1359 dis(i,j)=sqrt(rx(i,j)**2+ry(i,j)**2+rz(i,j)**2)
1360 c write(*,*) 'rx(i,j):',i,j,rx(i,j),bx(j),bx(i)
1361 c write(*,*) 'ry(i,j):',i,j,ry(i,j),by(j),by(i)
1362 c write(*,*) 'rz(i,j):',i,j,rz(i,j),bz(j),bz(i)
1363 c write(*,*) 'dis(i,j):',i,j,dis(i,j)
1366 c end of r[x,y,z] calc
1372 if(dis(i,ip).ge.1.0e-8.and.dis(ip,ipp).ge.1.0e-8) then
1373 ulcos(i)=rx(i,ip)*rx(ip,ipp)+ry(i,ip)*ry(ip,ipp)
1374 $ +rz(i,ip)*rz(ip,ipp)
1375 ulcos(i)=ulcos(i)/(dis(i,ip)*dis(ip,ipp))
1378 c end of virtual bond angle
1379 c write(*,*) 'inside angvectors1'
1391 rippx=bx(ip3)-bx(ipp)
1392 rippy=by(ip3)-by(ipp)
1393 rippz=bz(ip3)-bz(ipp)
1395 gx=riy*ripz-riz*ripy
1396 gy=riz*ripx-rix*ripz
1397 gz=rix*ripy-riy*ripx
1398 gpx=ripy*rippz-ripz*rippy
1399 gpy=ripz*rippx-ripx*rippz
1400 gpz=ripx*rippy-ripy*rippx
1401 gpcrp_x=gpy*ripz-gpz*ripy
1402 gpcrp_y=gpz*ripx-gpx*ripz
1403 gpcrp_z=gpx*ripy-gpy*ripx
1404 d_gpcrp=sqrt(gpcrp_x**2+gpcrp_y**2+gpcrp_z**2)
1405 gpcrp__g=gx*gpy*ripz+gpx*ripy*gz+ripx*gpz*gy
1406 & -gz*gpy*ripx-gpz*ripy*gx-ripz*gpx*gy
1412 gmx=rimy*riz-rimz*riy
1413 gmy=rimz*rix-rimx*riz
1414 gmz=rimx*riy-rimy*rix
1415 dgm=sqrt(gmx**2+gmy**2+gmz**2)
1417 ggm=gmx*gx+gmy*gy+gmz*gz
1418 gmrp=gmx*ripx+gmy*ripy+gmz*ripz
1424 d_gcr=sqrt(gcr_x**2+gcr_y**2+gcr_z**2)
1426 gcr__gm=gmx*gy*riz+gx*riy*gmz+rix*gz*gmy
1427 & -gmz*gy*rix-gz*riy*gmx-riz*gx*gmy
1429 c write(*,*) 'inside angvectors2'
1431 rimmx=bx(i-1)-bx(i-2)
1432 rimmy=by(i-1)-by(i-2)
1433 rimmz=bz(i-1)-bz(i-2)
1435 gmmx=rimmy*rimz-rimmz*rimy
1436 gmmy=rimmz*rimx-rimmx*rimz
1437 gmmz=rimmx*rimy-rimmy*rimx
1438 dgmm=sqrt(gmmx**2+gmmy**2+gmmz**2)
1440 gmmgm=gmmx*gmx+gmmy*gmy+gmmz*gmz
1441 gmmr=gmmx*rix+gmmy*riy+gmmz*riz
1442 gmcrim_x=gmy*rimz-gmz*rimy
1443 gmcrim_y=gmz*rimx-gmx*rimz
1444 gmcrim_z=gmx*rimy-gmy*rimx
1445 d_gmcrim=sqrt(gmcrim_x**2+gmcrim_y**2+gmcrim_z**2)
1446 d_gmcrim3=d_gmcrim**3
1447 gmcrim__gmm=gmmx*gmy*rimz+gmx*rimy*gmmz+rimx*gmz*gmmy
1448 & -gmmz*gmy*rimx-gmz*rimy*gmmx-rimz*gmx*gmmy
1452 rim3x=bx(i-2)-bx(i-3)
1453 rim3y=by(i-2)-by(i-3)
1454 rim3z=bz(i-2)-bz(i-3)
1455 g3x=rim3y*rimmz-rim3z*rimmy
1456 g3y=rim3z*rimmx-rim3x*rimmz
1457 g3z=rim3x*rimmy-rim3y*rimmx
1458 dg30=sqrt(g3x**2+g3y**2+g3z**2)
1459 g3gmm=g3x*gmmx+g3y*gmmy+g3z*gmmz
1460 g3rim_=g3x*rimx+g3y*rimy+g3z*rimz
1461 cc**********************************************************************
1462 gmmcrimm_x=gmmy*rimmz-gmmz*rimmy
1463 gmmcrimm_y=gmmz*rimmx-gmmx*rimmz
1464 gmmcrimm_z=gmmx*rimmy-gmmy*rimmx
1465 d_gmmcrimm=sqrt(gmmcrimm_x**2+gmmcrimm_y**2+gmmcrimm_z**2)
1466 d_gmmcrimm3=d_gmmcrimm**3
1467 gmmcrimm__gmmm=g3x*gmmy*rimmz+gmmx*rimmy*g3z+rimmx*gmmz*g3y
1468 & -g3z*gmmy*rimmx-gmmz*rimmy*g3x-rimmz*gmmx*g3y
1475 dg=sqrt(gx**2+gy**2+gz**2)
1476 dgp=sqrt(gpx**2+gpy**2+gpz**2)
1479 ggp=gx*gpx+gy*gpy+gz*gpz
1480 grpp=gx*rippx+gy*rippy+gz*rippz
1482 if(dg.gt.0.0D0.and.dripp.gt.0.0D0.and.dgp.gt.0.0D0
1483 & .and.d_gpcrp.gt.0.0D0) then
1484 cph(i)=grpp/dg/dripp
1486 sth(i)=gpcrp__g/d_gpcrp/dg
1494 c write(*,*) 'inside angvectors3'
1496 if(dgp.gt.0.0D0.and.dg3.gt.0.0D0
1497 & .and.dripp.gt.0.0D0.and.d_gpcrp.gt.0.0D0) then
1500 d12=1.0D0/(dg*dripp)
1501 d13=grpp/(dg3*dripp)
1502 sd10=1.0D0/(d_gpcrp*dg)
1503 sd11=gpcrp__g/(d_gpcrp*dg3)
1513 atx(i)=(ripz*gpy-ripy*gpz)*d10
1514 & -(gy*ripz-gz*ripy)*d11
1515 aty(i)=(ripx*gpz-ripz*gpx)*d10
1516 & -(gz*ripx-gx*ripz)*d11
1517 atz(i)=(ripy*gpx-ripx*gpy)*d10
1518 & -(gx*ripy-gy*ripx)*d11
1519 astx(i)=sd10*(-gpx*ripy**2+ripx*gpz*ripz
1520 & +ripy*gpy*ripx-gpx*ripz**2)
1521 & -sd11*(gy*ripz-gz*ripy)
1522 asty(i)=sd10*(-gpy*ripz**2+gpx*ripy*ripx
1523 & -gpy*ripx**2+gpz*ripy*ripz)
1524 & -sd11*(-gx*ripz+gz*ripx)
1525 astz(i)=sd10*(ripy*gpy*ripz-gpz*ripx**2
1526 & -gpz*ripy**2+ripz*gpx*ripx)
1527 & -sd11*(gx*ripy-gy*ripx)
1528 apx(i)=(ripz*rippy-ripy*rippz)*d12
1529 & -(gy*ripz-gz*ripy)*d13
1530 apy(i)=(ripx*rippz-ripz*rippx)*d12
1531 & -(gz*ripx-gx*ripz)*d13
1532 apz(i)=(ripy*rippx-ripx*rippy)*d12
1533 & -(gx*ripy-gy*ripx)*d13
1545 if(dgm3.gt.0.0D0.and.dg3.gt.0.0D0.and.drip.gt.0.0D0
1546 & .and.d_gcr3.gt.0.0D0) then
1550 d23=1.0D0/(dgm*drip)
1551 d24=gmrp/(dgm3*drip)
1552 sd20=1.0D0/(d_gcr*dgm)
1553 sd21=gcr__gm/(d_gcr3*dgm)
1554 sd22=gcr__gm/(d_gcr*dgm3)
1565 atmx(i)=(ciy*gz-ciz*gy-ripy*gmz+ripz*gmy)*d20
1566 & -(ciy*gmz-ciz*gmy)*d21
1567 & +(ripy*gz-ripz*gy)*d22
1568 atmy(i)=(ciz*gx-cix*gz-ripz*gmx+ripx*gmz)*d20
1569 & -(ciz*gmx-cix*gmz)*d21
1570 & +(ripz*gx-ripx*gz)*d22
1571 atmz(i)=(cix*gy-ciy*gx-ripx*gmy+ripy*gmx)*d20
1572 & -(cix*gmy-ciy*gmx)*d21
1573 & +(ripx*gy-ripy*gx)*d22
1574 cc**********************************************************************
1575 astmx(i)=sd20*(gmx*ripz*riz+gx*riy*ciy-gz*gmy
1576 & -rix*ripy*gmy-rix*gz*ciz-ciy*gy*rix-gmz*ripz*rix
1577 & +gmz*gy+ripy*riy*gmx+riz*gx*ciz)
1578 & -sd21*(gcr_x*(ripz*riz+ripy*riy)+gcr_y*(-ripy*rix-gz)
1579 & +gcr_z*(-ripz*rix+gy))
1580 & -sd22*(-gmy*ciz+gmz*ciy)
1582 astmy(i)=sd20*(ciz*gy*riz-ripz*riy*gmz-gx*gmz-gx*riy*cix
1583 & +rix*ripx*gmy+cix*gy*rix-ripx*riy*gmx+gz*gmx-gz*riy*ciz
1585 & -sd21*(gcr_x*(-ripx*riy+gz)+gcr_y*(ripx*rix+ripz*riz)
1586 & -gcr_z*(ripz*riy+gx))
1587 & -sd22*(gmx*ciz-gmz*cix)
1589 astmz(i)=sd20*(-ciy*gy*riz-gmx*ripx*riz-gmx*gy+ripy*riy*gmz
1590 & +rix*gz*cix+gmz*ripx*rix+gz*riy*ciy+gx*gmy-riz*ripy*gmy
1592 & -sd21*(gcr_x*(-ripx*riz-gy)+gcr_y*(-ripy*riz+gx)
1593 & +gcr_z*(ripy*riy+ripx*rix))
1594 & -sd22*(-gmx*ciy+gmy*cix)
1595 cc**********************************************************************
1596 apmx(i)=(ciy*ripz-ripy*ciz)*d23
1597 & -(ciy*gmz-ciz*gmy)*d24
1598 apmy(i)=(ciz*ripx-ripz*cix)*d23
1599 & -(ciz*gmx-cix*gmz)*d24
1600 apmz(i)=(cix*ripy-ripx*ciy)*d23
1601 & -(cix*gmy-ciy*gmx)*d24
1605 if(dgm3.gt.0.0D0.and.dgmm3.gt.0.0D0.and.dri3.gt.0.0D0
1606 & .and.d_gmcrim3.gt.0.0D0) then
1607 d30=1.0D0/(dgm*dgmm)
1608 d31=gmmgm/(dgm3*dgmm)
1609 d32=gmmgm/(dgm*dgmm3)
1610 d33=1.0D0/(dgmm*dri)
1611 d34=gmmr/(dgmm3*dri)
1612 d35=gmmr/(dgmm*dri3)
1613 sd30=1.0D0/(d_gmcrim*dgmm)
1614 sd31=gmcrim__gmm/(d_gmcrim3*dgmm)
1615 sd32=gmcrim__gmm/(d_gmcrim*dgmm3)
1628 c write(*,*) 'inside angvectors4'
1630 cc**********************************************************************
1631 atmmx(i)=(ciy*gmmz-ciz*gmmy-rimmy*gmz+rimmz*gmy)*d30
1632 & -(ciy*gmz-ciz*gmy)*d31
1633 & -(gmmy*rimmz-gmmz*rimmy)*d32
1634 atmmy(i)=(ciz*gmmx-cix*gmmz-rimmz*gmx+rimmx*gmz)*d30
1635 & -(ciz*gmx-cix*gmz)*d31
1636 & -(gmmz*rimmx-gmmx*rimmz)*d32
1637 atmmz(i)=(cix*gmmy-ciy*gmmx-rimmx*gmy+rimmy*gmx)*d30
1638 & -(cix*gmy-ciy*gmx)*d31
1639 & -(gmmx*rimmy-gmmy*rimmx)*d32
1640 cc**********************************************************************
1641 astmmx(i)=sd30*(-gmmx*ciz*rimz-gmx*rimy*rimmy
1642 & +gmz*gmmy+rimx*ciy*gmmy+rimx*gmz*rimmz
1643 & +rimmy*gmy*rimx+gmmz*ciz*rimx-gmmz*gmy
1644 & -ciy*rimy*gmmx-rimz*gmx*rimmz)
1645 & -sd31*(gmcrim_x*(-ciz*rimz-ciy*rimy)
1646 & +gmcrim_y*(ciy*rimx+gmz)+gmcrim_z*(ciz*rimx-gmy))
1647 & -sd32*(gmmy*rimmz-rimmy*gmmz)
1649 astmmy(i)=sd30*(-rimmz*gmy*rimz+ciz*rimy*gmmz
1650 & +gmx*gmmz+gmx*rimy*rimmx-rimx*cix*gmmy
1651 & -rimmx*gmy*rimx+cix*rimy*gmmx-gmz*gmmx
1652 & +gmz*rimy*rimmz-rimz*ciz*gmmy)
1653 & -sd31*(gmcrim_x*(cix*rimy-gmz)
1654 & +gmcrim_y*(-cix*rimx-ciz*rimz)+gmcrim_z*(ciz*rimy+gmx))
1655 & -sd32*(-gmmx*rimmz+rimmx*gmmz)
1657 astmmz(i)=sd30*(rimmy*gmy*rimz+gmmx*cix*rimz
1658 & +gmmx*gmy-ciy*rimy*gmmz-rimx*gmz*rimmx
1659 & -gmmz*cix*rimx-gmz*rimy*rimmy-gmx*gmmy
1660 & +rimz*ciy*gmmy+rimz*gmx*rimmx)
1661 & -sd31*(gmcrim_x*(cix*rimz+gmy)
1662 & +gmcrim_y*(ciy*rimz-gmx)+gmcrim_z*(-ciy*rimy-cix*rimx))
1663 & -sd32*(gmmx*rimmy-rimmx*gmmy)
1664 c**********************************************************************
1665 apmmx(i)=(riy*rimmz-riz*rimmy-gmmx)*d33
1666 & -(gmmy*rimmz-gmmz*rimmy)*d34
1668 apmmy(i)=(riz*rimmx-rix*rimmz-gmmy)*d33
1669 & -(gmmz*rimmx-gmmx*rimmz)*d34
1671 apmmz(i)=(rix*rimmy-riy*rimmx-gmmz)*d33
1672 & -(gmmx*rimmy-gmmy*rimmx)*d34
1677 if(dg30.gt.0.0D0.and.dgmm3.gt.0.0D0
1678 & .and.drim3.gt.0.0D0
1679 & .and.d_gmmcrimm3.gt.0.0D0) then
1680 d40=1.0D0/(dg30*dgmm)
1681 d41=g3gmm/(dg30*dgmm3)
1682 d42=1.0D0/(dg30*drim)
1683 d43=g3rim_/(dg30*drim3)
1684 sd40=1.0D0/(dg30*d_gmmcrimm)
1685 sd41=gmmcrimm__gmmm/(d_gmmcrimm3*dg30)
1694 atm3x(i)=(g3y*rimmz-g3z*rimmy)*d40
1695 & -(gmmy*rimmz-gmmz*rimmy)*d41
1696 atm3y(i)=(g3z*rimmx-g3x*rimmz)*d40
1697 & -(gmmz*rimmx-gmmx*rimmz)*d41
1698 atm3z(i)=(g3x*rimmy-g3y*rimmx)*d40
1699 & -(gmmx*rimmy-gmmy*rimmx)*d41
1700 cc**********************************************************************
1701 astm3x(i)=sd40*(g3x*rimmz**2-rimmx*rimmy*g3y
1702 & -g3z*rimmz*rimmx+rimmy**2*g3x)
1703 & -sd41*(gmmcrimm_x*(rimmz**2+rimmy**2)
1704 & -gmmcrimm_y*rimmy*rimmx-gmmcrimm_z*rimmz*rimmx)
1706 astm3y(i)=sd40*(-rimmz*rimmy*g3z+rimmx**2*g3y
1707 & -rimmx*rimmy*g3x+rimmz**2*g3y)
1708 & -sd41*(-gmmcrimm_x*rimmx*rimmy
1709 & +gmmcrimm_y*(rimmx**2+rimmz**2)-gmmcrimm_z*rimmz*rimmy)
1711 c & +gmmcrimm_y*(rimmx**2+rimmz**2)-gmmcrimm_z*rimmz*rimmx)
1713 astm3z(i)=sd40*(-g3x*rimmx*rimmz+rimmy**2*g3z
1714 & +g3z*rimmx**2-rimmz*rimmy*g3y)
1715 & -sd41*(-gmmcrimm_x*rimmx*rimmz-gmmcrimm_y*rimmy*rimmz
1716 & +gmmcrimm_z*(rimmy**2+rimmx**2))
1717 c**********************************************************************
1718 apm3x(i)=g3x*d42-rimx*d43
1719 apm3y(i)=g3y*d42-rimy*d43
1720 apm3z(i)=g3z*d42-rimz*d43
1723 c*******************************************************************************
1725 c write(*,*) 'inside angvectors5'
1732 rimmx=bx(i-1)-bx(i-2)
1733 rimmy=by(i-1)-by(i-2)
1734 rimmz=bz(i-1)-bz(i-2)
1735 rim3x=bx(i-2)-bx(i-3)
1736 rim3y=by(i-2)-by(i-3)
1737 rim3z=bz(i-2)-bz(i-3)
1738 gmmx=rimmy*rimz-rimmz*rimy
1739 gmmy=rimmz*rimx-rimmx*rimz
1740 gmmz=rimmx*rimy-rimmy*rimx
1741 g3x=rim3y*rimmz-rim3z*rimmy
1742 g3y=rim3z*rimmx-rim3x*rimmz
1743 g3z=rim3x*rimmy-rim3y*rimmx
1745 dg30=sqrt(g3x**2+g3y**2+g3z**2)
1746 g3gmm=g3x*gmmx+g3y*gmmy+g3z*gmmz
1747 dgmm=sqrt(gmmx**2+gmmy**2+gmmz**2)
1752 g3rim_=g3x*rimx+g3y*rimy+g3z*rimz
1753 cc**********************************************************************
1754 gmmcrimm_x=gmmy*rimmz-gmmz*rimmy
1755 gmmcrimm_y=gmmz*rimmx-gmmx*rimmz
1756 gmmcrimm_z=gmmx*rimmy-gmmy*rimmx
1757 d_gmmcrimm=sqrt(gmmcrimm_x**2+gmmcrimm_y**2+gmmcrimm_z**2)
1758 d_gmmcrimm3=d_gmmcrimm**3
1759 gmmcrimm__gmmm=g3x*gmmy*rimmz+gmmx*rimmy*g3z+rimmx*gmmz*g3y
1760 & -g3z*gmmy*rimmx-gmmz*rimmy*g3x-rimmz*gmmx*g3y
1762 if(dg30.gt.0.0D0.and.dgmm3.gt.0.0D0
1763 & .and.drim3.gt.0.0D0
1764 & .and.d_gmmcrimm3.gt.0.0D0) then
1765 d40=1.0D0/(dg30*dgmm)
1766 d41=g3gmm/(dg30*dgmm3)
1767 d42=1.0D0/(dg30*drim)
1768 d43=g3rim_/(dg30*drim3)
1769 sd40=1.0D0/(dg30*d_gmmcrimm)
1770 sd41=gmmcrimm__gmmm/(d_gmmcrimm3*dg30)
1779 atm3x(i)=(g3y*rimmz-g3z*rimmy)*d40
1780 & -(gmmy*rimmz-gmmz*rimmy)*d41
1781 atm3y(i)=(g3z*rimmx-g3x*rimmz)*d40
1782 & -(gmmz*rimmx-gmmx*rimmz)*d41
1783 atm3z(i)=(g3x*rimmy-g3y*rimmx)*d40
1784 & -(gmmx*rimmy-gmmy*rimmx)*d41
1785 cc**********************************************************************
1786 astm3x(i)=sd40*(g3x*rimmz**2-rimmx*rimmy*g3y
1787 & -g3z*rimmz*rimmx+rimmy**2*g3x)
1788 & -sd41*(gmmcrimm_x*(rimmz**2+rimmy**2)
1789 & -gmmcrimm_y*rimmy*rimmx-gmmcrimm_z*rimmz*rimmx)
1791 astm3y(i)=sd40*(-rimmz*rimmy*g3z+rimmx**2*g3y
1792 & -rimmx*rimmy*g3x+rimmz**2*g3y)
1793 & -sd41*(-gmmcrimm_x*rimmx*rimmy
1794 & +gmmcrimm_y*(rimmx**2+rimmz**2)-gmmcrimm_z*rimmz*rimmx)
1796 astm3z(i)=sd40*(-g3x*rimmx*rimmz+rimmy**2*g3z
1797 & +g3z*rimmx**2-rimmz*rimmy*g3y)
1798 & -sd41*(-gmmcrimm_x*rimmx*rimmz-gmmcrimm_y*rimmy*rimmz
1799 & +gmmcrimm_z*(rimmy**2+rimmx**2))
1800 cc**********************************************************************
1801 apm3x(i)=g3x*d42-rimx*d43
1802 apm3y(i)=g3y*d42-rimy*d43
1803 apm3z(i)=g3z*d42-rimz*d43
1813 gmx=rimy*riz-rimz*riy
1814 gmy=rimz*rix-rimx*riz
1815 gmz=rimx*riy-rimy*rix
1816 dgm=sqrt(gmx**2+gmy**2+gmz**2)
1820 gmmgm=gmmx*gmx+gmmy*gmy+gmmz+gmz
1821 gmmr=gmmx*rix+gmmy*riy+gmmz*riz
1822 gmcrim_x=gmy*rimz-gmz*rimy
1823 gmcrim_y=gmz*rimx-gmx*rimz
1824 gmcrim_z=gmx*rimy-gmy*rimx
1825 d_gmcrim=sqrt(gmcrim_x**2+gmcrim_y**2+gmcrim_z**2)
1826 d_gmcrim3=d_gmcrim**3
1827 gmcrim__gmm=gmmx*gmy*rimz+gmx*rimy*gmmz+rimx*gmz*gmmy
1828 & -gmmz*gmy*rimx-gmz*rimy*gmmx-rimz*gmx*gmmy
1830 if(dgm3.gt.0.0D0.and.
1831 & dgmm3.gt.0.0D0.and.dri3.gt.0.0D0
1832 & .and.d_gmcrim3.gt.0.0D0) then
1833 d30=1.0D0/(dgm*dgmm)
1834 d31=gmmgm/(dgm3*dgmm)
1835 d32=gmmgm/(dgm*dgmm3)
1836 d33=1.0D0/(dgmm*dri)
1837 d34=gmmr/(dgmm3*dri)
1838 d35=gmmr/(dgmm*dri3)
1839 sd30=1.0D0/(d_gmcrim*dgmm)
1840 sd31=gmcrim__gmm/(d_gmcrim3*dgmm)
1841 sd32=gmcrim__gmm/(d_gmcrim*dgmm3)
1854 cc**********************************************************************
1855 atmmx(i)=(ciy*gmmz-ciz*gmmy-rimmy*gmz+rimmz*gmy)*d30
1856 & -(ciy*gmz-ciz*gmy)*d31
1857 & -(gmmy*rimmz-gmmz*rimmy)*d32
1858 atmmy(i)=(ciz*gmmx-cix*gmmz-rimmz*gmx+rimmx*gmz)*d30
1859 & -(ciz*gmx-cix*gmz)*d31
1860 & -(gmmz*rimmx-gmmx*rimmz)*d32
1861 atmmz(i)=(cix*gmmy-ciy*gmmx-rimmx*gmy+rimmy*gmx)*d30
1862 & -(cix*gmy-ciy*gmx)*d31
1863 & -(gmmx*rimmy-gmmy*rimmx)*d32
1864 cc**********************************************************************
1865 astmmx(i)=sd30*(-gmmx*ciz*rimz-gmx*rimy*rimmy
1866 & +gmz*gmmy+rimx*ciy*gmmy+rimx*gmz*rimmz
1867 & +rimmy*gmy*rimx+gmmz*ciz*rimx-gmmz*gmy
1868 & -ciy*rimy*gmmx-rimz*gmx*rimmz)
1869 & -sd31*(gmcrim_x*(-ciz*rimz-ciy*rimy)
1870 & +gmcrim_y*(ciy*rimx+gmz)+gmcrim_z*(ciz*rimx-gmy))
1871 & -sd32*(gmmy*rimmz-rimmy*gmmz)
1873 astmmy(i)=sd30*(-rimmz*gmy*rimz+ciz*rimy*gmmz
1874 & +gmx*gmmz+gmx*rimy*rimmx-rimx*cix*gmmy
1875 & -rimmx*gmy*rimx+cix*rimy*gmmx-gmz*gmmx
1876 & +gmz*rimy*rimmz-rimz*ciz*gmmy)
1877 & -sd31*(gmcrim_x*(cix*rimy-gmz)
1878 & +gmcrim_y*(-cix*rimx-ciz*rimz)+gmcrim_z*(ciz*rimy+gmx))
1879 & -sd32*(-gmmx*rimmz+rimmx*gmmz)
1881 astmmz(i)=sd30*(rimmy*gmy*rimz+gmmx*cix*rimz
1882 & +gmmx*gmy-ciy*rimy*gmmz-rimx*gmz*rimmx
1883 & -gmmz*cix*rimx-gmz*rimy*rimmy-gmx*gmmy
1884 & +rimz*ciy*gmmy+rimz*gmx*rimmx)
1885 & -sd31*(gmcrim_x*(cix*rimz+gmy)
1886 & +gmcrim_y*(ciy*rimz-gmx)+gmcrim_z*(-ciy*rimy-cix*rimx))
1887 & -sd32*(gmmx*rimmy-rimmx*gmmy)
1888 cc**********************************************************************
1889 apmmx(i)=(riy*rimmz-riz*rimmy-gmmx)*d33
1890 & -(gmmy*rimmz-gmmz*rimmy)*d34
1892 apmmy(i)=(riz*rimmx-rix*rimmz-gmmy)*d33
1893 & -(gmmz*rimmx-gmmx*rimmz)*d34
1895 apmmz(i)=(rix*rimmy-riy*rimmx-gmmz)*d33
1896 & -(gmmx*rimmy-gmmy*rimmx)*d34
1900 c write(*,*) 'inside angvectors6'
1910 gx=riy*ripz-riz*ripy
1911 gy=riz*ripx-rix*ripz
1912 gz=rix*ripy-riy*ripx
1913 ggm=gmx*gx+gmy*gy+gmz*gz
1914 gmrp=gmx*ripx+gmy*ripy+gmz*ripz
1915 dg=sqrt(gx**2+gy**2+gz**2)
1921 d_gcr=sqrt(gcr_x**2+gcr_y**2+gcr_z**2)
1923 gcr__gm=gmx*gy*riz+gx*riy*gmz+rix*gz*gmy
1924 & -gmz*gy*rix-gz*riy*gmx-riz*gx*gmy
1925 if(dgm3.gt.0.0D0.and.
1926 & dg3.gt.0.0D0.and.drip.gt.0.0D0.and.d_gcr3.gt.0.0D0
1931 d23=1.0D0/(dgm*drip)
1932 d24=gmrp/(dgm3*drip)
1933 sd20=1.0D0/(d_gcr*dgm)
1934 sd21=gcr__gm/(d_gcr3*dgm)
1935 sd22=gcr__gm/(d_gcr*dgm3)
1946 atmx(i)=(ciy*gz-ciz*gy-ripy*gmz+ripz*gmy)*d20
1947 & -(ciy*gmz-ciz*gmy)*d21
1948 & +(ripy*gz-ripz*gy)*d22
1949 atmy(i)=(ciz*gx-cix*gz-ripz*gmx+ripx*gmz)*d20
1950 & -(ciz*gmx-cix*gmz)*d21
1951 & +(ripz*gx-ripx*gz)*d22
1952 atmz(i)=(cix*gy-ciy*gx-ripx*gmy+ripy*gmx)*d20
1953 & -(cix*gmy-ciy*gmx)*d21
1954 & +(ripx*gy-ripy*gx)*d22
1955 cc**********************************************************************
1956 astmx(i)=sd20*(gmx*ripz*riz+gx*riy*ciy-gz*gmy
1957 & -rix*ripy*gmy-rix*gz*ciz-ciy*gy*rix-gmz*ripz*rix
1958 & +gmz*gy+ripy*riy*gmx+riz*gx*ciz)
1959 & -sd21*(gcr_x*(ripz*riz+ripy*riy)+gcr_y*(-ripy*rix-gz)
1960 & +gcr_z*(-ripz*rix+gy))
1961 & -sd22*(-gmy*ciz+gmz*ciy)
1963 astmy(i)=sd20*(ciz*gy*riz-ripz*riy*gmz-gx*gmz-gx*riy*cix
1964 & +rix*ripx*gmy+cix*gy*rix-ripx*riy*gmx+gz*gmx-gz*riy*ciz
1966 & -sd21*(gcr_x*(-ripx*riy+gz)+gcr_y*(ripx*rix+ripz*riz)
1967 & -gcr_z*(ripz*riy+gx))
1968 & -sd22*(gmx*ciz-gmz*cix)
1970 astmz(i)=sd20*(-ciy*gy*riz-gmx*ripx*riz-gmx*gy+ripy*riy*gmz
1971 & +rix*gz*cix+gmz*ripx*rix+gz*riy*ciy+gx*gmy-riz*ripy*gmy
1973 & -sd21*(gcr_x*(-ripx*riz-gy)+gcr_y*(-ripy*riz+gx)
1974 & +gcr_z*(ripy*riy+ripx*rix))
1975 & -sd22*(-gmx*ciy+gmy*cix)
1976 cc**********************************************************************
1978 apmx(i)=(ciy*ripz-ripy*ciz)*d23
1979 & -(ciy*gmz-ciz*gmy)*d24
1980 apmy(i)=(ciz*ripx-ripz*cix)*d23
1981 & -(ciz*gmx-cix*gmz)*d24
1982 apmz(i)=(cix*ripy-ripx*ciy)*d23
1983 & -(cix*gmy-ciy*gmx)*d24
1991 c-------------------------------------------------------------------------------
1992 C---------------------------------------------------------------------------------
1993 subroutine sheetforce(nca,wshet)
1996 c this should be matched with dfa.fcm
1998 parameter(maxca=800)
1999 cc**********************************************************************
2002 integer inb,nmax,iselect
2004 c real*8 dfaexp(15001)
2006 real*8 vbeta,vbetp,vbetm
2007 real*8 shefx(maxca,12)
2008 real*8 shefy(maxca,12),shefz(maxca,12)
2009 real*8 shetfx(maxca),shetfy(maxca),shetfz(maxca)
2010 real*8 vbet(maxca,maxca)
2011 real*8 wshet(maxca,maxca)
2012 real*8 bx(maxca),by(maxca),bz(maxca)
2014 common /sheca/ bx,by,bz
2015 common /phys1/ inb,nmax,iselect
2016 common /shef/ shefx,shefy,shefz
2017 common /shee/ vbeta,vbet,vbetp,vbetm
2018 common /shetf/ shetfx,shetfy,shetfz
2035 call sheetene(nca,wshet)
2038 887 format(a,1x,i6,3x,f12.8)
2039 888 format(a,1x,i4,1x,i4,3x,f12.8)
2040 889 format(a,1x,i4,3x,f12.8)
2041 !write(2,*) 'coord : '
2043 !write(2,887) 'bx:',i,bx(i)
2044 !write(2,887) 'by:',i,by(i)
2045 !write(2,887) 'bz:',i,bz(i)
2047 !write(2,*) 'After sheetforce1'
2050 !write(2,888) 'shefx :',i,k,shefx(i,k)
2051 !write(2,888) 'shefy :',i,k,shefy(i,k)
2052 !write(2,888) 'shefz :',i,k,shefz(i,k)
2058 !write(2,*) 'After sheetforce5'
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 sheetforce6'
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 sheetforce11'
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 sheetforce12'
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 shetfx(i)=shetfx(i)+shefx(i,k)
2103 shetfy(i)=shetfy(i)+shefy(i,k)
2104 shetfz(i)=shetfz(i)+shefz(i,k)
2107 !write(2,*) 'Beta Finished'
2109 !write(2,889) 'shetfx : ',i,shetfx(i)
2110 !write(2,889) 'shetfy : ',i,shetfy(i)
2111 !write(2,889) 'shetfz : ',i,shetfz(i)
2117 c-------------------------------------------------------------------------------
2118 subroutine sheetene(nca,wshet)
2121 parameter(maxca=800)
2122 cc******************************************************************************
2124 c real*8 dfaexp(15001)
2125 real*8 dtmp1, dtmp2, dtmp3
2127 real*8 vbet(maxca,maxca)
2128 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2129 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2130 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2131 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
2132 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
2133 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
2134 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
2135 real*8 cph(maxca),cth(maxca)
2136 real*8 rx(maxca,maxca)
2137 real*8 ry(maxca,maxca),rz(maxca,maxca)
2138 real*8 bx(maxca),by(maxca),bz(maxca)
2139 real*8 dis(maxca,maxca)
2141 cc**********************************************************************
2142 real*8 astx(maxca),asty(maxca),astz(maxca)
2143 real*8 astmx(maxca),astmy(maxca),astmz(maxca)
2144 real*8 astmmx(maxca),astmmy(maxca),astmmz(maxca)
2145 real*8 astm3x(maxca),astm3y(maxca),astm3z(maxca)
2147 real*8 wshet(maxca,maxca)
2148 real*8 dp45, dm45, w_beta
2149 real*8 c00, s00, ulnex, dnex, dca,dlhb,ulhb,dshe,dldhb,uldhb
2151 integer i,ip,ipp,j,jp,jpp,inb,nmax,iselect
2153 real*8 vbeta,vbetp,vbetm,y,y1,y2,yshe1,yshe2,yy1,yy2
2155 common /sheca/ bx,by,bz
2156 common /phys1/ inb,nmax,iselect
2158 common /difvec/ rx,ry,rz
2159 common /coscos/ cph,cth
2160 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2161 & c00,s00,ulnex,dnex
2162 common /sheconst/ dp45,dm45,w_beta
2163 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2164 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
2165 common /shee/ vbeta,vbet,vbetp,vbetm
2166 common /ulang/ ulcos
2167 cc**********************************************************************
2168 common /angvt2/ astx,asty,astz,astmx,astmy,astmz,astmmx,astmmy,
2169 & astmmz,astm3x,astm3y,astm3z
2172 real*8 r_pair_mat(maxca,maxca)
2173 ci integer istrand(maxca,maxca)
2174 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
2175 ci common /shetest/ istrand,istrand_p,istrand_m
2176 common /beta_p/ r_pair_mat
2177 C-------------------------------------------------------------------------------
2181 r_pair_mat(i,j)=wshet(i,j)
2182 c write(*,*) 'r_pair_mat :',i,j,r_pair_mat(i,j)
2197 cc**********************************************************************
2198 y1=(cth(i)*c00+sth(i)*s00-1.0D0)**2
2199 & +(cth(j)*c00+sth(j)*s00-1.0D0)**2
2201 y2=(ulcos(i)-ulnex)**2+(ulcos(ip)-ulnex)**2
2202 & +(ulcos(j)-ulnex)**2+(ulcos(jp)-ulnex)**2
2215 ci if(istrand(i,j).eq.1) then
2217 yy1=-0.5d0*(dis(ip,jp)-ulhb)**2/dlhb
2218 yy2=-0.5d0*(dis(ipp,jpp)-ulhb)**2/dlhb
2221 pin1(i,j)=(rx(ip,jp)*rx(ip,ipp)+ry(ip,jp)*ry(ip,ipp)
2222 $ +rz(ip,jp)*rz(ip,ipp))/(dis(ip,jp)*dis(ip,ipp))
2223 pin2(i,j)=(rx(ip,jp)*rx(jp,jpp)+ry(ip,jp)*ry(jp,jpp)
2224 $ +rz(ip,jp)*rz(jp,jpp))/(dis(ip,jp)*dis(jp,jpp))
2225 pin3(i,j)=(rx(ipp,jpp)*rx(ip,ipp)+ry(ipp,jpp)*ry(ip,ipp)
2226 $ +rz(ipp,jpp)*rz(ip,ipp))/(dis(ipp,jpp)*dis(ip,ipp))
2227 pin4(i,j)=(rx(ipp,jpp)*rx(jp,jpp)+ry(ipp,jpp)*ry(jp,jpp)
2228 $ +rz(ipp,jpp)*rz(jp,jpp))/(dis(ipp,jpp)*dis(jp,jpp))
2230 yshe1=pin1(i,j)**2+pin2(i,j)**2
2231 yshe1=-0.5d0*yshe1/dshe
2232 yshe2=pin3(i,j)**2+pin4(i,j)**2
2233 yshe2=-0.5d0*yshe2/dshe
2235 ci if((yshe1+yshe2).ge.-4) then
2242 C write(*,*) 'rx(i,j):',i,j,rx(i,j),bx(j),bx(i)
2243 C write(*,*) 'ry(i,j):',i,j,ry(i,j),by(j),by(i)
2244 C write(*,*) 'rz(i,j):',i,j,rz(i,j),bz(j),bz(i)
2245 C write(*,*) 'dis(i,j):',i,j,dis(i,j)
2246 C write(*,*) 'rx(ip,jp):',ip,jp,bx(ip),bx(jp),rx(ip,jp)
2247 C write(*,*) 'rx(ip,ipp):',ip,ipp,bx(ip),bx(ipp),rx(ip,ipp)
2248 C write(*,*) 'pin1:',pin1(i,j)
2249 C write(*,*) 'pin2:',pin2(i,j)
2250 C write(*,*) 'pin3:',pin3(i,j)
2251 C write(*,*) 'pin4:',pin4(i,j)
2254 C write(*,*) 'yy1:',yy1
2255 C write(*,*) 'yy2:',yy2
2256 C write(*,*) 'yshe1:',yshe1
2257 C write(*,*) 'yshe2:',yshe2
2260 ci if (istrand_p(i,j).eq.1) then
2268 dtmp3 = y+yy1+yy2+yshe1+yshe2
2270 C write(*,*)'1', i,j,dtmp1,dtmp2,dtmp3
2271 C write(*,*)'2', y,yy1,yy2
2272 C write(*,*)'3', yshe1,yshe2
2274 cc if (dtmp3.le.-35.0d0) then
2275 c vbetap(i,j)=-dp45*exp(dtmp3)
2276 cc vbetap(i,j)=0.0d0
2278 c vbetap(i,j)=-dp45*dfaexp(idint(-dtmp3*1000)+1)
2279 vbetap(i,j)=-dp45*exp(dtmp3)
2282 cc if (dtmp1.le.-35.0d0) then
2283 c vbetap1(i,j)=-r_pair_mat(i+1,j+1)*exp(dtmp1)
2284 cc vbetap1(i,j)=0.0d0
2286 c vbetap1(i,j)=-r_pair_mat(i+1,j+1)
2287 c $ *dfaexp(idint(-dtmp1*1000)+1)
2288 vbetap1(i,j)=-r_pair_mat(i+1,j+1)*exp(dtmp1)
2291 cc if (dtmp2.le.-35.0d0) then
2292 C vbetap2(i,j)=-r_pair_mat(i+2,j+2)*exp(dtmp2)
2293 cc vbetap2(i,j)=0.0d0
2295 c vbetap2(i,j)=-r_pair_mat(i+2,j+2)
2296 c $ *dfaexp(idint(-dtmp2*1000)+1)
2297 vbetap2(i,j)=-r_pair_mat(i+2,j+2)*exp(dtmp2)
2300 c vbetap(i,j)=-dp45*exp(y+yy1+yy2+yshe1+yshe2)
2301 c vbetap1(i,j)=-r_pair_mat(i+1,j+1)*exp(y+yy1+yshe1)
2302 c vbetap2(i,j)=-r_pair_mat(i+2,j+2)*exp(y+yy2+yshe2)
2304 ! write(*,*) 'r_pair_mat>',i+1,j+1,r_pair_mat(i+1,j+1)
2305 ! write(*,*) 'r_pair_mat>',i+2,j+2,r_pair_mat(i+2,j+2)
2307 ci elseif (istrand_p(i,j).eq.0)then
2313 yy1=-0.5d0*(dis(ip,jpp)-ulhb)**2/dlhb
2314 yy2=-0.5d0*(dis(ipp,jp)-ulhb)**2/dlhb
2316 pina1(i,j)=(rx(ip,jpp)*rx(ip,ipp)+ry(ip,jpp)*ry(ip,ipp)
2317 $ +rz(ip,jpp)*rz(ip,ipp))/(dis(ip,jpp)*dis(ip,ipp))
2318 pina2(i,j)=(rx(ip,jpp)*rx(jp,jpp)+ry(ip,jpp)*ry(jp,jpp)
2319 $ +rz(ip,jpp)*rz(jp,jpp))/(dis(ip,jpp)*dis(jp,jpp))
2320 pina3(i,j)=(rx(jp,ipp)*rx(ip,ipp)+ry(jp,ipp)*ry(ip,ipp)
2321 $ +rz(jp,ipp)*rz(ip,ipp))/(dis(jp,ipp)*dis(ip,ipp))
2322 pina4(i,j)=(rx(jp,ipp)*rx(jp,jpp)+ry(jp,ipp)*ry(jp,jpp)
2323 $ +rz(jp,ipp)*rz(jp,jpp))/(dis(jp,ipp)*dis(jp,jpp))
2325 yshe1=pina1(i,j)**2+pina2(i,j)**2
2326 yshe1=-0.5d0*yshe1/dshe
2327 yshe2=pina3(i,j)**2+pina4(i,j)**2
2328 yshe2=-0.5d0*yshe2/dshe
2330 ci if((yshe1+yshe2).ge.-4) then
2337 C write(*,*) 'pina1:',pina1(i,j)
2338 C write(*,*) 'pina2:',pina2(i,j)
2339 C write(*,*) 'pina3:',pina3(i,j)
2340 C write(*,*) 'pina4:',pina4(i,j)
2341 C write(*,*) 'yshe1:',yshe1
2342 C write(*,*) 'yshe2:',yshe2
2343 C write(*,*) 'dshe:',dshe
2345 ci if (istrand_m(i,j).eq.1) then
2352 dtmp3=y+yy1+yy2+yshe1+yshe2
2356 cc if(dtmp3 .le. -35.0d0) then
2357 c vbetam(i,j)=-dm45*exp(dtmp3)
2358 cc vbetam(i,j)=0.0d0
2360 c vbetam(i,j)=-dm45*dfaexp(idint(-dtmp3*1000)+1)
2361 vbetam(i,j)=-dm45*exp(dtmp3)
2364 cc if(dtmp1 .le. -35.0d0) then
2365 c vbetam1(i,j)=-r_pair_mat(i+1,j+2)*exp(dtmp1)
2366 cc vbetam1(i,j)=0.0d0
2368 c vbetam1(i,j)=-r_pair_mat(i+1,j+2)
2369 c $ *dfaexp(idint(-dtmp1*1000)+1)
2370 vbetam1(i,j)=-r_pair_mat(i+1,j+2)*exp(dtmp1)
2373 cc if(dtmp2.le.-35.0d0) then
2374 c vbetam2(i,j)=-r_pair_mat(i+2,j+1)*exp(dtmp2)
2375 cc vbetam2(i,j)=0.0d0
2377 c vbetam2(i,j)=-r_pair_mat(i+2,j+1)
2378 c $ *dfaexp(idint(-dtmp2*1000)+1)
2379 vbetam2(i,j)=-r_pair_mat(i+2,j+1)*exp(dtmp2)
2382 ci elseif (istrand_m(i,j).eq.0)then
2389 c vbetam(i,j)=-dm45*exp(y+yy1+yy2+yshe1+yshe2)
2390 c vbetam1(i,j)=-r_pair_mat(i+1,j+2)*exp(y+yy1+yshe1)
2391 c vbetam2(i,j)=-r_pair_mat(i+2,j+1)*exp(y+yy2+yshe2)
2393 ! write(*,*) 'r_pair_mat>',i+1,j+2,r_pair_mat(i+1,j+2)
2394 ! write(*,*) 'r_pair_mat>',i+2,j+1,r_pair_mat(i+2,j+1)
2396 uup = vbetap(i,j)+vbetap1(i,j)+vbetap2(i,j)
2397 uum = vbetam(i,j)+vbetam1(i,j)+vbetam2(i,j)
2399 c write(*,*) 'uup,uum:', uup, uum
2401 c uup=vbetap1(i,j)+vbetap2(i,j)
2402 c uum=vbetam1(i,j)+vbetam2(i,j)
2407 vbeta=vbeta+vbet(i,j)
2409 ci elseif(istrand(i,j).eq.0)then
2413 c write(*,*) 'uup,uum:',uup,uum
2414 c write(*,*) 'vbetap(i,j):',vbetap(i,j)
2415 c write(*,*) 'vbetap1(i,j):',vbetap1(i,j)
2416 c write(*,*) 'vbetap2(i,j):',vbetap2(i,j)
2417 c write(*,*) 'vbetam(i,j):',vbetam(i,j)
2418 c write(*,*) 'vbetam1(i,j):',vbetam1(i,j)
2419 c write(*,*) 'vbetam2(i,j):',vbetam2(i,j)
2420 c write(*,*) 'uup:',uup
2421 c write(*,*) 'uum:',uum
2422 c write(*,*) 'vbetp:',vbetp
2423 c write(*,*) 'vbetm:',vbetm
2424 c write(*,*) 'vbet(i,j):',vbet(i,j)
2432 ! write(*,*) 'I,J:', i,j
2433 ! write(*,*) 'vbetap(i,j):',vbetap(i,j)
2434 ! write(*,*) 'vbetap1(i,j):',vbetap1(i,j)
2435 ! write(*,*) 'vbetap2(i,j):',vbetap2(i,j)
2436 ! write(*,*) 'vbetam(i,j):',vbetam(i,j)
2437 ! write(*,*) 'vbetam1(i,j):',vbetam1(i,j)
2438 ! write(*,*) 'vbetam2(i,j):',vbetam2(i,j)
2439 ! write(*,*) 'vbet(i,j):',vbet(i,j)
2445 c-------------------------------------------------------------------------------
2446 subroutine sheetforce1
2449 parameter(maxca=800)
2450 cc**********************************************************************
2451 real*8 vbet(maxca,maxca)
2452 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2453 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2454 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2455 real*8 cph(maxca),cth(maxca)
2456 real*8 rx(maxca,maxca)
2457 real*8 ry(maxca,maxca),rz(maxca,maxca)
2458 real*8 bx(maxca),by(maxca),bz(maxca)
2459 real*8 dis(maxca,maxca)
2460 real*8 shefx(maxca,12)
2461 real*8 shefy(maxca,12),shefz(maxca,12)
2462 real*8 atx(maxca),aty(maxca),atz(maxca)
2463 real*8 atmx(maxca),atmy(maxca),atmz(maxca)
2464 real*8 atmmx(maxca),atmmy(maxca),atmmz(maxca)
2465 real*8 atm3x(maxca),atm3y(maxca),atm3z(maxca)
2466 real*8 apx(maxca),apy(maxca),apz(maxca)
2467 real*8 apmx(maxca),apmy(maxca),apmz(maxca)
2468 real*8 apmmx(maxca),apmmy(maxca),apmmz(maxca)
2469 real*8 apm3x(maxca),apm3y(maxca),apm3z(maxca)
2471 real*8 astx(maxca),asty(maxca),astz(maxca)
2472 real*8 astmx(maxca),astmy(maxca),astmz(maxca)
2473 real*8 astmmx(maxca),astmmy(maxca),astmmz(maxca)
2474 real*8 astm3x(maxca),astm3y(maxca),astm3z(maxca)
2476 real*8 w_beta,dp45, dm45
2477 real*8 vbeta, vbetp, vbetm
2478 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
2479 $ c00,s00,ulnex,dnex
2480 integer inb,nmax,iselect
2482 common /phys1/ inb,nmax,iselect
2484 common /difvec/ rx,ry,rz
2485 common /coscos/ cph,cth
2486 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2487 $ c00,s00,ulnex,dnex
2488 common /sheconst/ dp45,dm45,w_beta
2489 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2490 common /angvt/ atx,aty,atz,atmx,atmy,atmz,atmmx,atmmy,
2491 $ atmmz,atm3x,atm3y,atm3z
2492 common /angvp/ apx,apy,apz,apmx,apmy,apmz,apmmx,apmmy,
2493 $ apmmz,apm3x,apm3y,apm3z
2494 common /shef/ shefx,shefy,shefz
2495 common /shee/ vbeta,vbet,vbetp,vbetm
2496 common /ulang/ ulcos
2497 c c**********************************************************************
2498 common /angvt2/ astx,asty,astz,astmx,astmy,astmz,astmmx,astmmy,
2499 $ astmmz,astm3x,astm3y,astm3z
2501 C--------------------------------------------------------------------------------
2503 integer i,j,im3,imm,im,ip,ipp,jm,jmm,jm3,jp,jpp
2504 real*8 c1,v1,cc1,dmm,dmm__,fx,fy,fz,c2,v2,dmm1
2505 real*8 c3,v3,cc2,cc3,dmm3,dmm3__,c4,v4,c7,v7,cc7,c8,v8,cc8
2506 real*8 c9,v9,cc9,dmm9,dmm9__,c10,v10,dmm2,dmm1__,dmm2_1,dmm2_2
2507 real*8 dmm7,dmm8,dmm7__,dmm8_1,dmm8_2
2508 C--------------------------------------------------------------------------------
2513 c1=(cth(im3)*c00+sth(im3)*s00-1)/dca
2518 cc1=(ulcos(imm)-ulnex)/dnex
2519 dmm=cc1/(dis(imm,im)*dis(im,i))
2520 dmm__=cc1*ulcos(imm)/dis(im,i)**2
2521 fx=rx(imm,im)*dmm-rx(im,i)*dmm__
2522 fy=ry(imm,im)*dmm-ry(im,i)*dmm__
2523 fz=rz(imm,im)*dmm-rz(im,i)*dmm__
2527 fx=fx+(atm3x(i)*c00+astm3x(i)*s00)*c1
2528 fy=fy+(atm3y(i)*c00+astm3y(i)*s00)*c1
2529 fz=fz+(atm3z(i)*c00+astm3z(i)*s00)*c1
2539 c2=(cth(imm)*c00+sth(imm)*s00-1)/dca
2544 cc1=(ulcos(imm)-ulnex)/dnex
2545 cc2=(ulcos(im)-ulnex)/dnex
2546 dmm1=cc1/(dis(imm,im)*dis(im,i))
2547 dmm2=cc2/(dis(im,i)*dis(i,ip))
2548 dmm1__=cc1*ulcos(imm)/dis(im,i)**2
2549 dmm2_1=cc2*ulcos(im)/dis(im,i)**2
2550 dmm2_2=cc2*ulcos(im)/dis(i,ip)**2
2551 cc**********************************************************************
2552 fx=rx(imm,im)*dmm1-rx(im,i)*dmm1__+rx(i,ip)*dmm2-rx(im,i)*dmm2
2553 $ -rx(im,i)*dmm2_1+rx(i,ip)*dmm2_2
2554 fy=ry(imm,im)*dmm1-ry(im,i)*dmm1__+ry(i,ip)*dmm2-ry(im,i)*dmm2
2555 $ -ry(im,i)*dmm2_1+ry(i,ip)*dmm2_2
2556 fz=rz(imm,im)*dmm1-rz(im,i)*dmm1__+rz(i,ip)*dmm2-rz(im,i)*dmm2
2557 $ -rz(im,i)*dmm2_1+rz(i,ip)*dmm2_2
2561 fx=fx+(atmmx(i)*c00+astmmx(i)*s00)*c2
2562 fy=fy+(atmmy(i)*c00+astmmy(i)*s00)*c2
2563 fz=fz+(atmmz(i)*c00+astmmz(i)*s00)*c2
2572 c3=(cth(im)*c00+sth(im)*s00-1)/dca
2577 cc2=(ulcos(im)-ulnex)/dnex
2578 cc3=(ulcos(i)-ulnex)/dnex
2579 dmm2=cc2/(dis(im,i)*dis(i,ip))
2580 dmm3=cc3/(dis(i,ip)*dis(ip,ipp))
2581 dmm2_1=cc2*ulcos(im)/dis(im,i)**2
2582 dmm2_2=cc2*ulcos(im)/dis(i,ip)**2
2583 dmm3__=cc3*ulcos(i)/dis(i,ip)**2
2584 fx=-rx(ip,ipp)*dmm3+rx(i,ip)*dmm2-rx(im,i)*dmm2
2585 $ -rx(im,i)*dmm2_1+rx(i,ip)*dmm2_2+rx(i,ip)*dmm3__
2586 fy=-ry(ip,ipp)*dmm3+ry(i,ip)*dmm2-ry(im,i)*dmm2
2587 $ -ry(im,i)*dmm2_1+ry(i,ip)*dmm2_2+ry(i,ip)*dmm3__
2588 fz=-rz(ip,ipp)*dmm3+rz(i,ip)*dmm2-rz(im,i)*dmm2
2589 $ -rz(im,i)*dmm2_1+rz(i,ip)*dmm2_2+rz(i,ip)*dmm3__
2593 fx=fx+(atmx(i)*c00+astmx(i)*s00)*c3
2594 fy=fy+(atmy(i)*c00+astmy(i)*s00)*c3
2595 fz=fz+(atmz(i)*c00+astmz(i)*s00)*c3
2603 c4=(cth(i)*c00+sth(i)*s00-1)/dca
2608 cc3=(ulcos(i)-ulnex)/dnex
2609 dmm3=cc3/(dis(i,ip)*dis(ip,ipp))
2610 dmm3__=cc3*ulcos(i)/dis(i,ip)**2
2611 fx=-rx(ip,ipp)*dmm3+rx(i,ip)*dmm3__
2612 fy=-ry(ip,ipp)*dmm3+ry(i,ip)*dmm3__
2613 fz=-rz(ip,ipp)*dmm3+rz(i,ip)*dmm3__
2617 fx=fx+(atx(i)*c00+astx(i)*s00)*c4
2618 fy=fy+(aty(i)*c00+asty(i)*s00)*c4
2619 fz=fz+(atz(i)*c00+astz(i)*s00)*c4
2628 c7=(cth(jm3)*c00+sth(jm3)*s00-1)/dca
2633 cc7=(ulcos(jmm)-ulnex)/dnex
2634 dmm=cc7/(dis(jmm,jm)*dis(jm,j))
2635 dmm__=cc7*ulcos(jmm)/dis(jm,j)**2
2636 fx=rx(jmm,jm)*dmm-rx(jm,j)*dmm__
2637 fy=ry(jmm,jm)*dmm-ry(jm,j)*dmm__
2638 fz=rz(jmm,jm)*dmm-rz(jm,j)*dmm__
2642 fx=fx+(atm3x(j)*c00+astm3x(j)*s00)*c7
2643 fy=fy+(atm3y(j)*c00+astm3y(j)*s00)*c7
2644 fz=fz+(atm3z(j)*c00+astm3z(j)*s00)*c7
2653 c8=(cth(jmm)*c00+sth(jmm)*s00-1)/dca
2658 cc7=(ulcos(jmm)-ulnex)/dnex
2659 cc8=(ulcos(jm)-ulnex)/dnex
2660 dmm7=cc7/(dis(jmm,jm)*dis(jm,j))
2661 dmm8=cc8/(dis(jm,j)*dis(j,jp))
2662 dmm7__=cc7*ulcos(jmm)/dis(jm,j)**2
2663 dmm8_1=cc8*ulcos(jm)/dis(jm,j)**2
2664 dmm8_2=cc8*ulcos(jm)/dis(j,jp)**2
2665 fx=rx(jmm,jm)*dmm7+rx(j,jp)*dmm8-rx(jm,j)*dmm8
2666 $ -rx(jm,j)*dmm7__-rx(jm,j)*dmm8_1+rx(j,jp)*dmm8_2
2667 fy=ry(jmm,jm)*dmm7+ry(j,jp)*dmm8-ry(jm,j)*dmm8
2668 $ -ry(jm,j)*dmm7__-ry(jm,j)*dmm8_1+ry(j,jp)*dmm8_2
2669 fz=rz(jmm,jm)*dmm7+rz(j,jp)*dmm8-rz(jm,j)*dmm8
2670 $ -rz(jm,j)*dmm7__-rz(jm,j)*dmm8_1+rz(j,jp)*dmm8_2
2674 fx=fx+(atmmx(j)*c00+astmmx(j)*s00)*c8
2675 fy=fy+(atmmy(j)*c00+astmmy(j)*s00)*c8
2676 fz=fz+(atmmz(j)*c00+astmmz(j)*s00)*c8
2686 c9=(cth(jm)*c00+sth(jm)*s00-1)/dca
2691 cc8=(ulcos(jm)-ulnex)/dnex
2692 cc9=(ulcos(j)-ulnex)/dnex
2693 dmm8=cc8/(dis(jm,j)*dis(j,jp))
2694 dmm9=cc9/(dis(j,jp)*dis(jp,jpp))
2695 dmm8_1=cc8*ulcos(jm)/dis(jm,j)**2
2696 dmm8_2=cc8*ulcos(jm)/dis(j,jp)**2
2697 dmm9__=cc9*ulcos(j)/dis(j,jp)**2
2698 fx=-rx(jp,jpp)*dmm9+rx(j,jp)*dmm8-rx(jm,j)*dmm8
2699 $ -rx(jm,j)*dmm8_1+rx(j,jp)*dmm8_2+rx(j,jp)*dmm9__
2700 fy=-ry(jp,jpp)*dmm9+ry(j,jp)*dmm8-ry(jm,j)*dmm8
2701 $ -ry(jm,j)*dmm8_1+ry(j,jp)*dmm8_2+ry(j,jp)*dmm9__
2702 fz=-rz(jp,jpp)*dmm9+rz(j,jp)*dmm8-rz(jm,j)*dmm8
2703 $ -rz(jm,j)*dmm8_1+rz(j,jp)*dmm8_2+rz(j,jp)*dmm9__
2707 fx=fx+(atmx(j)*c00+astmx(j)*s00)*c9
2708 fy=fy+(atmy(j)*c00+astmy(j)*s00)*c9
2709 fz=fz+(atmz(j)*c00+astmz(j)*s00)*c9
2718 c10=(cth(j)*c00+sth(j)*s00-1)/dca
2723 cc9=(ulcos(j)-ulnex)/dnex
2724 dmm9=cc9/(dis(j,jp)*dis(jp,jpp))
2725 dmm9__=cc9*ulcos(j)/dis(j,jp)**2
2726 fx=-rx(jp,jpp)*dmm9+rx(j,jp)*dmm9__
2727 fy=-ry(jp,jpp)*dmm9+ry(j,jp)*dmm9__
2728 fz=-rz(jp,jpp)*dmm9+rz(j,jp)*dmm9__
2732 fx=fx+(atx(j)*c00+astx(j)*s00)*c10
2733 fy=fy+(aty(j)*c00+asty(j)*s00)*c10
2734 fz=fz+(atz(j)*c00+astz(j)*s00)*c10
2742 c----------------------------------------------------------------------------
2743 subroutine sheetforce5
2746 parameter(maxca=800)
2747 cc**********************************************************************
2748 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2749 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2750 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2751 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
2752 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
2753 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
2754 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
2755 real*8 rx(maxca,maxca)
2756 real*8 ry(maxca,maxca),rz(maxca,maxca)
2757 real*8 bx(maxca),by(maxca),bz(maxca)
2758 real*8 dis(maxca,maxca)
2759 real*8 shefx(maxca,12),shefy(maxca,12)
2760 real*8 shefz(maxca,12)
2761 real*8 dp45,dm45,w_beta
2762 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
2763 $ c00,s00,ulnex,dnex
2764 integer inb,nmax,iselect
2765 cc**********************************************************************
2766 common /phys1/ inb,nmax,iselect
2768 common /difvec/ rx,ry,rz
2769 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2770 $ c00,s00,ulnex,dnex
2771 common /sheconst/ dp45,dm45,w_beta
2772 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2773 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
2774 common /shef/ shefx,shefy,shefz
2775 ci integer istrand(maxca,maxca)
2776 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
2777 ci common /shetest/ istrand,istrand_p,istrand_m
2778 c********************************************************************************
2780 integer i,imm,im,jp,jpp,j
2781 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
2782 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y,y5z
2783 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z
2784 real*8 y66x,y66y,y66z,yy6,yyy4,yyy5a,yyy5b
2785 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y,y9z
2786 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy8,yyy9a,yyy9b
2787 c********************************************************************************
2795 ci if(istrand(imm,j).eq.1
2796 ci & .and.(istrand_p(imm,j)+istrand_m(imm,j)).ge.1) then
2799 yy1=-(dis(i,jpp)-ulhb)/dlhb
2800 y1x=rx(jpp,i)/dis(i,jpp)
2801 y1y=ry(jpp,i)/dis(i,jpp)
2802 y1z=rz(jpp,i)/dis(i,jpp)
2807 yy33=1.0D0/(dis(im,jp)*dis(im,i))
2808 yyy3=pin1(imm,j)/(dis(im,i)**2)
2809 yy3=-pin1(imm,j)/dshe
2810 y3x=(yy33*rx(im,jp)-yyy3*rx(im,i))*yy3
2811 y3y=(yy33*ry(im,jp)-yyy3*ry(im,i))*yy3
2812 y3z=(yy33*rz(im,jp)-yyy3*rz(im,i))*yy3
2814 yy44=1.0D0/(dis(i,jpp)*dis(im,i))
2815 yyy4a=pin3(imm,j)/(dis(i,jpp)**2)
2816 yyy4b=pin3(imm,j)/(dis(im,i)**2)
2817 yy4=-pin3(imm,j)/dshe
2818 y4x=(yy44*(rx(i,jpp)-rx(im,i))+yyy4a*rx(i,jpp)
2819 $ -yyy4b*rx(im,i))*yy4
2820 y4y=(yy44*(ry(i,jpp)-ry(im,i))+yyy4a*ry(i,jpp)
2821 $ -yyy4b*ry(im,i))*yy4
2822 y4z=(yy44*(rz(i,jpp)-rz(im,i))+yyy4a*rz(i,jpp)
2823 $ -yyy4b*rz(im,i))*yy4
2826 yy55=1.0D0/(dis(i,jpp)*dis(jp,jpp))
2827 yyy5=pin4(imm,j)/(dis(i,jpp)**2)
2828 yy5=-pin4(imm,j)/dshe
2829 y5x=(-yy55*rx(jp,jpp)+yyy5*rx(i,jpp))*yy5
2830 y5y=(-yy55*ry(jp,jpp)+yyy5*ry(i,jpp))*yy5
2831 y5z=(-yy55*rz(jp,jpp)+yyy5*rz(i,jpp))*yy5
2844 shefx(i,5)=shefx(i,5)-sx*vbetap(imm,j)
2845 $ -sx1*vbetap1(imm,j)-sx2*vbetap2(imm,j)
2846 shefy(i,5)=shefy(i,5)-sy*vbetap(imm,j)
2847 $ -sy1*vbetap1(imm,j)-sy2*vbetap2(imm,j)
2848 shefz(i,5)=shefz(i,5)-sz*vbetap(imm,j)
2849 $ -sz1*vbetap1(imm,j)-sz2*vbetap2(imm,j)
2851 ! shefx(i,5)=shefx(i,5)
2852 ! $ -sx1*vbetap1(imm,j)-sx2*vbetap2(imm,j)
2853 ! shefy(i,5)=shefy(i,5)
2854 ! $ -sy1*vbetap1(imm,j)-sy2*vbetap2(imm,j)
2855 ! shefz(i,5)=shefz(i,5)
2856 ! $ -sz1*vbetap1(imm,j)-sz2*vbetap2(imm,j)
2858 yy6=-(dis(i,jp)-uldhb)/dldhb
2859 y6x=rx(jp,i)/dis(i,jp)
2860 y6y=ry(jp,i)/dis(i,jp)
2861 y6z=rz(jp,i)/dis(i,jp)
2866 yy88=1.0D0/(dis(im,jpp)*dis(im,i))
2867 yyy8=pina1(imm,j)/(dis(im,i)**2)
2868 yy8=-pina1(imm,j)/dshe
2869 y8x=(yy88*rx(im,jpp)-yyy8*rx(im,i))*yy8
2870 y8y=(yy88*ry(im,jpp)-yyy8*ry(im,i))*yy8
2871 y8z=(yy88*rz(im,jpp)-yyy8*rz(im,i))*yy8
2873 yy99=1.0D0/(dis(jp,i)*dis(im,i))
2874 yyy9a=pina3(imm,j)/(dis(jp,i)**2)
2875 yyy9b=pina3(imm,j)/(dis(im,i)**2)
2876 yy9=-pina3(imm,j)/dshe
2877 y9x=(yy99*(rx(jp,i)+rx(im,i))-yyy9a*rx(jp,i)
2878 $ -yyy9b*rx(im,i))*yy9
2879 y9y=(yy99*(ry(jp,i)+ry(im,i))-yyy9a*ry(jp,i)
2880 $ -yyy9b*ry(im,i))*yy9
2881 y9z=(yy99*(rz(jp,i)+rz(im,i))-yyy9a*rz(jp,i)
2882 $ -yyy9b*rz(im,i))*yy9
2884 yy1010=1.0D0/(dis(jp,i)*dis(jp,jpp))
2885 yyy10=pina4(imm,j)/(dis(jp,i)**2)
2886 yy10=-pina4(imm,j)/dshe
2887 y10x=(yy1010*rx(jp,jpp)-yyy10*rx(jp,i))*yy10
2888 y10y=(yy1010*ry(jp,jpp)-yyy10*ry(jp,i))*yy10
2889 y10z=(yy1010*rz(jp,jpp)-yyy10*rz(jp,i))*yy10
2891 sx=y66x+y8x+y9x+y10x
2892 sy=y66y+y8y+y9y+y10y
2893 sz=y66z+y8z+y9z+y10z
2902 shefx(i,5)=shefx(i,5)-sx*vbetam(imm,j)
2903 $ -sx1*vbetam1(imm,j)-sx2*vbetam2(imm,j)
2904 shefy(i,5)=shefy(i,5)-sy*vbetam(imm,j)
2905 $ -sy1*vbetam1(imm,j)-sy2*vbetam2(imm,j)
2906 shefz(i,5)=shefz(i,5)-sz*vbetam(imm,j)
2907 $ -sz1*vbetam1(imm,j)-sz2*vbetam2(imm,j)
2909 ! shefx(i,5)=shefx(i,5)
2910 ! $ -sx1*vbetam1(imm,j)-sx2*vbetam2(imm,j)
2911 ! shefy(i,5)=shefy(i,5)
2912 ! $ -sy1*vbetam1(imm,j)-sy2*vbetam2(imm,j)
2913 ! shefz(i,5)=shefz(i,5)
2914 ! $ -sz1*vbetam1(imm,j)-sz2*vbetam2(imm,j)
2923 c--------------------------------------------------------------------------c
2924 subroutine sheetforce6
2927 parameter(maxca=800)
2928 cc**********************************************************************
2929 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2930 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2931 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2932 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
2933 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
2934 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
2935 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
2936 real*8 rx(maxca,maxca)
2937 real*8 ry(maxca,maxca),rz(maxca,maxca)
2938 real*8 bx(maxca),by(maxca),bz(maxca)
2939 real*8 dis(maxca,maxca)
2940 real*8 shefx(maxca,12),shefy(maxca,12)
2941 real*8 shefz(maxca,12)
2942 real*8 dp45,dm45,w_beta
2943 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
2944 $ c00,s00,ulnex,dnex
2945 integer inb,nmax,iselect
2946 cc**********************************************************************
2947 common /phys1/ inb,nmax,iselect
2949 common /difvec/ rx,ry,rz
2950 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2951 $ c00,s00,ulnex,dnex
2952 common /sheconst/ dp45,dm45,w_beta
2953 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2954 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
2955 common /shef/ shefx,shefy,shefz
2956 ci integer istrand(maxca,maxca)
2957 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
2958 ci common /shetest/ istrand,istrand_p,istrand_m
2959 cc**********************************************************************
2961 integer i,imm,im,jp,jpp,j,ip
2962 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
2963 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y,y5z
2964 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z,y66x,y66y
2965 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y,y9z
2966 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy8,yyy9a,yyy9b,yyy4
2967 real*8 yyy3a,yyy3b,y66z,yy6,yyy5a,yyy5b
2968 C********************************************************************************
2976 ci if(istrand(im,j).eq.1
2977 ci & .and.(istrand_p(im,j)+istrand_m(im,j)).ge.1) then
2980 yy1=-(dis(i,jp)-ulhb)/dlhb
2981 y1x=rx(jp,i)/dis(i,jp)
2982 y1y=ry(jp,i)/dis(i,jp)
2983 y1z=rz(jp,i)/dis(i,jp)
2988 yy33=1.0D0/(dis(i,jp)*dis(i,ip))
2989 yyy3a=pin1(im,j)/(dis(i,jp)**2)
2990 yyy3b=pin1(im,j)/(dis(i,ip)**2)
2991 yy3=-pin1(im,j)/dshe
2992 y3x=(-yy33*(rx(i,ip)+rx(i,jp))+yyy3a*rx(i,jp)
2993 $ +yyy3b*rx(i,ip))*yy3
2994 y3y=(-yy33*(ry(i,ip)+ry(i,jp))+yyy3a*ry(i,jp)
2995 $ +yyy3b*ry(i,ip))*yy3
2996 y3z=(-yy33*(rz(i,ip)+rz(i,jp))+yyy3a*rz(i,jp)
2997 $ +yyy3b*rz(i,ip))*yy3
2999 yy44=1.0D0/(dis(i,jp)*dis(jp,jpp))
3000 yyy4=pin2(im,j)/(dis(i,jp)**2)
3001 yy4=-pin2(im,j)/dshe
3002 y4x=(-yy44*rx(jp,jpp)+yyy4*rx(i,jp))*yy4
3003 y4y=(-yy44*ry(jp,jpp)+yyy4*ry(i,jp))*yy4
3004 y4z=(-yy44*rz(jp,jpp)+yyy4*rz(i,jp))*yy4
3006 yy55=1.0D0/(dis(ip,jpp)*dis(i,ip))
3007 yyy5=pin3(im,j)/(dis(i,ip)**2)
3008 yy5=-pin3(im,j)/dshe
3009 y5x=(-yy55*rx(ip,jpp)+yyy5*rx(i,ip))*yy5
3010 y5y=(-yy55*ry(ip,jpp)+yyy5*ry(i,ip))*yy5
3011 y5z=(-yy55*rz(ip,jpp)+yyy5*rz(i,ip))*yy5
3024 shefx(i,6)=shefx(i,6)-sx*vbetap(im,j)
3025 $ -sx1*vbetap1(im,j)-sx2*vbetap2(im,j)
3026 shefy(i,6)=shefy(i,6)-sy*vbetap(im,j)
3027 $ -sy1*vbetap1(im,j)-sy2*vbetap2(im,j)
3028 shefz(i,6)=shefz(i,6)-sz*vbetap(im,j)
3029 $ -sz1*vbetap1(im,j)-sz2*vbetap2(im,j)
3030 ! shefx(i,6)=shefx(i,6)
3031 ! $ -sx1*vbetap1(im,j)-sx2*vbetap2(im,j)
3032 ! shefy(i,6)=shefy(i,6)
3033 ! $ -sy1*vbetap1(im,j)-sy2*vbetap2(im,j)
3034 ! shefz(i,6)=shefz(i,6)
3035 ! $ -sz1*vbetap1(im,j)-sz2*vbetap2(im,j)
3037 yy6=-(dis(jpp,i)-uldhb)/dldhb
3038 y6x=rx(jpp,i)/dis(jpp,i)
3039 y6y=ry(jpp,i)/dis(jpp,i)
3040 y6z=rz(jpp,i)/dis(jpp,i)
3045 yy88=1.0D0/(dis(i,jpp)*dis(i,ip))
3046 yyy8a=pina1(im,j)/(dis(i,jpp)**2)
3047 yyy8b=pina1(im,j)/(dis(i,ip)**2)
3048 yy8=-pina1(im,j)/dshe
3049 y8x=(-yy88*(rx(i,jpp)+rx(i,ip))+yyy8a*rx(i,jpp)
3050 $ +yyy8b*rx(i,ip))*yy8
3051 y8y=(-yy88*(ry(i,jpp)+ry(i,ip))+yyy8a*ry(i,jpp)
3052 $ +yyy8b*ry(i,ip))*yy8
3053 y8z=(-yy88*(rz(i,jpp)+rz(i,ip))+yyy8a*rz(i,jpp)
3054 $ +yyy8b*rz(i,ip))*yy8
3056 yy99=1.0D0/(dis(i,jpp)*dis(jp,jpp))
3057 yyy9=pina2(im,j)/(dis(i,jpp)**2)
3058 yy9=-pina2(im,j)/dshe
3059 y9x=(-yy99*rx(jp,jpp)+yyy9*rx(i,jpp))*yy9
3060 y9y=(-yy99*ry(jp,jpp)+yyy9*ry(i,jpp))*yy9
3061 y9z=(-yy99*rz(jp,jpp)+yyy9*rz(i,jpp))*yy9
3063 yy1010=1.0D0/(dis(jp,ip)*dis(i,ip))
3064 yyy10=pina3(im,j)/(dis(i,ip)**2)
3065 yy10=-pina3(im,j)/dshe
3066 y10x=(-yy1010*rx(jp,ip)+yyy10*rx(i,ip))*yy10
3067 y10y=(-yy1010*ry(jp,ip)+yyy10*ry(i,ip))*yy10
3068 y10z=(-yy1010*rz(jp,ip)+yyy10*rz(i,ip))*yy10
3070 sx=y66x+y8x+y9x+y10x
3071 sy=y66y+y8y+y9y+y10y
3072 sz=y66z+y8z+y9z+y10z
3081 shefx(i,6)=shefx(i,6)-sx*vbetam(im,j)
3082 $ -sx1*vbetam1(im,j)-sx2*vbetam2(im,j)
3083 shefy(i,6)=shefy(i,6)-sy*vbetam(im,j)
3084 $ -sy1*vbetam1(im,j)-sy2*vbetam2(im,j)
3085 shefz(i,6)=shefz(i,6)-sz*vbetam(im,j)
3086 $ -sz1*vbetam1(im,j)-sz2*vbetam2(im,j)
3088 ! shefx(i,6)=shefx(i,6)
3089 ! $ -sx1*vbetam1(im,j)-sx2*vbetam2(im,j)
3090 ! shefy(i,6)=shefy(i,6)
3091 ! $ -sy1*vbetam1(im,j)-sy2*vbetam2(im,j)
3092 ! shefz(i,6)=shefz(i,6)
3093 ! $ -sz1*vbetam1(im,j)-sz2*vbetam2(im,j)
3102 c-----------------------------------------------------------------------
3103 subroutine sheetforce11
3106 parameter(maxca=800)
3107 cc**********************************************************************
3108 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
3109 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
3110 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
3111 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
3112 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
3113 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
3114 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
3115 real*8 rx(maxca,maxca)
3116 real*8 ry(maxca,maxca),rz(maxca,maxca)
3117 real*8 bx(maxca),by(maxca),bz(maxca)
3118 real*8 dis(maxca,maxca)
3119 real*8 shefx(maxca,12),shefy(maxca,12)
3120 real*8 shefz(maxca,12)
3121 real*8 dp45,dm45,w_beta
3122 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
3123 $ c00,s00,ulnex,dnex
3124 integer inb,nmax,iselect
3125 cc**********************************************************************
3126 common /phys1/ inb,nmax,iselect
3128 common /difvec/ rx,ry,rz
3129 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
3130 $ c00,s00,ulnex,dnex
3131 common /sheconst/ dp45,dm45,w_beta
3132 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
3133 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
3134 common /shef/ shefx,shefy,shefz
3135 ci integer istrand(maxca,maxca)
3136 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
3137 ci common /shetest/ istrand,istrand_p,istrand_m
3138 C********************************************************************************
3140 integer j,jm,jmm,ip,i,ipp
3141 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
3142 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y
3143 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z,y66x,y66y
3144 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y
3145 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy4,yyy5a,yyy5b,yy6
3146 real*8 yyy9a,yyy9b,y5z,y66z,y9z,yyy8
3147 C********************************************************************************
3156 ci if(istrand(i,jmm).eq.1
3157 ci & .and.(istrand_p(i,jmm)+istrand_m(i,jmm)).ge.1) then
3160 yy1=-(dis(ipp,j)-ulhb)/dlhb
3161 y1x=rx(ipp,j)/dis(ipp,j)
3162 y1y=ry(ipp,j)/dis(ipp,j)
3163 y1z=rz(ipp,j)/dis(ipp,j)
3168 yy33=1.0D0/(dis(ip,jm)*dis(jm,j))
3169 yyy3=pin2(i,jmm)/(dis(jm,j)**2)
3170 yy3=-pin2(i,jmm)/dshe
3171 y3x=(yy33*rx(ip,jm)-yyy3*rx(jm,j))*yy3
3172 y3y=(yy33*ry(ip,jm)-yyy3*ry(jm,j))*yy3
3173 y3z=(yy33*rz(ip,jm)-yyy3*rz(jm,j))*yy3
3175 yy44=1.0D0/(dis(ipp,j)*dis(ip,ipp))
3176 yyy4=pin3(i,jmm)/(dis(ipp,j)**2)
3177 yy4=-pin3(i,jmm)/dshe
3178 y4x=(yy44*rx(ip,ipp)-yyy4*rx(ipp,j))*yy4
3179 y4y=(yy44*ry(ip,ipp)-yyy4*ry(ipp,j))*yy4
3180 y4z=(yy44*rz(ip,ipp)-yyy4*rz(ipp,j))*yy4
3182 yy55=1.0D0/(dis(ipp,j)*dis(jm,j))
3183 yyy5a=pin4(i,jmm)/(dis(ipp,j)**2)
3184 yyy5b=pin4(i,jmm)/(dis(jm,j)**2)
3185 yy5=-pin4(i,jmm)/dshe
3186 y5x=(yy55*(rx(jm,j)+rx(ipp,j))-yyy5a*rx(ipp,j)
3187 $ -yyy5b*rx(jm,j))*yy5
3188 y5y=(yy55*(ry(jm,j)+ry(ipp,j))-yyy5a*ry(ipp,j)
3189 $ -yyy5b*ry(jm,j))*yy5
3190 y5z=(yy55*(rz(jm,j)+rz(ipp,j))-yyy5a*rz(ipp,j)
3191 $ -yyy5b*rz(jm,j))*yy5
3204 shefx(j,11)=shefx(j,11)-sx*vbetap(i,jmm)
3205 $ -sx1*vbetap1(i,jmm)-sx2*vbetap2(i,jmm)
3206 shefy(j,11)=shefy(j,11)-sy*vbetap(i,jmm)
3207 $ -sy1*vbetap1(i,jmm)-sy2*vbetap2(i,jmm)
3208 shefz(j,11)=shefz(j,11)-sz*vbetap(i,jmm)
3209 $ -sz1*vbetap1(i,jmm)-sz2*vbetap2(i,jmm)
3211 ! shefx(j,11)=shefx(j,11)
3212 ! $ -sx1*vbetap1(i,jmm)-sx2*vbetap2(i,jmm)
3213 ! shefy(j,11)=shefy(j,11)
3214 ! $ -sy1*vbetap1(i,jmm)-sy2*vbetap2(i,jmm)
3215 ! shefz(j,11)=shefz(j,11)
3216 ! $ -sz1*vbetap1(i,jmm)-sz2*vbetap2(i,jmm)
3218 yy6=-(dis(ip,j)-uldhb)/dldhb
3219 y6x=rx(ip,j)/dis(ip,j)
3220 y6y=ry(ip,j)/dis(ip,j)
3221 y6z=rz(ip,j)/dis(ip,j)
3226 yy88=1.0D0/(dis(ip,j)*dis(ip,ipp))
3227 yyy8=pina1(i,jmm)/(dis(ip,j)**2)
3228 yy8=-pina1(i,jmm)/dshe
3229 y8x=(yy88*rx(ip,ipp)-yyy8*rx(ip,j))*yy8
3230 y8y=(yy88*ry(ip,ipp)-yyy8*ry(ip,j))*yy8
3231 y8z=(yy88*rz(ip,ipp)-yyy8*rz(ip,j))*yy8
3233 yy99=1.0D0/(dis(ip,j)*dis(jm,j))
3234 yyy9a=pina2(i,jmm)/(dis(ip,j)**2)
3235 yyy9b=pina2(i,jmm)/(dis(jm,j)**2)
3236 yy9=-pina2(i,jmm)/dshe
3237 y9x=(yy99*(rx(jm,j)+rx(ip,j))-yyy9a*rx(ip,j)
3238 $ -yyy9b*rx(jm,j))*yy9
3239 y9y=(yy99*(ry(jm,j)+ry(ip,j))-yyy9a*ry(ip,j)
3240 $ -yyy9b*ry(jm,j))*yy9
3241 y9z=(yy99*(rz(jm,j)+rz(ip,j))-yyy9a*rz(ip,j)
3242 $ -yyy9b*rz(jm,j))*yy9
3244 yy1010=1.0D0/(dis(jm,ipp)*dis(jm,j))
3245 yyy10=pina4(i,jmm)/(dis(jm,j)**2)
3246 yy10=-pina4(i,jmm)/dshe
3247 y10x=(yy1010*rx(jm,ipp)-yyy10*rx(jm,j))*yy10
3248 y10y=(yy1010*ry(jm,ipp)-yyy10*ry(jm,j))*yy10
3249 y10z=(yy1010*rz(jm,ipp)-yyy10*rz(jm,j))*yy10
3251 sx=y66x+y8x+y9x+y10x
3252 sy=y66y+y8y+y9y+y10y
3253 sz=y66z+y8z+y9z+y10z
3262 shefx(j,11)=shefx(j,11)-sx*vbetam(i,jmm)
3263 $ -sx1*vbetam1(i,jmm)-sx2*vbetam2(i,jmm)
3264 shefy(j,11)=shefy(j,11)-sy*vbetam(i,jmm)
3265 $ -sy1*vbetam1(i,jmm)-sy2*vbetam2(i,jmm)
3266 shefz(j,11)=shefz(j,11)-sz*vbetam(i,jmm)
3267 $ -sz1*vbetam1(i,jmm)-sz2*vbetam2(i,jmm)
3269 ! shefx(j,11)=shefx(j,11)
3270 ! $ -sx1*vbetam1(i,jmm)-sx2*vbetam2(i,jmm)
3271 ! shefy(j,11)=shefy(j,11)
3272 ! $ -sy1*vbetam1(i,jmm)-sy2*vbetam2(i,jmm)
3273 ! shefz(j,11)=shefz(j,11)
3274 ! $ -sz1*vbetam1(i,jmm)-sz2*vbetam2(i,jmm)
3283 c-----------------------------------------------------------------------
3284 subroutine sheetforce12
3287 parameter(maxca=800)
3288 cc**********************************************************************
3289 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
3290 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
3291 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
3292 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
3293 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
3294 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
3295 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
3296 real*8 rx(maxca,maxca)
3297 real*8 ry(maxca,maxca),rz(maxca,maxca)
3298 real*8 bx(maxca),by(maxca),bz(maxca)
3299 real*8 dis(maxca,maxca)
3300 real*8 shefx(maxca,12),shefy(maxca,12)
3301 real*8 shefz(maxca,12)
3302 real*8 dp45,dm45,w_beta
3303 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
3304 $ c00,s00,ulnex,dnex
3305 integer inb,nmax,iselect
3306 cc**********************************************************************
3307 common /phys1/ inb,nmax,iselect
3309 common /difvec/ rx,ry,rz
3310 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
3311 $ c00,s00,ulnex,dnex
3312 common /sheconst/ dp45,dm45,w_beta
3313 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
3314 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
3315 common /shef/ shefx,shefy,shefz
3316 ci integer istrand(maxca,maxca)
3317 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
3318 ci common /shetest/ istrand,istrand_p,istrand_m
3319 cc**********************************************************************
3321 integer j,jm,jmm,ip,i,ipp,jp
3322 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
3323 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y,y5z
3324 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z,y66x,y66y,y66z
3325 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y,y9z
3326 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy10a,yyy10b,yy6,yyy8
3327 !c*************************************************************************c
3335 ci if(istrand(i,jm).eq.1
3336 ci & .and.(istrand_p(i,jm)+istrand_m(i,jm)).ge.1) then
3339 yy1=-(dis(ip,j)-ulhb)/dlhb
3340 y1x=rx(ip,j)/dis(ip,j)
3341 y1y=ry(ip,j)/dis(ip,j)
3342 y1z=rz(ip,j)/dis(ip,j)
3347 yy33=1.0D0/(dis(ip,j)*dis(ip,ipp))
3348 yyy3=pin1(i,jm)/(dis(ip,j)**2)
3349 yy3=-pin1(i,jm)/dshe
3350 y3x=(yy33*rx(ip,ipp)-yyy3*rx(ip,j))*yy3
3351 y3y=(yy33*ry(ip,ipp)-yyy3*ry(ip,j))*yy3
3352 y3z=(yy33*rz(ip,ipp)-yyy3*rz(ip,j))*yy3
3353 yy44=1.0D0/(dis(ip,j)*dis(j,jp))
3355 yyy4a=pin2(i,jm)/(dis(ip,j)**2)
3356 yyy4b=pin2(i,jm)/(dis(j,jp)**2)
3357 yy4=-pin2(i,jm)/dshe
3358 y4x=(yy44*(rx(j,jp)-rx(ip,j))-yyy4a*rx(ip,j)
3359 $ +yyy4b*rx(j,jp))*yy4
3360 y4y=(yy44*(ry(j,jp)-ry(ip,j))-yyy4a*ry(ip,j)
3361 $ +yyy4b*ry(j,jp))*yy4
3362 y4z=(yy44*(rz(j,jp)-rz(ip,j))-yyy4a*rz(ip,j)
3363 $ +yyy4b*rz(j,jp))*yy4
3365 yy55=1.0D0/(dis(ipp,jp)*dis(j,jp))
3366 yyy5=pin4(i,jm)/(dis(j,jp)**2)
3367 yy5=-pin4(i,jm)/dshe
3368 y5x=(-yy55*rx(ipp,jp)+yyy5*rx(j,jp))*yy5
3369 y5y=(-yy55*ry(ipp,jp)+yyy5*ry(j,jp))*yy5
3370 y5z=(-yy55*rz(ipp,jp)+yyy5*rz(j,jp))*yy5
3383 shefx(j,12)=shefx(j,12)-sx*vbetap(i,jm)
3384 $ -sx1*vbetap1(i,jm)-sx2*vbetap2(i,jm)
3385 shefy(j,12)=shefy(j,12)-sy*vbetap(i,jm)
3386 $ -sy1*vbetap1(i,jm)-sy2*vbetap2(i,jm)
3387 shefz(j,12)=shefz(j,12)-sz*vbetap(i,jm)
3388 $ -sz1*vbetap1(i,jm)-sz2*vbetap2(i,jm)
3390 ! shefx(j,12)=shefx(j,12)
3391 ! $ -sx1*vbetap1(i,jm)-sx2*vbetap2(i,jm)
3392 ! shefy(j,12)=shefy(j,12)
3393 ! $ -sy1*vbetap1(i,jm)-sy2*vbetap2(i,jm)
3394 ! shefz(j,12)=shefz(j,12)
3395 ! $ -sz1*vbetap1(i,jm)-sz2*vbetap2(i,jm)
3397 yy6=-(dis(ipp,j)-uldhb)/dldhb
3398 y6x=rx(ipp,j)/dis(ipp,j)
3399 y6y=ry(ipp,j)/dis(ipp,j)
3400 y6z=rz(ipp,j)/dis(ipp,j)
3405 yy88=1.0D0/(dis(ip,jp)*dis(j,jp))
3406 yyy8=pina2(i,jm)/(dis(j,jp)**2)
3407 yy8=-pina2(i,jm)/dshe
3408 y8x=(-yy88*rx(ip,jp)+yyy8*rx(j,jp))*yy8
3409 y8y=(-yy88*ry(ip,jp)+yyy8*ry(j,jp))*yy8
3410 y8z=(-yy88*rz(ip,jp)+yyy8*rz(j,jp))*yy8
3412 yy99=1.0D0/(dis(j,ipp)*dis(ip,ipp))
3413 yyy9=pina3(i,jm)/(dis(j,ipp)**2)
3414 yy9=-pina3(i,jm)/dshe
3415 y9x=(-yy99*rx(ip,ipp)+yyy9*rx(j,ipp))*yy9
3416 y9y=(-yy99*ry(ip,ipp)+yyy9*ry(j,ipp))*yy9
3417 y9z=(-yy99*rz(ip,ipp)+yyy9*rz(j,ipp))*yy9
3419 yy1010=1.0D0/(dis(j,ipp)*dis(j,jp))
3420 yyy10a=pina4(i,jm)/(dis(j,ipp)**2)
3421 yyy10b=pina4(i,jm)/(dis(j,jp)**2)
3422 yy10=-pina4(i,jm)/dshe
3423 y10x=(-yy1010*(rx(j,ipp)+rx(j,jp))+yyy10a*rx(j,ipp)
3424 $ +yyy10b*rx(j,jp))*yy10
3425 y10y=(-yy1010*(ry(j,ipp)+ry(j,jp))+yyy10a*ry(j,ipp)
3426 $ +yyy10b*ry(j,jp))*yy10
3427 y10z=(-yy1010*(rz(j,ipp)+rz(j,jp))+yyy10a*rz(j,ipp)
3428 $ +yyy10b*rz(j,jp))*yy10
3430 sx=y66x+y8x+y9x+y10x
3431 sy=y66y+y8y+y9y+y10y
3432 sz=y66z+y8z+y9z+y10z
3441 shefx(j,12)=shefx(j,12)-sx*vbetam(i,jm)
3442 $ -sx1*vbetam1(i,jm)-sx2*vbetam2(i,jm)
3443 shefy(j,12)=shefy(j,12)-sy*vbetam(i,jm)
3444 $ -sy1*vbetam1(i,jm)-sy2*vbetam2(i,jm)
3445 shefz(j,12)=shefz(j,12)-sz*vbetam(i,jm)
3446 $ -sz1*vbetam1(i,jm)-sz2*vbetam2(i,jm)
3455 C===============================================================================