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 1698 by chrisfen, Tue Nov 2 15:28:25 2004 UTC vs.
Revision 1707 by gezelter, Thu Nov 4 16:20:37 2004 UTC

# Line 376 | Line 376 | contains  
376      real (kind=dp) :: depsjdux, depsjduy, depsjduz
377  
378      real (kind=dp) :: xi, yi, zi, xj, yj, zj, xi2, yi2, zi2, xj2, yj2, zj2
379 +
380 +    real (kind=dp) :: sti2, stj2
381  
382      real (kind=dp) :: proji, proji3, projj, projj3
383      real (kind=dp) :: cti, ctj, cpi, cpj, spi, spj
# Line 444 | Line 446 | contains  
446         call handleError("calc_shape", "NO SHAPEMAP!!!!")
447         return      
448      endif
449 +
450 +    write(*,*) rij, r2, d(1), d(2), d(3)
451 +    write(*,*) 'before, atom1, 2 = ', atom1, atom2
452 +    write(*,*) 'f1 = ', f(1,atom1), f(2,atom1), f(3,atom1)
453 +    write(*,*) 'f2 = ', f(1,atom2), f(2,atom2), f(3,atom2)
454 +    write(*,*) 't1 = ', t(1,atom1), t(2,atom1), t(3,atom1)
455 +    write(*,*) 't2 = ', t(1,atom2), t(2,atom2), t(3,atom2)
456      
457      !! We assume that the rotation matrices have already been calculated
458      !! and placed in the A array.
# Line 517 | Line 526 | contains  
526  
527         xi2 = xi*xi
528         yi2 = yi*yi
529 <       zi2 = zi*zi
521 <      
522 <       proji = sqrt(xi2 + yi2)
523 <       proji3 = proji*proji*proji
524 <      
529 >       zi2 = zi*zi            
530         cti = zi / rij
531  
532 +       if (cti .gt. 1.0_dp) cti = 1.0_dp
533 +       if (cti .lt. -1.0_dp) cti = -1.0_dp
534 +
535         dctidx = - zi * xi / r3
536         dctidy = - zi * yi / r3
537         dctidz = 1.0d0 / rij - zi2 / r3
538 <       dctidux =  yi / rij
539 <       dctiduy = -xi / rij
538 >       dctidux =  yi / rij + (zi * yi) / r3
539 >       dctiduy = -xi / rij - (zi * xi) / r3
540         dctiduz = 0.0d0
541 +
542 +       ! this is an attempt to try to truncate the singularity when
543 +       ! sin(theta) is near 0.0:
544 +
545 +       sti2 = 1.0_dp - cti*cti
546 +       if (dabs(sti2) .lt. 1.0d-12) then
547 +          proji = sqrt(rij * 1.0d-12)
548 +          dcpidx = 1.0d0 / proji
549 +          dcpidy = 0.0d0
550 +          dcpidux = 0.0d0
551 +          dcpiduy = zi / proji
552 +          dspidx = 0.0d0
553 +          dspidy = 1.0d0 / proji
554 +          dspidux = -zi / proji
555 +          dspiduy = 0.0d0
556 +       else
557 +          proji = sqrt(xi2 + yi2)
558 +          proji3 = proji*proji*proji
559 +          dcpidx = 1.0d0 / proji - xi2 / proji3
560 +          dcpidy = - xi * yi / proji3
561 +          dcpidux = xi * yi * zi / proji3
562 +          dcpiduy = zi / proji - xi2 * zi / proji3
563 +          dspidx = - xi * yi / proji3
564 +          dspidy = 1.0d0 / proji - yi2 / proji3
565 +          dspidux = -zi / proji + yi2 * zi / proji3
566 +          dspiduy = - xi * yi * zi / proji3
567 +       endif
568        
569         cpi = xi / proji
535       dcpidx = 1.0d0 / proji - xi2 / proji3
536       dcpidy = - xi * yi / proji3
570         dcpidz = 0.0d0
571 <       dcpidux = xi * yi * zi / proji3
539 <       dcpiduy = -zi * (1.0d0 / proji - xi2 / proji3)
540 <       dcpiduz = -yi * (1.0d0 / proji - xi2 / proji3)  - (xi2 * yi / proji3)
571 >       dcpiduz = -yi / proji
572        
573         spi = yi / proji
543       dspidx = - xi * yi / proji3
544       dspidy = 1.0d0 / proji - yi2 / proji3
574         dspidz = 0.0d0
575 <       dspidux = -zi * (1.0d0 / proji - yi2 / proji3)
576 <       dspiduy = xi * yi * zi / proji3
548 <       dspiduz = xi * (1.0d0 / proji - yi2 / proji3) + (xi * yi2 / proji3)
575 >       dspiduz = xi / proji
576 >       write(*,*) 'before lmloop', cpi, dcpidx, dcpidux
577  
578         call Associated_Legendre(cti, ShapeMap%Shapes(st1)%bigM, &
579              ShapeMap%Shapes(st1)%bigL, LMAX, &
# Line 626 | Line 654 | contains  
654            coeff = ShapeMap%Shapes(st1)%RangeFuncCoefficient(lm)
655            function_type = ShapeMap%Shapes(st1)%RangeFunctionType(lm)
656            
657 +         write(*,*) 'in lm loop a', coeff, dtm_i(m), dcpidx
658 +
659 +
660            if ((function_type .eq. SH_COS).or.(m.eq.0)) then
661               Phunc = coeff * tm_i(m)
662               dPhuncdX = coeff * dtm_i(m) * dcpidx
# Line 645 | Line 676 | contains  
676            endif
677  
678            s_i = s_i + plm_i(m,l)*Phunc
679 <          
679 >          
680 >
681 >          write(*,*) 'in lm loop ', dsidx, plm_i(m,l), dPhuncdX, Phunc, dlm_i(m,l), dctidx
682            dsidx = dsidx + plm_i(m,l)*dPhuncdX + &
683                 Phunc * dlm_i(m,l) * dctidx
684            dsidy = dsidy + plm_i(m,l)*dPhuncdY + &
# Line 753 | Line 786 | contains  
786         xj2 = xj*xj
787         yj2 = yj*yj
788         zj2 = zj*zj
756      
757       projj = sqrt(xj2 + yj2)
758       projj3 = projj*projj*projj
759      
789         ctj = zj / rij
790 +      
791 +       if (ctj .gt. 1.0_dp) ctj = 1.0_dp
792 +       if (ctj .lt. -1.0_dp) ctj = -1.0_dp
793 +
794         dctjdx = - zj * xj / r3
795         dctjdy = - zj * yj / r3
796         dctjdz = 1.0d0 / rij - zj2 / r3
797 <       dctjdux =  yj / rij
798 <       dctjduy = -xj / rij
797 >       dctjdux =  yj / rij + (zj * yj) / r3
798 >       dctjduy = -xj / rij - (zj * xj) / r3
799         dctjduz = 0.0d0
800        
801 +       ! this is an attempt to try to truncate the singularity when
802 +       ! sin(theta) is near 0.0:
803 +
804 +       stj2 = 1.0_dp - ctj*ctj
805 +       if (dabs(stj2) .lt. 1.0d-12) then
806 +          projj = sqrt(rij * 1.0d-12)
807 +          dcpjdx = 1.0d0 / projj
808 +          dcpjdy = 0.0d0
809 +          dcpjdux = 0.0d0
810 +          dcpjduy = zj / projj
811 +          dspjdx = 0.0d0
812 +          dspjdy = 1.0d0 / projj
813 +          dspjdux = -zj / projj
814 +          dspjduy = 0.0d0
815 +       else
816 +          projj = sqrt(xj2 + yj2)
817 +          projj3 = projj*projj*projj
818 +          dcpjdx = 1.0d0 / projj - xj2 / projj3
819 +          dcpjdy = - xj * yj / projj3
820 +          dcpjdux = xj * yj * zj / projj3
821 +          dcpjduy = zj / projj - xj2 * zj / projj3
822 +          dspjdx = - xj * yj / projj3
823 +          dspjdy = 1.0d0 / projj - yj2 / projj3
824 +          dspjdux = -zj / projj + yj2 * zj / projj3
825 +          dspjduy = - xj * yj * zj / projj3
826 +       endif
827 +
828         cpj = xj / projj
769       dcpjdx = 1.0d0 / projj - xj2 / projj3
770       dcpjdy = - xj * yj / projj3
829         dcpjdz = 0.0d0
830 <       dcpjdux = xj * yj * zj / projj3
773 <       dcpjduy = -zj * (1.0d0 / projj - xj2 / projj3)
774 <       dcpjduz = -yj * (1.0d0 / projj - xj2 / projj3)  - (xj2 * yj / projj3)
830 >       dcpjduz = -yj / projj
831        
832         spj = yj / projj
777       dspjdx = - xj * yj / projj3
778       dspjdy = 1.0d0 / projj - yj2 / projj3
833         dspjdz = 0.0d0
834 <       dspjdux = -zj * (1.0d0 / projj - yj2 / projj3)
835 <       dspjduy = xj * yj * zj / projj3
782 <       dspjduz = xj * (1.0d0 / projj - yi2 / projj3) + (xj * yj2 / projj3)
783 <      
834 >       dspjduz = xj / projj
835 >
836         call Associated_Legendre(ctj, ShapeMap%Shapes(st2)%bigM, &
837              ShapeMap%Shapes(st2)%bigL, LMAX, &
838              plm_j, dlm_j)
# Line 976 | Line 1028 | contains  
1028  
1029      eps = sqrt(eps_i * eps_j)
1030  
1031 +    write(*,*) 'sigma, s, eps = ', sigma, s, eps
1032 +
1033      depsdxi = eps_j * depsidx / (2.0d0 * eps)
1034      depsdyi = eps_j * depsidy / (2.0d0 * eps)
1035      depsdzi = eps_j * depsidz / (2.0d0 * eps)
# Line 991 | Line 1045 | contains  
1045      depsduzj = eps_i * depsjduz / (2.0d0 * eps)
1046      
1047      rtdenom = rij-sigma+s
1048 +
1049 +    write(*,*) 'rtdenom = ', rtdenom, ' sw = ', sw
1050      rt = s / rtdenom
1051  
1052 +    write(*,*) 'john' , dsdxi, rt, drdxi, dsigmadxi, rtdenom
1053 +    write(*,*) 'bigboot', dsduzj, rt, drduzj, dsigmaduzj, rtdenom
1054 +
1055 +
1056      drtdxi = (dsdxi + rt * (drdxi - dsigmadxi + dsdxi)) / rtdenom
1057      drtdyi = (dsdyi + rt * (drdyi - dsigmadyi + dsdyi)) / rtdenom
1058      drtdzi = (dsdzi + rt * (drdzi - dsigmadzi + dsdzi)) / rtdenom
# Line 1023 | Line 1083 | contains  
1083   #endif
1084      endif
1085      
1086 +    write(*,*) 'drtdxi = ', drtdxi, drtdyi
1087 +    write(*,*) 'depsdxi = ', depsdxi, depsdyi
1088 +
1089      dvdxi = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtdxi + 4.0d0*depsdxi*rt126
1090      dvdyi = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtdyi + 4.0d0*depsdyi*rt126
1091      dvdzi = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtdzi + 4.0d0*depsdzi*rt126
# Line 1030 | Line 1093 | contains  
1093      dvduyi = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtduyi + 4.0d0*depsduyi*rt126
1094      dvduzi = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtduzi + 4.0d0*depsduzi*rt126
1095  
1096 +    write(*,*) 'drtduzj = ', drtduzj, depsduzj
1097 +
1098      dvdxj = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtdxj + 4.0d0*depsdxj*rt126
1099      dvdyj = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtdyj + 4.0d0*depsdyj*rt126
1100      dvdzj = 24.0d0*eps*(2.0d0*rt11 - rt5)*drtdzj + 4.0d0*depsdzj*rt126
# Line 1039 | Line 1104 | contains  
1104  
1105      ! do the torques first since they are easy:
1106      ! remember that these are still in the body fixed axes
1107 +
1108 +    write(*,*) 'dvdx = ', dvdxi, dvdyi, dvdzi
1109 +    write(*,*) 'dvdx = ', dvdxj, dvdyj, dvdzj
1110 +    write(*,*) 'dvdu = ', dvduxi, dvduyi, dvduzi
1111 +    write(*,*) 'dvdu = ', dvduxj, dvduyj, dvduzj
1112  
1113      txi = dvduxi * sw
1114      tyi = dvduyi * sw
# Line 1149 | Line 1219 | contains  
1219        
1220      endif
1221      
1222 +    write(*,*) 'f1 = ', f(1,atom1), f(2,atom1), f(3,atom1)
1223 +    write(*,*) 'f2 = ', f(1,atom2), f(2,atom2), f(3,atom2)
1224 +    write(*,*) 't1 = ', t(1,atom1), t(2,atom1), t(3,atom1)
1225 +    write(*,*) 't2 = ', t(1,atom2), t(2,atom2), t(3,atom2)
1226 +
1227 +
1228    end subroutine do_shape_pair
1229      
1230    SUBROUTINE Associated_Legendre(x, l, m, lmax, plm, dlm)        

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines