--- trunk/OOPSE/libmdtools/calc_eam.F90 2003/10/04 18:46:12 801 +++ trunk/OOPSE/libmdtools/calc_eam.F90 2003/12/17 20:13:33 882 @@ -66,6 +66,7 @@ module eam real( kind = dp),save, dimension(:), allocatable :: frho_col real( kind = dp),save, dimension(:), allocatable :: rho_row real( kind = dp),save, dimension(:), allocatable :: rho_col + real( kind = dp),save, dimension(:), allocatable :: rho_tmp real( kind = dp),save, dimension(:), allocatable :: d2frhodrhodrho_col real( kind = dp),save, dimension(:), allocatable :: d2frhodrhodrho_row #endif @@ -222,7 +223,6 @@ contains 0.0E0_DP, 0.0E0_DP, 'N') enddo - ! current_rcut_max = EAMList%EAMParams(1)%eam_rcut !! find the smallest rcut for any eam atype ! do i = 2, EAMList%currentAddition @@ -294,6 +294,14 @@ contains #ifdef IS_MPI + if (allocated(rho_tmp)) deallocate(rho_tmp) + allocate(rho_tmp(nlocal),stat=alloc_stat) + if (alloc_stat /= 0) then + status = -1 + return + end if + + if (allocated(frho_row)) deallocate(frho_row) allocate(frho_row(nrow),stat=alloc_stat) if (alloc_stat /= 0) then @@ -377,6 +385,7 @@ contains frho_col = 0.0_dp rho_row = 0.0_dp rho_col = 0.0_dp + rho_tmp = 0.0_dp dfrhodrho_row = 0.0_dp dfrhodrho_col = 0.0_dp #endif @@ -525,7 +534,7 @@ contains EAMList%EAMParams(myid_atom2)%eam_rho_r_pp, & r, rho_j_at_i,drho,d2rho) - + #ifdef IS_MPI @@ -536,6 +545,10 @@ contains endif + + + + end subroutine calc_eam_prepair_rho @@ -561,14 +574,17 @@ contains write(errMsg,*) " Error scattering rho_row into rho" call handleError(RoutineName,errMesg) endif - call scatter(rho_col,rho,plan_col,eam_err) + call scatter(rho_col,rho_tmp,plan_col,eam_err) if (eam_err /= 0 ) then write(errMsg,*) " Error scattering rho_col into rho" call handleError(RoutineName,errMesg) endif + + rho(1:nlocal) = rho(1:nlocal) + rho_tmp(1:nlocal) #endif + !! Calculate F(rho) and derivative do atom = 1, nlocal me = atid(atom)