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 c bx=0.0d0;by=0.0d0;bz=0.0d0
1039 c 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 real*8 dfa_cutoff,dfa_cutoff_delta
2123 parameter(dfa_cutoff=15.5d0)
2124 parameter(dfa_cutoff_delta=0.5d0)
2125 cc******************************************************************************
2127 c real*8 dfaexp(15001)
2128 real*8 dtmp1, dtmp2, dtmp3
2130 real*8 vbet(maxca,maxca)
2131 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2132 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2133 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2134 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
2135 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
2136 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
2137 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
2138 real*8 cph(maxca),cth(maxca)
2139 real*8 rx(maxca,maxca)
2140 real*8 ry(maxca,maxca),rz(maxca,maxca)
2141 real*8 bx(maxca),by(maxca),bz(maxca)
2142 real*8 dis(maxca,maxca)
2144 cc**********************************************************************
2145 real*8 astx(maxca),asty(maxca),astz(maxca)
2146 real*8 astmx(maxca),astmy(maxca),astmz(maxca)
2147 real*8 astmmx(maxca),astmmy(maxca),astmmz(maxca)
2148 real*8 astm3x(maxca),astm3y(maxca),astm3z(maxca)
2150 real*8 wshet(maxca,maxca)
2151 real*8 dp45, dm45, w_beta
2152 real*8 c00, s00, ulnex, dnex, dca,dlhb,ulhb,dshe,dldhb,uldhb
2154 integer i,ip,ipp,j,jp,jpp,inb,nmax,iselect
2156 real*8 vbeta,vbetp,vbetm,y,y1,y2,yshe1,yshe2,yy1,yy2
2158 real*8 shetfx(maxca),shetfy(maxca),shetfz(maxca)
2159 common /shetf/ shetfx,shetfy,shetfz
2161 common /sheca/ bx,by,bz
2162 common /phys1/ inb,nmax,iselect
2164 common /difvec/ rx,ry,rz
2165 common /coscos/ cph,cth
2166 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2167 & c00,s00,ulnex,dnex
2168 common /sheconst/ dp45,dm45,w_beta
2169 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2170 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
2171 common /shee/ vbeta,vbet,vbetp,vbetm
2172 common /ulang/ ulcos
2173 cc**********************************************************************
2174 common /angvt2/ astx,asty,astz,astmx,astmy,astmz,astmmx,astmmy,
2175 & astmmz,astm3x,astm3y,astm3z
2178 real*8 r_pair_mat(maxca,maxca)
2179 real*8 e_gcont,fprim_gcont,de_gcont
2180 ci integer istrand(maxca,maxca)
2181 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
2182 ci common /shetest/ istrand,istrand_p,istrand_m
2183 common /beta_p/ r_pair_mat
2184 C-------------------------------------------------------------------------------
2188 r_pair_mat(i,j)=wshet(i,j)
2189 c write(*,*) 'r_pair_mat :',i,j,r_pair_mat(i,j)
2201 if (dis(i,j).lt.dfa_cutoff) then
2202 call gcont(dis(i,j),dfa_cutoff-dfa_cutoff_delta,1.0D0,
2203 & dfa_cutoff_delta,e_gcont,fprim_gcont)
2210 cc**********************************************************************
2211 y1=(cth(i)*c00+sth(i)*s00-1.0D0)**2
2212 & +(cth(j)*c00+sth(j)*s00-1.0D0)**2
2214 y2=(ulcos(i)-ulnex)**2+(ulcos(ip)-ulnex)**2
2215 & +(ulcos(j)-ulnex)**2+(ulcos(jp)-ulnex)**2
2228 ci if(istrand(i,j).eq.1) then
2230 yy1=-0.5d0*(dis(ip,jp)-ulhb)**2/dlhb
2231 yy2=-0.5d0*(dis(ipp,jpp)-ulhb)**2/dlhb
2234 pin1(i,j)=(rx(ip,jp)*rx(ip,ipp)+ry(ip,jp)*ry(ip,ipp)
2235 $ +rz(ip,jp)*rz(ip,ipp))/(dis(ip,jp)*dis(ip,ipp))
2236 pin2(i,j)=(rx(ip,jp)*rx(jp,jpp)+ry(ip,jp)*ry(jp,jpp)
2237 $ +rz(ip,jp)*rz(jp,jpp))/(dis(ip,jp)*dis(jp,jpp))
2238 pin3(i,j)=(rx(ipp,jpp)*rx(ip,ipp)+ry(ipp,jpp)*ry(ip,ipp)
2239 $ +rz(ipp,jpp)*rz(ip,ipp))/(dis(ipp,jpp)*dis(ip,ipp))
2240 pin4(i,j)=(rx(ipp,jpp)*rx(jp,jpp)+ry(ipp,jpp)*ry(jp,jpp)
2241 $ +rz(ipp,jpp)*rz(jp,jpp))/(dis(ipp,jpp)*dis(jp,jpp))
2243 yshe1=pin1(i,j)**2+pin2(i,j)**2
2244 yshe1=-0.5d0*yshe1/dshe
2245 yshe2=pin3(i,j)**2+pin4(i,j)**2
2246 yshe2=-0.5d0*yshe2/dshe
2248 ci if((yshe1+yshe2).ge.-4) then
2255 C write(*,*) 'rx(i,j):',i,j,rx(i,j),bx(j),bx(i)
2256 C write(*,*) 'ry(i,j):',i,j,ry(i,j),by(j),by(i)
2257 C write(*,*) 'rz(i,j):',i,j,rz(i,j),bz(j),bz(i)
2258 C write(*,*) 'dis(i,j):',i,j,dis(i,j)
2259 C write(*,*) 'rx(ip,jp):',ip,jp,bx(ip),bx(jp),rx(ip,jp)
2260 C write(*,*) 'rx(ip,ipp):',ip,ipp,bx(ip),bx(ipp),rx(ip,ipp)
2261 C write(*,*) 'pin1:',pin1(i,j)
2262 C write(*,*) 'pin2:',pin2(i,j)
2263 C write(*,*) 'pin3:',pin3(i,j)
2264 C write(*,*) 'pin4:',pin4(i,j)
2267 C write(*,*) 'yy1:',yy1
2268 C write(*,*) 'yy2:',yy2
2269 C write(*,*) 'yshe1:',yshe1
2270 C write(*,*) 'yshe2:',yshe2
2273 ci if (istrand_p(i,j).eq.1) then
2281 dtmp3 = y+yy1+yy2+yshe1+yshe2
2283 C write(*,*)'1', i,j,dtmp1,dtmp2,dtmp3
2284 C write(*,*)'2', y,yy1,yy2
2285 C write(*,*)'3', yshe1,yshe2
2287 cc if (dtmp3.le.-35.0d0) then
2288 c vbetap(i,j)=-dp45*exp(dtmp3)
2289 cc vbetap(i,j)=0.0d0
2291 c vbetap(i,j)=-dp45*dfaexp(idint(-dtmp3*1000)+1)
2292 vbetap(i,j)=-dp45*exp(dtmp3)
2295 cc if (dtmp1.le.-35.0d0) then
2296 c vbetap1(i,j)=-r_pair_mat(i+1,j+1)*exp(dtmp1)
2297 cc vbetap1(i,j)=0.0d0
2299 c vbetap1(i,j)=-r_pair_mat(i+1,j+1)
2300 c $ *dfaexp(idint(-dtmp1*1000)+1)
2301 vbetap1(i,j)=-r_pair_mat(i+1,j+1)*exp(dtmp1)
2304 cc if (dtmp2.le.-35.0d0) then
2305 C vbetap2(i,j)=-r_pair_mat(i+2,j+2)*exp(dtmp2)
2306 cc vbetap2(i,j)=0.0d0
2308 c vbetap2(i,j)=-r_pair_mat(i+2,j+2)
2309 c $ *dfaexp(idint(-dtmp2*1000)+1)
2310 vbetap2(i,j)=-r_pair_mat(i+2,j+2)*exp(dtmp2)
2313 c vbetap(i,j)=-dp45*exp(y+yy1+yy2+yshe1+yshe2)
2314 c vbetap1(i,j)=-r_pair_mat(i+1,j+1)*exp(y+yy1+yshe1)
2315 c vbetap2(i,j)=-r_pair_mat(i+2,j+2)*exp(y+yy2+yshe2)
2317 ! write(*,*) 'r_pair_mat>',i+1,j+1,r_pair_mat(i+1,j+1)
2318 ! write(*,*) 'r_pair_mat>',i+2,j+2,r_pair_mat(i+2,j+2)
2320 ci elseif (istrand_p(i,j).eq.0)then
2326 yy1=-0.5d0*(dis(ip,jpp)-ulhb)**2/dlhb
2327 yy2=-0.5d0*(dis(ipp,jp)-ulhb)**2/dlhb
2329 pina1(i,j)=(rx(ip,jpp)*rx(ip,ipp)+ry(ip,jpp)*ry(ip,ipp)
2330 $ +rz(ip,jpp)*rz(ip,ipp))/(dis(ip,jpp)*dis(ip,ipp))
2331 pina2(i,j)=(rx(ip,jpp)*rx(jp,jpp)+ry(ip,jpp)*ry(jp,jpp)
2332 $ +rz(ip,jpp)*rz(jp,jpp))/(dis(ip,jpp)*dis(jp,jpp))
2333 pina3(i,j)=(rx(jp,ipp)*rx(ip,ipp)+ry(jp,ipp)*ry(ip,ipp)
2334 $ +rz(jp,ipp)*rz(ip,ipp))/(dis(jp,ipp)*dis(ip,ipp))
2335 pina4(i,j)=(rx(jp,ipp)*rx(jp,jpp)+ry(jp,ipp)*ry(jp,jpp)
2336 $ +rz(jp,ipp)*rz(jp,jpp))/(dis(jp,ipp)*dis(jp,jpp))
2338 yshe1=pina1(i,j)**2+pina2(i,j)**2
2339 yshe1=-0.5d0*yshe1/dshe
2340 yshe2=pina3(i,j)**2+pina4(i,j)**2
2341 yshe2=-0.5d0*yshe2/dshe
2343 ci if((yshe1+yshe2).ge.-4) then
2350 C write(*,*) 'pina1:',pina1(i,j)
2351 C write(*,*) 'pina2:',pina2(i,j)
2352 C write(*,*) 'pina3:',pina3(i,j)
2353 C write(*,*) 'pina4:',pina4(i,j)
2354 C write(*,*) 'yshe1:',yshe1
2355 C write(*,*) 'yshe2:',yshe2
2356 C write(*,*) 'dshe:',dshe
2358 ci if (istrand_m(i,j).eq.1) then
2365 dtmp3=y+yy1+yy2+yshe1+yshe2
2369 cc if(dtmp3 .le. -35.0d0) then
2370 c vbetam(i,j)=-dm45*exp(dtmp3)
2371 cc vbetam(i,j)=0.0d0
2373 c vbetam(i,j)=-dm45*dfaexp(idint(-dtmp3*1000)+1)
2374 vbetam(i,j)=-dm45*exp(dtmp3)
2377 cc if(dtmp1 .le. -35.0d0) then
2378 c vbetam1(i,j)=-r_pair_mat(i+1,j+2)*exp(dtmp1)
2379 cc vbetam1(i,j)=0.0d0
2381 c vbetam1(i,j)=-r_pair_mat(i+1,j+2)
2382 c $ *dfaexp(idint(-dtmp1*1000)+1)
2383 vbetam1(i,j)=-r_pair_mat(i+1,j+2)*exp(dtmp1)
2386 cc if(dtmp2.le.-35.0d0) then
2387 c vbetam2(i,j)=-r_pair_mat(i+2,j+1)*exp(dtmp2)
2388 cc vbetam2(i,j)=0.0d0
2390 c vbetam2(i,j)=-r_pair_mat(i+2,j+1)
2391 c $ *dfaexp(idint(-dtmp2*1000)+1)
2392 vbetam2(i,j)=-r_pair_mat(i+2,j+1)*exp(dtmp2)
2395 ci elseif (istrand_m(i,j).eq.0)then
2402 c vbetam(i,j)=-dm45*exp(y+yy1+yy2+yshe1+yshe2)
2403 c vbetam1(i,j)=-r_pair_mat(i+1,j+2)*exp(y+yy1+yshe1)
2404 c vbetam2(i,j)=-r_pair_mat(i+2,j+1)*exp(y+yy2+yshe2)
2406 ! write(*,*) 'r_pair_mat>',i+1,j+2,r_pair_mat(i+1,j+2)
2407 ! write(*,*) 'r_pair_mat>',i+2,j+1,r_pair_mat(i+2,j+1)
2409 uup = vbetap(i,j)+vbetap1(i,j)+vbetap2(i,j)
2410 uum = vbetam(i,j)+vbetam1(i,j)+vbetam2(i,j)
2412 c write(*,*) 'uup,uum:', uup, uum
2414 c uup=vbetap1(i,j)+vbetap2(i,j)
2415 c uum=vbetam1(i,j)+vbetam2(i,j)
2420 vbeta=vbeta+vbet(i,j)*e_gcont
2423 if (dis(i,j) .ge. dfa_cutoff-2*dfa_cutoff_delta) then
2424 c gradient correction from gcont
2425 de_gcont=vbet(i,j)*fprim_gcont/dis(i,j)
2426 shetfx(i)=shetfx(i) + de_gcont*rx(i,j)
2427 shetfy(i)=shetfy(i) + de_gcont*ry(i,j)
2428 shetfz(i)=shetfz(i) + de_gcont*rz(i,j)
2430 shetfx(j)=shetfx(j) - de_gcont*rx(i,j)
2431 shetfy(j)=shetfy(j) - de_gcont*ry(i,j)
2432 shetfz(j)=shetfz(j) - de_gcont*rz(i,j)
2434 c energy correction from gcont
2435 vbet(i,j)=vbet(i,j)*e_gcont
2436 vbetap(i,j)=vbetap(i,j)*e_gcont
2437 vbetap1(i,j)=vbetap1(i,j)*e_gcont
2438 vbetap2(i,j)=vbetap2(i,j)*e_gcont
2439 vbetam(i,j)=vbetam(i,j)*e_gcont
2440 vbetam1(i,j)=vbetam1(i,j)*e_gcont
2441 vbetam2(i,j)=vbetam2(i,j)*e_gcont
2445 ci elseif(istrand(i,j).eq.0)then
2449 c write(*,*) 'uup,uum:',uup,uum
2450 c write(*,*) 'vbetap(i,j):',vbetap(i,j)
2451 c write(*,*) 'vbetap1(i,j):',vbetap1(i,j)
2452 c write(*,*) 'vbetap2(i,j):',vbetap2(i,j)
2453 c write(*,*) 'vbetam(i,j):',vbetam(i,j)
2454 c write(*,*) 'vbetam1(i,j):',vbetam1(i,j)
2455 c write(*,*) 'vbetam2(i,j):',vbetam2(i,j)
2456 c write(*,*) 'uup:',uup
2457 c write(*,*) 'uum:',uum
2458 c write(*,*) 'vbetp:',vbetp
2459 c write(*,*) 'vbetm:',vbetm
2460 c write(*,*) 'vbet(i,j):',vbet(i,j)
2477 ! write(*,*) 'I,J:', i,j
2478 ! write(*,*) 'vbetap(i,j):',vbetap(i,j)
2479 ! write(*,*) 'vbetap1(i,j):',vbetap1(i,j)
2480 ! write(*,*) 'vbetap2(i,j):',vbetap2(i,j)
2481 ! write(*,*) 'vbetam(i,j):',vbetam(i,j)
2482 ! write(*,*) 'vbetam1(i,j):',vbetam1(i,j)
2483 ! write(*,*) 'vbetam2(i,j):',vbetam2(i,j)
2484 ! write(*,*) 'vbet(i,j):',vbet(i,j)
2490 c-------------------------------------------------------------------------------
2491 subroutine sheetforce1
2494 parameter(maxca=800)
2495 real*8 dfa_cutoff,dfa_cutoff_delta
2496 parameter(dfa_cutoff=15.5d0)
2497 parameter(dfa_cutoff_delta=0.5d0)
2498 cc**********************************************************************
2499 real*8 vbet(maxca,maxca)
2500 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2501 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2502 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2503 real*8 cph(maxca),cth(maxca)
2504 real*8 rx(maxca,maxca)
2505 real*8 ry(maxca,maxca),rz(maxca,maxca)
2506 real*8 bx(maxca),by(maxca),bz(maxca)
2507 real*8 dis(maxca,maxca)
2508 real*8 shefx(maxca,12)
2509 real*8 shefy(maxca,12),shefz(maxca,12)
2510 real*8 atx(maxca),aty(maxca),atz(maxca)
2511 real*8 atmx(maxca),atmy(maxca),atmz(maxca)
2512 real*8 atmmx(maxca),atmmy(maxca),atmmz(maxca)
2513 real*8 atm3x(maxca),atm3y(maxca),atm3z(maxca)
2514 real*8 apx(maxca),apy(maxca),apz(maxca)
2515 real*8 apmx(maxca),apmy(maxca),apmz(maxca)
2516 real*8 apmmx(maxca),apmmy(maxca),apmmz(maxca)
2517 real*8 apm3x(maxca),apm3y(maxca),apm3z(maxca)
2519 real*8 astx(maxca),asty(maxca),astz(maxca)
2520 real*8 astmx(maxca),astmy(maxca),astmz(maxca)
2521 real*8 astmmx(maxca),astmmy(maxca),astmmz(maxca)
2522 real*8 astm3x(maxca),astm3y(maxca),astm3z(maxca)
2524 real*8 w_beta,dp45, dm45
2525 real*8 vbeta, vbetp, vbetm
2526 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
2527 $ c00,s00,ulnex,dnex
2528 integer inb,nmax,iselect
2530 common /phys1/ inb,nmax,iselect
2532 common /difvec/ rx,ry,rz
2533 common /coscos/ cph,cth
2534 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2535 $ c00,s00,ulnex,dnex
2536 common /sheconst/ dp45,dm45,w_beta
2537 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2538 common /angvt/ atx,aty,atz,atmx,atmy,atmz,atmmx,atmmy,
2539 $ atmmz,atm3x,atm3y,atm3z
2540 common /angvp/ apx,apy,apz,apmx,apmy,apmz,apmmx,apmmy,
2541 $ apmmz,apm3x,apm3y,apm3z
2542 common /shef/ shefx,shefy,shefz
2543 common /shee/ vbeta,vbet,vbetp,vbetm
2544 common /ulang/ ulcos
2545 c c**********************************************************************
2546 common /angvt2/ astx,asty,astz,astmx,astmy,astmz,astmmx,astmmy,
2547 $ astmmz,astm3x,astm3y,astm3z
2549 C--------------------------------------------------------------------------------
2551 integer i,j,im3,imm,im,ip,ipp,jm,jmm,jm3,jp,jpp
2552 real*8 c1,v1,cc1,dmm,dmm__,fx,fy,fz,c2,v2,dmm1
2553 real*8 c3,v3,cc2,cc3,dmm3,dmm3__,c4,v4,c7,v7,cc7,c8,v8,cc8
2554 real*8 c9,v9,cc9,dmm9,dmm9__,c10,v10,dmm2,dmm1__,dmm2_1,dmm2_2
2555 real*8 dmm7,dmm8,dmm7__,dmm8_1,dmm8_2
2556 real*8 e_gcont,fprim_gcont
2557 C--------------------------------------------------------------------------------
2562 c1=(cth(im3)*c00+sth(im3)*s00-1)/dca
2567 cc1=(ulcos(imm)-ulnex)/dnex
2568 dmm=cc1/(dis(imm,im)*dis(im,i))
2569 dmm__=cc1*ulcos(imm)/dis(im,i)**2
2570 fx=rx(imm,im)*dmm-rx(im,i)*dmm__
2571 fy=ry(imm,im)*dmm-ry(im,i)*dmm__
2572 fz=rz(imm,im)*dmm-rz(im,i)*dmm__
2576 fx=fx+(atm3x(i)*c00+astm3x(i)*s00)*c1
2577 fy=fy+(atm3y(i)*c00+astm3y(i)*s00)*c1
2578 fz=fz+(atm3z(i)*c00+astm3z(i)*s00)*c1
2588 c2=(cth(imm)*c00+sth(imm)*s00-1)/dca
2593 cc1=(ulcos(imm)-ulnex)/dnex
2594 cc2=(ulcos(im)-ulnex)/dnex
2595 dmm1=cc1/(dis(imm,im)*dis(im,i))
2596 dmm2=cc2/(dis(im,i)*dis(i,ip))
2597 dmm1__=cc1*ulcos(imm)/dis(im,i)**2
2598 dmm2_1=cc2*ulcos(im)/dis(im,i)**2
2599 dmm2_2=cc2*ulcos(im)/dis(i,ip)**2
2600 cc**********************************************************************
2601 fx=rx(imm,im)*dmm1-rx(im,i)*dmm1__+rx(i,ip)*dmm2-rx(im,i)*dmm2
2602 $ -rx(im,i)*dmm2_1+rx(i,ip)*dmm2_2
2603 fy=ry(imm,im)*dmm1-ry(im,i)*dmm1__+ry(i,ip)*dmm2-ry(im,i)*dmm2
2604 $ -ry(im,i)*dmm2_1+ry(i,ip)*dmm2_2
2605 fz=rz(imm,im)*dmm1-rz(im,i)*dmm1__+rz(i,ip)*dmm2-rz(im,i)*dmm2
2606 $ -rz(im,i)*dmm2_1+rz(i,ip)*dmm2_2
2610 fx=fx+(atmmx(i)*c00+astmmx(i)*s00)*c2
2611 fy=fy+(atmmy(i)*c00+astmmy(i)*s00)*c2
2612 fz=fz+(atmmz(i)*c00+astmmz(i)*s00)*c2
2621 c3=(cth(im)*c00+sth(im)*s00-1)/dca
2626 cc2=(ulcos(im)-ulnex)/dnex
2627 cc3=(ulcos(i)-ulnex)/dnex
2628 dmm2=cc2/(dis(im,i)*dis(i,ip))
2629 dmm3=cc3/(dis(i,ip)*dis(ip,ipp))
2630 dmm2_1=cc2*ulcos(im)/dis(im,i)**2
2631 dmm2_2=cc2*ulcos(im)/dis(i,ip)**2
2632 dmm3__=cc3*ulcos(i)/dis(i,ip)**2
2633 fx=-rx(ip,ipp)*dmm3+rx(i,ip)*dmm2-rx(im,i)*dmm2
2634 $ -rx(im,i)*dmm2_1+rx(i,ip)*dmm2_2+rx(i,ip)*dmm3__
2635 fy=-ry(ip,ipp)*dmm3+ry(i,ip)*dmm2-ry(im,i)*dmm2
2636 $ -ry(im,i)*dmm2_1+ry(i,ip)*dmm2_2+ry(i,ip)*dmm3__
2637 fz=-rz(ip,ipp)*dmm3+rz(i,ip)*dmm2-rz(im,i)*dmm2
2638 $ -rz(im,i)*dmm2_1+rz(i,ip)*dmm2_2+rz(i,ip)*dmm3__
2642 fx=fx+(atmx(i)*c00+astmx(i)*s00)*c3
2643 fy=fy+(atmy(i)*c00+astmy(i)*s00)*c3
2644 fz=fz+(atmz(i)*c00+astmz(i)*s00)*c3
2652 c4=(cth(i)*c00+sth(i)*s00-1)/dca
2657 cc3=(ulcos(i)-ulnex)/dnex
2658 dmm3=cc3/(dis(i,ip)*dis(ip,ipp))
2659 dmm3__=cc3*ulcos(i)/dis(i,ip)**2
2660 fx=-rx(ip,ipp)*dmm3+rx(i,ip)*dmm3__
2661 fy=-ry(ip,ipp)*dmm3+ry(i,ip)*dmm3__
2662 fz=-rz(ip,ipp)*dmm3+rz(i,ip)*dmm3__
2666 fx=fx+(atx(i)*c00+astx(i)*s00)*c4
2667 fy=fy+(aty(i)*c00+asty(i)*s00)*c4
2668 fz=fz+(atz(i)*c00+astz(i)*s00)*c4
2677 c7=(cth(jm3)*c00+sth(jm3)*s00-1)/dca
2682 cc7=(ulcos(jmm)-ulnex)/dnex
2683 dmm=cc7/(dis(jmm,jm)*dis(jm,j))
2684 dmm__=cc7*ulcos(jmm)/dis(jm,j)**2
2685 fx=rx(jmm,jm)*dmm-rx(jm,j)*dmm__
2686 fy=ry(jmm,jm)*dmm-ry(jm,j)*dmm__
2687 fz=rz(jmm,jm)*dmm-rz(jm,j)*dmm__
2691 fx=fx+(atm3x(j)*c00+astm3x(j)*s00)*c7
2692 fy=fy+(atm3y(j)*c00+astm3y(j)*s00)*c7
2693 fz=fz+(atm3z(j)*c00+astm3z(j)*s00)*c7
2702 c8=(cth(jmm)*c00+sth(jmm)*s00-1)/dca
2707 cc7=(ulcos(jmm)-ulnex)/dnex
2708 cc8=(ulcos(jm)-ulnex)/dnex
2709 dmm7=cc7/(dis(jmm,jm)*dis(jm,j))
2710 dmm8=cc8/(dis(jm,j)*dis(j,jp))
2711 dmm7__=cc7*ulcos(jmm)/dis(jm,j)**2
2712 dmm8_1=cc8*ulcos(jm)/dis(jm,j)**2
2713 dmm8_2=cc8*ulcos(jm)/dis(j,jp)**2
2714 fx=rx(jmm,jm)*dmm7+rx(j,jp)*dmm8-rx(jm,j)*dmm8
2715 $ -rx(jm,j)*dmm7__-rx(jm,j)*dmm8_1+rx(j,jp)*dmm8_2
2716 fy=ry(jmm,jm)*dmm7+ry(j,jp)*dmm8-ry(jm,j)*dmm8
2717 $ -ry(jm,j)*dmm7__-ry(jm,j)*dmm8_1+ry(j,jp)*dmm8_2
2718 fz=rz(jmm,jm)*dmm7+rz(j,jp)*dmm8-rz(jm,j)*dmm8
2719 $ -rz(jm,j)*dmm7__-rz(jm,j)*dmm8_1+rz(j,jp)*dmm8_2
2723 fx=fx+(atmmx(j)*c00+astmmx(j)*s00)*c8
2724 fy=fy+(atmmy(j)*c00+astmmy(j)*s00)*c8
2725 fz=fz+(atmmz(j)*c00+astmmz(j)*s00)*c8
2735 c9=(cth(jm)*c00+sth(jm)*s00-1)/dca
2740 cc8=(ulcos(jm)-ulnex)/dnex
2741 cc9=(ulcos(j)-ulnex)/dnex
2742 dmm8=cc8/(dis(jm,j)*dis(j,jp))
2743 dmm9=cc9/(dis(j,jp)*dis(jp,jpp))
2744 dmm8_1=cc8*ulcos(jm)/dis(jm,j)**2
2745 dmm8_2=cc8*ulcos(jm)/dis(j,jp)**2
2746 dmm9__=cc9*ulcos(j)/dis(j,jp)**2
2747 fx=-rx(jp,jpp)*dmm9+rx(j,jp)*dmm8-rx(jm,j)*dmm8
2748 $ -rx(jm,j)*dmm8_1+rx(j,jp)*dmm8_2+rx(j,jp)*dmm9__
2749 fy=-ry(jp,jpp)*dmm9+ry(j,jp)*dmm8-ry(jm,j)*dmm8
2750 $ -ry(jm,j)*dmm8_1+ry(j,jp)*dmm8_2+ry(j,jp)*dmm9__
2751 fz=-rz(jp,jpp)*dmm9+rz(j,jp)*dmm8-rz(jm,j)*dmm8
2752 $ -rz(jm,j)*dmm8_1+rz(j,jp)*dmm8_2+rz(j,jp)*dmm9__
2756 fx=fx+(atmx(j)*c00+astmx(j)*s00)*c9
2757 fy=fy+(atmy(j)*c00+astmy(j)*s00)*c9
2758 fz=fz+(atmz(j)*c00+astmz(j)*s00)*c9
2767 c10=(cth(j)*c00+sth(j)*s00-1)/dca
2772 cc9=(ulcos(j)-ulnex)/dnex
2773 dmm9=cc9/(dis(j,jp)*dis(jp,jpp))
2774 dmm9__=cc9*ulcos(j)/dis(j,jp)**2
2775 fx=-rx(jp,jpp)*dmm9+rx(j,jp)*dmm9__
2776 fy=-ry(jp,jpp)*dmm9+ry(j,jp)*dmm9__
2777 fz=-rz(jp,jpp)*dmm9+rz(j,jp)*dmm9__
2781 fx=fx+(atx(j)*c00+astx(j)*s00)*c10
2782 fy=fy+(aty(j)*c00+asty(j)*s00)*c10
2783 fz=fz+(atz(j)*c00+astz(j)*s00)*c10
2791 c----------------------------------------------------------------------------
2792 subroutine sheetforce5
2795 parameter(maxca=800)
2796 real*8 dfa_cutoff,dfa_cutoff_delta
2797 parameter(dfa_cutoff=15.5d0)
2798 parameter(dfa_cutoff_delta=0.5d0)
2799 cc**********************************************************************
2800 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2801 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2802 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2803 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
2804 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
2805 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
2806 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
2807 real*8 rx(maxca,maxca)
2808 real*8 ry(maxca,maxca),rz(maxca,maxca)
2809 real*8 bx(maxca),by(maxca),bz(maxca)
2810 real*8 dis(maxca,maxca)
2811 real*8 shefx(maxca,12),shefy(maxca,12)
2812 real*8 shefz(maxca,12)
2813 real*8 dp45,dm45,w_beta
2814 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
2815 $ c00,s00,ulnex,dnex
2816 integer inb,nmax,iselect
2817 cc**********************************************************************
2818 common /phys1/ inb,nmax,iselect
2820 common /difvec/ rx,ry,rz
2821 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
2822 $ c00,s00,ulnex,dnex
2823 common /sheconst/ dp45,dm45,w_beta
2824 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
2825 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
2826 common /shef/ shefx,shefy,shefz
2827 ci integer istrand(maxca,maxca)
2828 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
2829 ci common /shetest/ istrand,istrand_p,istrand_m
2830 c********************************************************************************
2832 integer i,imm,im,jp,jpp,j
2833 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
2834 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y,y5z
2835 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z
2836 real*8 y66x,y66y,y66z,yy6,yyy4,yyy5a,yyy5b
2837 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y,y9z
2838 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy8,yyy9a,yyy9b
2839 real*8 e_gcont,fprim_gcont
2840 c********************************************************************************
2846 if (dis(imm,j).lt.dfa_cutoff) then
2847 call gcont(dis(imm,j),dfa_cutoff-dfa_cutoff_delta,1.0D0,
2848 & dfa_cutoff_delta,e_gcont,fprim_gcont)
2853 ci if(istrand(imm,j).eq.1
2854 ci & .and.(istrand_p(imm,j)+istrand_m(imm,j)).ge.1) then
2857 yy1=-(dis(i,jpp)-ulhb)/dlhb
2858 y1x=rx(jpp,i)/dis(i,jpp)
2859 y1y=ry(jpp,i)/dis(i,jpp)
2860 y1z=rz(jpp,i)/dis(i,jpp)
2865 yy33=1.0D0/(dis(im,jp)*dis(im,i))
2866 yyy3=pin1(imm,j)/(dis(im,i)**2)
2867 yy3=-pin1(imm,j)/dshe
2868 y3x=(yy33*rx(im,jp)-yyy3*rx(im,i))*yy3
2869 y3y=(yy33*ry(im,jp)-yyy3*ry(im,i))*yy3
2870 y3z=(yy33*rz(im,jp)-yyy3*rz(im,i))*yy3
2872 yy44=1.0D0/(dis(i,jpp)*dis(im,i))
2873 yyy4a=pin3(imm,j)/(dis(i,jpp)**2)
2874 yyy4b=pin3(imm,j)/(dis(im,i)**2)
2875 yy4=-pin3(imm,j)/dshe
2876 y4x=(yy44*(rx(i,jpp)-rx(im,i))+yyy4a*rx(i,jpp)
2877 $ -yyy4b*rx(im,i))*yy4
2878 y4y=(yy44*(ry(i,jpp)-ry(im,i))+yyy4a*ry(i,jpp)
2879 $ -yyy4b*ry(im,i))*yy4
2880 y4z=(yy44*(rz(i,jpp)-rz(im,i))+yyy4a*rz(i,jpp)
2881 $ -yyy4b*rz(im,i))*yy4
2884 yy55=1.0D0/(dis(i,jpp)*dis(jp,jpp))
2885 yyy5=pin4(imm,j)/(dis(i,jpp)**2)
2886 yy5=-pin4(imm,j)/dshe
2887 y5x=(-yy55*rx(jp,jpp)+yyy5*rx(i,jpp))*yy5
2888 y5y=(-yy55*ry(jp,jpp)+yyy5*ry(i,jpp))*yy5
2889 y5z=(-yy55*rz(jp,jpp)+yyy5*rz(i,jpp))*yy5
2902 shefx(i,5)=shefx(i,5)-sx*vbetap(imm,j)
2903 $ -sx1*vbetap1(imm,j)-sx2*vbetap2(imm,j)
2904 shefy(i,5)=shefy(i,5)-sy*vbetap(imm,j)
2905 $ -sy1*vbetap1(imm,j)-sy2*vbetap2(imm,j)
2906 shefz(i,5)=shefz(i,5)-sz*vbetap(imm,j)
2907 $ -sz1*vbetap1(imm,j)-sz2*vbetap2(imm,j)
2909 ! shefx(i,5)=shefx(i,5)
2910 ! $ -sx1*vbetap1(imm,j)-sx2*vbetap2(imm,j)
2911 ! shefy(i,5)=shefy(i,5)
2912 ! $ -sy1*vbetap1(imm,j)-sy2*vbetap2(imm,j)
2913 ! shefz(i,5)=shefz(i,5)
2914 ! $ -sz1*vbetap1(imm,j)-sz2*vbetap2(imm,j)
2916 yy6=-(dis(i,jp)-uldhb)/dldhb
2917 y6x=rx(jp,i)/dis(i,jp)
2918 y6y=ry(jp,i)/dis(i,jp)
2919 y6z=rz(jp,i)/dis(i,jp)
2924 yy88=1.0D0/(dis(im,jpp)*dis(im,i))
2925 yyy8=pina1(imm,j)/(dis(im,i)**2)
2926 yy8=-pina1(imm,j)/dshe
2927 y8x=(yy88*rx(im,jpp)-yyy8*rx(im,i))*yy8
2928 y8y=(yy88*ry(im,jpp)-yyy8*ry(im,i))*yy8
2929 y8z=(yy88*rz(im,jpp)-yyy8*rz(im,i))*yy8
2931 yy99=1.0D0/(dis(jp,i)*dis(im,i))
2932 yyy9a=pina3(imm,j)/(dis(jp,i)**2)
2933 yyy9b=pina3(imm,j)/(dis(im,i)**2)
2934 yy9=-pina3(imm,j)/dshe
2935 y9x=(yy99*(rx(jp,i)+rx(im,i))-yyy9a*rx(jp,i)
2936 $ -yyy9b*rx(im,i))*yy9
2937 y9y=(yy99*(ry(jp,i)+ry(im,i))-yyy9a*ry(jp,i)
2938 $ -yyy9b*ry(im,i))*yy9
2939 y9z=(yy99*(rz(jp,i)+rz(im,i))-yyy9a*rz(jp,i)
2940 $ -yyy9b*rz(im,i))*yy9
2942 yy1010=1.0D0/(dis(jp,i)*dis(jp,jpp))
2943 yyy10=pina4(imm,j)/(dis(jp,i)**2)
2944 yy10=-pina4(imm,j)/dshe
2945 y10x=(yy1010*rx(jp,jpp)-yyy10*rx(jp,i))*yy10
2946 y10y=(yy1010*ry(jp,jpp)-yyy10*ry(jp,i))*yy10
2947 y10z=(yy1010*rz(jp,jpp)-yyy10*rz(jp,i))*yy10
2949 sx=y66x+y8x+y9x+y10x
2950 sy=y66y+y8y+y9y+y10y
2951 sz=y66z+y8z+y9z+y10z
2960 shefx(i,5)=shefx(i,5)-sx*vbetam(imm,j)
2961 $ -sx1*vbetam1(imm,j)-sx2*vbetam2(imm,j)
2962 shefy(i,5)=shefy(i,5)-sy*vbetam(imm,j)
2963 $ -sy1*vbetam1(imm,j)-sy2*vbetam2(imm,j)
2964 shefz(i,5)=shefz(i,5)-sz*vbetam(imm,j)
2965 $ -sz1*vbetam1(imm,j)-sz2*vbetam2(imm,j)
2967 ! shefx(i,5)=shefx(i,5)
2968 ! $ -sx1*vbetam1(imm,j)-sx2*vbetam2(imm,j)
2969 ! shefy(i,5)=shefy(i,5)
2970 ! $ -sy1*vbetam1(imm,j)-sy2*vbetam2(imm,j)
2971 ! shefz(i,5)=shefz(i,5)
2972 ! $ -sz1*vbetam1(imm,j)-sz2*vbetam2(imm,j)
2982 c--------------------------------------------------------------------------c
2983 subroutine sheetforce6
2986 parameter(maxca=800)
2987 real*8 dfa_cutoff,dfa_cutoff_delta
2988 parameter(dfa_cutoff=15.5d0)
2989 parameter(dfa_cutoff_delta=0.5d0)
2990 cc**********************************************************************
2991 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
2992 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
2993 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
2994 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
2995 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
2996 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
2997 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
2998 real*8 rx(maxca,maxca)
2999 real*8 ry(maxca,maxca),rz(maxca,maxca)
3000 real*8 bx(maxca),by(maxca),bz(maxca)
3001 real*8 dis(maxca,maxca)
3002 real*8 shefx(maxca,12),shefy(maxca,12)
3003 real*8 shefz(maxca,12)
3004 real*8 dp45,dm45,w_beta
3005 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
3006 $ c00,s00,ulnex,dnex
3007 integer inb,nmax,iselect
3008 cc**********************************************************************
3009 common /phys1/ inb,nmax,iselect
3011 common /difvec/ rx,ry,rz
3012 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
3013 $ c00,s00,ulnex,dnex
3014 common /sheconst/ dp45,dm45,w_beta
3015 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
3016 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
3017 common /shef/ shefx,shefy,shefz
3018 ci integer istrand(maxca,maxca)
3019 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
3020 ci common /shetest/ istrand,istrand_p,istrand_m
3021 cc**********************************************************************
3023 integer i,imm,im,jp,jpp,j,ip
3024 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
3025 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y,y5z
3026 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z,y66x,y66y
3027 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y,y9z
3028 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy8,yyy9a,yyy9b,yyy4
3029 real*8 yyy3a,yyy3b,y66z,yy6,yyy5a,yyy5b
3030 real*8 e_gcont,fprim_gcont
3031 C********************************************************************************
3037 if (dis(im,j).lt.dfa_cutoff) then
3038 call gcont(dis(im,j),dfa_cutoff-dfa_cutoff_delta,1.0D0,
3039 & dfa_cutoff_delta,e_gcont,fprim_gcont)
3044 ci if(istrand(im,j).eq.1
3045 ci & .and.(istrand_p(im,j)+istrand_m(im,j)).ge.1) then
3048 yy1=-(dis(i,jp)-ulhb)/dlhb
3049 y1x=rx(jp,i)/dis(i,jp)
3050 y1y=ry(jp,i)/dis(i,jp)
3051 y1z=rz(jp,i)/dis(i,jp)
3056 yy33=1.0D0/(dis(i,jp)*dis(i,ip))
3057 yyy3a=pin1(im,j)/(dis(i,jp)**2)
3058 yyy3b=pin1(im,j)/(dis(i,ip)**2)
3059 yy3=-pin1(im,j)/dshe
3060 y3x=(-yy33*(rx(i,ip)+rx(i,jp))+yyy3a*rx(i,jp)
3061 $ +yyy3b*rx(i,ip))*yy3
3062 y3y=(-yy33*(ry(i,ip)+ry(i,jp))+yyy3a*ry(i,jp)
3063 $ +yyy3b*ry(i,ip))*yy3
3064 y3z=(-yy33*(rz(i,ip)+rz(i,jp))+yyy3a*rz(i,jp)
3065 $ +yyy3b*rz(i,ip))*yy3
3067 yy44=1.0D0/(dis(i,jp)*dis(jp,jpp))
3068 yyy4=pin2(im,j)/(dis(i,jp)**2)
3069 yy4=-pin2(im,j)/dshe
3070 y4x=(-yy44*rx(jp,jpp)+yyy4*rx(i,jp))*yy4
3071 y4y=(-yy44*ry(jp,jpp)+yyy4*ry(i,jp))*yy4
3072 y4z=(-yy44*rz(jp,jpp)+yyy4*rz(i,jp))*yy4
3074 yy55=1.0D0/(dis(ip,jpp)*dis(i,ip))
3075 yyy5=pin3(im,j)/(dis(i,ip)**2)
3076 yy5=-pin3(im,j)/dshe
3077 y5x=(-yy55*rx(ip,jpp)+yyy5*rx(i,ip))*yy5
3078 y5y=(-yy55*ry(ip,jpp)+yyy5*ry(i,ip))*yy5
3079 y5z=(-yy55*rz(ip,jpp)+yyy5*rz(i,ip))*yy5
3092 shefx(i,6)=shefx(i,6)-sx*vbetap(im,j)
3093 $ -sx1*vbetap1(im,j)-sx2*vbetap2(im,j)
3094 shefy(i,6)=shefy(i,6)-sy*vbetap(im,j)
3095 $ -sy1*vbetap1(im,j)-sy2*vbetap2(im,j)
3096 shefz(i,6)=shefz(i,6)-sz*vbetap(im,j)
3097 $ -sz1*vbetap1(im,j)-sz2*vbetap2(im,j)
3098 ! shefx(i,6)=shefx(i,6)
3099 ! $ -sx1*vbetap1(im,j)-sx2*vbetap2(im,j)
3100 ! shefy(i,6)=shefy(i,6)
3101 ! $ -sy1*vbetap1(im,j)-sy2*vbetap2(im,j)
3102 ! shefz(i,6)=shefz(i,6)
3103 ! $ -sz1*vbetap1(im,j)-sz2*vbetap2(im,j)
3105 yy6=-(dis(jpp,i)-uldhb)/dldhb
3106 y6x=rx(jpp,i)/dis(jpp,i)
3107 y6y=ry(jpp,i)/dis(jpp,i)
3108 y6z=rz(jpp,i)/dis(jpp,i)
3113 yy88=1.0D0/(dis(i,jpp)*dis(i,ip))
3114 yyy8a=pina1(im,j)/(dis(i,jpp)**2)
3115 yyy8b=pina1(im,j)/(dis(i,ip)**2)
3116 yy8=-pina1(im,j)/dshe
3117 y8x=(-yy88*(rx(i,jpp)+rx(i,ip))+yyy8a*rx(i,jpp)
3118 $ +yyy8b*rx(i,ip))*yy8
3119 y8y=(-yy88*(ry(i,jpp)+ry(i,ip))+yyy8a*ry(i,jpp)
3120 $ +yyy8b*ry(i,ip))*yy8
3121 y8z=(-yy88*(rz(i,jpp)+rz(i,ip))+yyy8a*rz(i,jpp)
3122 $ +yyy8b*rz(i,ip))*yy8
3124 yy99=1.0D0/(dis(i,jpp)*dis(jp,jpp))
3125 yyy9=pina2(im,j)/(dis(i,jpp)**2)
3126 yy9=-pina2(im,j)/dshe
3127 y9x=(-yy99*rx(jp,jpp)+yyy9*rx(i,jpp))*yy9
3128 y9y=(-yy99*ry(jp,jpp)+yyy9*ry(i,jpp))*yy9
3129 y9z=(-yy99*rz(jp,jpp)+yyy9*rz(i,jpp))*yy9
3131 yy1010=1.0D0/(dis(jp,ip)*dis(i,ip))
3132 yyy10=pina3(im,j)/(dis(i,ip)**2)
3133 yy10=-pina3(im,j)/dshe
3134 y10x=(-yy1010*rx(jp,ip)+yyy10*rx(i,ip))*yy10
3135 y10y=(-yy1010*ry(jp,ip)+yyy10*ry(i,ip))*yy10
3136 y10z=(-yy1010*rz(jp,ip)+yyy10*rz(i,ip))*yy10
3138 sx=y66x+y8x+y9x+y10x
3139 sy=y66y+y8y+y9y+y10y
3140 sz=y66z+y8z+y9z+y10z
3149 shefx(i,6)=shefx(i,6)-sx*vbetam(im,j)
3150 $ -sx1*vbetam1(im,j)-sx2*vbetam2(im,j)
3151 shefy(i,6)=shefy(i,6)-sy*vbetam(im,j)
3152 $ -sy1*vbetam1(im,j)-sy2*vbetam2(im,j)
3153 shefz(i,6)=shefz(i,6)-sz*vbetam(im,j)
3154 $ -sz1*vbetam1(im,j)-sz2*vbetam2(im,j)
3156 ! shefx(i,6)=shefx(i,6)
3157 ! $ -sx1*vbetam1(im,j)-sx2*vbetam2(im,j)
3158 ! shefy(i,6)=shefy(i,6)
3159 ! $ -sy1*vbetam1(im,j)-sy2*vbetam2(im,j)
3160 ! shefz(i,6)=shefz(i,6)
3161 ! $ -sz1*vbetam1(im,j)-sz2*vbetam2(im,j)
3171 c-----------------------------------------------------------------------
3172 subroutine sheetforce11
3175 parameter(maxca=800)
3176 real*8 dfa_cutoff,dfa_cutoff_delta
3177 parameter(dfa_cutoff=15.5d0)
3178 parameter(dfa_cutoff_delta=0.5d0)
3179 cc**********************************************************************
3180 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
3181 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
3182 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
3183 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
3184 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
3185 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
3186 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
3187 real*8 rx(maxca,maxca)
3188 real*8 ry(maxca,maxca),rz(maxca,maxca)
3189 real*8 bx(maxca),by(maxca),bz(maxca)
3190 real*8 dis(maxca,maxca)
3191 real*8 shefx(maxca,12),shefy(maxca,12)
3192 real*8 shefz(maxca,12)
3193 real*8 dp45,dm45,w_beta
3194 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
3195 $ c00,s00,ulnex,dnex
3196 integer inb,nmax,iselect
3197 cc**********************************************************************
3198 common /phys1/ inb,nmax,iselect
3200 common /difvec/ rx,ry,rz
3201 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
3202 $ c00,s00,ulnex,dnex
3203 common /sheconst/ dp45,dm45,w_beta
3204 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
3205 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
3206 common /shef/ shefx,shefy,shefz
3207 ci integer istrand(maxca,maxca)
3208 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
3209 ci common /shetest/ istrand,istrand_p,istrand_m
3210 C********************************************************************************
3212 integer j,jm,jmm,ip,i,ipp
3213 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
3214 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y
3215 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z,y66x,y66y
3216 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y
3217 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy4,yyy5a,yyy5b,yy6
3218 real*8 yyy9a,yyy9b,y5z,y66z,y9z,yyy8
3219 real*8 e_gcont,fprim_gcont
3220 C********************************************************************************
3227 if (dis(i,jmm).lt.dfa_cutoff) then
3228 call gcont(dis(i,jmm),dfa_cutoff-dfa_cutoff_delta,1.0D0,
3229 & dfa_cutoff_delta,e_gcont,fprim_gcont)
3234 ci if(istrand(i,jmm).eq.1
3235 ci & .and.(istrand_p(i,jmm)+istrand_m(i,jmm)).ge.1) then
3238 yy1=-(dis(ipp,j)-ulhb)/dlhb
3239 y1x=rx(ipp,j)/dis(ipp,j)
3240 y1y=ry(ipp,j)/dis(ipp,j)
3241 y1z=rz(ipp,j)/dis(ipp,j)
3246 yy33=1.0D0/(dis(ip,jm)*dis(jm,j))
3247 yyy3=pin2(i,jmm)/(dis(jm,j)**2)
3248 yy3=-pin2(i,jmm)/dshe
3249 y3x=(yy33*rx(ip,jm)-yyy3*rx(jm,j))*yy3
3250 y3y=(yy33*ry(ip,jm)-yyy3*ry(jm,j))*yy3
3251 y3z=(yy33*rz(ip,jm)-yyy3*rz(jm,j))*yy3
3253 yy44=1.0D0/(dis(ipp,j)*dis(ip,ipp))
3254 yyy4=pin3(i,jmm)/(dis(ipp,j)**2)
3255 yy4=-pin3(i,jmm)/dshe
3256 y4x=(yy44*rx(ip,ipp)-yyy4*rx(ipp,j))*yy4
3257 y4y=(yy44*ry(ip,ipp)-yyy4*ry(ipp,j))*yy4
3258 y4z=(yy44*rz(ip,ipp)-yyy4*rz(ipp,j))*yy4
3260 yy55=1.0D0/(dis(ipp,j)*dis(jm,j))
3261 yyy5a=pin4(i,jmm)/(dis(ipp,j)**2)
3262 yyy5b=pin4(i,jmm)/(dis(jm,j)**2)
3263 yy5=-pin4(i,jmm)/dshe
3264 y5x=(yy55*(rx(jm,j)+rx(ipp,j))-yyy5a*rx(ipp,j)
3265 $ -yyy5b*rx(jm,j))*yy5
3266 y5y=(yy55*(ry(jm,j)+ry(ipp,j))-yyy5a*ry(ipp,j)
3267 $ -yyy5b*ry(jm,j))*yy5
3268 y5z=(yy55*(rz(jm,j)+rz(ipp,j))-yyy5a*rz(ipp,j)
3269 $ -yyy5b*rz(jm,j))*yy5
3282 shefx(j,11)=shefx(j,11)-sx*vbetap(i,jmm)
3283 $ -sx1*vbetap1(i,jmm)-sx2*vbetap2(i,jmm)
3284 shefy(j,11)=shefy(j,11)-sy*vbetap(i,jmm)
3285 $ -sy1*vbetap1(i,jmm)-sy2*vbetap2(i,jmm)
3286 shefz(j,11)=shefz(j,11)-sz*vbetap(i,jmm)
3287 $ -sz1*vbetap1(i,jmm)-sz2*vbetap2(i,jmm)
3289 ! shefx(j,11)=shefx(j,11)
3290 ! $ -sx1*vbetap1(i,jmm)-sx2*vbetap2(i,jmm)
3291 ! shefy(j,11)=shefy(j,11)
3292 ! $ -sy1*vbetap1(i,jmm)-sy2*vbetap2(i,jmm)
3293 ! shefz(j,11)=shefz(j,11)
3294 ! $ -sz1*vbetap1(i,jmm)-sz2*vbetap2(i,jmm)
3296 yy6=-(dis(ip,j)-uldhb)/dldhb
3297 y6x=rx(ip,j)/dis(ip,j)
3298 y6y=ry(ip,j)/dis(ip,j)
3299 y6z=rz(ip,j)/dis(ip,j)
3304 yy88=1.0D0/(dis(ip,j)*dis(ip,ipp))
3305 yyy8=pina1(i,jmm)/(dis(ip,j)**2)
3306 yy8=-pina1(i,jmm)/dshe
3307 y8x=(yy88*rx(ip,ipp)-yyy8*rx(ip,j))*yy8
3308 y8y=(yy88*ry(ip,ipp)-yyy8*ry(ip,j))*yy8
3309 y8z=(yy88*rz(ip,ipp)-yyy8*rz(ip,j))*yy8
3311 yy99=1.0D0/(dis(ip,j)*dis(jm,j))
3312 yyy9a=pina2(i,jmm)/(dis(ip,j)**2)
3313 yyy9b=pina2(i,jmm)/(dis(jm,j)**2)
3314 yy9=-pina2(i,jmm)/dshe
3315 y9x=(yy99*(rx(jm,j)+rx(ip,j))-yyy9a*rx(ip,j)
3316 $ -yyy9b*rx(jm,j))*yy9
3317 y9y=(yy99*(ry(jm,j)+ry(ip,j))-yyy9a*ry(ip,j)
3318 $ -yyy9b*ry(jm,j))*yy9
3319 y9z=(yy99*(rz(jm,j)+rz(ip,j))-yyy9a*rz(ip,j)
3320 $ -yyy9b*rz(jm,j))*yy9
3322 yy1010=1.0D0/(dis(jm,ipp)*dis(jm,j))
3323 yyy10=pina4(i,jmm)/(dis(jm,j)**2)
3324 yy10=-pina4(i,jmm)/dshe
3325 y10x=(yy1010*rx(jm,ipp)-yyy10*rx(jm,j))*yy10
3326 y10y=(yy1010*ry(jm,ipp)-yyy10*ry(jm,j))*yy10
3327 y10z=(yy1010*rz(jm,ipp)-yyy10*rz(jm,j))*yy10
3329 sx=y66x+y8x+y9x+y10x
3330 sy=y66y+y8y+y9y+y10y
3331 sz=y66z+y8z+y9z+y10z
3340 shefx(j,11)=shefx(j,11)-sx*vbetam(i,jmm)
3341 $ -sx1*vbetam1(i,jmm)-sx2*vbetam2(i,jmm)
3342 shefy(j,11)=shefy(j,11)-sy*vbetam(i,jmm)
3343 $ -sy1*vbetam1(i,jmm)-sy2*vbetam2(i,jmm)
3344 shefz(j,11)=shefz(j,11)-sz*vbetam(i,jmm)
3345 $ -sz1*vbetam1(i,jmm)-sz2*vbetam2(i,jmm)
3347 ! shefx(j,11)=shefx(j,11)
3348 ! $ -sx1*vbetam1(i,jmm)-sx2*vbetam2(i,jmm)
3349 ! shefy(j,11)=shefy(j,11)
3350 ! $ -sy1*vbetam1(i,jmm)-sy2*vbetam2(i,jmm)
3351 ! shefz(j,11)=shefz(j,11)
3352 ! $ -sz1*vbetam1(i,jmm)-sz2*vbetam2(i,jmm)
3362 c-----------------------------------------------------------------------
3363 subroutine sheetforce12
3366 parameter(maxca=800)
3367 real*8 dfa_cutoff,dfa_cutoff_delta
3368 parameter(dfa_cutoff=15.5d0)
3369 parameter(dfa_cutoff_delta=0.5d0)
3370 cc**********************************************************************
3371 real*8 vbetap(maxca,maxca),vbetam(maxca,maxca)
3372 real*8 vbetap1(maxca,maxca),vbetam1(maxca,maxca)
3373 real*8 vbetap2(maxca,maxca),vbetam2(maxca,maxca)
3374 real*8 pin1(maxca,maxca),pin2(maxca,maxca)
3375 real*8 pin3(maxca,maxca),pin4(maxca,maxca)
3376 real*8 pina1(maxca,maxca),pina2(maxca,maxca)
3377 real*8 pina3(maxca,maxca),pina4(maxca,maxca)
3378 real*8 rx(maxca,maxca)
3379 real*8 ry(maxca,maxca),rz(maxca,maxca)
3380 real*8 bx(maxca),by(maxca),bz(maxca)
3381 real*8 dis(maxca,maxca)
3382 real*8 shefx(maxca,12),shefy(maxca,12)
3383 real*8 shefz(maxca,12)
3384 real*8 dp45,dm45,w_beta
3385 real*8 dca,dlhb,ulhb,dshe,dldhb,uldhb,
3386 $ c00,s00,ulnex,dnex
3387 integer inb,nmax,iselect
3388 cc**********************************************************************
3389 common /phys1/ inb,nmax,iselect
3391 common /difvec/ rx,ry,rz
3392 common /sheparm/ dca,dlhb,ulhb,dshe,dldhb,uldhb,
3393 $ c00,s00,ulnex,dnex
3394 common /sheconst/ dp45,dm45,w_beta
3395 common /she/ vbetap,vbetam,vbetap1,vbetap2,vbetam1,vbetam2
3396 common /shepin/ pin1,pin2,pin3,pin4,pina1,pina2,pina3,pina4
3397 common /shef/ shefx,shefy,shefz
3398 ci integer istrand(maxca,maxca)
3399 ci integer istrand_p(maxca,maxca),istrand_m(maxca,maxca)
3400 ci common /shetest/ istrand,istrand_p,istrand_m
3401 cc**********************************************************************
3403 integer j,jm,jmm,ip,i,ipp,jp
3404 real*8 yy1,y1x,y1y,y1z,y11x,y11y,y11z,yy33,yyy3,yy3,y3x,y3y,y3z
3405 real*8 yy44,yyy4a,yyy4b,yy4,y4x,y4y,y4z,yy55,yyy5,yy5,y5x,y5y,y5z
3406 real*8 sx,sy,sz,sx1,sy1,sz1,sx2,sy2,sz2,y6x,y6y,y6z,y66x,y66y,y66z
3407 real*8 yy88,yyy8a,yyy8b,yy8,y8x,y8y,y8z,yy99,yyy9,yy9,y9x,y9y,y9z
3408 real*8 yy1010,yyy10,yy10,y10x,y10y,y10z,yyy10a,yyy10b,yy6,yyy8
3409 real*8 e_gcont,fprim_gcont
3410 !c*************************************************************************c
3416 if (dis(i,jm).lt.dfa_cutoff) then
3417 call gcont(dis(i,jm),dfa_cutoff-dfa_cutoff_delta,1.0D0,
3418 & dfa_cutoff_delta,e_gcont,fprim_gcont)
3423 ci if(istrand(i,jm).eq.1
3424 ci & .and.(istrand_p(i,jm)+istrand_m(i,jm)).ge.1) then
3427 yy1=-(dis(ip,j)-ulhb)/dlhb
3428 y1x=rx(ip,j)/dis(ip,j)
3429 y1y=ry(ip,j)/dis(ip,j)
3430 y1z=rz(ip,j)/dis(ip,j)
3435 yy33=1.0D0/(dis(ip,j)*dis(ip,ipp))
3436 yyy3=pin1(i,jm)/(dis(ip,j)**2)
3437 yy3=-pin1(i,jm)/dshe
3438 y3x=(yy33*rx(ip,ipp)-yyy3*rx(ip,j))*yy3
3439 y3y=(yy33*ry(ip,ipp)-yyy3*ry(ip,j))*yy3
3440 y3z=(yy33*rz(ip,ipp)-yyy3*rz(ip,j))*yy3
3441 yy44=1.0D0/(dis(ip,j)*dis(j,jp))
3443 yyy4a=pin2(i,jm)/(dis(ip,j)**2)
3444 yyy4b=pin2(i,jm)/(dis(j,jp)**2)
3445 yy4=-pin2(i,jm)/dshe
3446 y4x=(yy44*(rx(j,jp)-rx(ip,j))-yyy4a*rx(ip,j)
3447 $ +yyy4b*rx(j,jp))*yy4
3448 y4y=(yy44*(ry(j,jp)-ry(ip,j))-yyy4a*ry(ip,j)
3449 $ +yyy4b*ry(j,jp))*yy4
3450 y4z=(yy44*(rz(j,jp)-rz(ip,j))-yyy4a*rz(ip,j)
3451 $ +yyy4b*rz(j,jp))*yy4
3453 yy55=1.0D0/(dis(ipp,jp)*dis(j,jp))
3454 yyy5=pin4(i,jm)/(dis(j,jp)**2)
3455 yy5=-pin4(i,jm)/dshe
3456 y5x=(-yy55*rx(ipp,jp)+yyy5*rx(j,jp))*yy5
3457 y5y=(-yy55*ry(ipp,jp)+yyy5*ry(j,jp))*yy5
3458 y5z=(-yy55*rz(ipp,jp)+yyy5*rz(j,jp))*yy5
3471 shefx(j,12)=shefx(j,12)-sx*vbetap(i,jm)
3472 $ -sx1*vbetap1(i,jm)-sx2*vbetap2(i,jm)
3473 shefy(j,12)=shefy(j,12)-sy*vbetap(i,jm)
3474 $ -sy1*vbetap1(i,jm)-sy2*vbetap2(i,jm)
3475 shefz(j,12)=shefz(j,12)-sz*vbetap(i,jm)
3476 $ -sz1*vbetap1(i,jm)-sz2*vbetap2(i,jm)
3478 ! shefx(j,12)=shefx(j,12)
3479 ! $ -sx1*vbetap1(i,jm)-sx2*vbetap2(i,jm)
3480 ! shefy(j,12)=shefy(j,12)
3481 ! $ -sy1*vbetap1(i,jm)-sy2*vbetap2(i,jm)
3482 ! shefz(j,12)=shefz(j,12)
3483 ! $ -sz1*vbetap1(i,jm)-sz2*vbetap2(i,jm)
3485 yy6=-(dis(ipp,j)-uldhb)/dldhb
3486 y6x=rx(ipp,j)/dis(ipp,j)
3487 y6y=ry(ipp,j)/dis(ipp,j)
3488 y6z=rz(ipp,j)/dis(ipp,j)
3493 yy88=1.0D0/(dis(ip,jp)*dis(j,jp))
3494 yyy8=pina2(i,jm)/(dis(j,jp)**2)
3495 yy8=-pina2(i,jm)/dshe
3496 y8x=(-yy88*rx(ip,jp)+yyy8*rx(j,jp))*yy8
3497 y8y=(-yy88*ry(ip,jp)+yyy8*ry(j,jp))*yy8
3498 y8z=(-yy88*rz(ip,jp)+yyy8*rz(j,jp))*yy8
3500 yy99=1.0D0/(dis(j,ipp)*dis(ip,ipp))
3501 yyy9=pina3(i,jm)/(dis(j,ipp)**2)
3502 yy9=-pina3(i,jm)/dshe
3503 y9x=(-yy99*rx(ip,ipp)+yyy9*rx(j,ipp))*yy9
3504 y9y=(-yy99*ry(ip,ipp)+yyy9*ry(j,ipp))*yy9
3505 y9z=(-yy99*rz(ip,ipp)+yyy9*rz(j,ipp))*yy9
3507 yy1010=1.0D0/(dis(j,ipp)*dis(j,jp))
3508 yyy10a=pina4(i,jm)/(dis(j,ipp)**2)
3509 yyy10b=pina4(i,jm)/(dis(j,jp)**2)
3510 yy10=-pina4(i,jm)/dshe
3511 y10x=(-yy1010*(rx(j,ipp)+rx(j,jp))+yyy10a*rx(j,ipp)
3512 $ +yyy10b*rx(j,jp))*yy10
3513 y10y=(-yy1010*(ry(j,ipp)+ry(j,jp))+yyy10a*ry(j,ipp)
3514 $ +yyy10b*ry(j,jp))*yy10
3515 y10z=(-yy1010*(rz(j,ipp)+rz(j,jp))+yyy10a*rz(j,ipp)
3516 $ +yyy10b*rz(j,jp))*yy10
3518 sx=y66x+y8x+y9x+y10x
3519 sy=y66y+y8y+y9y+y10y
3520 sz=y66z+y8z+y9z+y10z
3529 shefx(j,12)=shefx(j,12)-sx*vbetam(i,jm)
3530 $ -sx1*vbetam1(i,jm)-sx2*vbetam2(i,jm)
3531 shefy(j,12)=shefy(j,12)-sy*vbetam(i,jm)
3532 $ -sy1*vbetam1(i,jm)-sy2*vbetam2(i,jm)
3533 shefz(j,12)=shefz(j,12)-sz*vbetam(i,jm)
3534 $ -sz1*vbetam1(i,jm)-sz2*vbetam2(i,jm)
3545 C===============================================================================