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

Comparing trunk/OOPSE-3.0/src/UseTheForce/DarkSide/eam.F90 (file contents):
Revision 2727 by gezelter, Thu Apr 20 18:24:24 2006 UTC vs.
Revision 2728 by chrisfen, Fri Apr 21 20:02:19 2006 UTC

# Line 118 | Line 118 | module eam
118    public :: clean_EAM
119    public :: destroyEAMTypes
120    public :: getEAMCut
121 +  public :: lookupEAMSpline
122 +  public :: lookupEAMSpline1d
123  
124   contains
125  
# Line 381 | Line 383 | contains
383  
384      if (r.lt.EAMList%EAMParams(myid_atom1)%eam_rcut) then
385  
386 <       call lookupUniformSpline(EAMList%EAMParams(myid_atom1)%rho, r, &
386 >       call lookupEAMSpline(EAMList%EAMParams(myid_atom1)%rho, r, &
387              rho_i_at_j)
388  
389   #ifdef  IS_MPI
# Line 393 | Line 395 | contains
395  
396      if (r.lt.EAMList%EAMParams(myid_atom2)%eam_rcut) then
397  
398 <       call lookupUniformSpline(EAMList%EAMParams(myid_atom2)%rho, r, &
398 >       call lookupEAMSpline(EAMList%EAMParams(myid_atom2)%rho, r, &
399              rho_j_at_i)
400  
401   #ifdef  IS_MPI
# Line 438 | Line 440 | contains
440         atid1 = atid(atom)
441         me = eamList%atidToEAMtype(atid1)
442  
443 <       call lookupUniformSpline1d(EAMList%EAMParams(me)%F, rho(atom), &
443 >       call lookupEAMSpline1d(EAMList%EAMParams(me)%F, rho(atom), &
444              u, u1)
445        
446         frho(atom) = u
# Line 528 | Line 530 | contains
530  
531            ! Calculate rho and drho for atom1
532  
533 <          call lookupUniformSpline1d(EAMList%EAMParams(mytype_atom1)%rho, &
533 >          call lookupEAMSpline1d(EAMList%EAMParams(mytype_atom1)%rho, &
534                 rij, rha, drha)
535            
536            ! Calculate Phi(r) for atom1.
537            
538 <          call lookupUniformSpline1d(EAMList%EAMParams(mytype_atom1)%phi, &
538 >          call lookupEAMSpline1d(EAMList%EAMParams(mytype_atom1)%phi, &
539                 rij, pha, dpha)
540  
541         endif
# Line 542 | Line 544 | contains
544  
545            ! Calculate rho and drho for atom2
546  
547 <          call lookupUniformSpline1d(EAMList%EAMParams(mytype_atom2)%rho, &
547 >          call lookupEAMSpline1d(EAMList%EAMParams(mytype_atom2)%rho, &
548                 rij, rhb, drhb)
549  
550            ! Calculate Phi(r) for atom2.
551  
552 <          call lookupUniformSpline1d(EAMList%EAMParams(mytype_atom2)%phi, &
552 >          call lookupEAMSpline1d(EAMList%EAMParams(mytype_atom2)%phi, &
553                 rij, phb, dphb)
554  
555         endif
# Line 629 | Line 631 | end module eam
631      endif
632    end subroutine do_eam_pair
633  
634 +  subroutine lookupEAMSpline(cs, xval, yval)
635 +    
636 +    implicit none
637 +
638 +    type (cubicSpline), intent(in) :: cs
639 +    real( kind = DP ), intent(in)  :: xval
640 +    real( kind = DP ), intent(out) :: yval
641 +    real( kind = DP ) ::  dx
642 +    integer :: i, j
643 +    !
644 +    !  Find the interval J = [ cs%x(J), cs%x(J+1) ] that contains
645 +    !  or is nearest to xval.
646 +    
647 +    j = MAX(1, MIN(cs%n-1, idint((xval-cs%x(1)) * cs%dx_i) + 1))
648 +    
649 +    dx = xval - cs%x(j)
650 +    yval = cs%y(j) + dx*(cs%b(j) + dx*(cs%c(j) + dx*cs%d(j)))
651 +    
652 +    return
653 +  end subroutine lookupEAMSpline
654 +
655 +  subroutine lookupEAMSpline1d(cs, xval, yval, dydx)
656 +    
657 +    implicit none
658 +
659 +    type (cubicSpline), intent(in) :: cs
660 +    real( kind = DP ), intent(in)  :: xval
661 +    real( kind = DP ), intent(out) :: yval, dydx
662 +    real( kind = DP ) :: dx
663 +    integer :: i, j
664 +    
665 +    !  Find the interval J = [ cs%x(J), cs%x(J+1) ] that contains
666 +    !  or is nearest to xval.
667 +
668 +
669 +    j = MAX(1, MIN(cs%n-1, idint((xval-cs%x(1)) * cs%dx_i) + 1))
670 +    
671 +    dx = xval - cs%x(j)
672 +    yval = cs%y(j) + dx*(cs%b(j) + dx*(cs%c(j) + dx*cs%d(j)))
673 +
674 +    dydx = cs%b(j) + dx*(2.0d0 * cs%c(j) + 3.0d0 * dx * cs%d(j))
675 +      
676 +    return
677 +  end subroutine lookupEAMSpline1d
678 +
679   end module eam

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines