ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/UseTheForce/DarkSide/shapes.F90
(Generate patch)

Comparing trunk/OOPSE-4/src/UseTheForce/DarkSide/shapes.F90 (file contents):
Revision 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 2357 by chuckv, Wed Oct 12 20:18:17 2005 UTC

# Line 55 | Line 55 | module shapes
55    implicit none
56  
57    PRIVATE
58 <
58 > #define __FORTRAN90
59 > #include "UseTheForce/DarkSide/fInteractionMap.h"
60    INTEGER, PARAMETER:: CHEBYSHEV_TN = 1
61    INTEGER, PARAMETER:: CHEBYSHEV_UN = 2
62    INTEGER, PARAMETER:: LAGUERRE     = 3
# Line 69 | Line 70 | module shapes
70    public :: newShapeType
71    public :: complete_Shape_FF
72    public :: destroyShapeTypes
73 +  public :: getShapeCut
74  
75    type, private :: Shape
76       integer :: atid
# Line 97 | Line 99 | module shapes
99    type, private :: ShapeList
100       integer :: n_shapes = 0
101       integer :: currentShape = 0
102 <     type (Shape), pointer :: Shapes(:)      => null()
103 <     integer, pointer      :: atidToShape(:) => null()
102 >     type(Shape), pointer :: Shapes(:)      => null()
103 >     integer, pointer     :: atidToShape(:) => null()
104    end type ShapeList
105 <
105 >  
106    type(ShapeList), save :: ShapeMap
107 <
107 >  
108    integer :: lmax
109 <
109 >  
110   contains  
111 <
111 >  
112    subroutine newShapeType(nContactFuncs, ContactFuncLValue, &
113         ContactFuncMValue, ContactFunctionType, ContactFuncCoefficient, &
114         nRangeFuncs, RangeFuncLValue, RangeFuncMValue, RangeFunctionType, &
115         RangeFuncCoefficient, nStrengthFuncs, StrengthFuncLValue, &
116         StrengthFuncMValue, StrengthFunctionType, StrengthFuncCoefficient, &
117 <       myATID, status)
118 <
117 >       c_ident, status)
118 >    
119      integer :: nContactFuncs
120      integer :: nRangeFuncs
121      integer :: nStrengthFuncs
122      integer :: shape_ident
123      integer :: status
124 +    integer :: c_ident
125      integer :: myATID
126      integer :: bigL
127      integer :: bigM
# Line 153 | Line 156 | contains  
156         allocate(ShapeMap%Shapes(nShapeTypes + nLJTypes))
157  
158         ntypes = getSize(atypes)
159 <
160 <       allocate(ShapeMap%atidToShape(0:ntypes))
159 >
160 >       allocate(ShapeMap%atidToShape(ntypes))
161      end if
162  
163      ShapeMap%currentShape = ShapeMap%currentShape + 1
# Line 167 | Line 170 | contains  
170         return
171      endif
172  
173 <    call getElementProperty(atypes, myATID, 'c_ident', me)
173 >    myATID = getFirstMatchingElement(atypes, "c_ident", c_ident)
174  
175 <    ShapeMap%atidToShape(me)                         = current
176 <    ShapeMap%Shapes(current)%atid                    = me
175 >    ShapeMap%atidToShape(myATID)                     = current
176 >    ShapeMap%Shapes(current)%atid                    = myATID
177      ShapeMap%Shapes(current)%nContactFuncs           = nContactFuncs
178      ShapeMap%Shapes(current)%nRangeFuncs             = nRangeFuncs
179      ShapeMap%Shapes(current)%nStrengthFuncs          = nStrengthFuncs
# Line 336 | Line 339 | contains  
339      integer :: status
340      integer :: i, j, l, m, lm, function_type
341      real(kind=dp) :: thisDP, sigma
342 <    integer :: alloc_stat, iTheta, iPhi, nSteps, nAtypes, thisIP, current
342 >    integer :: alloc_stat, iTheta, iPhi, nSteps, nAtypes, myATID, current
343      logical :: thisProperty
344  
345      status = 0
# Line 351 | Line 354 | contains  
354      if (nAtypes == 0) then
355         status = -1
356         return
357 <    end if
357 >    end if      
358  
359      ! atypes comes from c side
360 <    do i = 0, nAtypes
361 <
362 <       call getElementProperty(atypes, i, "is_LennardJones", thisProperty)
363 <
360 >    do i = 1, nAtypes
361 >    
362 >       myATID = getFirstMatchingElement(atypes, 'c_ident', i)
363 >       call getElementProperty(atypes, myATID, "is_LennardJones", thisProperty)
364 >        
365         if (thisProperty) then
362
366            ShapeMap%currentShape = ShapeMap%currentShape + 1
367            current = ShapeMap%currentShape
368  
369 <          call getElementProperty(atypes, i, "c_ident",  thisIP)
370 <          ShapeMap%atidToShape(thisIP) = current
368 <          ShapeMap%Shapes(current)%atid = thisIP
369 >          ShapeMap%atidToShape(myATID) = current
370 >          ShapeMap%Shapes(current)%atid = myATID
371  
372            ShapeMap%Shapes(current)%isLJ = .true.
373  
374 <          ShapeMap%Shapes(current)%epsilon = getEpsilon(thisIP)
375 <          ShapeMap%Shapes(current)%sigma = getSigma(thisIP)
374 >          ShapeMap%Shapes(current)%epsilon = getEpsilon(myATID)
375 >          ShapeMap%Shapes(current)%sigma = getSigma(myATID)
376  
377         endif
378  
379      end do
380  
381      haveShapeMap = .true.
382 +
383 + !    do i = 1, ShapeMap%n_shapes
384 + !       write(*,*) 'i = ', i, ' isLJ = ', ShapeMap%Shapes(i)%isLJ
385 + !    end do
386  
387    end subroutine complete_Shape_FF
388  
389 +  function getShapeCut(atomID) result(cutValue)
390 +    integer, intent(in) :: atomID
391 +    real(kind=dp) :: cutValue, whoopdedoo
392 +
393 +    !! this is just a placeholder for a cutoff value, hopefully we'll
394 +    !! develop a method to calculate a sensible value
395 +    whoopdedoo = 9.0_dp
396 +
397 +    cutValue = whoopdedoo
398 +
399 +  end function getShapeCut
400 +
401    subroutine do_shape_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, &
402         pot, A, f, t, do_pot)
403  
# Line 480 | Line 498 | contains  
498      real (kind=dp) :: fxji, fyji, fzji, fxjj, fyjj, fzjj
499      real (kind=dp) :: fxradial, fyradial, fzradial
500  
501 +    real (kind=dp) :: xihat, yihat, zihat, xjhat, yjhat, zjhat
502 +
503      real (kind=dp) :: plm_i(0:LMAX,0:MMAX), dlm_i(0:LMAX,0:MMAX)
504      real (kind=dp) :: plm_j(0:LMAX,0:MMAX), dlm_j(0:LMAX,0:MMAX)
505      real (kind=dp) :: tm_i(0:MMAX), dtm_i(0:MMAX), um_i(0:MMAX), dum_i(0:MMAX)
# Line 492 | Line 512 | contains  
512  
513      !! We assume that the rotation matrices have already been calculated
514      !! and placed in the A array.
495
515      r3 = r2*rij
516      r5 = r3*r2
517  
518      drdxi = -d(1) / rij
519      drdyi = -d(2) / rij
520      drdzi = -d(3) / rij
521 +    drduxi = 0.0d0
522 +    drduyi = 0.0d0
523 +    drduzi = 0.0d0
524  
525      drdxj = d(1) / rij
526      drdyj = d(2) / rij
527      drdzj = d(3) / rij
528 +    drduxj = 0.0d0
529 +    drduyj = 0.0d0
530 +    drduzj = 0.0d0
531  
532      ! find the atom type id (atid) for each atom:
533   #ifdef IS_MPI
# Line 516 | Line 541 | contains  
541      ! use the atid to find the shape type (st) for each atom:
542      st1 = ShapeMap%atidToShape(atid1)
543      st2 = ShapeMap%atidToShape(atid2)
544 +    
545 + !    write(*,*) atom1, atom2, atid1, atid2, st1, st2, ShapeMap%Shapes(st1)%isLJ, ShapeMap%Shapes(st2)%isLJ
546  
547      if (ShapeMap%Shapes(st1)%isLJ) then
548  
# Line 559 | Line 586 | contains  
586         zi = a(7,atom1)*d(1) + a(8,atom1)*d(2) + a(9,atom1)*d(3)
587  
588   #endif
589 <
589 >       xihat = xi / rij
590 >       yihat = yi / rij
591 >       zihat = zi / rij
592         xi2 = xi*xi
593         yi2 = yi*yi
594         zi2 = zi*zi            
# Line 571 | Line 600 | contains  
600         dctidx = - zi * xi / r3
601         dctidy = - zi * yi / r3
602         dctidz = 1.0d0 / rij - zi2 / r3
603 <       dctidux = - (zi * xi2) / r3
604 <       dctiduy = - (zi * yi2) / r3
605 <       dctiduz = zi / rij - (zi2 * zi) / r3
603 >       dctidux = yi / rij ! - (zi * xi2) / r3
604 >       dctiduy = -xi / rij !- (zi * yi2) / r3
605 >       dctiduz = 0.0d0 !zi / rij - (zi2 * zi) / r3
606  
607         ! this is an attempt to try to truncate the singularity when
608         ! sin(theta) is near 0.0:
# Line 652 | Line 681 | contains  
681               dPhuncdX = coeff * dtm_i(m) * dcpidx
682               dPhuncdY = coeff * dtm_i(m) * dcpidy
683               dPhuncdZ = coeff * dtm_i(m) * dcpidz
684 <             dPhuncdUz = coeff * dtm_i(m) * dcpidux
684 >             dPhuncdUx = coeff * dtm_i(m) * dcpidux
685               dPhuncdUy = coeff * dtm_i(m) * dcpiduy
686               dPhuncdUz = coeff * dtm_i(m) * dcpiduz
687            else
# Line 666 | Line 695 | contains  
695            endif
696  
697            sigma_i = sigma_i + plm_i(m,l)*Phunc
698 <
698 > !!$          write(*,*) 'dsigmaidux = ', dsigmaidux
699 > !!$          write(*,*) 'Phunc = ', Phunc
700            dsigmaidx = dsigmaidx + plm_i(m,l)*dPhuncdX + &
701                 Phunc * dlm_i(m,l) * dctidx
702            dsigmaidy = dsigmaidy + plm_i(m,l)*dPhuncdY + &
703                 Phunc * dlm_i(m,l) * dctidy
704            dsigmaidz = dsigmaidz + plm_i(m,l)*dPhuncdZ + &
705                 Phunc * dlm_i(m,l) * dctidz
676
706            dsigmaidux = dsigmaidux + plm_i(m,l)* dPhuncdUx + &
707                 Phunc * dlm_i(m,l) * dctidux
708            dsigmaiduy = dsigmaiduy + plm_i(m,l)* dPhuncdUy + &
709                 Phunc * dlm_i(m,l) * dctiduy
710            dsigmaiduz = dsigmaiduz + plm_i(m,l)* dPhuncdUz + &
711                 Phunc * dlm_i(m,l) * dctiduz
712 <
712 > !!$          write(*,*) 'dsigmaidux = ', dsigmaidux, '; dPhuncdUx = ', dPhuncdUx, &
713 > !!$                     '; dctidux = ', dctidux, '; plm_i(m,l) = ', plm_i(m,l), &
714 > !!$                     '; dlm_i(m,l) = ', dlm_i(m,l), '; m = ', m, '; l = ', l
715         end do
716  
717         do lm = 1, ShapeMap%Shapes(st1)%nRangeFuncs
# Line 694 | Line 725 | contains  
725               dPhuncdX = coeff * dtm_i(m) * dcpidx
726               dPhuncdY = coeff * dtm_i(m) * dcpidy
727               dPhuncdZ = coeff * dtm_i(m) * dcpidz
728 <             dPhuncdUz = coeff * dtm_i(m) * dcpidux
728 >             dPhuncdUx = coeff * dtm_i(m) * dcpidux
729               dPhuncdUy = coeff * dtm_i(m) * dcpiduy
730               dPhuncdUz = coeff * dtm_i(m) * dcpiduz
731            else
# Line 736 | Line 767 | contains  
767               dPhuncdX = coeff * dtm_i(m) * dcpidx
768               dPhuncdY = coeff * dtm_i(m) * dcpidy
769               dPhuncdZ = coeff * dtm_i(m) * dcpidz
770 <             dPhuncdUz = coeff * dtm_i(m) * dcpidux
770 >             dPhuncdUx = coeff * dtm_i(m) * dcpidux
771               dPhuncdUy = coeff * dtm_i(m) * dcpiduy
772               dPhuncdUz = coeff * dtm_i(m) * dcpiduz
773            else
# Line 813 | Line 844 | contains  
844         zj = -(a(7,atom2)*d(1) + a(8,atom2)*d(2) + a(9,atom2)*d(3))
845   #endif
846  
847 +       xjhat = xj / rij
848 +       yjhat = yj / rij
849 +       zjhat = zj / rij
850         xj2 = xj*xj
851         yj2 = yj*yj
852         zj2 = zj*zj
# Line 824 | Line 858 | contains  
858         dctjdx = - zj * xj / r3
859         dctjdy = - zj * yj / r3
860         dctjdz = 1.0d0 / rij - zj2 / r3
861 <       dctjdux = - (zi * xj2) / r3
862 <       dctjduy = - (zj * yj2) / r3
863 <       dctjduz = zj / rij - (zj2 * zj) / r3
861 >       dctjdux = yj / rij !- (zi * xj2) / r3
862 >       dctjduy = -xj / rij !- (zj * yj2) / r3
863 >       dctjduz = 0.0d0 !zj / rij - (zj2 * zj) / r3
864  
865         ! this is an attempt to try to truncate the singularity when
866         ! sin(theta) is near 0.0:
# Line 864 | Line 898 | contains  
898         dspjduz = 0.0d0
899  
900  
901 <       write(*,*) 'dcpdu = ' ,dcpidux, dcpiduy, dcpiduz
902 <       write(*,*) 'dcpdu = ' ,dcpjdux, dcpjduy, dcpjduz
901 > !       write(*,*) 'dcpdu = ' ,dcpidux, dcpiduy, dcpiduz
902 > !       write(*,*) 'dcpdu = ' ,dcpjdux, dcpjduy, dcpjduz
903         call Associated_Legendre(ctj, ShapeMap%Shapes(st2)%bigM, &
904              ShapeMap%Shapes(st2)%bigL, LMAX, &
905              plm_j, dlm_j)
# Line 908 | Line 942 | contains  
942               dPhuncdX = coeff * dtm_j(m) * dcpjdx
943               dPhuncdY = coeff * dtm_j(m) * dcpjdy
944               dPhuncdZ = coeff * dtm_j(m) * dcpjdz
945 <             dPhuncdUz = coeff * dtm_j(m) * dcpjdux
945 >             dPhuncdUx = coeff * dtm_j(m) * dcpjdux
946               dPhuncdUy = coeff * dtm_j(m) * dcpjduy
947               dPhuncdUz = coeff * dtm_j(m) * dcpjduz
948            else
# Line 950 | Line 984 | contains  
984               dPhuncdX = coeff * dtm_j(m) * dcpjdx
985               dPhuncdY = coeff * dtm_j(m) * dcpjdy
986               dPhuncdZ = coeff * dtm_j(m) * dcpjdz
987 <             dPhuncdUz = coeff * dtm_j(m) * dcpjdux
987 >             dPhuncdUx = coeff * dtm_j(m) * dcpjdux
988               dPhuncdUy = coeff * dtm_j(m) * dcpjduy
989               dPhuncdUz = coeff * dtm_j(m) * dcpjduz
990            else
# Line 1005 | Line 1039 | contains  
1039               dPhuncdUz = coeff*(spj * dum_j(m-1)*dcpjduz + dspjduz *um_j(m-1))
1040            endif
1041  
1042 <          write(*,*) 'l,m = ', l, m, coeff, dPhuncdUx, dPhuncdUy, dPhuncdUz
1042 > !          write(*,*) 'l,m = ', l, m, coeff, dPhuncdUx, dPhuncdUy, dPhuncdUz
1043  
1044            eps_j = eps_j + plm_j(m,l)*Phunc
1045  
# Line 1030 | Line 1064 | contains  
1064      ! phew, now let's assemble the potential energy:
1065  
1066      sigma = 0.5*(sigma_i + sigma_j)
1067 <
1067 > !    write(*,*) sigma_i, ' = sigma_i; ', sigma_j, ' = sigma_j'
1068      dsigmadxi = 0.5*dsigmaidx
1069      dsigmadyi = 0.5*dsigmaidy
1070      dsigmadzi = 0.5*dsigmaidz
# Line 1062 | Line 1096 | contains  
1096      dsduzj = 0.5*dsjduz
1097  
1098      eps = sqrt(eps_i * eps_j)
1099 <
1099 > !!$    write(*,*) 'dsidu = ', dsidux, dsiduy, dsiduz
1100 > !!$    write(*,*) 'dsigidu = ', dsigmaidux, dsigmaiduy, dsigmaiduz
1101 > !!$    write(*,*) sigma_j, ' is sigma j; ', s_j, ' is s j; ', eps_j, ' is eps j'
1102      depsdxi = eps_j * depsidx / (2.0d0 * eps)
1103      depsdyi = eps_j * depsidy / (2.0d0 * eps)
1104      depsdzi = eps_j * depsidz / (2.0d0 * eps)
# Line 1078 | Line 1114 | contains  
1114      depsduzj = eps_i * depsjduz / (2.0d0 * eps)
1115  
1116   !!$    write(*,*) 'depsidu = ', depsidux, depsiduy, depsiduz
1117 +
1118   !!$    write(*,*) 'depsjdu = ', depsjdux, depsjduy, depsjduz
1082 !!$
1083 !!$    write(*,*) 'depsdui = ', depsduxi, depsduyi, depsduzi
1119   !!$    write(*,*) 'depsduj = ', depsduxj, depsduyj, depsduzj
1120   !!$
1121   !!$    write(*,*) 's, sig, eps = ', s, sigma, eps
# Line 1088 | Line 1123 | contains  
1123      rtdenom = rij-sigma+s
1124      rt = s / rtdenom
1125  
1126 <    drtdxi = (dsdxi + rt * (drdxi - dsigmadxi + dsdxi)) / rtdenom
1127 <    drtdyi = (dsdyi + rt * (drdyi - dsigmadyi + dsdyi)) / rtdenom
1128 <    drtdzi = (dsdzi + rt * (drdzi - dsigmadzi + dsdzi)) / rtdenom
1129 <    drtduxi = (dsduxi + rt * (drduxi - dsigmaduxi + dsduxi)) / rtdenom
1130 <    drtduyi = (dsduyi + rt * (drduyi - dsigmaduyi + dsduyi)) / rtdenom
1131 <    drtduzi = (dsduzi + rt * (drduzi - dsigmaduzi + dsduzi)) / rtdenom
1132 <    drtdxj = (dsdxj + rt * (drdxj - dsigmadxj + dsdxj)) / rtdenom
1133 <    drtdyj = (dsdyj + rt * (drdyj - dsigmadyj + dsdyj)) / rtdenom
1134 <    drtdzj = (dsdzj + rt * (drdzj - dsigmadzj + dsdzj)) / rtdenom
1135 <    drtduxj = (dsduxj + rt * (drduxj - dsigmaduxj + dsduxj)) / rtdenom
1136 <    drtduyj = (dsduyj + rt * (drduyj - dsigmaduyj + dsduyj)) / rtdenom
1137 <    drtduzj = (dsduzj + rt * (drduzj - dsigmaduzj + dsduzj)) / rtdenom
1126 >    drtdxi = (dsdxi - rt * (drdxi - dsigmadxi + dsdxi)) / rtdenom
1127 >    drtdyi = (dsdyi - rt * (drdyi - dsigmadyi + dsdyi)) / rtdenom
1128 >    drtdzi = (dsdzi - rt * (drdzi - dsigmadzi + dsdzi)) / rtdenom
1129 >    drtduxi = (dsduxi - rt * (drduxi - dsigmaduxi + dsduxi)) / rtdenom
1130 >    drtduyi = (dsduyi - rt * (drduyi - dsigmaduyi + dsduyi)) / rtdenom
1131 >    drtduzi = (dsduzi - rt * (drduzi - dsigmaduzi + dsduzi)) / rtdenom
1132 >    drtdxj = (dsdxj - rt * (drdxj - dsigmadxj + dsdxj)) / rtdenom
1133 >    drtdyj = (dsdyj - rt * (drdyj - dsigmadyj + dsdyj)) / rtdenom
1134 >    drtdzj = (dsdzj - rt * (drdzj - dsigmadzj + dsdzj)) / rtdenom
1135 >    drtduxj = (dsduxj - rt * (drduxj - dsigmaduxj + dsduxj)) / rtdenom
1136 >    drtduyj = (dsduyj - rt * (drduyj - dsigmaduyj + dsduyj)) / rtdenom
1137 >    drtduzj = (dsduzj - rt * (drduzj - dsigmaduzj + dsduzj)) / rtdenom
1138  
1139 + !!$    write(*,*) 'drtd_i = ', drtdxi, drtdyi, drtdzi
1140 + !!$    write(*,*) 'drtdu_j = ', drtduxj, drtduyj, drtduzj
1141 +
1142      rt2 = rt*rt
1143      rt3 = rt2*rt
1144      rt5 = rt2*rt3
# Line 1114 | Line 1152 | contains  
1152      vpair = vpair + pot_temp
1153      if (do_pot) then
1154   #ifdef IS_MPI
1155 <       pot_row(atom1) = pot_row(atom1) + 0.5d0*pot_temp*sw
1156 <       pot_col(atom2) = pot_col(atom2) + 0.5d0*pot_temp*sw
1155 >       pot_row(SHAPE_POT,atom1) = pot_row(SHAPE_POT,atom1) + 0.5d0*pot_temp*sw
1156 >       pot_col(SHAPE_POT,atom2) = pot_col(SHAPE_POT,atom2) + 0.5d0*pot_temp*sw
1157   #else
1158         pot = pot + pot_temp*sw
1159   #endif
# Line 1136 | Line 1174 | contains  
1174      dvduxj = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtduxj + 4.0d0*depsduxj*rt126
1175      dvduyj = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtduyj + 4.0d0*depsduyj*rt126
1176      dvduzj = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtduzj + 4.0d0*depsduzj*rt126
1177 <
1177 > !!$    write(*,*) 'drtduxi = ', drtduxi, ' depsduxi = ', depsduxi
1178      ! do the torques first since they are easy:
1179      ! remember that these are still in the body fixed axes
1180  
1181 +    txi = 0.0d0
1182 +    tyi = 0.0d0
1183 +    tzi = 0.0d0
1184  
1185 < !!$    write(*,*) 'sw = ', sw
1186 < !!$    write(*,*) 'dvdu1 = ', dvduxi, dvduyi, dvduzi
1187 < !!$    write(*,*) 'dvdu2 = ', dvduxj, dvduyj, dvduzj
1147 < !!$
1148 <    txi =  (dvduzi - dvduyi) * sw
1149 <    tyi =  (dvduxi - dvduzi) * sw
1150 <    tzi =  (dvduyi - dvduxi) * sw
1185 >    txj = 0.0d0
1186 >    tyj = 0.0d0
1187 >    tzj = 0.0d0
1188  
1189 <    txj = (dvduzj - dvduyj) * sw
1190 <    tyj = (dvduxj - dvduzj) * sw
1191 <    tzj = (dvduyj - dvduxj) * sw
1189 >    txi = (dvduyi - dvduzi) * sw
1190 >    tyi = (dvduzi - dvduxi) * sw
1191 >    tzi = (dvduxi - dvduyi) * sw
1192  
1193 < !!$    txi = -dvduxi * sw
1194 < !!$    tyi = -dvduyi * sw
1195 < !!$    tzi = -dvduzi * sw
1193 >    txj = (dvduyj - dvduzj) * sw
1194 >    tyj = (dvduzj - dvduxj) * sw
1195 >    tzj = (dvduxj - dvduyj) * sw
1196 >
1197 > !!$    txi = dvduxi * sw
1198 > !!$    tyi = dvduyi * sw
1199 > !!$    tzi = dvduzi * sw
1200   !!$
1201   !!$    txj = dvduxj * sw
1202   !!$    tyj = dvduyj * sw
# Line 1188 | Line 1229 | contains  
1229      t(1,atom2) = t(1,atom2) + a(1,atom2)*txj + a(4,atom2)*tyj + a(7,atom2)*tzj
1230      t(2,atom2) = t(2,atom2) + a(2,atom2)*txj + a(5,atom2)*tyj + a(8,atom2)*tzj
1231      t(3,atom2) = t(3,atom2) + a(3,atom2)*txj + a(6,atom2)*tyj + a(9,atom2)*tzj
1232 +
1233   #endif
1234      ! Now, on to the forces:
1235  
1236      ! first rotate the i terms back into the lab frame:
1237  
1238 <    fxi = dvdxi * sw
1239 <    fyi = dvdyi * sw
1240 <    fzi = dvdzi * sw
1238 >    fxi = -dvdxi * sw
1239 >    fyi = -dvdyi * sw
1240 >    fzi = -dvdzi * sw
1241  
1242 <    fxj = dvdxj * sw
1243 <    fyj = dvdyj * sw
1244 <    fzj = dvdzj * sw
1242 >    fxj = -dvdxj * sw
1243 >    fyj = -dvdyj * sw
1244 >    fzj = -dvdzj * sw
1245  
1246 +
1247   #ifdef IS_MPI
1248      fxii = a_Row(1,atom1)*fxi + a_Row(4,atom1)*fyi + a_Row(7,atom1)*fzi
1249      fyii = a_Row(2,atom1)*fxi + a_Row(5,atom1)*fyi + a_Row(8,atom1)*fzi
# Line 1227 | Line 1270 | contains  
1270      fyji = -fyjj
1271      fzji = -fzjj
1272  
1273 <    fxradial = 0.5_dp * (fxii + fxji)
1274 <    fyradial = 0.5_dp * (fyii + fyji)
1275 <    fzradial = 0.5_dp * (fzii + fzji)
1276 <
1273 >    fxradial = (fxii + fxji)
1274 >    fyradial = (fyii + fyji)
1275 >    fzradial = (fzii + fzji)
1276 > !!$    write(*,*) fxradial, ' is fxrad; ', fyradial, ' is fyrad; ', fzradial, 'is fzrad'
1277   #ifdef IS_MPI
1278      f_Row(1,atom1) = f_Row(1,atom1) + fxradial
1279      f_Row(2,atom1) = f_Row(2,atom1) + fyradial

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines