ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/calc_eam.F90
(Generate patch)

Comparing trunk/OOPSE/libmdtools/calc_eam.F90 (file contents):
Revision 730 by gezelter, Wed Aug 27 16:25:11 2003 UTC vs.
Revision 1150 by gezelter, Fri May 7 21:35:05 2004 UTC

# Line 66 | Line 66 | module eam
66    real( kind = dp),save, dimension(:), allocatable :: frho_col
67    real( kind = dp),save, dimension(:), allocatable :: rho_row
68    real( kind = dp),save, dimension(:), allocatable :: rho_col
69 +  real( kind = dp),save, dimension(:), allocatable :: rho_tmp
70    real( kind = dp),save, dimension(:), allocatable :: d2frhodrhodrho_col
71    real( kind = dp),save, dimension(:), allocatable :: d2frhodrhodrho_row
72   #endif
# Line 78 | Line 79 | module eam
79    end type EAMTypeList
80  
81  
82 <  type (eamTypeList) :: EAMList
82 >  type (eamTypeList), save :: EAMList
83  
84    !! standard eam stuff  
85  
# Line 164 | Line 165 | contains
165      integer :: alloc_stat
166      integer :: number_r, number_rho
167  
168 +
169 +    status = 0
170      if (EAMList%currentAddition == 0) then
171         call handleError("init_EAM_FF","No members in EAMList")
172         status = -1
173         return
174      end if
175  
176 <
174 <
176 >
177         do i = 1, EAMList%currentAddition
178  
179   ! Build array of r values
# Line 221 | Line 223 | contains
223                 0.0E0_DP, 0.0E0_DP, 'N')
224         enddo
225  
224
226   !       current_rcut_max = EAMList%EAMParams(1)%eam_rcut
227         !! find the smallest rcut for any eam atype
228   !       do i = 2, EAMList%currentAddition
# Line 234 | Line 235 | contains
235   !          EAMList%EAMParam(i)s%eam_atype_map(eam_atype(i)) = i
236   !       end do
237         !! Allocate arrays for force calculation
238 <          call allocateEAM(alloc_stat)
239 <          if (alloc_stat /= 0 ) then
240 <             status = -1
241 <             return
242 <          endif
243 <
238 >      
239 >       call allocateEAM(alloc_stat)
240 >       if (alloc_stat /= 0 ) then
241 >          write(*,*) "allocateEAM failed"
242 >          status = -1
243 >          return
244 >       endif
245 >    
246    end subroutine init_EAM_FF
247  
248   !! routine checks to see if array is allocated, deallocates array if allocated
# Line 247 | Line 250 | contains
250    subroutine allocateEAM(status)
251      integer, intent(out) :: status
252  
250    integer :: nlocal
253   #ifdef IS_MPI
254      integer :: nrow
255      integer :: ncol
# Line 255 | Line 257 | contains
257      integer :: alloc_stat
258  
259  
260 <    nlocal = getNlocal()
259 <
260 >    status = 0
261   #ifdef IS_MPI
262      nrow = getNrow(plan_row)
263      ncol = getNcol(plan_col)
# Line 290 | Line 291 | contains
291      end if
292      
293   #ifdef IS_MPI
294 +
295 +    if (allocated(rho_tmp)) deallocate(rho_tmp)
296 +    allocate(rho_tmp(nlocal),stat=alloc_stat)
297 +    if (alloc_stat /= 0) then
298 +       status = -1
299 +       return
300 +    end if
301  
302 +
303      if (allocated(frho_row)) deallocate(frho_row)
304      allocate(frho_row(nrow),stat=alloc_stat)
305      if (alloc_stat /= 0) then
# Line 374 | Line 383 | contains
383      frho_col = 0.0_dp
384      rho_row  = 0.0_dp
385      rho_col  = 0.0_dp
386 +    rho_tmp  = 0.0_dp
387      dfrhodrho_row = 0.0_dp
388      dfrhodrho_col = 0.0_dp
389   #endif
# Line 522 | Line 532 | contains
532                 EAMList%EAMParams(myid_atom2)%eam_rho_r_pp, &
533                 r, rho_j_at_i,drho,d2rho)
534  
535 <
535 >    
536        
537        
538   #ifdef  IS_MPI
# Line 533 | Line 543 | contains
543         endif
544  
545  
546 +
547 +
548 +
549 +
550    end subroutine calc_eam_prepair_rho
551  
552  
# Line 558 | Line 572 | contains
572        write(errMsg,*) " Error scattering rho_row into rho"
573        call handleError(RoutineName,errMesg)
574     endif      
575 <    call scatter(rho_col,rho,plan_col,eam_err)
575 >    call scatter(rho_col,rho_tmp,plan_col,eam_err)
576      if (eam_err /= 0 ) then
577        write(errMsg,*) " Error scattering rho_col into rho"
578        call handleError(RoutineName,errMesg)
579     endif
580 +
581 +      rho(1:nlocal) = rho(1:nlocal) + rho_tmp(1:nlocal)
582   #endif
583  
584  
585 +
586   !! Calculate F(rho) and derivative
587      do atom = 1, nlocal
588         me = atid(atom)
# Line 634 | Line 651 | contains
651  
652  
653    !! Does EAM pairwise Force calculation.  
654 <  subroutine do_eam_pair(atom1,atom2,d,rij,r2,pot,f,do_pot,do_stress)
654 >  subroutine do_eam_pair(atom1, atom2, d, rij, r2, sw, vpair, pot, f, &
655 >       do_pot, do_stress)
656      !Arguments    
657      integer, intent(in) ::  atom1, atom2
658      real( kind = dp ), intent(in) :: rij, r2
659 <    real( kind = dp ) :: pot
660 <    real( kind = dp ), dimension(3,getNlocal()) :: f
659 >    real( kind = dp ) :: pot, sw, vpair
660 >    real( kind = dp ), dimension(3,nLocal) :: f
661      real( kind = dp ), intent(in), dimension(3) :: d
662      logical, intent(in) :: do_pot, do_stress
663      
# Line 771 | Line 789 | contains
789            pot_Row(atom1) = pot_Row(atom1) + phab*0.5
790            pot_Col(atom2) = pot_Col(atom2) + phab*0.5
791         end if
792 +       vpair = vpair + phab
793  
794         f_Row(1,atom1) = f_Row(1,atom1) + fx
795         f_Row(2,atom1) = f_Row(2,atom1) + fy
# Line 784 | Line 803 | contains
803         if(do_pot) then
804            pot = pot + phab
805         end if
806 +       vpair = vpair + phab
807  
808         f(1,atom1) = f(1,atom1) + fx
809         f(2,atom1) = f(2,atom1) + fy

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines