50 |
|
!! @author Matthew Meineke |
51 |
|
!! @author Christopher Fennell |
52 |
|
!! @author J. Daniel Gezelter |
53 |
< |
!! @version $Id: sticky.F90,v 1.10 2005-05-17 22:35:01 chrisfen Exp $, $Date: 2005-05-17 22:35:01 $, $Name: not supported by cvs2svn $, $Revision: 1.10 $ |
53 |
> |
!! @version $Id: sticky.F90,v 1.12 2005-05-18 19:06:22 chrisfen Exp $, $Date: 2005-05-18 19:06:22 $, $Name: not supported by cvs2svn $, $Revision: 1.12 $ |
54 |
|
|
55 |
|
module sticky |
56 |
|
|
513 |
|
end subroutine destroyStickyTypes |
514 |
|
|
515 |
|
subroutine do_sticky_power_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, & |
516 |
< |
pot, A, f, t, do_pot) |
516 |
> |
pot, A, f, t, do_pot, ebalance) |
517 |
|
!! We assume that the rotation matrices have already been calculated |
518 |
|
!! and placed in the A array. |
519 |
|
|
527 |
|
real (kind=dp), dimension(9,nLocal) :: A |
528 |
|
real (kind=dp), dimension(3,nLocal) :: f |
529 |
|
real (kind=dp), dimension(3,nLocal) :: t |
530 |
+ |
real (kind=dp), intent(in) :: ebalance |
531 |
|
logical, intent(in) :: do_pot |
532 |
|
|
533 |
|
real (kind=dp) :: xi, yi, zi, xj, yj, zj, xi2, yi2, zi2, xj2, yj2, zj2 |
534 |
|
real (kind=dp) :: xihat, yihat, zihat, xjhat, yjhat, zjhat |
535 |
|
real (kind=dp) :: rI, rI2, rI3, rI4, rI5, rI6, rI7, s, sp, dsdr, dspdr |
536 |
< |
real (kind=dp) :: wi, wj, w, wip, wjp, wp, wi2, wj2, wip3, wjp3 |
536 |
> |
real (kind=dp) :: wi, wj, w, wi2, wj2 |
537 |
|
real (kind=dp) :: dwidx, dwidy, dwidz, dwjdx, dwjdy, dwjdz |
537 |
– |
real (kind=dp) :: dwipdx, dwipdy, dwipdz, dwjpdx, dwjpdy, dwjpdz |
538 |
|
real (kind=dp) :: dwidux, dwiduy, dwiduz, dwjdux, dwjduy, dwjduz |
539 |
– |
real (kind=dp) :: dwipdux, dwipduy, dwipduz, dwjpdux, dwjpduy, dwjpduz |
540 |
– |
real (kind=dp) :: zif, zis, zjf, zjs, uglyi, uglyj |
539 |
|
real (kind=dp) :: drdx, drdy, drdz |
540 |
|
real (kind=dp) :: txi, tyi, tzi, txj, tyj, tzj |
541 |
|
real (kind=dp) :: fxii, fyii, fzii, fxjj, fyjj, fzjj |
548 |
|
integer :: me1, me2 |
549 |
|
real (kind=dp) :: w0, v0, v0p, rl, ru, rlp, rup, rbig |
550 |
|
real (kind=dp) :: zi3, zi4, zi5, zj3, zj4, zj5 |
551 |
< |
real (kind=dp) :: frac1, frac2, prodVal |
552 |
< |
real (kind=dp) :: prei1, prei2, prei, prej1, prej2, prej |
555 |
< |
real (kind=dp) :: walt, walti, waltj, dwaltidx, dwaltidy, dwaltidz |
556 |
< |
real (kind=dp) :: dwaltjdx, dwaltjdy, dwaltjdz |
557 |
< |
real (kind=dp) :: dwaltidux, dwaltiduy, dwaltiduz |
558 |
< |
real (kind=dp) :: dwaltjdux, dwaltjduy, dwaltjduz |
559 |
< |
real (kind=dp) :: doSw1idx, doSw1idy, doSw1idz, doSw1jdx, doSw1jdy, doSw1jdz |
560 |
< |
real (kind=dp) :: doSw1idux, doSw1iduy, doSw1iduz |
561 |
< |
real (kind=dp) :: doSw1jdux, doSw1jduy, doSw1jduz |
562 |
< |
real (kind=dp) :: doSw2idx, doSw2idy, doSw2idz, doSw2jdx, doSw2jdy, doSw2jdz |
563 |
< |
real (kind=dp) :: doSw2idux, doSw2iduy, doSw2iduz |
564 |
< |
real (kind=dp) :: doSw2jdux, doSw2jduy, doSw2jduz |
565 |
< |
|
551 |
> |
real (kind=dp) :: frac1, frac2 |
552 |
> |
|
553 |
|
if (.not.allocated(StickyMap)) then |
554 |
|
call handleError("sticky", "no StickyMap was present before first call of do_sticky_power_pair!") |
555 |
|
return |
634 |
|
zi2 = zi*zi |
635 |
|
zi3 = zi2*zi |
636 |
|
zi4 = zi2*zi2 |
637 |
< |
zi5 = zi4*zi |
637 |
> |
zi5 = zi3*zi2 |
638 |
|
xihat = xi*rI |
639 |
|
yihat = yi*rI |
640 |
|
zihat = zi*rI |
644 |
|
zj2 = zj*zj |
645 |
|
zj3 = zj2*zj |
646 |
|
zj4 = zj2*zj2 |
647 |
< |
zj5 = zj4*zj |
647 |
> |
zj5 = zj3*zj2 |
648 |
|
xjhat = xj*rI |
649 |
|
yjhat = yj*rI |
650 |
|
zjhat = zj*rI |
651 |
|
|
652 |
|
call calc_sw_fnc(rij, rl, ru, rlp, rup, s, sp, dsdr, dspdr) |
653 |
|
|
654 |
< |
frac1 = 0.5d0 |
654 |
> |
frac1 = 1.5d0 |
655 |
|
frac2 = 0.5d0 |
656 |
|
|
657 |
|
wi = 2.0d0*(xi2-yi2)*zi*rI3 |
658 |
|
wj = 2.0d0*(xj2-yj2)*zj*rI3 |
659 |
|
|
673 |
– |
! prodVal = zihat*zjhat |
674 |
– |
! if (prodVal .ge. 0.0d0) then |
675 |
– |
! wi = 0.0d0 |
676 |
– |
! wj = 0.0d0 |
677 |
– |
! endif |
678 |
– |
|
660 |
|
wi2 = wi*wi |
661 |
|
wj2 = wj*wj |
662 |
|
|
663 |
< |
w = frac1*wi*wi2 + frac2*wi + wj*wj2 |
663 |
> |
w = frac1*wi*wi2 + frac2*wi + frac1*wj*wj2 + frac2*wj |
664 |
|
|
665 |
< |
zif = zihat - 0.6d0 |
685 |
< |
zis = zihat + 0.8d0 |
686 |
< |
|
687 |
< |
zjf = zjhat - 0.6d0 |
688 |
< |
zjs = zjhat + 0.8d0 |
689 |
< |
|
690 |
< |
wip = zif*zif*zis*zis - w0 |
691 |
< |
wjp = zjf*zjf*zjs*zjs - w0 |
692 |
< |
wp = wip + wjp |
693 |
< |
|
694 |
< |
!wip = zihat - 0.2d0 |
695 |
< |
!wjp = zjhat - 0.2d0 |
696 |
< |
!wip3 = wip*wip*wip |
697 |
< |
!wjp3 = wjp*wjp*wjp |
665 |
> |
vpair = vpair + 0.5d0*(v0*s*w) + ebalance |
666 |
|
|
699 |
– |
!wp = wip3*wip + wjp3*wjp |
700 |
– |
|
701 |
– |
vpair = vpair + 0.5d0*(v0*s*w + v0p*sp*wp) |
702 |
– |
|
667 |
|
if (do_pot) then |
668 |
|
#ifdef IS_MPI |
669 |
< |
pot_row(atom1) = pot_row(atom1) + 0.25d0*(v0*s*w + v0p*sp*wp)*sw |
670 |
< |
pot_col(atom2) = pot_col(atom2) + 0.25d0*(v0*s*w + v0p*sp*wp)*sw |
669 |
> |
pot_row(atom1) = pot_row(atom1) + 0.25d0*(v0*s*w)*sw |
670 |
> |
pot_col(atom2) = pot_col(atom2) + 0.25d0*(v0*s*w)*sw |
671 |
|
#else |
672 |
< |
pot = pot + 0.5d0*(v0*s*w + v0p*sp*wp)*sw |
672 |
> |
pot = pot + 0.5d0*(v0*s*w)*sw + ebalance |
673 |
|
#endif |
674 |
|
endif |
675 |
|
|
689 |
|
dwjdy = frac1*3.0d0*wj2*dwjdy + frac2*dwjdy |
690 |
|
dwjdz = frac1*3.0d0*wj2*dwjdz + frac2*dwjdz |
691 |
|
|
728 |
– |
uglyi = zif*zif*zis + zif*zis*zis |
729 |
– |
uglyj = zjf*zjf*zjs + zjf*zjs*zjs |
730 |
– |
|
731 |
– |
dwipdx = -2.0d0*xi*zi*uglyi*rI3 |
732 |
– |
dwipdy = -2.0d0*yi*zi*uglyi*rI3 |
733 |
– |
dwipdz = 2.0d0*(rI - zi2*rI3)*uglyi |
734 |
– |
|
735 |
– |
dwjpdx = -2.0d0*xj*zj*uglyj*rI3 |
736 |
– |
dwjpdy = -2.0d0*yj*zj*uglyj*rI3 |
737 |
– |
dwjpdz = 2.0d0*(rI - zj2*rI3)*uglyj |
738 |
– |
|
739 |
– |
!dwipdx = -4.0d0*wip3*zi*xihat |
740 |
– |
!dwipdy = -4.0d0*wip3*zi*yihat |
741 |
– |
!dwipdz = -4.0d0*wip3*(zi2 - 1.0d0)*rI |
742 |
– |
|
743 |
– |
!dwjpdx = -4.0d0*wjp3*zj*xjhat |
744 |
– |
!dwjpdy = -4.0d0*wjp3*zj*yjhat |
745 |
– |
!dwjpdz = -4.0d0*wjp3*(zj2 - 1.0d0)*rI |
746 |
– |
|
747 |
– |
!dwipdx = 0.0d0 |
748 |
– |
!dwipdy = 0.0d0 |
749 |
– |
!dwipdz = 0.0d0 |
750 |
– |
|
751 |
– |
!dwjpdx = 0.0d0 |
752 |
– |
!dwjpdy = 0.0d0 |
753 |
– |
!dwjpdz = 0.0d0 |
754 |
– |
|
692 |
|
dwidux = ( 4.0d0*(yi*zi2 + 0.5d0*yi*(xi2-yi2))*rI3 ) |
693 |
|
dwiduy = ( 4.0d0*(xi*zi2 - 0.5d0*xi*(xi2-yi2))*rI3 ) |
694 |
|
dwiduz = ( -8.0d0*xi*yi*zi*rI3 ) |
705 |
|
dwjduy = frac1*3.0d0*wj2*dwjduy + frac2*dwjduy |
706 |
|
dwjduz = frac1*3.0d0*wj2*dwjduz + frac2*dwjduz |
707 |
|
|
771 |
– |
dwipdux = 2.0d0*yi*uglyi*rI |
772 |
– |
dwipduy = -2.0d0*xi*uglyi*rI |
773 |
– |
dwipduz = 0.0d0 |
774 |
– |
|
775 |
– |
dwjpdux = 2.0d0*yj*uglyj*rI |
776 |
– |
dwjpduy = -2.0d0*xj*uglyj*rI |
777 |
– |
dwjpduz = 0.0d0 |
778 |
– |
|
779 |
– |
!dwipdux = 4.0d0*wip3*yihat |
780 |
– |
!dwipduy = -4.0d0*wip3*xihat |
781 |
– |
!dwipduz = 0.0d0 |
782 |
– |
|
783 |
– |
!dwjpdux = 4.0d0*wjp3*yjhat |
784 |
– |
!dwjpduy = -4.0d0*wjp3*xjhat |
785 |
– |
!dwjpduz = 0.0d0 |
786 |
– |
|
787 |
– |
!dwipdux = 0.0d0 |
788 |
– |
!dwipduy = 0.0d0 |
789 |
– |
!dwipduz = 0.0d0 |
790 |
– |
|
791 |
– |
!dwjpdux = 0.0d0 |
792 |
– |
!dwjpduy = 0.0d0 |
793 |
– |
!dwjpduz = 0.0d0 |
794 |
– |
|
708 |
|
! do the torques first since they are easy: |
709 |
|
! remember that these are still in the body fixed axes |
710 |
|
|
711 |
< |
txi = 0.5d0*(v0*s*dwidux + v0p*sp*dwipdux)*sw |
712 |
< |
tyi = 0.5d0*(v0*s*dwiduy + v0p*sp*dwipduy)*sw |
713 |
< |
tzi = 0.5d0*(v0*s*dwiduz + v0p*sp*dwipduz)*sw |
711 |
> |
txi = 0.5d0*(v0*s*dwidux)*sw |
712 |
> |
tyi = 0.5d0*(v0*s*dwiduy)*sw |
713 |
> |
tzi = 0.5d0*(v0*s*dwiduz)*sw |
714 |
|
|
715 |
< |
txj = 0.5d0*(v0*s*dwjdux + v0p*sp*dwjpdux)*sw |
716 |
< |
tyj = 0.5d0*(v0*s*dwjduy + v0p*sp*dwjpduy)*sw |
717 |
< |
tzj = 0.5d0*(v0*s*dwjduz + v0p*sp*dwjpduz)*sw |
715 |
> |
txj = 0.5d0*(v0*s*dwjdux)*sw |
716 |
> |
tyj = 0.5d0*(v0*s*dwjduy)*sw |
717 |
> |
tzj = 0.5d0*(v0*s*dwjduz)*sw |
718 |
|
|
719 |
|
! go back to lab frame using transpose of rotation matrix: |
720 |
|
|
745 |
|
|
746 |
|
! first rotate the i terms back into the lab frame: |
747 |
|
|
748 |
< |
radcomxi = (v0*s*dwidx+v0p*sp*dwipdx)*sw |
749 |
< |
radcomyi = (v0*s*dwidy+v0p*sp*dwipdy)*sw |
750 |
< |
radcomzi = (v0*s*dwidz+v0p*sp*dwipdz)*sw |
748 |
> |
radcomxi = (v0*s*dwidx)*sw |
749 |
> |
radcomyi = (v0*s*dwidy)*sw |
750 |
> |
radcomzi = (v0*s*dwidz)*sw |
751 |
|
|
752 |
< |
radcomxj = (v0*s*dwjdx+v0p*sp*dwjpdx)*sw |
753 |
< |
radcomyj = (v0*s*dwjdy+v0p*sp*dwjpdy)*sw |
754 |
< |
radcomzj = (v0*s*dwjdz+v0p*sp*dwjpdz)*sw |
752 |
> |
radcomxj = (v0*s*dwjdx)*sw |
753 |
> |
radcomyj = (v0*s*dwjdy)*sw |
754 |
> |
radcomzj = (v0*s*dwjdz)*sw |
755 |
|
|
756 |
|
#ifdef IS_MPI |
757 |
|
fxii = a_Row(1,atom1)*(radcomxi) + & |
805 |
|
|
806 |
|
! now assemble these with the radial-only terms: |
807 |
|
|
808 |
< |
fxradial = 0.5d0*((v0*dsdr*w + v0p*dspdr*wp)*drdx + fxii + fxji) |
809 |
< |
fyradial = 0.5d0*((v0*dsdr*w + v0p*dspdr*wp)*drdy + fyii + fyji) |
810 |
< |
fzradial = 0.5d0*((v0*dsdr*w + v0p*dspdr*wp)*drdz + fzii + fzji) |
808 |
> |
fxradial = 0.5d0*(v0*dsdr*w*drdx + fxii + fxji + ebalance*xihat) |
809 |
> |
fyradial = 0.5d0*(v0*dsdr*w*drdy + fyii + fyji + ebalance*yihat) |
810 |
> |
fzradial = 0.5d0*(v0*dsdr*w*drdz + fzii + fzji + ebalance*zihat) |
811 |
|
|
812 |
|
#ifdef IS_MPI |
813 |
|
f_Row(1,atom1) = f_Row(1,atom1) + fxradial |