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

Comparing trunk/OOPSE-4/src/UseTheForce/DarkSide/electrostatic.F90 (file contents):
Revision 2118 by gezelter, Fri Mar 11 15:53:18 2005 UTC vs.
Revision 2127 by gezelter, Mon Mar 21 19:23:27 2005 UTC

# Line 319 | Line 319 | contains
319      real( kind = dp ), dimension(3,nLocal) :: f
320      real( kind = dp ), dimension(3,nLocal) :: t
321      
322 <    real (kind = dp), dimension(3) :: ul_i
323 <    real (kind = dp), dimension(3) :: ul_j
322 >    real (kind = dp), dimension(3) :: ux_i, uy_i, uz_i
323 >    real (kind = dp), dimension(3) :: ux_j, uy_j, uz_j
324 >    real (kind = dp), dimension(3) :: dudux_i, duduy_i, duduz_i
325 >    real (kind = dp), dimension(3) :: dudux_j, duduy_j, duduz_j
326  
327      logical :: i_is_Charge, i_is_Dipole, i_is_SplitDipole, i_is_Quadrupole
328      logical :: j_is_Charge, j_is_Dipole, j_is_SplitDipole, j_is_Quadrupole
329      integer :: me1, me2, id1, id2
330      real (kind=dp) :: q_i, q_j, mu_i, mu_j, d_i, d_j
331 +    real (kind=dp) :: qxx_i, qyy_i, qzz_i
332 +    real (kind=dp) :: qxx_j, qyy_j, qzz_j
333 +    real (kind=dp) :: cx_i, cy_i, cz_i
334 +    real (kind=dp) :: cx_j, cy_j, cz_j
335 +    real (kind=dp) :: cx2, cy2, cz2
336      real (kind=dp) :: ct_i, ct_j, ct_ij, a1
337      real (kind=dp) :: riji, ri, ri2, ri3, ri4
338      real (kind=dp) :: pref, vterm, epot, dudr    
339      real (kind=dp) :: xhat, yhat, zhat
340      real (kind=dp) :: dudx, dudy, dudz
341      real (kind=dp) :: drdxj, drdyj, drdzj
335    real (kind=dp) :: duduix, duduiy, duduiz, dudujx, dudujy, dudujz
342      real (kind=dp) :: scale, sc2, bigR
343  
344      if (.not.allocated(ElectrostaticMap)) then
# Line 379 | Line 385 | contains
385      if (i_is_Dipole) then
386         mu_i = ElectrostaticMap(me1)%dipole_moment
387   #ifdef IS_MPI
388 <       ul_i(1) = eFrame_Row(3,atom1)
389 <       ul_i(2) = eFrame_Row(6,atom1)
390 <       ul_i(3) = eFrame_Row(9,atom1)
388 >       uz_i(1) = eFrame_Row(3,atom1)
389 >       uz_i(2) = eFrame_Row(6,atom1)
390 >       uz_i(3) = eFrame_Row(9,atom1)
391   #else
392 <       ul_i(1) = eFrame(3,atom1)
393 <       ul_i(2) = eFrame(6,atom1)
394 <       ul_i(3) = eFrame(9,atom1)
392 >       uz_i(1) = eFrame(3,atom1)
393 >       uz_i(2) = eFrame(6,atom1)
394 >       uz_i(3) = eFrame(9,atom1)
395   #endif
396 <       ct_i = ul_i(1)*drdxj + ul_i(2)*drdyj + ul_i(3)*drdzj
396 >       ct_i = uz_i(1)*xhat + uz_i(2)*yhat + uz_i(3)*zhat
397  
398         if (i_is_SplitDipole) then
399            d_i = ElectrostaticMap(me1)%split_dipole_distance
# Line 395 | Line 401 | contains
401        
402      endif
403  
404 +    if (i_is_Quadrupole) then
405 +       qxx_i = ElectrostaticMap(me1)%quadrupole_moments(1)
406 +       qyy_i = ElectrostaticMap(me1)%quadrupole_moments(2)
407 +       qzz_i = ElectrostaticMap(me1)%quadrupole_moments(3)
408 + #ifdef IS_MPI
409 +       ux_i(1) = eFrame_Row(1,atom1)
410 +       ux_i(2) = eFrame_Row(4,atom1)
411 +       ux_i(3) = eFrame_Row(7,atom1)
412 +       uy_i(1) = eFrame_Row(2,atom1)
413 +       uy_i(2) = eFrame_Row(5,atom1)
414 +       uy_i(3) = eFrame_Row(8,atom1)
415 +       uz_i(1) = eFrame_Row(3,atom1)
416 +       uz_i(2) = eFrame_Row(6,atom1)
417 +       uz_i(3) = eFrame_Row(9,atom1)
418 + #else
419 +       ux_i(1) = eFrame(1,atom1)
420 +       ux_i(2) = eFrame(4,atom1)
421 +       ux_i(3) = eFrame(7,atom1)
422 +       uy_i(1) = eFrame(2,atom1)
423 +       uy_i(2) = eFrame(5,atom1)
424 +       uy_i(3) = eFrame(8,atom1)
425 +       uz_i(1) = eFrame(3,atom1)
426 +       uz_i(2) = eFrame(6,atom1)
427 +       uz_i(3) = eFrame(9,atom1)
428 + #endif
429 +       cx_i = ux_i(1)*xhat + ux_i(2)*yhat + ux_i(3)*zhat
430 +       cy_i = uy_i(1)*xhat + uy_i(2)*yhat + uy_i(3)*zhat
431 +       cz_i = uz_i(1)*xhat + uz_i(2)*yhat + uz_i(3)*zhat
432 +    endif
433 +
434 +
435      if (j_is_Charge) then
436         q_j = ElectrostaticMap(me2)%charge      
437      endif
# Line 402 | Line 439 | contains
439      if (j_is_Dipole) then
440         mu_j = ElectrostaticMap(me2)%dipole_moment
441   #ifdef IS_MPI
442 <       ul_j(1) = eFrame_Col(3,atom2)
443 <       ul_j(2) = eFrame_Col(6,atom2)
444 <       ul_j(3) = eFrame_Col(9,atom2)
442 >       uz_j(1) = eFrame_Col(3,atom2)
443 >       uz_j(2) = eFrame_Col(6,atom2)
444 >       uz_j(3) = eFrame_Col(9,atom2)
445   #else
446 <       ul_j(1) = eFrame(3,atom2)
447 <       ul_j(2) = eFrame(6,atom2)
448 <       ul_j(3) = eFrame(9,atom2)
446 >       uz_j(1) = eFrame(3,atom2)
447 >       uz_j(2) = eFrame(6,atom2)
448 >       uz_j(3) = eFrame(9,atom2)
449   #endif
450 <       ct_j = ul_j(1)*drdxj + ul_j(2)*drdyj + ul_j(3)*drdzj
450 >       ct_j = uz_j(1)*drdxj + uz_j(2)*drdyj + uz_j(3)*drdzj
451  
452         if (j_is_SplitDipole) then
453            d_j = ElectrostaticMap(me2)%split_dipole_distance
454         endif
455      endif
456  
457 +    if (j_is_Quadrupole) then
458 +       qxx_j = ElectrostaticMap(me2)%quadrupole_moments(1)
459 +       qyy_j = ElectrostaticMap(me2)%quadrupole_moments(2)
460 +       qzz_j = ElectrostaticMap(me2)%quadrupole_moments(3)
461 + #ifdef IS_MPI
462 +       ux_j(1) = eFrame_Col(1,atom2)
463 +       ux_j(2) = eFrame_Col(4,atom2)
464 +       ux_j(3) = eFrame_Col(7,atom2)
465 +       uy_j(1) = eFrame_Col(2,atom2)
466 +       uy_j(2) = eFrame_Col(5,atom2)
467 +       uy_j(3) = eFrame_Col(8,atom2)
468 +       uz_j(1) = eFrame_Col(3,atom2)
469 +       uz_j(2) = eFrame_Col(6,atom2)
470 +       uz_j(3) = eFrame_Col(9,atom2)
471 + #else
472 +       ux_j(1) = eFrame(1,atom2)
473 +       ux_j(2) = eFrame(4,atom2)
474 +       ux_j(3) = eFrame(7,atom2)
475 +       uy_j(1) = eFrame(2,atom2)
476 +       uy_j(2) = eFrame(5,atom2)
477 +       uy_j(3) = eFrame(8,atom2)
478 +       uz_j(1) = eFrame(3,atom2)
479 +       uz_j(2) = eFrame(6,atom2)
480 +       uz_j(3) = eFrame(9,atom2)
481 + #endif
482 +       cx_j = ux_j(1)*xhat + ux_j(2)*yhat + ux_j(3)*zhat
483 +       cy_j = uy_j(1)*xhat + uy_j(2)*yhat + uy_j(3)*zhat
484 +       cz_j = uz_j(1)*xhat + uz_j(2)*yhat + uz_j(3)*zhat
485 +    endif
486 +
487      epot = 0.0_dp
488      dudx = 0.0_dp
489      dudy = 0.0_dp
490      dudz = 0.0_dp
491  
492 <    duduix = 0.0_dp
493 <    duduiy = 0.0_dp
494 <    duduiz = 0.0_dp
492 >    dudux_i = 0.0_dp
493 >    duduy_i = 0.0_dp
494 >    duduz_i = 0.0_dp
495  
496 <    dudujx = 0.0_dp
497 <    dudujy = 0.0_dp
498 <    dudujz = 0.0_dp
496 >    dudux_j = 0.0_dp
497 >    duduy_j = 0.0_dp
498 >    duduz_j = 0.0_dp
499  
500      if (i_is_Charge) then
501  
# Line 470 | Line 537 | contains
537            !! r_j - r_i and the charge-dipole potential takes the origin
538            !! as the point dipole, which is atom j in this case.
539  
540 <          dudx = dudx + pref * sw * ri3 * ( ul_j(1) + 3.0d0*ct_j*xhat*sc2)
541 <          dudy = dudy + pref * sw * ri3 * ( ul_j(2) + 3.0d0*ct_j*yhat*sc2)
542 <          dudz = dudz + pref * sw * ri3 * ( ul_j(3) + 3.0d0*ct_j*zhat*sc2)
540 >          dudx = dudx + pref * sw * ri3 * ( uz_j(1) + 3.0d0*ct_j*xhat*sc2)
541 >          dudy = dudy + pref * sw * ri3 * ( uz_j(2) + 3.0d0*ct_j*yhat*sc2)
542 >          dudz = dudz + pref * sw * ri3 * ( uz_j(3) + 3.0d0*ct_j*zhat*sc2)
543  
544 <          dudujx = dudujx - pref * sw * ri2 * xhat * scale
545 <          dudujy = dudujy - pref * sw * ri2 * yhat * scale
546 <          dudujz = dudujz - pref * sw * ri2 * zhat * scale
544 >          duduz_j(1) = duduz_j(1) - pref * sw * ri2 * xhat * scale
545 >          duduz_j(2) = duduz_j(2) - pref * sw * ri2 * yhat * scale
546 >          duduz_j(3) = duduz_j(3) - pref * sw * ri2 * zhat * scale
547            
548         endif
549  
550 +       if (j_is_Quadrupole) then
551 +          ri2 = riji * riji
552 +          ri3 = ri2 * riji
553 +          ri4 = ri2 * ri2
554 +          cx2 = cx_j * cx_j
555 +          cy2 = cy_j * cy_j
556 +          cz2 = cz_j * cz_j
557 +
558 +
559 +          pref =  pre14 * q_i / 6.0_dp
560 +          vterm = pref * ri3 * (qxx_j * (3.0_dp*cx2 - 1.0_dp) + &
561 +               qyy_j * (3.0_dp*cy2 - 1.0_dp) + &
562 +               qzz_j * (3.0_dp*cz2 - 1.0_dp))
563 +          vpair = vpair + vterm
564 +          epot = epot + sw * vterm
565 +
566 +          dudx = dudx - 5.0_dp*sw*vterm*riji*xhat - pref * sw * ri4 * ( &
567 +               qxx_j*(6.0_dp*cx_j*ux_j(1) - 2.0_dp*xhat) + &
568 +               qyy_j*(6.0_dp*cy_j*uy_j(1) - 2.0_dp*xhat) + &
569 +               qzz_j*(6.0_dp*cz_j*uz_j(1) - 2.0_dp*xhat) )
570 +          dudy = dudy - 5.0_dp*sw*vterm*riji*yhat - pref * sw * ri4 * ( &
571 +               qxx_j*(6.0_dp*cx_j*ux_j(2) - 2.0_dp*yhat) + &
572 +               qyy_j*(6.0_dp*cy_j*uy_j(2) - 2.0_dp*yhat) + &
573 +               qzz_j*(6.0_dp*cz_j*uz_j(2) - 2.0_dp*yhat) )
574 +          dudz = dudz - 5.0_dp*sw*vterm*riji*zhat - pref * sw * ri4 * ( &
575 +               qxx_j*(6.0_dp*cx_j*ux_j(3) - 2.0_dp*zhat) + &
576 +               qyy_j*(6.0_dp*cy_j*uy_j(3) - 2.0_dp*zhat) + &
577 +               qzz_j*(6.0_dp*cz_j*uz_j(3) - 2.0_dp*zhat) )
578 +          
579 +          dudux_j(1) = dudux_j(1) + pref * sw * ri3 * (qxx_j*6.0_dp*cx_j*xhat)
580 +          dudux_j(2) = dudux_j(2) + pref * sw * ri3 * (qxx_j*6.0_dp*cx_j*yhat)
581 +          dudux_j(3) = dudux_j(3) + pref * sw * ri3 * (qxx_j*6.0_dp*cx_j*zhat)
582 +
583 +          duduy_j(1) = duduy_j(1) + pref * sw * ri3 * (qyy_j*6.0_dp*cy_j*xhat)
584 +          duduy_j(2) = duduy_j(2) + pref * sw * ri3 * (qyy_j*6.0_dp*cy_j*yhat)
585 +          duduy_j(3) = duduy_j(3) + pref * sw * ri3 * (qyy_j*6.0_dp*cy_j*zhat)
586 +
587 +          duduz_j(1) = duduz_j(1) + pref * sw * ri3 * (qzz_j*6.0_dp*cz_j*xhat)
588 +          duduz_j(2) = duduz_j(2) + pref * sw * ri3 * (qzz_j*6.0_dp*cz_j*yhat)
589 +          duduz_j(3) = duduz_j(3) + pref * sw * ri3 * (qzz_j*6.0_dp*cz_j*zhat)
590 +       endif
591 +
592      endif
593    
594      if (i_is_Dipole) then
# Line 504 | Line 613 | contains
613            vpair = vpair + vterm
614            epot = epot + sw * vterm
615  
616 <          dudx = dudx + pref * sw * ri3 * ( ul_i(1) - 3.0d0 * ct_i * xhat*sc2)
617 <          dudy = dudy + pref * sw * ri3 * ( ul_i(2) - 3.0d0 * ct_i * yhat*sc2)
618 <          dudz = dudz + pref * sw * ri3 * ( ul_i(3) - 3.0d0 * ct_i * zhat*sc2)
616 >          dudx = dudx + pref * sw * ri3 * ( uz_i(1) - 3.0d0 * ct_i * xhat*sc2)
617 >          dudy = dudy + pref * sw * ri3 * ( uz_i(2) - 3.0d0 * ct_i * yhat*sc2)
618 >          dudz = dudz + pref * sw * ri3 * ( uz_i(3) - 3.0d0 * ct_i * zhat*sc2)
619  
620 <          duduix = duduix + pref * sw * ri2 * xhat * scale
621 <          duduiy = duduiy + pref * sw * ri2 * yhat * scale
622 <          duduiz = duduiz + pref * sw * ri2 * zhat * scale
620 >          duduz_i(1) = duduz_i(1) + pref * sw * ri2 * xhat * scale
621 >          duduz_i(2) = duduz_i(2) + pref * sw * ri2 * yhat * scale
622 >          duduz_i(3) = duduz_i(3) + pref * sw * ri2 * zhat * scale
623         endif
624  
625         if (j_is_Dipole) then
# Line 534 | Line 643 | contains
643               endif
644            endif
645  
646 <          ct_ij = ul_i(1)*ul_j(1) + ul_i(2)*ul_j(2) + ul_i(3)*ul_j(3)
646 >          ct_ij = uz_i(1)*uz_j(1) + uz_i(2)*uz_j(2) + uz_i(3)*uz_j(3)
647  
648            ri2 = ri * ri
649            ri3 = ri2 * ri
# Line 548 | Line 657 | contains
657            
658            a1 = 5.0d0 * ct_i * ct_j * sc2 - ct_ij
659  
660 <          dudx=dudx+pref*sw*3.0d0*ri4*scale*(a1*xhat-ct_i*ul_j(1)-ct_j*ul_i(1))
661 <          dudy=dudy+pref*sw*3.0d0*ri4*scale*(a1*yhat-ct_i*ul_j(2)-ct_j*ul_i(2))
662 <          dudz=dudz+pref*sw*3.0d0*ri4*scale*(a1*zhat-ct_i*ul_j(3)-ct_j*ul_i(3))
660 >          dudx=dudx+pref*sw*3.0d0*ri4*scale*(a1*xhat-ct_i*uz_j(1)-ct_j*uz_i(1))
661 >          dudy=dudy+pref*sw*3.0d0*ri4*scale*(a1*yhat-ct_i*uz_j(2)-ct_j*uz_i(2))
662 >          dudz=dudz+pref*sw*3.0d0*ri4*scale*(a1*zhat-ct_i*uz_j(3)-ct_j*uz_i(3))
663  
664 <          duduix = duduix + pref*sw*ri3*(ul_j(1) - 3.0d0*ct_j*xhat*sc2)
665 <          duduiy = duduiy + pref*sw*ri3*(ul_j(2) - 3.0d0*ct_j*yhat*sc2)
666 <          duduiz = duduiz + pref*sw*ri3*(ul_j(3) - 3.0d0*ct_j*zhat*sc2)
664 >          duduz_i(1) = duduz_i(1) + pref*sw*ri3*(uz_j(1) - 3.0d0*ct_j*xhat*sc2)
665 >          duduz_i(2) = duduz_i(2) + pref*sw*ri3*(uz_j(2) - 3.0d0*ct_j*yhat*sc2)
666 >          duduz_i(3) = duduz_i(3) + pref*sw*ri3*(uz_j(3) - 3.0d0*ct_j*zhat*sc2)
667  
668 <          dudujx = dudujx + pref*sw*ri3*(ul_i(1) - 3.0d0*ct_i*xhat*sc2)
669 <          dudujy = dudujy + pref*sw*ri3*(ul_i(2) - 3.0d0*ct_i*yhat*sc2)
670 <          dudujz = dudujz + pref*sw*ri3*(ul_i(3) - 3.0d0*ct_i*zhat*sc2)
668 >          duduz_j(1) = duduz_j(1) + pref*sw*ri3*(uz_i(1) - 3.0d0*ct_i*xhat*sc2)
669 >          duduz_j(2) = duduz_j(2) + pref*sw*ri3*(uz_i(2) - 3.0d0*ct_i*yhat*sc2)
670 >          duduz_j(3) = duduz_j(3) + pref*sw*ri3*(uz_i(3) - 3.0d0*ct_i*zhat*sc2)
671         endif
672  
673      endif
674 +
675 +    if (i_is_Quadrupole) then
676 +       if (j_is_Charge) then
677 +          
678 +          ri2 = riji * riji
679 +          ri3 = ri2 * riji
680 +          ri4 = ri2 * ri2
681 +          cx2 = cx_i * cx_i
682 +          cy2 = cy_i * cy_i
683 +          cz2 = cz_i * cz_i
684 +          
685 +          pref = pre14 * q_j / 6.0_dp
686 +          vterm = pref * ri3 * (qxx_i * (3.0_dp*cx2 - 1.0_dp) + &
687 +               qyy_i * (3.0_dp*cy2 - 1.0_dp) + &
688 +               qzz_i * (3.0_dp*cz2 - 1.0_dp))
689 +          vpair = vpair + vterm
690 +          epot = epot + sw * vterm
691 +          
692 +          dudx = dudx - 5.0_dp*sw*vterm*riji*xhat - pref * sw * ri4 * ( &
693 +               qxx_i*(6.0_dp*cx_i*ux_i(1) - 2.0_dp*xhat) + &
694 +               qyy_i*(6.0_dp*cy_i*uy_i(1) - 2.0_dp*xhat) + &
695 +               qzz_i*(6.0_dp*cz_i*uz_i(1) - 2.0_dp*xhat) )
696 +          dudy = dudy - 5.0_dp*sw*vterm*riji*yhat - pref * sw * ri4 * ( &
697 +               qxx_i*(6.0_dp*cx_i*ux_i(2) - 2.0_dp*yhat) + &
698 +               qyy_i*(6.0_dp*cy_i*uy_i(2) - 2.0_dp*yhat) + &
699 +               qzz_i*(6.0_dp*cz_i*uz_i(2) - 2.0_dp*yhat) )
700 +          dudz = dudz - 5.0_dp*sw*vterm*riji*zhat - pref * sw * ri4 * ( &
701 +               qxx_i*(6.0_dp*cx_i*ux_i(3) - 2.0_dp*zhat) + &
702 +               qyy_i*(6.0_dp*cy_i*uy_i(3) - 2.0_dp*zhat) + &
703 +               qzz_i*(6.0_dp*cz_i*uz_i(3) - 2.0_dp*zhat) )
704 +          
705 +          dudux_i(1) = dudux_i(1) + pref * sw * ri3 * (qxx_i*6.0_dp*cx_i*xhat)
706 +          dudux_i(2) = dudux_i(2) + pref * sw * ri3 * (qxx_i*6.0_dp*cx_i*yhat)
707 +          dudux_i(3) = dudux_i(3) + pref * sw * ri3 * (qxx_i*6.0_dp*cx_i*zhat)
708 +          
709 +          duduy_i(1) = duduy_i(1) + pref * sw * ri3 * (qyy_i*6.0_dp*cy_i*xhat)
710 +          duduy_i(2) = duduy_i(2) + pref * sw * ri3 * (qyy_i*6.0_dp*cy_i*yhat)
711 +          duduy_i(3) = duduy_i(3) + pref * sw * ri3 * (qyy_i*6.0_dp*cy_i*zhat)
712 +          
713 +          duduz_i(1) = duduz_i(1) + pref * sw * ri3 * (qzz_i*6.0_dp*cz_i*xhat)
714 +          duduz_i(2) = duduz_i(2) + pref * sw * ri3 * (qzz_i*6.0_dp*cz_i*yhat)
715 +          duduz_i(3) = duduz_i(3) + pref * sw * ri3 * (qzz_i*6.0_dp*cz_i*zhat)
716 +       endif
717 +    endif
718 +      
719      
720      if (do_pot) then
721   #ifdef IS_MPI
# Line 582 | Line 736 | contains
736      f_Col(3,atom2) = f_Col(3,atom2) - dudz
737      
738      if (i_is_Dipole .or. i_is_Quadrupole) then
739 <       t_Row(1,atom1) = t_Row(1,atom1) - ul_i(2)*duduiz + ul_i(3)*duduiy
740 <       t_Row(2,atom1) = t_Row(2,atom1) - ul_i(3)*duduix + ul_i(1)*duduiz
741 <       t_Row(3,atom1) = t_Row(3,atom1) - ul_i(1)*duduiy + ul_i(2)*duduix
739 >       t_Row(1,atom1)=t_Row(1,atom1) - uz_i(2)*duduz_i(3) + uz_i(3)*duduz_i(2)
740 >       t_Row(2,atom1)=t_Row(2,atom1) - uz_i(3)*duduz_i(1) + uz_i(1)*duduz_i(3)
741 >       t_Row(3,atom1)=t_Row(3,atom1) - uz_i(1)*duduz_i(2) + uz_i(2)*duduz_i(1)
742      endif
743 +    if (i_is_Quadrupole) then
744 +       t_Row(1,atom1)=t_Row(1,atom1) - ux_i(2)*dudux_i(3) + ux_i(3)*dudux_i(2)
745 +       t_Row(2,atom1)=t_Row(2,atom1) - ux_i(3)*dudux_i(1) + ux_i(1)*dudux_i(3)
746 +       t_Row(3,atom1)=t_Row(3,atom1) - ux_i(1)*dudux_i(2) + ux_i(2)*dudux_i(1)
747  
748 +       t_Row(1,atom1)=t_Row(1,atom1) - uy_i(2)*duduy_i(3) + uy_i(3)*duduy_i(2)
749 +       t_Row(2,atom1)=t_Row(2,atom1) - uy_i(3)*duduy_i(1) + uy_i(1)*duduy_i(3)
750 +       t_Row(3,atom1)=t_Row(3,atom1) - uy_i(1)*duduy_i(2) + uy_i(2)*duduy_i(1)
751 +    endif
752 +
753      if (j_is_Dipole .or. j_is_Quadrupole) then
754 <       t_Col(1,atom2) = t_Col(1,atom2) - ul_j(2)*dudujz + ul_j(3)*dudujy
755 <       t_Col(2,atom2) = t_Col(2,atom2) - ul_j(3)*dudujx + ul_j(1)*dudujz
756 <       t_Col(3,atom2) = t_Col(3,atom2) - ul_j(1)*dudujy + ul_j(2)*dudujx
754 >       t_Col(1,atom2)=t_Col(1,atom2) - uz_j(2)*duduz_j(3) + uz_j(3)*duduz_j(2)
755 >       t_Col(2,atom2)=t_Col(2,atom2) - uz_j(3)*duduz_j(1) + uz_j(1)*duduz_j(3)
756 >       t_Col(3,atom2)=t_Col(3,atom2) - uz_j(1)*duduz_j(2) + uz_j(2)*duduz_j(1)
757      endif
758 +    if (j_is_Quadrupole) then
759 +       t_Col(1,atom2)=t_Col(1,atom2) - ux_j(2)*dudux_j(3) + ux_j(3)*dudux_j(2)
760 +       t_Col(2,atom2)=t_Col(2,atom2) - ux_j(3)*dudux_j(1) + ux_j(1)*dudux_j(3)
761 +       t_Col(3,atom2)=t_Col(3,atom2) - ux_j(1)*dudux_j(2) + ux_j(2)*dudux_j(1)
762  
763 +       t_Col(1,atom2)=t_Col(1,atom2) - uy_j(2)*duduy_j(3) + uy_j(3)*duduy_j(2)
764 +       t_Col(2,atom2)=t_Col(2,atom2) - uy_j(3)*duduy_j(1) + uy_j(1)*duduy_j(3)
765 +       t_Col(3,atom2)=t_Col(3,atom2) - uy_j(1)*duduy_j(2) + uy_j(2)*duduy_j(1)
766 +    endif
767 +
768   #else
769      f(1,atom1) = f(1,atom1) + dudx
770      f(2,atom1) = f(2,atom1) + dudy
# Line 603 | Line 775 | contains
775      f(3,atom2) = f(3,atom2) - dudz
776      
777      if (i_is_Dipole .or. i_is_Quadrupole) then
778 <       t(1,atom1) = t(1,atom1) - ul_i(2)*duduiz + ul_i(3)*duduiy
779 <       t(2,atom1) = t(2,atom1) - ul_i(3)*duduix + ul_i(1)*duduiz
780 <       t(3,atom1) = t(3,atom1) - ul_i(1)*duduiy + ul_i(2)*duduix
778 >       t(1,atom1)=t(1,atom1) - uz_i(2)*duduz_i(3) + uz_i(3)*duduz_i(2)
779 >       t(2,atom1)=t(2,atom1) - uz_i(3)*duduz_i(1) + uz_i(1)*duduz_i(3)
780 >       t(3,atom1)=t(3,atom1) - uz_i(1)*duduz_i(2) + uz_i(2)*duduz_i(1)
781      endif
782 <      
782 >    if (i_is_Quadrupole) then
783 >       t(1,atom1)=t(1,atom1) - ux_i(2)*dudux_i(3) + ux_i(3)*dudux_i(2)
784 >       t(2,atom1)=t(2,atom1) - ux_i(3)*dudux_i(1) + ux_i(1)*dudux_i(3)
785 >       t(3,atom1)=t(3,atom1) - ux_i(1)*dudux_i(2) + ux_i(2)*dudux_i(1)
786 >
787 >       t(1,atom1)=t(1,atom1) - uy_i(2)*duduy_i(3) + uy_i(3)*duduy_i(2)
788 >       t(2,atom1)=t(2,atom1) - uy_i(3)*duduy_i(1) + uy_i(1)*duduy_i(3)
789 >       t(3,atom1)=t(3,atom1) - uy_i(1)*duduy_i(2) + uy_i(2)*duduy_i(1)
790 >    endif
791 >
792      if (j_is_Dipole .or. j_is_Quadrupole) then
793 <       t(1,atom2) = t(1,atom2) - ul_j(2)*dudujz + ul_j(3)*dudujy
794 <       t(2,atom2) = t(2,atom2) - ul_j(3)*dudujx + ul_j(1)*dudujz
795 <       t(3,atom2) = t(3,atom2) - ul_j(1)*dudujy + ul_j(2)*dudujx
793 >       t(1,atom2)=t(1,atom2) - uz_j(2)*duduz_j(3) + uz_j(3)*duduz_j(2)
794 >       t(2,atom2)=t(2,atom2) - uz_j(3)*duduz_j(1) + uz_j(1)*duduz_j(3)
795 >       t(3,atom2)=t(3,atom2) - uz_j(1)*duduz_j(2) + uz_j(2)*duduz_j(1)
796      endif
797 +    if (j_is_Quadrupole) then
798 +       t(1,atom2)=t(1,atom2) - ux_j(2)*dudux_j(3) + ux_j(3)*dudux_j(2)
799 +       t(2,atom2)=t(2,atom2) - ux_j(3)*dudux_j(1) + ux_j(1)*dudux_j(3)
800 +       t(3,atom2)=t(3,atom2) - ux_j(1)*dudux_j(2) + ux_j(2)*dudux_j(1)
801 +
802 +       t(1,atom2)=t(1,atom2) - uy_j(2)*duduy_j(3) + uy_j(3)*duduy_j(2)
803 +       t(2,atom2)=t(2,atom2) - uy_j(3)*duduy_j(1) + uy_j(1)*duduy_j(3)
804 +       t(3,atom2)=t(3,atom2) - uy_j(1)*duduy_j(2) + uy_j(2)*duduy_j(1)
805 +    endif
806 +
807   #endif
808      
809   #ifdef IS_MPI

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines